From 6f6c40186f75ea8f3c6cee5afba80b30627519aa Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Tue, 6 Mar 2018 11:00:41 -0800 Subject: [PATCH] Add test for undefined action returned Test for #22343 --- src/harness/fourslash.ts | 4 ++++ ...ixInferFromUsageSetterWithInaccessibleType.ts | 16 ++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 tests/cases/fourslash/codeFixInferFromUsageSetterWithInaccessibleType.ts diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 401caac323411..68dd3169112c7 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -2923,6 +2923,10 @@ Actual: ${stringify(fullActual)}`); if (!codeFixes.length) { this.raiseError(`verifyCodeFixAvailable failed - expected code fixes but none found.`); } + codeFixes.forEach(fix => fix.changes.forEach(change => { + assert.isObject(change, `Invalid change in code fix: ${JSON.stringify(fix)}`); + change.textChanges.forEach(textChange => assert.isObject(textChange, `Invalid textChange in codeFix: ${JSON.stringify(fix)}`)); + })); if (info) { assert.equal(info.length, codeFixes.length); ts.zipWith(codeFixes, info, (fix, info) => { diff --git a/tests/cases/fourslash/codeFixInferFromUsageSetterWithInaccessibleType.ts b/tests/cases/fourslash/codeFixInferFromUsageSetterWithInaccessibleType.ts new file mode 100644 index 0000000000000..993a58e8e8e4d --- /dev/null +++ b/tests/cases/fourslash/codeFixInferFromUsageSetterWithInaccessibleType.ts @@ -0,0 +1,16 @@ +/// + +// @noImplicitAny: true + +// @Filename: /a.ts +////export class D {} +////export default new D(); + +// @Filename: /b.ts +////export class C { +//// [|set x(val) {}|] +//// method() { this.x = import("./a"); } +////} + +goTo.file("/b.ts"); +verify.codeFixAvailable(); \ No newline at end of file