+
;
+function noCloseBracketTrailingText() { }
+var donkey =
+ bananas="please"/
+ Cranky Wrinkly Funky
+
;
+function noCloseBracketTypeArgAttrsTrailingText() { }
+var donkey =
+
+ Cranky Wrinkly Funky
+
;
+function noSelfcloseTrailingText() { }
+var donkey =
+ bananas="please">
+ Cranky Wrinkly Funky
+
;
+function noSelfcloseTypeArgAttrsTrailingText() { }
diff --git a/tests/cases/conformance/jsx/tsxReactEmitSpreadAttribute.ts b/tests/cases/conformance/jsx/tsxReactEmitSpreadAttribute.ts
new file mode 100644
index 0000000000..2ddc20ae39
--- /dev/null
+++ b/tests/cases/conformance/jsx/tsxReactEmitSpreadAttribute.ts
@@ -0,0 +1,32 @@
+// @jsx: react-jsx
+// @target: es2015,es2018,esnext
+// @filename: test.tsx
+///
+
+export function T1(a: any) {
+ return T1
;
+}
+
+export function T2(a: any, b: any) {
+ return T2
;
+}
+
+export function T3(a: any, b: any) {
+ return T3
;
+}
+
+export function T4(a: any, b: any) {
+ return T4
;
+}
+
+export function T5(a: any, b: any, c: any, d: any) {
+ return T5
;
+}
+
+export function T6(a: any, b: any, c: any, d: any) {
+ return T6
;
+}
+
+export function T7(a: any, b: any, c: any, d: any) {
+ return T7
;
+}
diff --git a/tests/cases/conformance/moduleResolution/declarationNotFoundPackageBundlesTypes.ts b/tests/cases/conformance/moduleResolution/declarationNotFoundPackageBundlesTypes.ts
new file mode 100644
index 0000000000..75c681daf0
--- /dev/null
+++ b/tests/cases/conformance/moduleResolution/declarationNotFoundPackageBundlesTypes.ts
@@ -0,0 +1,23 @@
+// @noImplicitAny: true
+// @noImplicitReferences: true
+
+// @filename: node_modules/foo/package.json
+{
+ "name": "foo",
+ "version": "1.0.0"
+}
+
+// @filename: node_modules/foo/index.js
+var foo = 0;
+module.exports = foo;
+
+// @filename: node_modules/foo/index.d.ts
+declare const foo: any;
+export = foo;
+
+// @filename: node_modules/foo/other.js
+module.exports = {};
+
+// @filename: index.ts
+import * as Foo from "foo";
+import * as Other from "foo/other"/*1*/;
\ No newline at end of file
diff --git a/tests/cases/conformance/moduleResolution/scopedPackages/index.d.ts b/tests/cases/conformance/moduleResolution/scopedPackages/index.d.ts
new file mode 100644
index 0000000000..04d4f15421
--- /dev/null
+++ b/tests/cases/conformance/moduleResolution/scopedPackages/index.d.ts
@@ -0,0 +1,3 @@
+// @filename: /node_modules/@cow/boy/index.d.ts
+export const x: number;
+export const y: number;
\ No newline at end of file
diff --git a/tests/cases/conformance/moduleResolution/scopedPackages/scopedPackages.ts b/tests/cases/conformance/moduleResolution/scopedPackages/scopedPackages.ts
new file mode 100644
index 0000000000..80db9778d1
--- /dev/null
+++ b/tests/cases/conformance/moduleResolution/scopedPackages/scopedPackages.ts
@@ -0,0 +1,12 @@
+// @noImplicitReferences: true
+// @traceResolution: true
+// @typeRoots: types
+
+
+// @filename: /a.ts
+import { x } from "./index";
+import { y } from "./index";
+import { z } from "./z";
+x;
+y;
+z;
\ No newline at end of file
diff --git a/tests/cases/conformance/moduleResolution/scopedPackages/z.d.ts b/tests/cases/conformance/moduleResolution/scopedPackages/z.d.ts
new file mode 100644
index 0000000000..8af8c4b248
--- /dev/null
+++ b/tests/cases/conformance/moduleResolution/scopedPackages/z.d.ts
@@ -0,0 +1,2 @@
+// @filename: /node_modules/@types/be__bop/e/z.d.ts
+export const z: number;
\ No newline at end of file
diff --git a/tests/cases/conformance/moduleResolution/scopedPackagesClassic/index.d.ts b/tests/cases/conformance/moduleResolution/scopedPackagesClassic/index.d.ts
new file mode 100644
index 0000000000..7cfe77597d
--- /dev/null
+++ b/tests/cases/conformance/moduleResolution/scopedPackagesClassic/index.d.ts
@@ -0,0 +1,2 @@
+// @filename: /node_modules/@types/see__saw/index.d.ts
+export const x = 0;
diff --git a/tests/cases/conformance/moduleResolution/scopedPackagesClassic/scopedPackagesClassic.ts b/tests/cases/conformance/moduleResolution/scopedPackagesClassic/scopedPackagesClassic.ts
new file mode 100644
index 0000000000..4f491b9532
--- /dev/null
+++ b/tests/cases/conformance/moduleResolution/scopedPackagesClassic/scopedPackagesClassic.ts
@@ -0,0 +1,9 @@
+// @noImplicitReferences: true
+// @traceResolution: true
+// @typeRoots: types
+// @moduleResolution: classic
+
+
+// @filename: /a.ts
+import { x } from "./index";
+x;
\ No newline at end of file
diff --git a/tests/cases/conformance/moduleResolution/untypedModuleImport_allowJs/untypedModuleImport_allowJs.ts b/tests/cases/conformance/moduleResolution/untypedModuleImport_allowJs/untypedModuleImport_allowJs.ts
new file mode 100644
index 0000000000..b2c0c1f81c
--- /dev/null
+++ b/tests/cases/conformance/moduleResolution/untypedModuleImport_allowJs/untypedModuleImport_allowJs.ts
@@ -0,0 +1,12 @@
+// @noImplicitReferences: true
+// @currentDirectory: /
+// @allowJs: true
+// @maxNodeModuleJsDepth: 1
+// Same as untypedModuleImport.ts but with --allowJs, so the package will actually be typed.
+
+// @filename: /node_modules/foo/index.js
+// exports.default = { bar() { return 0; } }
+
+// @filename: /a.ts
+import foo from "foo";
+foo.bar();
diff --git a/tests/cases/conformance/moduleResolution/untypedModuleImport_vsAmbient/declarations.d.ts b/tests/cases/conformance/moduleResolution/untypedModuleImport_vsAmbient/declarations.d.ts
new file mode 100644
index 0000000000..c54d01514d
--- /dev/null
+++ b/tests/cases/conformance/moduleResolution/untypedModuleImport_vsAmbient/declarations.d.ts
@@ -0,0 +1,4 @@
+// @filename: /declarations.d.ts
+declare module "foo" {
+ export const x: number;
+}
diff --git a/tests/cases/conformance/moduleResolution/untypedModuleImport_vsAmbient/untypedModuleImport_vsAmbient.ts b/tests/cases/conformance/moduleResolution/untypedModuleImport_vsAmbient/untypedModuleImport_vsAmbient.ts
new file mode 100644
index 0000000000..577d258b72
--- /dev/null
+++ b/tests/cases/conformance/moduleResolution/untypedModuleImport_vsAmbient/untypedModuleImport_vsAmbient.ts
@@ -0,0 +1,12 @@
+// @noImplicitReferences: true
+// @currentDirectory: /
+// This tests that an ambient module declaration overrides an untyped import.
+
+// @filename: /node_modules/foo/index.js
+// This file is not processed.
+
+
+// @filename: /a.ts
+///
+import { x } from "foo";
+x;
diff --git a/tests/cases/conformance/node/allowJs/nodeAllowJsPackageSelfName.ts b/tests/cases/conformance/node/allowJs/nodeAllowJsPackageSelfName.ts
new file mode 100644
index 0000000000..a19a7104ae
--- /dev/null
+++ b/tests/cases/conformance/node/allowJs/nodeAllowJsPackageSelfName.ts
@@ -0,0 +1,24 @@
+// @module: node12,nodenext
+// @declaration: true
+// @allowJs: true
+// @checkJs: true
+// @outDir: out
+// @filename: index.js
+// esm format file
+import * as self from "package";
+self;
+// @filename: index.mjs
+// esm format file
+import * as self from "package";
+self;
+// @filename: index.cjs
+// esm format file
+import * as self from "package";
+self;
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module",
+ "exports": "./index.js"
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/allowJs/nodeModulesAllowJs1.ts b/tests/cases/conformance/node/allowJs/nodeModulesAllowJs1.ts
new file mode 100644
index 0000000000..113c1fdeb8
--- /dev/null
+++ b/tests/cases/conformance/node/allowJs/nodeModulesAllowJs1.ts
@@ -0,0 +1,324 @@
+// @module: node12,nodenext
+// @declaration: true
+// @allowJs: true
+// @checkJs: true
+// @outDir: out
+// @filename: subfolder/index.js
+// cjs format file
+const x = 1;
+export {x};
+// @filename: subfolder/index.cjs
+// cjs format file
+const x = 1;
+export {x};
+// @filename: subfolder/index.mjs
+// esm format file
+const x = 1;
+export {x};
+// @filename: subfolder2/index.js
+// cjs format file
+const x = 1;
+export {x};
+// @filename: subfolder2/index.cjs
+// cjs format file
+const x = 1;
+export {x};
+// @filename: subfolder2/index.mjs
+// esm format file
+const x = 1;
+export {x};
+// @filename: subfolder2/another/index.js
+// esm format file
+const x = 1;
+export {x};
+// @filename: subfolder2/another/index.cjs
+// cjs format file
+const x = 1;
+export {x};
+// @filename: subfolder2/another/index.mjs
+// esm format file
+const x = 1;
+export {x};
+// @filename: index.js
+import * as m1 from "./index.js";
+import * as m2 from "./index.mjs";
+import * as m3 from "./index.cjs";
+import * as m4 from "./subfolder/index.js";
+import * as m5 from "./subfolder/index.mjs";
+import * as m6 from "./subfolder/index.cjs";
+import * as m7 from "./subfolder2/index.js";
+import * as m8 from "./subfolder2/index.mjs";
+import * as m9 from "./subfolder2/index.cjs";
+import * as m10 from "./subfolder2/another/index.js";
+import * as m11 from "./subfolder2/another/index.mjs";
+import * as m12 from "./subfolder2/another/index.cjs";
+// The next ones shouldn't all work - esm format files have no index resolution or extension resolution
+import * as m13 from "./";
+import * as m14 from "./index";
+import * as m15 from "./subfolder";
+import * as m16 from "./subfolder/";
+import * as m17 from "./subfolder/index";
+import * as m18 from "./subfolder2";
+import * as m19 from "./subfolder2/";
+import * as m20 from "./subfolder2/index";
+import * as m21 from "./subfolder2/another";
+import * as m22 from "./subfolder2/another/";
+import * as m23 from "./subfolder2/another/index";
+void m1;
+void m2;
+void m3;
+void m4;
+void m5;
+void m6;
+void m7;
+void m8;
+void m9;
+void m10;
+void m11;
+void m12;
+void m13;
+void m14;
+void m15;
+void m16;
+void m17;
+void m18;
+void m19;
+void m20;
+void m21;
+void m22;
+void m23;
+
+// These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!)
+import m24 = require("./");
+import m25 = require("./index");
+import m26 = require("./subfolder");
+import m27 = require("./subfolder/");
+import m28 = require("./subfolder/index");
+import m29 = require("./subfolder2");
+import m30 = require("./subfolder2/");
+import m31 = require("./subfolder2/index");
+import m32 = require("./subfolder2/another");
+import m33 = require("./subfolder2/another/");
+import m34 = require("./subfolder2/another/index");
+void m24;
+void m25;
+void m26;
+void m27;
+void m28;
+void m29;
+void m30;
+void m31;
+void m32;
+void m33;
+void m34;
+
+// These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution
+const _m35 = import("./");
+const _m36 = import("./index");
+const _m37 = import("./subfolder");
+const _m38 = import("./subfolder/");
+const _m39 = import("./subfolder/index");
+const _m40 = import("./subfolder2");
+const _m41 = import("./subfolder2/");
+const _m42 = import("./subfolder2/index");
+const _m43 = import("./subfolder2/another");
+const _m44 = import("./subfolder2/another/");
+const _m45 = import("./subfolder2/another/index");
+// esm format file
+const x = 1;
+export {x};
+// @filename: index.cjs
+// ESM-format imports below should issue errors
+import * as m1 from "./index.js";
+import * as m2 from "./index.mjs";
+import * as m3 from "./index.cjs";
+import * as m4 from "./subfolder/index.js";
+import * as m5 from "./subfolder/index.mjs";
+import * as m6 from "./subfolder/index.cjs";
+import * as m7 from "./subfolder2/index.js";
+import * as m8 from "./subfolder2/index.mjs";
+import * as m9 from "./subfolder2/index.cjs";
+import * as m10 from "./subfolder2/another/index.js";
+import * as m11 from "./subfolder2/another/index.mjs";
+import * as m12 from "./subfolder2/another/index.cjs";
+// The next ones should _mostly_ work - cjs format files have index resolution and extension resolution (except for those which resolve to an esm format file)
+import * as m13 from "./";
+import * as m14 from "./index";
+import * as m15 from "./subfolder";
+import * as m16 from "./subfolder/";
+import * as m17 from "./subfolder/index";
+import * as m18 from "./subfolder2";
+import * as m19 from "./subfolder2/";
+import * as m20 from "./subfolder2/index";
+import * as m21 from "./subfolder2/another";
+import * as m22 from "./subfolder2/another/";
+import * as m23 from "./subfolder2/another/index";
+void m1;
+void m2;
+void m3;
+void m4;
+void m5;
+void m6;
+void m7;
+void m8;
+void m9;
+void m10;
+void m11;
+void m12;
+void m13;
+void m14;
+void m15;
+void m16;
+void m17;
+void m18;
+void m19;
+void m20;
+void m21;
+void m22;
+void m23;
+
+// These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!)
+import m24 = require("./");
+import m25 = require("./index");
+import m26 = require("./subfolder");
+import m27 = require("./subfolder/");
+import m28 = require("./subfolder/index");
+import m29 = require("./subfolder2");
+import m30 = require("./subfolder2/");
+import m31 = require("./subfolder2/index");
+import m32 = require("./subfolder2/another");
+import m33 = require("./subfolder2/another/");
+import m34 = require("./subfolder2/another/index");
+void m24;
+void m25;
+void m26;
+void m27;
+void m28;
+void m29;
+void m30;
+void m31;
+void m32;
+void m33;
+void m34;
+
+// These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution
+const _m35 = import("./");
+const _m36 = import("./index");
+const _m37 = import("./subfolder");
+const _m38 = import("./subfolder/");
+const _m39 = import("./subfolder/index");
+const _m40 = import("./subfolder2");
+const _m41 = import("./subfolder2/");
+const _m42 = import("./subfolder2/index");
+const _m43 = import("./subfolder2/another");
+const _m44 = import("./subfolder2/another/");
+const _m45 = import("./subfolder2/another/index");
+// cjs format file
+const x = 1;
+export {x};
+// @filename: index.mjs
+import * as m1 from "./index.js";
+import * as m2 from "./index.mjs";
+import * as m3 from "./index.cjs";
+import * as m4 from "./subfolder/index.js";
+import * as m5 from "./subfolder/index.mjs";
+import * as m6 from "./subfolder/index.cjs";
+import * as m7 from "./subfolder2/index.js";
+import * as m8 from "./subfolder2/index.mjs";
+import * as m9 from "./subfolder2/index.cjs";
+import * as m10 from "./subfolder2/another/index.js";
+import * as m11 from "./subfolder2/another/index.mjs";
+import * as m12 from "./subfolder2/another/index.cjs";
+// The next ones should all fail - esm format files have no index resolution or extension resolution
+import * as m13 from "./";
+import * as m14 from "./index";
+import * as m15 from "./subfolder";
+import * as m16 from "./subfolder/";
+import * as m17 from "./subfolder/index";
+import * as m18 from "./subfolder2";
+import * as m19 from "./subfolder2/";
+import * as m20 from "./subfolder2/index";
+import * as m21 from "./subfolder2/another";
+import * as m22 from "./subfolder2/another/";
+import * as m23 from "./subfolder2/another/index";
+void m1;
+void m2;
+void m3;
+void m4;
+void m5;
+void m6;
+void m7;
+void m8;
+void m9;
+void m10;
+void m11;
+void m12;
+void m13;
+void m14;
+void m15;
+void m16;
+void m17;
+void m18;
+void m19;
+void m20;
+void m21;
+void m22;
+void m23;
+
+// These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!)
+import m24 = require("./");
+import m25 = require("./index");
+import m26 = require("./subfolder");
+import m27 = require("./subfolder/");
+import m28 = require("./subfolder/index");
+import m29 = require("./subfolder2");
+import m30 = require("./subfolder2/");
+import m31 = require("./subfolder2/index");
+import m32 = require("./subfolder2/another");
+import m33 = require("./subfolder2/another/");
+import m34 = require("./subfolder2/another/index");
+void m24;
+void m25;
+void m26;
+void m27;
+void m28;
+void m29;
+void m30;
+void m31;
+void m32;
+void m33;
+void m34;
+
+// These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution
+const _m35 = import("./");
+const _m36 = import("./index");
+const _m37 = import("./subfolder");
+const _m38 = import("./subfolder/");
+const _m39 = import("./subfolder/index");
+const _m40 = import("./subfolder2");
+const _m41 = import("./subfolder2/");
+const _m42 = import("./subfolder2/index");
+const _m43 = import("./subfolder2/another");
+const _m44 = import("./subfolder2/another/");
+const _m45 = import("./subfolder2/another/index");
+
+// esm format file
+const x = 1;
+export {x};
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module"
+}
+// @filename: subfolder/package.json
+{
+ "type": "commonjs"
+}
+// @filename: subfolder2/package.json
+{
+}
+// @filename: subfolder2/another/package.json
+{
+ "type": "module"
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsCjsFromJs.ts b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsCjsFromJs.ts
new file mode 100644
index 0000000000..ea0821742f
--- /dev/null
+++ b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsCjsFromJs.ts
@@ -0,0 +1,8 @@
+// @module: node12,nodenext
+// @allowJs: true
+// @noEmit: true
+// @filename: foo.cjs
+exports.foo = "foo"
+// @filename: bar.ts
+import foo from "./foo.cjs"
+foo.foo;
\ No newline at end of file
diff --git a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsConditionalPackageExports.ts b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsConditionalPackageExports.ts
new file mode 100644
index 0000000000..1020812d5a
--- /dev/null
+++ b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsConditionalPackageExports.ts
@@ -0,0 +1,126 @@
+// @module: node12,nodenext
+// @declaration: true
+// @allowJs: true
+// @checkJs: true
+// @outDir: out
+// @filename: index.js
+// esm format file
+import * as cjs from "package/cjs";
+import * as mjs from "package/mjs";
+import * as type from "package";
+cjs;
+mjs;
+type;
+import * as cjsi from "inner/a";
+import * as mjsi from "inner/b";
+import * as typei from "inner";
+import * as ts from "inner/types";
+cjsi.mjsSource;
+mjsi.mjsSource;
+typei.mjsSource;
+ts.mjsSource;
+// @filename: index.mjs
+// esm format file
+import * as cjs from "package/cjs";
+import * as mjs from "package/mjs";
+import * as type from "package";
+cjs;
+mjs;
+type;
+import * as cjsi from "inner/a";
+import * as mjsi from "inner/b";
+import * as typei from "inner";
+import * as ts from "inner/types";
+cjsi.mjsSource;
+mjsi.mjsSource;
+typei.mjsSource;
+ts.mjsSource;
+// @filename: index.cjs
+// cjs format file
+import * as cjs from "package/cjs";
+import * as mjs from "package/mjs";
+import * as type from "package";
+cjs;
+mjs;
+type;
+import * as cjsi from "inner/a";
+import * as mjsi from "inner/b";
+import * as typei from "inner";
+import * as ts from "inner/types";
+cjsi.cjsSource;
+mjsi.cjsSource;
+typei.implicitCjsSource;
+ts.cjsSource;
+// @filename: node_modules/inner/index.d.ts
+// cjs format file
+import * as cjs from "inner/a";
+import * as mjs from "inner/b";
+import * as type from "inner";
+import * as ts from "inner/types";
+export { cjs };
+export { mjs };
+export { type };
+export { ts };
+export const implicitCjsSource = true;
+// @filename: node_modules/inner/index.d.mts
+// esm format file
+import * as cjs from "inner/a";
+import * as mjs from "inner/b";
+import * as type from "inner";
+import * as ts from "inner/types";
+export { cjs };
+export { mjs };
+export { type };
+export { ts };
+export const mjsSource = true;
+// @filename: node_modules/inner/index.d.cts
+// cjs format file
+import * as cjs from "inner/a";
+import * as mjs from "inner/b";
+import * as type from "inner";
+import * as ts from "inner/types";
+export { cjs };
+export { mjs };
+export { type };
+export { ts };
+export const cjsSource = true;
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module",
+ "exports": {
+ "./cjs": "./index.cjs",
+ "./mjs": "./index.mjs",
+ ".": "./index.js"
+ }
+}
+// @filename: node_modules/inner/package.json
+{
+ "name": "inner",
+ "private": true,
+ "exports": {
+ "./a": {
+ "require": "./index.cjs",
+ "node": "./index.mjs"
+ },
+ "./b": {
+ "import": "./index.mjs",
+ "node": "./index.cjs"
+ },
+ ".": {
+ "import": "./index.mjs",
+ "node": "./index.js"
+ },
+ "./types": {
+ "types": {
+ "import": "./index.d.mts",
+ "require": "./index.d.cts",
+ },
+ "node": {
+ "import": "./index.mjs",
+ "require": "./index.cjs"
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsDynamicImport.ts b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsDynamicImport.ts
new file mode 100644
index 0000000000..d7032c648b
--- /dev/null
+++ b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsDynamicImport.ts
@@ -0,0 +1,27 @@
+// @module: node12,nodenext
+// @declaration: true
+// @allowJs: true
+// @checkJs: true
+// @outDir: out
+// @filename: subfolder/index.js
+// cjs format file
+export async function main() {
+ const { readFile } = await import("fs");
+}
+// @filename: index.js
+// esm format file
+export async function main() {
+ const { readFile } = await import("fs");
+}
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module"
+}
+// @filename: subfolder/package.json
+{
+ "type": "commonjs"
+}
+// @filename: types.d.ts
+declare module "fs";
\ No newline at end of file
diff --git a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsExportAssignment.ts b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsExportAssignment.ts
new file mode 100644
index 0000000000..f7d5aaf822
--- /dev/null
+++ b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsExportAssignment.ts
@@ -0,0 +1,32 @@
+// @module: node12,nodenext
+// @declaration: true
+// @allowJs: true
+// @checkJs: true
+// @outDir: out
+// @filename: subfolder/index.js
+// cjs format file
+const a = {};
+export = a;
+// @filename: subfolder/file.js
+// cjs format file
+const a = {};
+module.exports = a;
+// @filename: index.js
+// esm format file
+const a = {};
+export = a;
+// @filename: file.js
+// esm format file
+import "fs";
+const a = {};
+module.exports = a;
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module"
+}
+// @filename: subfolder/package.json
+{
+ "type": "commonjs"
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsGeneratedNameCollisions.ts b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsGeneratedNameCollisions.ts
new file mode 100644
index 0000000000..14783731bf
--- /dev/null
+++ b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsGeneratedNameCollisions.ts
@@ -0,0 +1,29 @@
+// @module: node12,nodenext
+// @declaration: true
+// @allowJs: true
+// @checkJs: true
+// @outDir: out
+// @filename: subfolder/index.js
+// cjs format file
+function require() {}
+const exports = {};
+class Object {}
+export const __esModule = false;
+export {require, exports, Object};
+// @filename: index.js
+// esm format file
+function require() {}
+const exports = {};
+class Object {}
+export const __esModule = false;
+export {require, exports, Object};
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module"
+}
+// @filename: subfolder/package.json
+{
+ "type": "commonjs"
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportAssignment.ts b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportAssignment.ts
new file mode 100644
index 0000000000..53e6b94450
--- /dev/null
+++ b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportAssignment.ts
@@ -0,0 +1,34 @@
+// @module: node12,nodenext
+// @declaration: true
+// @allowJs: true
+// @checkJs: true
+// @outDir: out
+// @filename: subfolder/index.js
+// cjs format file
+import fs = require("fs");
+fs.readFile;
+export import fs2 = require("fs");
+// @filename: index.js
+// esm format file
+import fs = require("fs");
+fs.readFile;
+export import fs2 = require("fs");
+// @filename: file.js
+// esm format file
+const __require = null;
+const _createRequire = null;
+import fs = require("fs");
+fs.readFile;
+export import fs2 = require("fs");
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module"
+}
+// @filename: subfolder/package.json
+{
+ "type": "commonjs"
+}
+// @filename: types.d.ts
+declare module "fs";
\ No newline at end of file
diff --git a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportHelpersCollisions1.ts b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportHelpersCollisions1.ts
new file mode 100644
index 0000000000..d5727a3dc7
--- /dev/null
+++ b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportHelpersCollisions1.ts
@@ -0,0 +1,34 @@
+// @module: node12,nodenext
+// @declaration: true
+// @importHelpers: true
+// @allowJs: true
+// @checkJs: true
+// @outDir: out
+// @filename: subfolder/index.js
+// cjs format file
+import {default as _fs} from "fs";
+_fs.readFile;
+import * as fs from "fs";
+fs.readFile;
+// @filename: index.js
+// esm format file
+import {default as _fs} from "fs";
+_fs.readFile;
+import * as fs from "fs";
+fs.readFile;
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module"
+}
+// @filename: subfolder/package.json
+{
+ "type": "commonjs"
+}
+// @filename: types.d.ts
+declare module "fs";
+declare module "tslib" {
+ export {};
+ // intentionally missing all helpers
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportHelpersCollisions2.ts b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportHelpersCollisions2.ts
new file mode 100644
index 0000000000..032290f78b
--- /dev/null
+++ b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportHelpersCollisions2.ts
@@ -0,0 +1,30 @@
+// @module: node12,nodenext
+// @declaration: true
+// @importHelpers: true
+// @allowJs: true
+// @checkJs: true
+// @outDir: out
+// @filename: subfolder/index.ts
+// cjs format file
+export * from "fs";
+export * as fs from "fs";
+// @filename: index.js
+// esm format file
+export * from "fs";
+export * as fs from "fs";
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module"
+}
+// @filename: subfolder/package.json
+{
+ "type": "commonjs"
+}
+// @filename: types.d.ts
+declare module "fs";
+declare module "tslib" {
+ export {};
+ // intentionally missing all helpers
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportHelpersCollisions3.ts b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportHelpersCollisions3.ts
new file mode 100644
index 0000000000..9452e2003a
--- /dev/null
+++ b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportHelpersCollisions3.ts
@@ -0,0 +1,32 @@
+// @module: node12,nodenext
+// @declaration: true
+// @importHelpers: true
+// @allowJs: true
+// @checkJs: true
+// @outDir: out
+// @filename: subfolder/index.js
+// cjs format file
+export {default} from "fs";
+export {default as foo} from "fs";
+export {bar as baz} from "fs";
+// @filename: index.js
+// esm format file
+export {default} from "fs";
+export {default as foo} from "fs";
+export {bar as baz} from "fs";
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module"
+}
+// @filename: subfolder/package.json
+{
+ "type": "commonjs"
+}
+// @filename: types.d.ts
+declare module "fs";
+declare module "tslib" {
+ export {};
+ // intentionally missing all helpers
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportMeta.ts b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportMeta.ts
new file mode 100644
index 0000000000..a8708434b9
--- /dev/null
+++ b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportMeta.ts
@@ -0,0 +1,23 @@
+// @module: node12,nodenext
+// @declaration: true
+// @allowJs: true
+// @checkJs: true
+// @outDir: out
+// @filename: subfolder/index.js
+// cjs format file
+const x = import.meta.url;
+export {x};
+// @filename: index.js
+// esm format file
+const x = import.meta.url;
+export {x};
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module"
+}
+// @filename: subfolder/package.json
+{
+ "type": "commonjs"
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackageExports.ts b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackageExports.ts
new file mode 100644
index 0000000000..65e5721b0b
--- /dev/null
+++ b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackageExports.ts
@@ -0,0 +1,92 @@
+// @module: node12,nodenext
+// @declaration: true
+// @allowJs: true
+// @checkJs: true
+// @outDir: out
+// @filename: index.js
+// esm format file
+import * as cjs from "package/cjs";
+import * as mjs from "package/mjs";
+import * as type from "package";
+cjs;
+mjs;
+type;
+import * as cjsi from "inner/cjs";
+import * as mjsi from "inner/mjs";
+import * as typei from "inner";
+cjsi;
+mjsi;
+typei;
+// @filename: index.mjs
+// esm format file
+import * as cjs from "package/cjs";
+import * as mjs from "package/mjs";
+import * as type from "package";
+cjs;
+mjs;
+type;
+import * as cjsi from "inner/cjs";
+import * as mjsi from "inner/mjs";
+import * as typei from "inner";
+cjsi;
+mjsi;
+typei;
+// @filename: index.cjs
+// cjs format file
+import * as cjs from "package/cjs";
+import * as mjs from "package/mjs";
+import * as type from "package";
+cjs;
+mjs;
+type;
+import * as cjsi from "inner/cjs";
+import * as mjsi from "inner/mjs";
+import * as typei from "inner";
+cjsi;
+mjsi;
+typei;
+// @filename: node_modules/inner/index.d.ts
+// cjs format file
+import * as cjs from "inner/cjs";
+import * as mjs from "inner/mjs";
+import * as type from "inner";
+export { cjs };
+export { mjs };
+export { type };
+// @filename: node_modules/inner/index.d.mts
+// esm format file
+import * as cjs from "inner/cjs";
+import * as mjs from "inner/mjs";
+import * as type from "inner";
+export { cjs };
+export { mjs };
+export { type };
+// @filename: node_modules/inner/index.d.cts
+// cjs format file
+import * as cjs from "inner/cjs";
+import * as mjs from "inner/mjs";
+import * as type from "inner";
+export { cjs };
+export { mjs };
+export { type };
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module",
+ "exports": {
+ "./cjs": "./index.cjs",
+ "./mjs": "./index.mjs",
+ ".": "./index.js"
+ }
+}
+// @filename: node_modules/inner/package.json
+{
+ "name": "inner",
+ "private": true,
+ "exports": {
+ "./cjs": "./index.cjs",
+ "./mjs": "./index.mjs",
+ ".": "./index.js"
+ }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackageImports.ts b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackageImports.ts
new file mode 100644
index 0000000000..b9d6027f5d
--- /dev/null
+++ b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackageImports.ts
@@ -0,0 +1,41 @@
+// @module: node12,nodenext
+// @declaration: true
+// @allowJs: true
+// @checkJs: true
+// @outDir: out
+// @filename: index.js
+// esm format file
+import * as cjs from "#cjs";
+import * as mjs from "#mjs";
+import * as type from "#type";
+cjs;
+mjs;
+type;
+// @filename: index.mjs
+// esm format file
+import * as cjs from "#cjs";
+import * as mjs from "#mjs";
+import * as type from "#type";
+cjs;
+mjs;
+type;
+// @filename: index.cjs
+// esm format file
+import * as cjs from "#cjs";
+import * as mjs from "#mjs";
+import * as type from "#type";
+cjs;
+mjs;
+type;
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module",
+ "exports": "./index.js",
+ "imports": {
+ "#cjs": "./index.cjs",
+ "#mjs": "./index.mjs",
+ "#type": "./index.js"
+ }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackagePatternExports.ts b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackagePatternExports.ts
new file mode 100644
index 0000000000..2691885690
--- /dev/null
+++ b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackagePatternExports.ts
@@ -0,0 +1,69 @@
+// @module: node12,nodenext
+// @declaration: true
+// @allowJs: true
+// @checkJs: true
+// @outDir: out
+// @filename: index.js
+// esm format file
+import * as cjsi from "inner/cjs/index";
+import * as mjsi from "inner/mjs/index";
+import * as typei from "inner/js/index";
+cjsi;
+mjsi;
+typei;
+// @filename: index.mjs
+// esm format file
+import * as cjsi from "inner/cjs/index";
+import * as mjsi from "inner/mjs/index";
+import * as typei from "inner/js/index";
+cjsi;
+mjsi;
+typei;
+// @filename: index.cjs
+// cjs format file
+import * as cjsi from "inner/cjs/index";
+import * as mjsi from "inner/mjs/index";
+import * as typei from "inner/js/index";
+cjsi;
+mjsi;
+typei;
+// @filename: node_modules/inner/index.d.ts
+// cjs format file
+import * as cjs from "inner/cjs/index";
+import * as mjs from "inner/mjs/index";
+import * as type from "inner/js/index";
+export { cjs };
+export { mjs };
+export { type };
+// @filename: node_modules/inner/index.d.mts
+// esm format file
+import * as cjs from "inner/cjs/index";
+import * as mjs from "inner/mjs/index";
+import * as type from "inner/js/index";
+export { cjs };
+export { mjs };
+export { type };
+// @filename: node_modules/inner/index.d.cts
+// cjs format file
+import * as cjs from "inner/cjs/index";
+import * as mjs from "inner/mjs/index";
+import * as type from "inner/js/index";
+export { cjs };
+export { mjs };
+export { type };
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module",
+}
+// @filename: node_modules/inner/package.json
+{
+ "name": "inner",
+ "private": true,
+ "exports": {
+ "./cjs/*": "./*.cjs",
+ "./mjs/*": "./*.mjs",
+ "./js/*": "./*.js"
+ }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackagePatternExportsTrailers.ts b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackagePatternExportsTrailers.ts
new file mode 100644
index 0000000000..6b96f34758
--- /dev/null
+++ b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackagePatternExportsTrailers.ts
@@ -0,0 +1,69 @@
+// @module: node12,nodenext
+// @declaration: true
+// @allowJs: true
+// @checkJs: true
+// @outDir: out
+// @filename: index.js
+// esm format file
+import * as cjsi from "inner/cjs/index.cjs";
+import * as mjsi from "inner/mjs/index.mjs";
+import * as typei from "inner/js/index.js";
+cjsi;
+mjsi;
+typei;
+// @filename: index.mjs
+// esm format file
+import * as cjsi from "inner/cjs/index.cjs";
+import * as mjsi from "inner/mjs/index.mjs";
+import * as typei from "inner/js/index.js";
+cjsi;
+mjsi;
+typei;
+// @filename: index.cjs
+// cjs format file
+import * as cjsi from "inner/cjs/index.cjs";
+import * as mjsi from "inner/mjs/index.mjs";
+import * as typei from "inner/js/index.js";
+cjsi;
+mjsi;
+typei;
+// @filename: node_modules/inner/index.d.ts
+// cjs format file
+import * as cjs from "inner/cjs/index.cjs";
+import * as mjs from "inner/mjs/index.mjs";
+import * as type from "inner/js/index.js";
+export { cjs };
+export { mjs };
+export { type };
+// @filename: node_modules/inner/index.d.mts
+// esm format file
+import * as cjs from "inner/cjs/index.cjs";
+import * as mjs from "inner/mjs/index.mjs";
+import * as type from "inner/js/index.js";
+export { cjs };
+export { mjs };
+export { type };
+// @filename: node_modules/inner/index.d.cts
+// cjs format file
+import * as cjs from "inner/cjs/index.cjs";
+import * as mjs from "inner/mjs/index.mjs";
+import * as type from "inner/js/index.js";
+export { cjs };
+export { mjs };
+export { type };
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module",
+}
+// @filename: node_modules/inner/package.json
+{
+ "name": "inner",
+ "private": true,
+ "exports": {
+ "./cjs/*.cjs": "./*.cjs",
+ "./mjs/*.mjs": "./*.mjs",
+ "./js/*.js": "./*.js"
+ }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsSynchronousCallErrors.ts b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsSynchronousCallErrors.ts
new file mode 100644
index 0000000000..15892edbe3
--- /dev/null
+++ b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsSynchronousCallErrors.ts
@@ -0,0 +1,37 @@
+// @module: node12,nodenext
+// @declaration: true
+// @allowJs: true
+// @checkJs: true
+// @outDir: out
+// @filename: subfolder/index.js
+// cjs format file
+import {h} from "../index.js";
+import mod = require("../index.js");
+import {f as _f} from "./index.js";
+import mod2 = require("./index.js");
+export async function f() {
+ const mod3 = await import ("../index.js");
+ const mod4 = await import ("./index.js");
+ h();
+}
+// @filename: index.js
+// esm format file
+import {h as _h} from "./index.js";
+import mod = require("./index.js");
+import {f} from "./subfolder/index.js";
+import mod2 = require("./subfolder/index.js");
+export async function h() {
+ const mod3 = await import ("./index.js");
+ const mod4 = await import ("./subfolder/index.js");
+ f();
+}
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module"
+}
+// @filename: subfolder/package.json
+{
+ "type": "commonjs"
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsTopLevelAwait.ts b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsTopLevelAwait.ts
new file mode 100644
index 0000000000..872cad71c9
--- /dev/null
+++ b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsTopLevelAwait.ts
@@ -0,0 +1,25 @@
+// @module: node12,nodenext
+// @declaration: true
+// @allowJs: true
+// @checkJs: true
+// @outDir: out
+// @filename: subfolder/index.js
+// cjs format file
+const x = await 1;
+export {x};
+for await (const y of []) {}
+// @filename: index.js
+// esm format file
+const x = await 1;
+export {x};
+for await (const y of []) {}
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module"
+}
+// @filename: subfolder/package.json
+{
+ "type": "commonjs"
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/legacyNodeModulesExportsSpecifierGenerationConditions.ts b/tests/cases/conformance/node/legacyNodeModulesExportsSpecifierGenerationConditions.ts
new file mode 100644
index 0000000000..656465829e
--- /dev/null
+++ b/tests/cases/conformance/node/legacyNodeModulesExportsSpecifierGenerationConditions.ts
@@ -0,0 +1,33 @@
+// @module: commonjs
+// @lib: es2020
+// @declaration: true
+// @filename: index.ts
+export const a = async () => (await import("inner")).x();
+// @filename: node_modules/inner/index.d.ts
+export { x } from "./other.js";
+// @filename: node_modules/inner/other.d.ts
+import { Thing } from "./private.js"
+export const x: () => Thing;
+// @filename: node_modules/inner/private.d.ts
+export interface Thing {} // not exported in export map, inaccessible under new module modes
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module",
+ "exports": "./index.js"
+}
+// @filename: node_modules/inner/package.json
+{
+ "name": "inner",
+ "private": true,
+ "type": "module",
+ "exports": {
+ ".": {
+ "default": "./index.js"
+ },
+ "./other": {
+ "default": "./other.js"
+ }
+ }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/nodeModules1.ts b/tests/cases/conformance/node/nodeModules1.ts
new file mode 100644
index 0000000000..698a6efec1
--- /dev/null
+++ b/tests/cases/conformance/node/nodeModules1.ts
@@ -0,0 +1,321 @@
+// @module: node12,nodenext
+// @declaration: true
+// @filename: subfolder/index.ts
+// cjs format file
+const x = 1;
+export {x};
+// @filename: subfolder/index.cts
+// cjs format file
+const x = 1;
+export {x};
+// @filename: subfolder/index.mts
+// esm format file
+const x = 1;
+export {x};
+// @filename: subfolder2/index.ts
+// cjs format file
+const x = 1;
+export {x};
+// @filename: subfolder2/index.cts
+// cjs format file
+const x = 1;
+export {x};
+// @filename: subfolder2/index.mts
+// esm format file
+const x = 1;
+export {x};
+// @filename: subfolder2/another/index.ts
+// esm format file
+const x = 1;
+export {x};
+// @filename: subfolder2/another/index.mts
+// esm format file
+const x = 1;
+export {x};
+// @filename: subfolder2/another/index.cts
+// cjs format file
+const x = 1;
+export {x};
+// @filename: index.mts
+import * as m1 from "./index.js";
+import * as m2 from "./index.mjs";
+import * as m3 from "./index.cjs";
+import * as m4 from "./subfolder/index.js";
+import * as m5 from "./subfolder/index.mjs";
+import * as m6 from "./subfolder/index.cjs";
+import * as m7 from "./subfolder2/index.js";
+import * as m8 from "./subfolder2/index.mjs";
+import * as m9 from "./subfolder2/index.cjs";
+import * as m10 from "./subfolder2/another/index.js";
+import * as m11 from "./subfolder2/another/index.mjs";
+import * as m12 from "./subfolder2/another/index.cjs";
+// The next ones should all fail - esm format files have no index resolution or extension resolution
+import * as m13 from "./";
+import * as m14 from "./index";
+import * as m15 from "./subfolder";
+import * as m16 from "./subfolder/";
+import * as m17 from "./subfolder/index";
+import * as m18 from "./subfolder2";
+import * as m19 from "./subfolder2/";
+import * as m20 from "./subfolder2/index";
+import * as m21 from "./subfolder2/another";
+import * as m22 from "./subfolder2/another/";
+import * as m23 from "./subfolder2/another/index";
+void m1;
+void m2;
+void m3;
+void m4;
+void m5;
+void m6;
+void m7;
+void m8;
+void m9;
+void m10;
+void m11;
+void m12;
+void m13;
+void m14;
+void m15;
+void m16;
+void m17;
+void m18;
+void m19;
+void m20;
+void m21;
+void m22;
+void m23;
+
+// These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!)
+import m24 = require("./");
+import m25 = require("./index");
+import m26 = require("./subfolder");
+import m27 = require("./subfolder/");
+import m28 = require("./subfolder/index");
+import m29 = require("./subfolder2");
+import m30 = require("./subfolder2/");
+import m31 = require("./subfolder2/index");
+import m32 = require("./subfolder2/another");
+import m33 = require("./subfolder2/another/");
+import m34 = require("./subfolder2/another/index");
+void m24;
+void m25;
+void m26;
+void m27;
+void m28;
+void m29;
+void m30;
+void m31;
+void m32;
+void m33;
+void m34;
+
+// These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution
+const _m35 = import("./");
+const _m36 = import("./index");
+const _m37 = import("./subfolder");
+const _m38 = import("./subfolder/");
+const _m39 = import("./subfolder/index");
+const _m40 = import("./subfolder2");
+const _m41 = import("./subfolder2/");
+const _m42 = import("./subfolder2/index");
+const _m43 = import("./subfolder2/another");
+const _m44 = import("./subfolder2/another/");
+const _m45 = import("./subfolder2/another/index");
+
+// esm format file
+const x = 1;
+export {x};
+// @filename: index.cts
+// ESM-format imports below should issue errors
+import * as m1 from "./index.js";
+import * as m2 from "./index.mjs";
+import * as m3 from "./index.cjs";
+import * as m4 from "./subfolder/index.js";
+import * as m5 from "./subfolder/index.mjs";
+import * as m6 from "./subfolder/index.cjs";
+import * as m7 from "./subfolder2/index.js";
+import * as m8 from "./subfolder2/index.mjs";
+import * as m9 from "./subfolder2/index.cjs";
+import * as m10 from "./subfolder2/another/index.js";
+import * as m11 from "./subfolder2/another/index.mjs";
+import * as m12 from "./subfolder2/another/index.cjs";
+// The next ones should _mostly_ work - cjs format files have index resolution and extension resolution (except for those which resolve to an esm format file)
+import * as m13 from "./";
+import * as m14 from "./index";
+import * as m15 from "./subfolder";
+import * as m16 from "./subfolder/";
+import * as m17 from "./subfolder/index";
+import * as m18 from "./subfolder2";
+import * as m19 from "./subfolder2/";
+import * as m20 from "./subfolder2/index";
+import * as m21 from "./subfolder2/another";
+import * as m22 from "./subfolder2/another/";
+import * as m23 from "./subfolder2/another/index";
+void m1;
+void m2;
+void m3;
+void m4;
+void m5;
+void m6;
+void m7;
+void m8;
+void m9;
+void m10;
+void m11;
+void m12;
+void m13;
+void m14;
+void m15;
+void m16;
+void m17;
+void m18;
+void m19;
+void m20;
+void m21;
+void m22;
+void m23;
+
+// These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!)
+import m24 = require("./");
+import m25 = require("./index");
+import m26 = require("./subfolder");
+import m27 = require("./subfolder/");
+import m28 = require("./subfolder/index");
+import m29 = require("./subfolder2");
+import m30 = require("./subfolder2/");
+import m31 = require("./subfolder2/index");
+import m32 = require("./subfolder2/another");
+import m33 = require("./subfolder2/another/");
+import m34 = require("./subfolder2/another/index");
+void m24;
+void m25;
+void m26;
+void m27;
+void m28;
+void m29;
+void m30;
+void m31;
+void m32;
+void m33;
+void m34;
+
+// These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution
+const _m35 = import("./");
+const _m36 = import("./index");
+const _m37 = import("./subfolder");
+const _m38 = import("./subfolder/");
+const _m39 = import("./subfolder/index");
+const _m40 = import("./subfolder2");
+const _m41 = import("./subfolder2/");
+const _m42 = import("./subfolder2/index");
+const _m43 = import("./subfolder2/another");
+const _m44 = import("./subfolder2/another/");
+const _m45 = import("./subfolder2/another/index");
+// cjs format file
+const x = 1;
+export {x};
+// @filename: index.ts
+import * as m1 from "./index.js";
+import * as m2 from "./index.mjs";
+import * as m3 from "./index.cjs";
+import * as m4 from "./subfolder/index.js";
+import * as m5 from "./subfolder/index.mjs";
+import * as m6 from "./subfolder/index.cjs";
+import * as m7 from "./subfolder2/index.js";
+import * as m8 from "./subfolder2/index.mjs";
+import * as m9 from "./subfolder2/index.cjs";
+import * as m10 from "./subfolder2/another/index.js";
+import * as m11 from "./subfolder2/another/index.mjs";
+import * as m12 from "./subfolder2/another/index.cjs";
+// The next ones shouldn't all work - esm format files have no index resolution or extension resolution
+import * as m13 from "./";
+import * as m14 from "./index";
+import * as m15 from "./subfolder";
+import * as m16 from "./subfolder/";
+import * as m17 from "./subfolder/index";
+import * as m18 from "./subfolder2";
+import * as m19 from "./subfolder2/";
+import * as m20 from "./subfolder2/index";
+import * as m21 from "./subfolder2/another";
+import * as m22 from "./subfolder2/another/";
+import * as m23 from "./subfolder2/another/index";
+void m1;
+void m2;
+void m3;
+void m4;
+void m5;
+void m6;
+void m7;
+void m8;
+void m9;
+void m10;
+void m11;
+void m12;
+void m13;
+void m14;
+void m15;
+void m16;
+void m17;
+void m18;
+void m19;
+void m20;
+void m21;
+void m22;
+void m23;
+
+// These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!)
+import m24 = require("./");
+import m25 = require("./index");
+import m26 = require("./subfolder");
+import m27 = require("./subfolder/");
+import m28 = require("./subfolder/index");
+import m29 = require("./subfolder2");
+import m30 = require("./subfolder2/");
+import m31 = require("./subfolder2/index");
+import m32 = require("./subfolder2/another");
+import m33 = require("./subfolder2/another/");
+import m34 = require("./subfolder2/another/index");
+void m24;
+void m25;
+void m26;
+void m27;
+void m28;
+void m29;
+void m30;
+void m31;
+void m32;
+void m33;
+void m34;
+
+// These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution
+const _m35 = import("./");
+const _m36 = import("./index");
+const _m37 = import("./subfolder");
+const _m38 = import("./subfolder/");
+const _m39 = import("./subfolder/index");
+const _m40 = import("./subfolder2");
+const _m41 = import("./subfolder2/");
+const _m42 = import("./subfolder2/index");
+const _m43 = import("./subfolder2/another");
+const _m44 = import("./subfolder2/another/");
+const _m45 = import("./subfolder2/another/index");
+// esm format file
+const x = 1;
+export {x};
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module"
+}
+// @filename: subfolder/package.json
+{
+ "type": "commonjs"
+}
+// @filename: subfolder2/package.json
+{
+}
+// @filename: subfolder2/another/package.json
+{
+ "type": "module"
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/nodeModulesCjsFormatFileAlwaysHasDefault.ts b/tests/cases/conformance/node/nodeModulesCjsFormatFileAlwaysHasDefault.ts
new file mode 100644
index 0000000000..06c6320d77
--- /dev/null
+++ b/tests/cases/conformance/node/nodeModulesCjsFormatFileAlwaysHasDefault.ts
@@ -0,0 +1,19 @@
+// @module: node12,nodenext
+// @declaration: true
+// @filename: subfolder/index.ts
+// cjs format file
+export const a = 1;
+// @filename: index.ts
+// esm format file
+import mod from "./subfolder/index.js";
+mod;
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module"
+}
+// @filename: subfolder/package.json
+{
+ "type": "commonjs"
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/nodeModulesConditionalPackageExports.ts b/tests/cases/conformance/node/nodeModulesConditionalPackageExports.ts
new file mode 100644
index 0000000000..07bf9d9724
--- /dev/null
+++ b/tests/cases/conformance/node/nodeModulesConditionalPackageExports.ts
@@ -0,0 +1,124 @@
+// @module: node12,nodenext
+// @declaration: true
+// @outDir: out
+// @filename: index.ts
+// esm format file
+import * as cjs from "package/cjs";
+import * as mjs from "package/mjs";
+import * as type from "package";
+cjs;
+mjs;
+type;
+import * as cjsi from "inner/a";
+import * as mjsi from "inner/b";
+import * as typei from "inner";
+import * as ts from "inner/types";
+cjsi.mjsSource;
+mjsi.mjsSource;
+typei.mjsSource;
+ts.mjsSource;
+// @filename: index.mts
+// esm format file
+import * as cjs from "package/cjs";
+import * as mjs from "package/mjs";
+import * as type from "package";
+cjs;
+mjs;
+type;
+import * as cjsi from "inner/a";
+import * as mjsi from "inner/b";
+import * as typei from "inner";
+import * as ts from "inner/types";
+cjsi.mjsSource;
+mjsi.mjsSource;
+typei.mjsSource;
+ts.mjsSource;
+// @filename: index.cts
+// cjs format file
+import * as cjs from "package/cjs";
+import * as mjs from "package/mjs";
+import * as type from "package";
+cjs;
+mjs;
+type;
+import * as cjsi from "inner/a";
+import * as mjsi from "inner/b";
+import * as typei from "inner";
+import * as ts from "inner/types";
+cjsi.cjsSource;
+mjsi.cjsSource;
+typei.implicitCjsSource;
+ts.cjsSource;
+// @filename: node_modules/inner/index.d.ts
+// cjs format file
+import * as cjs from "inner/a";
+import * as mjs from "inner/b";
+import * as type from "inner";
+import * as ts from "inner/types";
+export { cjs };
+export { mjs };
+export { type };
+export { ts };
+export const implicitCjsSource = true;
+// @filename: node_modules/inner/index.d.mts
+// esm format file
+import * as cjs from "inner/a";
+import * as mjs from "inner/b";
+import * as type from "inner";
+import * as ts from "inner/types";
+export { cjs };
+export { mjs };
+export { type };
+export { ts };
+export const mjsSource = true;
+// @filename: node_modules/inner/index.d.cts
+// cjs format file
+import * as cjs from "inner/a";
+import * as mjs from "inner/b";
+import * as type from "inner";
+import * as ts from "inner/types";
+export { cjs };
+export { mjs };
+export { type };
+export { ts };
+export const cjsSource = true;
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module",
+ "exports": {
+ "./cjs": "./index.cjs",
+ "./mjs": "./index.mjs",
+ ".": "./index.js"
+ }
+}
+// @filename: node_modules/inner/package.json
+{
+ "name": "inner",
+ "private": true,
+ "exports": {
+ "./a": {
+ "require": "./index.cjs",
+ "node": "./index.mjs"
+ },
+ "./b": {
+ "import": "./index.mjs",
+ "node": "./index.cjs"
+ },
+ ".": {
+ "import": "./index.mjs",
+ "node": "./index.js"
+ },
+ "./types": {
+ "types": {
+ "import": "./index.d.mts",
+ "require": "./index.d.cts",
+ },
+ "node": {
+ "import": "./index.mjs",
+ "require": "./index.cjs"
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/nodeModulesDeclarationEmitDynamicImportWithPackageExports.ts b/tests/cases/conformance/node/nodeModulesDeclarationEmitDynamicImportWithPackageExports.ts
new file mode 100644
index 0000000000..3f8bae7ffc
--- /dev/null
+++ b/tests/cases/conformance/node/nodeModulesDeclarationEmitDynamicImportWithPackageExports.ts
@@ -0,0 +1,71 @@
+// @module: nodenext
+// @declaration: true
+// @filename: index.ts
+// esm format file
+export {};
+// @filename: index.mts
+// esm format file
+export {};
+// @filename: index.cts
+// cjs format file
+export {};
+// @filename: other.ts
+// esm format file
+export const a = await import("package/cjs");
+export const b = await import("package/mjs");
+export const c = await import("package");
+export const f = await import("inner");
+// @filename: other2.ts
+// esm format file
+export const d = await import("inner/cjs");
+export const e = await import("inner/mjs");
+// @filename: other.mts
+// esm format file
+export const a = await import("package/cjs");
+export const b = await import("package/mjs");
+export const c = await import("package");
+export const f = await import("inner");
+// @filename: other2.mts
+// esm format file
+export const d = await import("inner/cjs");
+export const e = await import("inner/mjs");
+// @filename: other.cts
+// cjs format file, no TLA
+export const a = import("package/cjs");
+export const b = import("package/mjs");
+export const c = import("package");
+export const f = import("inner");
+// @filename: other2.cts
+// cjs format file, no TLA
+export const d = import("inner/cjs");
+export const e = import("inner/mjs");
+// @filename: node_modules/inner/index.d.ts
+// cjs format file
+export const cjsMain = true;
+// @filename: node_modules/inner/index.d.mts
+// esm format file
+export const esm = true;
+// @filename: node_modules/inner/index.d.cts
+// cjs format file
+export const cjsNonmain = true;
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module",
+ "exports": {
+ "./cjs": "./index.cjs",
+ "./mjs": "./index.mjs",
+ ".": "./index.js"
+ }
+}
+// @filename: node_modules/inner/package.json
+{
+ "name": "inner",
+ "private": true,
+ "exports": {
+ "./cjs": "./index.cjs",
+ "./mjs": "./index.mjs",
+ ".": "./index.js"
+ }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/nodeModulesDeclarationEmitWithPackageExports.ts b/tests/cases/conformance/node/nodeModulesDeclarationEmitWithPackageExports.ts
new file mode 100644
index 0000000000..2599ff429f
--- /dev/null
+++ b/tests/cases/conformance/node/nodeModulesDeclarationEmitWithPackageExports.ts
@@ -0,0 +1,93 @@
+// @module: node12,nodenext
+// @declaration: true
+// @outDir: out
+// @filename: index.ts
+// esm format file
+import * as cjs from "package/cjs";
+import * as mjs from "package/mjs";
+import * as type from "package";
+export const a = cjs;
+export const b = mjs;
+export const c = type;
+import * as cjsi from "inner/cjs";
+import * as mjsi from "inner/mjs";
+import * as typei from "inner";
+export const d = cjsi;
+export const e = mjsi;
+export const f = typei;
+// @filename: index.mts
+// esm format file
+import * as cjs from "package/cjs";
+import * as mjs from "package/mjs";
+import * as type from "package";
+export const a = cjs;
+export const b = mjs;
+export const c = type;
+import * as cjsi from "inner/cjs";
+import * as mjsi from "inner/mjs";
+import * as typei from "inner";
+export const d = cjsi;
+export const e = mjsi;
+export const f = typei;
+// @filename: index.cts
+// cjs format file
+import * as cjs from "package/cjs";
+import * as mjs from "package/mjs";
+import * as type from "package";
+export const a = cjs;
+export const b = mjs;
+export const c = type;
+import * as cjsi from "inner/cjs";
+import * as mjsi from "inner/mjs";
+import * as typei from "inner";
+export const d = cjsi;
+export const e = mjsi;
+export const f = typei;
+// @filename: node_modules/inner/index.d.ts
+// cjs format file
+import * as cjs from "inner/cjs";
+import * as mjs from "inner/mjs";
+import * as type from "inner";
+cjs;
+mjs;
+type;
+export const cjsMain = true;
+// @filename: node_modules/inner/index.d.mts
+// esm format file
+import * as cjs from "inner/cjs";
+import * as mjs from "inner/mjs";
+import * as type from "inner";
+cjs;
+mjs;
+type;
+export const esm = true;
+// @filename: node_modules/inner/index.d.cts
+// cjs format file
+import * as cjs from "inner/cjs";
+import * as mjs from "inner/mjs";
+import * as type from "inner";
+cjs;
+mjs;
+type;
+export const cjsNonmain = true;
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module",
+ "exports": {
+ "./cjs": "./index.cjs",
+ "./mjs": "./index.mjs",
+ ".": "./index.js"
+ }
+}
+// @filename: node_modules/inner/package.json
+{
+ "name": "inner",
+ "private": true,
+ "exports": {
+ "./cjs": "./index.cjs",
+ "./mjs": "./index.mjs",
+ ".": "./index.js"
+ }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/nodeModulesDynamicImport.ts b/tests/cases/conformance/node/nodeModulesDynamicImport.ts
new file mode 100644
index 0000000000..46b317ca52
--- /dev/null
+++ b/tests/cases/conformance/node/nodeModulesDynamicImport.ts
@@ -0,0 +1,24 @@
+// @module: node12,nodenext
+// @declaration: true
+// @filename: subfolder/index.ts
+// cjs format file
+export async function main() {
+ const { readFile } = await import("fs");
+}
+// @filename: index.ts
+// esm format file
+export async function main() {
+ const { readFile } = await import("fs");
+}
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module"
+}
+// @filename: subfolder/package.json
+{
+ "type": "commonjs"
+}
+// @filename: types.d.ts
+declare module "fs";
\ No newline at end of file
diff --git a/tests/cases/conformance/node/nodeModulesExportAssignments.ts b/tests/cases/conformance/node/nodeModulesExportAssignments.ts
new file mode 100644
index 0000000000..7cbcd200d9
--- /dev/null
+++ b/tests/cases/conformance/node/nodeModulesExportAssignments.ts
@@ -0,0 +1,20 @@
+// @module: node12,nodenext
+// @declaration: true
+// @filename: subfolder/index.ts
+// cjs format file
+const a = {};
+export = a;
+// @filename: index.ts
+// esm format file
+const a = {};
+export = a;
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module"
+}
+// @filename: subfolder/package.json
+{
+ "type": "commonjs"
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/nodeModulesExportsBlocksSpecifierResolution.ts b/tests/cases/conformance/node/nodeModulesExportsBlocksSpecifierResolution.ts
new file mode 100644
index 0000000000..ffc5adf8e0
--- /dev/null
+++ b/tests/cases/conformance/node/nodeModulesExportsBlocksSpecifierResolution.ts
@@ -0,0 +1,27 @@
+// @module: node12,nodenext
+// @declaration: true
+// @filename: index.ts
+// esm format file
+import { Thing } from "inner/other";
+export const a = (await import("inner")).x();
+// @filename: node_modules/inner/index.d.ts
+// esm format file
+export { x } from "./other.js";
+// @filename: node_modules/inner/other.d.ts
+// esm format file
+export interface Thing {}
+export const x: () => Thing;
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module",
+ "exports": "./index.js"
+}
+// @filename: node_modules/inner/package.json
+{
+ "name": "inner",
+ "private": true,
+ "type": "module",
+ "exports": "./index.js"
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/nodeModulesExportsSpecifierGenerationConditions.ts b/tests/cases/conformance/node/nodeModulesExportsSpecifierGenerationConditions.ts
new file mode 100644
index 0000000000..2562c7a4a1
--- /dev/null
+++ b/tests/cases/conformance/node/nodeModulesExportsSpecifierGenerationConditions.ts
@@ -0,0 +1,34 @@
+// @module: node12,nodenext
+// @declaration: true
+// @filename: index.ts
+// esm format file
+import { Thing } from "inner/other.js"; // should fail
+export const a = (await import("inner")).x();
+// @filename: node_modules/inner/index.d.ts
+// esm format file
+export { x } from "./other.js";
+// @filename: node_modules/inner/other.d.ts
+// esm format file
+export interface Thing {}
+export const x: () => Thing;
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module",
+ "exports": "./index.js"
+}
+// @filename: node_modules/inner/package.json
+{
+ "name": "inner",
+ "private": true,
+ "type": "module",
+ "exports": {
+ ".": {
+ "default": "./index.js"
+ },
+ "./other": {
+ "default": "./other.js"
+ }
+ }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/nodeModulesExportsSpecifierGenerationDirectory.ts b/tests/cases/conformance/node/nodeModulesExportsSpecifierGenerationDirectory.ts
new file mode 100644
index 0000000000..2eb8ac58e6
--- /dev/null
+++ b/tests/cases/conformance/node/nodeModulesExportsSpecifierGenerationDirectory.ts
@@ -0,0 +1,29 @@
+// @module: node12,nodenext
+// @declaration: true
+// @filename: index.ts
+// esm format file
+import { Thing } from "inner/other";
+export const a = (await import("inner/index.js")).x();
+// @filename: node_modules/inner/index.d.ts
+// esm format file
+export { x } from "./other.js";
+// @filename: node_modules/inner/other.d.ts
+// esm format file
+export interface Thing {}
+export const x: () => Thing;
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module",
+ "exports": "./index.js"
+}
+// @filename: node_modules/inner/package.json
+{
+ "name": "inner",
+ "private": true,
+ "type": "module",
+ "exports": {
+ "./": "./"
+ }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/nodeModulesExportsSpecifierGenerationPattern.ts b/tests/cases/conformance/node/nodeModulesExportsSpecifierGenerationPattern.ts
new file mode 100644
index 0000000000..97812da5b5
--- /dev/null
+++ b/tests/cases/conformance/node/nodeModulesExportsSpecifierGenerationPattern.ts
@@ -0,0 +1,29 @@
+// @module: node12,nodenext
+// @declaration: true
+// @filename: index.ts
+// esm format file
+import { Thing } from "inner/other";
+export const a = (await import("inner/index.js")).x();
+// @filename: node_modules/inner/index.d.ts
+// esm format file
+export { x } from "./other.js";
+// @filename: node_modules/inner/other.d.ts
+// esm format file
+export interface Thing {}
+export const x: () => Thing;
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module",
+ "exports": "./index.js"
+}
+// @filename: node_modules/inner/package.json
+{
+ "name": "inner",
+ "private": true,
+ "type": "module",
+ "exports": {
+ "./*.js": "./*.js"
+ }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/nodeModulesForbidenSyntax.ts b/tests/cases/conformance/node/nodeModulesForbidenSyntax.ts
new file mode 100644
index 0000000000..d441627d7d
--- /dev/null
+++ b/tests/cases/conformance/node/nodeModulesForbidenSyntax.ts
@@ -0,0 +1,67 @@
+// @module: node12,nodenext
+// @declaration: true
+// @filename: subfolder/index.ts
+// cjs format file
+const x = () => (void 0);
+export {x};
+// @filename: subfolder/index.cts
+// cjs format file
+const x = () => (void 0);
+export {x};
+// @filename: subfolder/index.mts
+// esm format file
+const x = () => (void 0);
+export {x};
+// @filename: subfolder2/index.ts
+// cjs format file
+const x = () => (void 0);
+export {x};
+// @filename: subfolder2/index.cts
+// cjs format file
+const x = () => (void 0);
+export {x};
+// @filename: subfolder2/index.mts
+// esm format file
+const x = () => (void 0);
+export {x};
+// @filename: subfolder2/another/index.ts
+// esm format file
+const x = () => (void 0);
+export {x};
+// @filename: subfolder2/another/index.mts
+// esm format file
+const x = () => (void 0);
+export {x};
+// @filename: subfolder2/another/index.cts
+// cjs format file
+const x = () => (void 0);
+export {x};
+// @filename: index.mts
+// esm format file
+const x = () => (void 0);
+export {x};
+// @filename: index.cts
+// cjs format file
+const x = () => (void 0);
+export {x};
+// @filename: index.ts
+// esm format file
+const x = () => (void 0);
+export {x};
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module"
+}
+// @filename: subfolder/package.json
+{
+ "type": "commonjs"
+}
+// @filename: subfolder2/package.json
+{
+}
+// @filename: subfolder2/another/package.json
+{
+ "type": "module"
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/nodeModulesGeneratedNameCollisions.ts b/tests/cases/conformance/node/nodeModulesGeneratedNameCollisions.ts
new file mode 100644
index 0000000000..e9a9b9d9ed
--- /dev/null
+++ b/tests/cases/conformance/node/nodeModulesGeneratedNameCollisions.ts
@@ -0,0 +1,26 @@
+// @module: node12,nodenext
+// @declaration: true
+// @filename: subfolder/index.ts
+// cjs format file
+function require() {}
+const exports = {};
+class Object {}
+export const __esModule = false;
+export {require, exports, Object};
+// @filename: index.ts
+// esm format file
+function require() {}
+const exports = {};
+class Object {}
+export const __esModule = false;
+export {require, exports, Object};
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module"
+}
+// @filename: subfolder/package.json
+{
+ "type": "commonjs"
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/nodeModulesImportAssertions.ts b/tests/cases/conformance/node/nodeModulesImportAssertions.ts
new file mode 100644
index 0000000000..0fe1ccdf82
--- /dev/null
+++ b/tests/cases/conformance/node/nodeModulesImportAssertions.ts
@@ -0,0 +1,13 @@
+// @module: node12,nodenext
+// @resolveJsonModule: true
+// @filename: index.ts
+import json from "./package.json" assert { type: "json" };
+// @filename: otherc.cts
+import json from "./package.json" assert { type: "json" }; // should error, cjs mode imports don't support assertions
+const json2 = import("./package.json", { assert: { type: "json" } }); // should be fine
+// @filename: package.json
+{
+ "name": "pkg",
+ "private": true,
+ "type": "module"
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/nodeModulesImportAssignments.ts b/tests/cases/conformance/node/nodeModulesImportAssignments.ts
new file mode 100644
index 0000000000..6c22fe83e0
--- /dev/null
+++ b/tests/cases/conformance/node/nodeModulesImportAssignments.ts
@@ -0,0 +1,31 @@
+// @module: node12,nodenext
+// @declaration: true
+// @filename: subfolder/index.ts
+// cjs format file
+import fs = require("fs");
+fs.readFile;
+export import fs2 = require("fs");
+// @filename: index.ts
+// esm format file
+import fs = require("fs");
+fs.readFile;
+export import fs2 = require("fs");
+// @filename: file.ts
+// esm format file
+const __require = null;
+const _createRequire = null;
+import fs = require("fs");
+fs.readFile;
+export import fs2 = require("fs");
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module"
+}
+// @filename: subfolder/package.json
+{
+ "type": "commonjs"
+}
+// @filename: types.d.ts
+declare module "fs";
\ No newline at end of file
diff --git a/tests/cases/conformance/node/nodeModulesImportHelpersCollisions.ts b/tests/cases/conformance/node/nodeModulesImportHelpersCollisions.ts
new file mode 100644
index 0000000000..103b583712
--- /dev/null
+++ b/tests/cases/conformance/node/nodeModulesImportHelpersCollisions.ts
@@ -0,0 +1,31 @@
+// @module: node12,nodenext
+// @declaration: true
+// @importHelpers: true
+// @filename: subfolder/index.ts
+// cjs format file
+import {default as _fs} from "fs";
+_fs.readFile;
+import * as fs from "fs";
+fs.readFile;
+// @filename: index.ts
+// esm format file
+import {default as _fs} from "fs";
+_fs.readFile;
+import * as fs from "fs";
+fs.readFile;
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module"
+}
+// @filename: subfolder/package.json
+{
+ "type": "commonjs"
+}
+// @filename: types.d.ts
+declare module "fs";
+declare module "tslib" {
+ export {};
+ // intentionally missing all helpers
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/nodeModulesImportHelpersCollisions2.ts b/tests/cases/conformance/node/nodeModulesImportHelpersCollisions2.ts
new file mode 100644
index 0000000000..7f90947a5f
--- /dev/null
+++ b/tests/cases/conformance/node/nodeModulesImportHelpersCollisions2.ts
@@ -0,0 +1,27 @@
+// @module: node12,nodenext
+// @declaration: true
+// @importHelpers: true
+// @filename: subfolder/index.ts
+// cjs format file
+export * from "fs";
+export * as fs from "fs";
+// @filename: index.ts
+// esm format file
+export * from "fs";
+export * as fs from "fs";
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module"
+}
+// @filename: subfolder/package.json
+{
+ "type": "commonjs"
+}
+// @filename: types.d.ts
+declare module "fs";
+declare module "tslib" {
+ export {};
+ // intentionally missing all helpers
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/nodeModulesImportHelpersCollisions3.ts b/tests/cases/conformance/node/nodeModulesImportHelpersCollisions3.ts
new file mode 100644
index 0000000000..5f6984ad1f
--- /dev/null
+++ b/tests/cases/conformance/node/nodeModulesImportHelpersCollisions3.ts
@@ -0,0 +1,25 @@
+// @module: node12,nodenext
+// @declaration: true
+// @importHelpers: true
+// @filename: subfolder/index.ts
+// cjs format file
+export {default} from "fs";
+// @filename: index.ts
+// esm format file
+export {default} from "fs";
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module"
+}
+// @filename: subfolder/package.json
+{
+ "type": "commonjs"
+}
+// @filename: types.d.ts
+declare module "fs";
+declare module "tslib" {
+ export {};
+ // intentionally missing all helpers
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/nodeModulesImportMeta.ts b/tests/cases/conformance/node/nodeModulesImportMeta.ts
new file mode 100644
index 0000000000..d684c7b5cb
--- /dev/null
+++ b/tests/cases/conformance/node/nodeModulesImportMeta.ts
@@ -0,0 +1,20 @@
+// @module: node12,nodenext
+// @declaration: true
+// @filename: subfolder/index.ts
+// cjs format file
+const x = import.meta.url;
+export {x};
+// @filename: index.ts
+// esm format file
+const x = import.meta.url;
+export {x};
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module"
+}
+// @filename: subfolder/package.json
+{
+ "type": "commonjs"
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/nodeModulesImportResolutionIntoExport.ts b/tests/cases/conformance/node/nodeModulesImportResolutionIntoExport.ts
new file mode 100644
index 0000000000..2a407b2bc6
--- /dev/null
+++ b/tests/cases/conformance/node/nodeModulesImportResolutionIntoExport.ts
@@ -0,0 +1,24 @@
+// @module: node12,nodenext
+// @declaration: true
+// @filename: index.ts
+// esm format file
+import * as type from "#type";
+type;
+// @filename: index.mts
+// esm format file
+import * as type from "#type";
+type;
+// @filename: index.cts
+// esm format file
+import * as type from "#type";
+type;
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module",
+ "exports": "./index.cjs",
+ "imports": {
+ "#type": "package"
+ }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/nodeModulesImportResolutionNoCycle.ts b/tests/cases/conformance/node/nodeModulesImportResolutionNoCycle.ts
new file mode 100644
index 0000000000..c0482c86ec
--- /dev/null
+++ b/tests/cases/conformance/node/nodeModulesImportResolutionNoCycle.ts
@@ -0,0 +1,24 @@
+// @module: node12,nodenext
+// @declaration: true
+// @filename: index.ts
+// esm format file
+import * as type from "#type";
+type;
+// @filename: index.mts
+// esm format file
+import * as type from "#type";
+type;
+// @filename: index.cts
+// esm format file
+import * as type from "#type";
+type;
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module",
+ "exports": "package",
+ "imports": {
+ "#type": "package"
+ }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/nodeModulesPackageExports.ts b/tests/cases/conformance/node/nodeModulesPackageExports.ts
new file mode 100644
index 0000000000..897d01b07d
--- /dev/null
+++ b/tests/cases/conformance/node/nodeModulesPackageExports.ts
@@ -0,0 +1,90 @@
+// @module: node12,nodenext
+// @declaration: true
+// @outDir: out
+// @filename: index.ts
+// esm format file
+import * as cjs from "package/cjs";
+import * as mjs from "package/mjs";
+import * as type from "package";
+cjs;
+mjs;
+type;
+import * as cjsi from "inner/cjs";
+import * as mjsi from "inner/mjs";
+import * as typei from "inner";
+cjsi;
+mjsi;
+typei;
+// @filename: index.mts
+// esm format file
+import * as cjs from "package/cjs";
+import * as mjs from "package/mjs";
+import * as type from "package";
+cjs;
+mjs;
+type;
+import * as cjsi from "inner/cjs";
+import * as mjsi from "inner/mjs";
+import * as typei from "inner";
+cjsi;
+mjsi;
+typei;
+// @filename: index.cts
+// cjs format file
+import * as cjs from "package/cjs";
+import * as mjs from "package/mjs";
+import * as type from "package";
+cjs;
+mjs;
+type;
+import * as cjsi from "inner/cjs";
+import * as mjsi from "inner/mjs";
+import * as typei from "inner";
+cjsi;
+mjsi;
+typei;
+// @filename: node_modules/inner/index.d.ts
+// cjs format file
+import * as cjs from "inner/cjs";
+import * as mjs from "inner/mjs";
+import * as type from "inner";
+export { cjs };
+export { mjs };
+export { type };
+// @filename: node_modules/inner/index.d.mts
+// esm format file
+import * as cjs from "inner/cjs";
+import * as mjs from "inner/mjs";
+import * as type from "inner";
+export { cjs };
+export { mjs };
+export { type };
+// @filename: node_modules/inner/index.d.cts
+// cjs format file
+import * as cjs from "inner/cjs";
+import * as mjs from "inner/mjs";
+import * as type from "inner";
+export { cjs };
+export { mjs };
+export { type };
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module",
+ "exports": {
+ "./cjs": "./index.cjs",
+ "./mjs": "./index.mjs",
+ ".": "./index.js"
+ }
+}
+// @filename: node_modules/inner/package.json
+{
+ "name": "inner",
+ "private": true,
+ "exports": {
+ "./cjs": "./index.cjs",
+ "./mjs": "./index.mjs",
+ ".": "./index.js"
+ }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/nodeModulesPackageImports.ts b/tests/cases/conformance/node/nodeModulesPackageImports.ts
new file mode 100644
index 0000000000..cccf930098
--- /dev/null
+++ b/tests/cases/conformance/node/nodeModulesPackageImports.ts
@@ -0,0 +1,38 @@
+// @module: node12,nodenext
+// @declaration: true
+// @filename: index.ts
+// esm format file
+import * as cjs from "#cjs";
+import * as mjs from "#mjs";
+import * as type from "#type";
+cjs;
+mjs;
+type;
+// @filename: index.mts
+// esm format file
+import * as cjs from "#cjs";
+import * as mjs from "#mjs";
+import * as type from "#type";
+cjs;
+mjs;
+type;
+// @filename: index.cts
+// esm format file
+import * as cjs from "#cjs";
+import * as mjs from "#mjs";
+import * as type from "#type";
+cjs;
+mjs;
+type;
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module",
+ "exports": "./index.js",
+ "imports": {
+ "#cjs": "./index.cjs",
+ "#mjs": "./index.mjs",
+ "#type": "./index.js"
+ }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/nodeModulesPackagePatternExports.ts b/tests/cases/conformance/node/nodeModulesPackagePatternExports.ts
new file mode 100644
index 0000000000..e22e497a94
--- /dev/null
+++ b/tests/cases/conformance/node/nodeModulesPackagePatternExports.ts
@@ -0,0 +1,67 @@
+// @module: node12,nodenext
+// @declaration: true
+// @outDir: out
+// @filename: index.ts
+// esm format file
+import * as cjsi from "inner/cjs/index";
+import * as mjsi from "inner/mjs/index";
+import * as typei from "inner/js/index";
+cjsi;
+mjsi;
+typei;
+// @filename: index.mts
+// esm format file
+import * as cjsi from "inner/cjs/index";
+import * as mjsi from "inner/mjs/index";
+import * as typei from "inner/js/index";
+cjsi;
+mjsi;
+typei;
+// @filename: index.cts
+// cjs format file
+import * as cjsi from "inner/cjs/index";
+import * as mjsi from "inner/mjs/index";
+import * as typei from "inner/js/index";
+cjsi;
+mjsi;
+typei;
+// @filename: node_modules/inner/index.d.ts
+// cjs format file
+import * as cjs from "inner/cjs/index";
+import * as mjs from "inner/mjs/index";
+import * as type from "inner/js/index";
+export { cjs };
+export { mjs };
+export { type };
+// @filename: node_modules/inner/index.d.mts
+// esm format file
+import * as cjs from "inner/cjs/index";
+import * as mjs from "inner/mjs/index";
+import * as type from "inner/js/index";
+export { cjs };
+export { mjs };
+export { type };
+// @filename: node_modules/inner/index.d.cts
+// cjs format file
+import * as cjs from "inner/cjs/index";
+import * as mjs from "inner/mjs/index";
+import * as type from "inner/js/index";
+export { cjs };
+export { mjs };
+export { type };
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module",
+}
+// @filename: node_modules/inner/package.json
+{
+ "name": "inner",
+ "private": true,
+ "exports": {
+ "./cjs/*": "./*.cjs",
+ "./mjs/*": "./*.mjs",
+ "./js/*": "./*.js"
+ }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/nodeModulesPackagePatternExportsTrailers.ts b/tests/cases/conformance/node/nodeModulesPackagePatternExportsTrailers.ts
new file mode 100644
index 0000000000..3abe36e0d6
--- /dev/null
+++ b/tests/cases/conformance/node/nodeModulesPackagePatternExportsTrailers.ts
@@ -0,0 +1,67 @@
+// @module: node12,nodenext
+// @declaration: true
+// @outDir: out
+// @filename: index.ts
+// esm format file
+import * as cjsi from "inner/cjs/index.cjs";
+import * as mjsi from "inner/mjs/index.mjs";
+import * as typei from "inner/js/index.js";
+cjsi;
+mjsi;
+typei;
+// @filename: index.mts
+// esm format file
+import * as cjsi from "inner/cjs/index.cjs";
+import * as mjsi from "inner/mjs/index.mjs";
+import * as typei from "inner/js/index.js";
+cjsi;
+mjsi;
+typei;
+// @filename: index.cts
+// cjs format file
+import * as cjsi from "inner/cjs/index.cjs";
+import * as mjsi from "inner/mjs/index.mjs";
+import * as typei from "inner/js/index.js";
+cjsi;
+mjsi;
+typei;
+// @filename: node_modules/inner/index.d.ts
+// cjs format file
+import * as cjs from "inner/cjs/index.cjs";
+import * as mjs from "inner/mjs/index.mjs";
+import * as type from "inner/js/index.js";
+export { cjs };
+export { mjs };
+export { type };
+// @filename: node_modules/inner/index.d.mts
+// esm format file
+import * as cjs from "inner/cjs/index.cjs";
+import * as mjs from "inner/mjs/index.mjs";
+import * as type from "inner/js/index.js";
+export { cjs };
+export { mjs };
+export { type };
+// @filename: node_modules/inner/index.d.cts
+// cjs format file
+import * as cjs from "inner/cjs/index.cjs";
+import * as mjs from "inner/mjs/index.mjs";
+import * as type from "inner/js/index.js";
+export { cjs };
+export { mjs };
+export { type };
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module",
+}
+// @filename: node_modules/inner/package.json
+{
+ "name": "inner",
+ "private": true,
+ "exports": {
+ "./cjs/*.cjs": "./*.cjs",
+ "./mjs/*.mjs": "./*.mjs",
+ "./js/*.js": "./*.js"
+ }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/nodeModulesResolveJsonModule.ts b/tests/cases/conformance/node/nodeModulesResolveJsonModule.ts
new file mode 100644
index 0000000000..c298685c22
--- /dev/null
+++ b/tests/cases/conformance/node/nodeModulesResolveJsonModule.ts
@@ -0,0 +1,29 @@
+// @module: node12,nodenext
+// @resolveJsonModule: true
+// @outDir: ./out
+// @declaration: true
+// @filename: index.ts
+import pkg from "./package.json"
+export const name = pkg.name;
+import * as ns from "./package.json";
+export const thing = ns;
+export const name2 = ns.default.name;
+// @filename: index.cts
+import pkg from "./package.json"
+export const name = pkg.name;
+import * as ns from "./package.json";
+export const thing = ns;
+export const name2 = ns.default.name;
+// @filename: index.mts
+import pkg from "./package.json"
+export const name = pkg.name;
+import * as ns from "./package.json";
+export const thing = ns;
+export const name2 = ns.default.name;
+// @filename: package.json
+{
+ "name": "pkg",
+ "version": "0.0.1",
+ "type": "module",
+ "default": "misedirection"
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/nodeModulesSynchronousCallErrors.ts b/tests/cases/conformance/node/nodeModulesSynchronousCallErrors.ts
new file mode 100644
index 0000000000..78aa93ee17
--- /dev/null
+++ b/tests/cases/conformance/node/nodeModulesSynchronousCallErrors.ts
@@ -0,0 +1,34 @@
+// @module: node12,nodenext
+// @declaration: true
+// @filename: subfolder/index.ts
+// cjs format file
+import {h} from "../index.js";
+import mod = require("../index.js");
+import {f as _f} from "./index.js";
+import mod2 = require("./index.js");
+export async function f() {
+ const mod3 = await import ("../index.js");
+ const mod4 = await import ("./index.js");
+ h();
+}
+// @filename: index.ts
+// esm format file
+import {h as _h} from "./index.js";
+import mod = require("./index.js");
+import {f} from "./subfolder/index.js";
+import mod2 = require("./subfolder/index.js");
+export async function h() {
+ const mod3 = await import ("./index.js");
+ const mod4 = await import ("./subfolder/index.js");
+ f();
+}
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module"
+}
+// @filename: subfolder/package.json
+{
+ "type": "commonjs"
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/nodeModulesTopLevelAwait.ts b/tests/cases/conformance/node/nodeModulesTopLevelAwait.ts
new file mode 100644
index 0000000000..2fbd5d3b0c
--- /dev/null
+++ b/tests/cases/conformance/node/nodeModulesTopLevelAwait.ts
@@ -0,0 +1,22 @@
+// @module: node12,nodenext
+// @declaration: true
+// @filename: subfolder/index.ts
+// cjs format file
+const x = await 1;
+export {x};
+for await (const y of []) {}
+// @filename: index.ts
+// esm format file
+const x = await 1;
+export {x};
+for await (const y of []) {}
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module"
+}
+// @filename: subfolder/package.json
+{
+ "type": "commonjs"
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/nodeModulesTypesVersionPackageExports.ts b/tests/cases/conformance/node/nodeModulesTypesVersionPackageExports.ts
new file mode 100644
index 0000000000..52cda091b3
--- /dev/null
+++ b/tests/cases/conformance/node/nodeModulesTypesVersionPackageExports.ts
@@ -0,0 +1,53 @@
+// @module: node12,nodenext
+// @declaration: true
+// @outDir: out
+// @filename: index.ts
+// esm format file
+import * as mod from "inner";
+mod.correctVersionApplied;
+
+// @filename: index.mts
+// esm format file
+import * as mod from "inner";
+mod.correctVersionApplied;
+
+// @filename: index.cts
+// cjs format file
+import * as mod from "inner";
+mod.correctVersionApplied;
+
+// @filename: node_modules/inner/index.d.ts
+// cjs format file
+export const noConditionsApplied = true;
+// @filename: node_modules/inner/index.d.mts
+// esm format file
+export const importConditionApplied = true;
+// @filename: node_modules/inner/index.d.cts
+// cjs format file
+export const wrongConditionApplied = true;
+// @filename: node_modules/inner/old-types.d.ts
+export const noVersionApplied = true;
+// @filename: node_modules/inner/new-types.d.ts
+export const correctVersionApplied = true;
+// @filename: node_modules/inner/future-types.d.ts
+export const futureVersionApplied = true;
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module",
+}
+// @filename: node_modules/inner/package.json
+{
+ "name": "inner",
+ "private": true,
+ "exports": {
+ ".": {
+ "types@>=10000": "./future-types.d.ts",
+ "types@>=1": "./new-types.d.ts",
+ "types": "./old-types.d.ts",
+ "import": "./index.mjs",
+ "node": "./index.js"
+ },
+ }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/nodePackageSelfName.ts b/tests/cases/conformance/node/nodePackageSelfName.ts
new file mode 100644
index 0000000000..099d9c424e
--- /dev/null
+++ b/tests/cases/conformance/node/nodePackageSelfName.ts
@@ -0,0 +1,21 @@
+// @module: node12,nodenext
+// @declaration: true
+// @filename: index.ts
+// esm format file
+import * as self from "package";
+self;
+// @filename: index.mts
+// esm format file
+import * as self from "package";
+self;
+// @filename: index.cts
+// esm format file
+import * as self from "package";
+self;
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module",
+ "exports": "./index.js"
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/nodePackageSelfNameScoped.ts b/tests/cases/conformance/node/nodePackageSelfNameScoped.ts
new file mode 100644
index 0000000000..f4ef1e3798
--- /dev/null
+++ b/tests/cases/conformance/node/nodePackageSelfNameScoped.ts
@@ -0,0 +1,21 @@
+// @module: node12,nodenext
+// @declaration: true
+// @filename: index.ts
+// esm format file
+import * as self from "@scope/package";
+self;
+// @filename: index.mts
+// esm format file
+import * as self from "@scope/package";
+self;
+// @filename: index.cts
+// cjs format file
+import * as self from "@scope/package";
+self;
+// @filename: package.json
+{
+ "name": "@scope/package",
+ "private": true,
+ "type": "module",
+ "exports": "./index.js"
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/override/override10.ts b/tests/cases/conformance/override/override10.ts
index 3a8eca1632..31b904811c 100644
--- a/tests/cases/conformance/override/override10.ts
+++ b/tests/cases/conformance/override/override10.ts
@@ -9,4 +9,5 @@ abstract class Base {
abstract class Sub extends Base {
abstract override foo(): number;
bar() { }
-}
\ No newline at end of file
+}
+let aa =new Sub();
\ No newline at end of file
diff --git a/tests/cases/conformance/override/override12.ts b/tests/cases/conformance/override/override12.ts
index 304caf1627..084c248b37 100644
--- a/tests/cases/conformance/override/override12.ts
+++ b/tests/cases/conformance/override/override12.ts
@@ -24,3 +24,4 @@ class B extends A {
override m3(): void {}
}
+let qq13 = new B();
\ No newline at end of file
diff --git a/tests/cases/conformance/override/override15.ts b/tests/cases/conformance/override/override15.ts
new file mode 100644
index 0000000000..882cc7eb97
--- /dev/null
+++ b/tests/cases/conformance/override/override15.ts
@@ -0,0 +1,9 @@
+// @noImplicitOverride: true
+
+class A {
+ doSomething() {}
+}
+
+class B extends A {
+ override doSomethang() {}
+}
diff --git a/tests/cases/conformance/override/override16.ts b/tests/cases/conformance/override/override16.ts
index 4468edfdc4..b869c89311 100644
--- a/tests/cases/conformance/override/override16.ts
+++ b/tests/cases/conformance/override/override16.ts
@@ -8,3 +8,4 @@ class A {
class B extends A {
override foo = "string";
}
+let qq12 = new B();
\ No newline at end of file
diff --git a/tests/cases/conformance/override/override17.ts b/tests/cases/conformance/override/override17.ts
index edabe9816d..a5f92ef955 100644
--- a/tests/cases/conformance/override/override17.ts
+++ b/tests/cases/conformance/override/override17.ts
@@ -25,3 +25,4 @@ class B extends A {
override m3(): void {}
}
+let qq11 = new B();
\ No newline at end of file
diff --git a/tests/cases/conformance/override/override18.ts b/tests/cases/conformance/override/override18.ts
index 2527449e74..6d4d132193 100644
--- a/tests/cases/conformance/override/override18.ts
+++ b/tests/cases/conformance/override/override18.ts
@@ -9,3 +9,4 @@ class A {
class B extends A {
override foo = "string";
}
+let qq7 = new B();
\ No newline at end of file
diff --git a/tests/cases/conformance/override/override19.ts b/tests/cases/conformance/override/override19.ts
new file mode 100644
index 0000000000..63e5cd9994
--- /dev/null
+++ b/tests/cases/conformance/override/override19.ts
@@ -0,0 +1,20 @@
+// @target: esnext
+// @noImplicitOverride: true
+
+type Foo = abstract new(...args: any) => any;
+declare function CreateMixin(Context: C, Base: T): T & {
+ new (...args: any[]): { context: InstanceType }
+}
+class Context {}
+
+class A {
+ doSomething() {}
+}
+
+class B extends CreateMixin(Context, A) {
+ override foo() {} // Remove override
+}
+
+class C extends CreateMixin(Context, A) {
+ override doSomethang() {} // Suggestion 'doSomething'
+}
diff --git a/tests/cases/conformance/override/override20.ts b/tests/cases/conformance/override/override20.ts
new file mode 100644
index 0000000000..9835cd9135
--- /dev/null
+++ b/tests/cases/conformance/override/override20.ts
@@ -0,0 +1,34 @@
+// @target: esnext
+// @noImplicitOverride: true
+
+const Foo: C1 & C2 =
+ class {
+ m1() { }
+ m2() { }
+ }
+
+interface I1 {
+ m1(): void;
+}
+
+interface I2 {
+ m1(): void;
+ m2(): void;
+}
+
+interface C1 {
+ new(...args: any[]): I1;
+}
+
+interface C2 {
+ new(...args: any[]): I2;
+}
+
+export class Bar extends Foo {
+ m1() {
+ super.m1();
+ }
+ m2() {
+ super.m2();
+ }
+}
diff --git a/tests/cases/conformance/override/override_js1.ts b/tests/cases/conformance/override/override_js1.ts
index 75df72695e..d327d1dbcf 100644
--- a/tests/cases/conformance/override/override_js1.ts
+++ b/tests/cases/conformance/override/override_js1.ts
@@ -22,4 +22,6 @@ class C {
fooo (v) {}
/** @override */
bar(v) {}
-}
\ No newline at end of file
+}
+let qq8 = new D();
+let qq9 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/override/override_js4.ts b/tests/cases/conformance/override/override_js4.ts
new file mode 100644
index 0000000000..f5a7f1b6c4
--- /dev/null
+++ b/tests/cases/conformance/override/override_js4.ts
@@ -0,0 +1,14 @@
+// @noImplicitOverride: true
+// @allowJs: true
+// @checkJs: true
+// @noEmit: true
+
+// @Filename: a.js
+class A {
+ doSomething() {}
+}
+
+class B extends A {
+ /** @override */
+ doSomethang() {}
+}
diff --git a/tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration16.ts b/tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration16.ts
index b345892ec2..39a09037ca 100644
--- a/tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration16.ts
+++ b/tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration16.ts
@@ -1,4 +1,5 @@
class C {
foo();
foo() { }
-}
\ No newline at end of file
+}
+let q19 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration17.ts b/tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration17.ts
index a709f7d7bc..08f7560759 100644
--- a/tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration17.ts
+++ b/tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration17.ts
@@ -5,3 +5,4 @@ declare class Enumerator {
public item(): any;
constructor (o: any);
}
+let q22 = new Enumerator();
\ No newline at end of file
diff --git a/tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration19.ts b/tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration19.ts
index 65d9bd0a57..5ed5520812 100644
--- a/tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration19.ts
+++ b/tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration19.ts
@@ -1,4 +1,5 @@
class C {
foo();
"foo"() { }
-}
\ No newline at end of file
+}
+let q18 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration20.ts b/tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration20.ts
index 6c8540e833..a2025ab46f 100644
--- a/tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration20.ts
+++ b/tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration20.ts
@@ -1,4 +1,5 @@
class C {
0();
"0"() { }
-}
\ No newline at end of file
+}
+let q23 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration23.ts b/tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration23.ts
index 5720f935a6..7ff1604575 100644
--- a/tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration23.ts
+++ b/tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration23.ts
@@ -1,2 +1,3 @@
class C\u0032 {
-}
\ No newline at end of file
+}
+let q17 = new C\u0032();
\ No newline at end of file
diff --git a/tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration26.ts b/tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration26.ts
index 4d5395733a..fbefb55710 100644
--- a/tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration26.ts
+++ b/tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration26.ts
@@ -1,4 +1,5 @@
class C {
var
public
-}
\ No newline at end of file
+}
+let q20 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclarationIndexSignature1.ts b/tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclarationIndexSignature1.ts
index b99c0c6f48..bae31847e0 100644
--- a/tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclarationIndexSignature1.ts
+++ b/tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclarationIndexSignature1.ts
@@ -1,3 +1,4 @@
class C {
[index:number]:number
-}
\ No newline at end of file
+}
+let q21 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/parser/ecmascript5/ConstructorDeclarations/parserConstructorDeclaration1.ts b/tests/cases/conformance/parser/ecmascript5/ConstructorDeclarations/parserConstructorDeclaration1.ts
index b845118647..024f143cad 100644
--- a/tests/cases/conformance/parser/ecmascript5/ConstructorDeclarations/parserConstructorDeclaration1.ts
+++ b/tests/cases/conformance/parser/ecmascript5/ConstructorDeclarations/parserConstructorDeclaration1.ts
@@ -1,3 +1,4 @@
class C {
public constructor() { }
-}
\ No newline at end of file
+}
+let q24 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/parser/ecmascript5/ConstructorDeclarations/parserConstructorDeclaration5.ts b/tests/cases/conformance/parser/ecmascript5/ConstructorDeclarations/parserConstructorDeclaration5.ts
index f445d70c88..7305a4098d 100644
--- a/tests/cases/conformance/parser/ecmascript5/ConstructorDeclarations/parserConstructorDeclaration5.ts
+++ b/tests/cases/conformance/parser/ecmascript5/ConstructorDeclarations/parserConstructorDeclaration5.ts
@@ -1,3 +1,4 @@
class C {
private constructor() { }
-}
\ No newline at end of file
+}
+let q25 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/parser/ecmascript5/ErrorRecovery/AccessibilityAfterStatic/parserAccessibilityAfterStatic11.ts b/tests/cases/conformance/parser/ecmascript5/ErrorRecovery/AccessibilityAfterStatic/parserAccessibilityAfterStatic11.ts
index 5ebd8f13ae..bd99e7cfb1 100644
--- a/tests/cases/conformance/parser/ecmascript5/ErrorRecovery/AccessibilityAfterStatic/parserAccessibilityAfterStatic11.ts
+++ b/tests/cases/conformance/parser/ecmascript5/ErrorRecovery/AccessibilityAfterStatic/parserAccessibilityAfterStatic11.ts
@@ -2,3 +2,4 @@ class Outer
{
static public() {}
}
+let q12 = new Outer();
\ No newline at end of file
diff --git a/tests/cases/conformance/parser/ecmascript5/ErrorRecovery/AccessibilityAfterStatic/parserAccessibilityAfterStatic14.ts b/tests/cases/conformance/parser/ecmascript5/ErrorRecovery/AccessibilityAfterStatic/parserAccessibilityAfterStatic14.ts
index 23fb870f86..474e281b08 100644
--- a/tests/cases/conformance/parser/ecmascript5/ErrorRecovery/AccessibilityAfterStatic/parserAccessibilityAfterStatic14.ts
+++ b/tests/cases/conformance/parser/ecmascript5/ErrorRecovery/AccessibilityAfterStatic/parserAccessibilityAfterStatic14.ts
@@ -2,3 +2,4 @@ class Outer
{
static public() {}
}
+let q14 = new Outer();
\ No newline at end of file
diff --git a/tests/cases/conformance/parser/ecmascript5/ErrorRecovery/AccessibilityAfterStatic/parserAccessibilityAfterStatic2.ts b/tests/cases/conformance/parser/ecmascript5/ErrorRecovery/AccessibilityAfterStatic/parserAccessibilityAfterStatic2.ts
index 30045cf9f0..dfc01652e7 100644
--- a/tests/cases/conformance/parser/ecmascript5/ErrorRecovery/AccessibilityAfterStatic/parserAccessibilityAfterStatic2.ts
+++ b/tests/cases/conformance/parser/ecmascript5/ErrorRecovery/AccessibilityAfterStatic/parserAccessibilityAfterStatic2.ts
@@ -2,3 +2,4 @@ class Outer
{
static public;
}
+let q11 = new Outer();
\ No newline at end of file
diff --git a/tests/cases/conformance/parser/ecmascript5/ErrorRecovery/AccessibilityAfterStatic/parserAccessibilityAfterStatic3.ts b/tests/cases/conformance/parser/ecmascript5/ErrorRecovery/AccessibilityAfterStatic/parserAccessibilityAfterStatic3.ts
index c2f462b71a..f38fc7ee97 100644
--- a/tests/cases/conformance/parser/ecmascript5/ErrorRecovery/AccessibilityAfterStatic/parserAccessibilityAfterStatic3.ts
+++ b/tests/cases/conformance/parser/ecmascript5/ErrorRecovery/AccessibilityAfterStatic/parserAccessibilityAfterStatic3.ts
@@ -2,3 +2,4 @@ class Outer
{
static public = 1;
}
+let q9 = new Outer();
\ No newline at end of file
diff --git a/tests/cases/conformance/parser/ecmascript5/ErrorRecovery/AccessibilityAfterStatic/parserAccessibilityAfterStatic4.ts b/tests/cases/conformance/parser/ecmascript5/ErrorRecovery/AccessibilityAfterStatic/parserAccessibilityAfterStatic4.ts
index fe0ed44cf0..41f075c30c 100644
--- a/tests/cases/conformance/parser/ecmascript5/ErrorRecovery/AccessibilityAfterStatic/parserAccessibilityAfterStatic4.ts
+++ b/tests/cases/conformance/parser/ecmascript5/ErrorRecovery/AccessibilityAfterStatic/parserAccessibilityAfterStatic4.ts
@@ -2,3 +2,4 @@ class Outer
{
static public: number;
}
+let q13 = new Outer();
\ No newline at end of file
diff --git a/tests/cases/conformance/parser/ecmascript5/ErrorRecovery/AccessibilityAfterStatic/parserAccessibilityAfterStatic5.ts b/tests/cases/conformance/parser/ecmascript5/ErrorRecovery/AccessibilityAfterStatic/parserAccessibilityAfterStatic5.ts
index 49db39132c..ea9593bb53 100644
--- a/tests/cases/conformance/parser/ecmascript5/ErrorRecovery/AccessibilityAfterStatic/parserAccessibilityAfterStatic5.ts
+++ b/tests/cases/conformance/parser/ecmascript5/ErrorRecovery/AccessibilityAfterStatic/parserAccessibilityAfterStatic5.ts
@@ -2,3 +2,4 @@ class Outer
{
static public
}
+let q0 = new Outer();
\ No newline at end of file
diff --git a/tests/cases/conformance/parser/ecmascript5/Generics/parserGenericClass1.ts b/tests/cases/conformance/parser/ecmascript5/Generics/parserGenericClass1.ts
index 237910839d..a814947c9e 100644
--- a/tests/cases/conformance/parser/ecmascript5/Generics/parserGenericClass1.ts
+++ b/tests/cases/conformance/parser/ecmascript5/Generics/parserGenericClass1.ts
@@ -1,2 +1,3 @@
class C {
-}
\ No newline at end of file
+}
+let q38 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/parser/ecmascript5/Generics/parserGenericClass2.ts b/tests/cases/conformance/parser/ecmascript5/Generics/parserGenericClass2.ts
index 949f220fbd..f4f517c52c 100644
--- a/tests/cases/conformance/parser/ecmascript5/Generics/parserGenericClass2.ts
+++ b/tests/cases/conformance/parser/ecmascript5/Generics/parserGenericClass2.ts
@@ -1,2 +1,3 @@
class C {
-}
\ No newline at end of file
+}
+let q40 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/parser/ecmascript5/Generics/parserGenericConstraint1.ts b/tests/cases/conformance/parser/ecmascript5/Generics/parserGenericConstraint1.ts
index 585fa7dbe1..78a9ffb4db 100644
--- a/tests/cases/conformance/parser/ecmascript5/Generics/parserGenericConstraint1.ts
+++ b/tests/cases/conformance/parser/ecmascript5/Generics/parserGenericConstraint1.ts
@@ -1,2 +1,3 @@
class C {
-}
\ No newline at end of file
+}
+let q39 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration1.ts b/tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration1.ts
index 56ba0579b0..7de740ebab 100644
--- a/tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration1.ts
+++ b/tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration1.ts
@@ -1,3 +1,4 @@
class C {
[a: string]: number
-}
\ No newline at end of file
+}
+let q27 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration2.ts b/tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration2.ts
index 34108a6e71..f0224e9379 100644
--- a/tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration2.ts
+++ b/tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration2.ts
@@ -1,4 +1,5 @@
class C {
[a: string]: number
public v: number
-}
\ No newline at end of file
+}
+let q29 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration3.ts b/tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration3.ts
index f2180413ca..25ea575259 100644
--- a/tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration3.ts
+++ b/tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration3.ts
@@ -1,4 +1,5 @@
class C {
[a: string]: number;
public v: number
-}
\ No newline at end of file
+}
+let q30 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration4.ts b/tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration4.ts
index 498ad89d82..42622da3af 100644
--- a/tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration4.ts
+++ b/tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration4.ts
@@ -1,3 +1,4 @@
class C {
[a: string]: number; public v: number
-}
\ No newline at end of file
+}
+let q28 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration6.ts b/tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration6.ts
index af180f585f..b89c199246 100644
--- a/tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration6.ts
+++ b/tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration6.ts
@@ -1,3 +1,4 @@
class C {
static [x: string]: string;
-}
\ No newline at end of file
+}
+let q26 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/parser/ecmascript5/MemberVariableDeclarations/parserMemberVariableDeclaration5.ts b/tests/cases/conformance/parser/ecmascript5/MemberVariableDeclarations/parserMemberVariableDeclaration5.ts
index 98c4f9a75b..62e5062755 100644
--- a/tests/cases/conformance/parser/ecmascript5/MemberVariableDeclarations/parserMemberVariableDeclaration5.ts
+++ b/tests/cases/conformance/parser/ecmascript5/MemberVariableDeclarations/parserMemberVariableDeclaration5.ts
@@ -1,3 +1,4 @@
class C {
declare Foo;
-}
\ No newline at end of file
+}
+let q8 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/parser/ecmascript5/Protected/Protected3.ts b/tests/cases/conformance/parser/ecmascript5/Protected/Protected3.ts
index 2b07e1ca9a..765e7b650a 100644
--- a/tests/cases/conformance/parser/ecmascript5/Protected/Protected3.ts
+++ b/tests/cases/conformance/parser/ecmascript5/Protected/Protected3.ts
@@ -1,3 +1,4 @@
class C {
protected constructor() { }
-}
\ No newline at end of file
+}
+let q37 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/parser/ecmascript5/Protected/Protected5.ts b/tests/cases/conformance/parser/ecmascript5/Protected/Protected5.ts
index f0bf235a03..c1d4944d1e 100644
--- a/tests/cases/conformance/parser/ecmascript5/Protected/Protected5.ts
+++ b/tests/cases/conformance/parser/ecmascript5/Protected/Protected5.ts
@@ -1,3 +1,4 @@
class C {
protected static m() { }
-}
\ No newline at end of file
+}
+let q34 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/parser/ecmascript5/Protected/Protected9.ts b/tests/cases/conformance/parser/ecmascript5/Protected/Protected9.ts
index 4e24e28ec1..5ce2aa474a 100644
--- a/tests/cases/conformance/parser/ecmascript5/Protected/Protected9.ts
+++ b/tests/cases/conformance/parser/ecmascript5/Protected/Protected9.ts
@@ -1,3 +1,4 @@
class C {
constructor(protected p) { }
-}
\ No newline at end of file
+}
+let q35 = new C(null);
\ No newline at end of file
diff --git a/tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509546.ts b/tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509546.ts
index bfb48ee0e3..29d488ffbc 100644
--- a/tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509546.ts
+++ b/tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509546.ts
@@ -1,3 +1,4 @@
export class Logger {
public
}
+let q32 = new Logger();
\ No newline at end of file
diff --git a/tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509546_1.ts b/tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509546_1.ts
index bfb48ee0e3..18eeed1a6d 100644
--- a/tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509546_1.ts
+++ b/tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509546_1.ts
@@ -1,3 +1,4 @@
export class Logger {
public
}
+let q31 = new Logger();
\ No newline at end of file
diff --git a/tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509546_2.ts b/tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509546_2.ts
index ca1a460120..a4609ba88c 100644
--- a/tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509546_2.ts
+++ b/tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509546_2.ts
@@ -3,3 +3,4 @@
export class Logger {
public
}
+let q23 = new Logger();
\ No newline at end of file
diff --git a/tests/cases/conformance/parser/ecmascript5/parserUnicode3.ts b/tests/cases/conformance/parser/ecmascript5/parserUnicode3.ts
index bb5f00ea71..99802e72b5 100644
--- a/tests/cases/conformance/parser/ecmascript5/parserUnicode3.ts
+++ b/tests/cases/conformance/parser/ecmascript5/parserUnicode3.ts
@@ -1,2 +1,3 @@
class 剩下 {
-}
\ No newline at end of file
+}
+let q5 = new 剩下();
diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement22.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement22.ts
new file mode 100644
index 0000000000..87f569dbfb
--- /dev/null
+++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement22.ts
@@ -0,0 +1,4 @@
+// @target: esnext
+
+var async;
+for (async of [1, 2]) {}
diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement23.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement23.ts
new file mode 100644
index 0000000000..5a3601380b
--- /dev/null
+++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement23.ts
@@ -0,0 +1,6 @@
+// @target: esnext
+
+async function foo(x: any) {
+ var async;
+ for await (async of x) {}
+}
diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement24.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement24.ts
new file mode 100644
index 0000000000..3846bd0a91
--- /dev/null
+++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement24.ts
@@ -0,0 +1,4 @@
+// @target: esnext
+
+var async;
+for ((async) of [1, 2]);
diff --git a/tests/cases/conformance/salsa/inferringClassMembersFromAssignments3.ts b/tests/cases/conformance/salsa/inferringClassMembersFromAssignments3.ts
index 800bd368db..f713920ad5 100644
--- a/tests/cases/conformance/salsa/inferringClassMembersFromAssignments3.ts
+++ b/tests/cases/conformance/salsa/inferringClassMembersFromAssignments3.ts
@@ -14,3 +14,4 @@ class Derived extends Base {
this.p = 1
}
}
+let w1 = new Derived();
\ No newline at end of file
diff --git a/tests/cases/conformance/salsa/plainJSBinderErrors.ts b/tests/cases/conformance/salsa/plainJSBinderErrors.ts
new file mode 100644
index 0000000000..d2019e3f78
--- /dev/null
+++ b/tests/cases/conformance/salsa/plainJSBinderErrors.ts
@@ -0,0 +1,44 @@
+// @outdir: out/
+// @target: esnext
+// @allowJS: true
+// @filename: plainJSBinderErrors.js
+export default 12
+export default 13
+const await = 1
+const yield = 2
+async function f() {
+ const await = 3
+}
+function* g() {
+ const yield = 4
+}
+class C {
+ #constructor = 5
+ deleted() {
+ function container(f) {
+ delete f
+ }
+ var g = 6
+ delete g
+ delete container
+ }
+ evalArguments() {
+ const eval = 7
+ const arguments = 8
+ }
+ withOctal() {
+ const redundant = 010
+ with (redundant) {
+ return toFixed()
+ }
+ }
+ label() {
+ for(;;) {
+ label: var x = 1
+ break label
+ }
+ return x
+ }
+}
+const eval = 9
+const arguments = 10
diff --git a/tests/cases/conformance/salsa/plainJSRedeclare.ts b/tests/cases/conformance/salsa/plainJSRedeclare.ts
new file mode 100644
index 0000000000..be6831d0cd
--- /dev/null
+++ b/tests/cases/conformance/salsa/plainJSRedeclare.ts
@@ -0,0 +1,6 @@
+// @outdir: out/
+// @allowJS: true
+// @filename: plainJSRedeclare.js
+const orbitol = 1
+var orbitol = 1 + false
+orbitol.toExponential()
diff --git a/tests/cases/conformance/salsa/plainJSRedeclare2.ts b/tests/cases/conformance/salsa/plainJSRedeclare2.ts
new file mode 100644
index 0000000000..7409b6c8fe
--- /dev/null
+++ b/tests/cases/conformance/salsa/plainJSRedeclare2.ts
@@ -0,0 +1,7 @@
+// @outdir: out/
+// @allowJS: true
+// @checkJS: true
+// @filename: plainJSRedeclare.js
+const orbitol = 1
+var orbitol = 1 + false
+orbitol.toExponential()
diff --git a/tests/cases/conformance/salsa/plainJSRedeclare3.ts b/tests/cases/conformance/salsa/plainJSRedeclare3.ts
new file mode 100644
index 0000000000..1327fcfc17
--- /dev/null
+++ b/tests/cases/conformance/salsa/plainJSRedeclare3.ts
@@ -0,0 +1,7 @@
+// @outdir: out/
+// @allowJS: true
+// @checkJS: false
+// @filename: plainJSRedeclare.js
+const orbitol = 1
+var orbitol = 1 + false
+orbitol.toExponential()
diff --git a/tests/cases/conformance/salsa/plainJSReservedStrict.ts b/tests/cases/conformance/salsa/plainJSReservedStrict.ts
new file mode 100644
index 0000000000..fbd654927d
--- /dev/null
+++ b/tests/cases/conformance/salsa/plainJSReservedStrict.ts
@@ -0,0 +1,7 @@
+// @outdir: out/
+// @target: esnext
+// @allowJS: true
+// @filename: plainJSReservedStrict.js
+"use strict"
+const eval = 1
+const arguments = 2
diff --git a/tests/cases/conformance/salsa/spellingUncheckedJS.ts b/tests/cases/conformance/salsa/spellingUncheckedJS.ts
new file mode 100644
index 0000000000..d5a1e8ac56
--- /dev/null
+++ b/tests/cases/conformance/salsa/spellingUncheckedJS.ts
@@ -0,0 +1,51 @@
+// @noEmit: true
+// @allowJs: true
+// @filename: spellingUncheckedJS.js
+export var inModule = 1
+inmodule.toFixed()
+
+function f() {
+ var locals = 2 + true
+ locale.toFixed()
+ // @ts-expect-error
+ localf.toExponential()
+ // @ts-expect-error
+ "this is fine"
+}
+class Classe {
+ non = 'oui'
+ methode() {
+ // no error on 'this' references
+ return this.none
+ }
+}
+class Derivee extends Classe {
+ methode() {
+ // no error on 'super' references
+ return super.none
+ }
+}
+
+
+var object = {
+ spaaace: 3
+}
+object.spaaaace // error on read
+object.spaace = 12 // error on write
+object.fresh = 12 // OK
+other.puuuce // OK, from another file
+new Date().getGMTDate() // OK, from another file
+
+// No suggestions for globals from other files
+const atoc = setIntegral(() => console.log('ok'), 500)
+AudioBuffin // etc
+Jimmy
+Jon
+
+// @filename: other.js
+var Jimmy = 1
+var John = 2
+Jon // error, it's from the same file
+var other = {
+ puuce: 4
+}
diff --git a/tests/cases/conformance/salsa/typeFromJSInitializer2.ts b/tests/cases/conformance/salsa/typeFromJSInitializer2.ts
new file mode 100644
index 0000000000..c1d5857624
--- /dev/null
+++ b/tests/cases/conformance/salsa/typeFromJSInitializer2.ts
@@ -0,0 +1,18 @@
+// @allowJs: true
+// @checkJs: true
+// @noEmit: true
+// @strictNullChecks: true
+// @noImplicitAny: true
+// @Filename: a.js
+
+/** @type {() => undefined} */
+function f1() {
+ return undefined;
+}
+const a = f1()
+
+/** @type {() => null} */
+function f2() {
+ return null;
+}
+const b = f2()
diff --git a/tests/cases/conformance/salsa/typeFromJSInitializer3.ts b/tests/cases/conformance/salsa/typeFromJSInitializer3.ts
new file mode 100644
index 0000000000..c5100df43d
--- /dev/null
+++ b/tests/cases/conformance/salsa/typeFromJSInitializer3.ts
@@ -0,0 +1,18 @@
+// @allowJs: true
+// @checkJs: true
+// @noEmit: true
+// @strictNullChecks: false
+// @noImplicitAny: true
+// @Filename: a.js
+
+/** @type {() => undefined} */
+function f1() {
+ return undefined;
+}
+const a = f1()
+
+/** @type {() => null} */
+function f2() {
+ return null;
+}
+const b = f2()
diff --git a/tests/cases/conformance/salsa/typeFromJSInitializer4.ts b/tests/cases/conformance/salsa/typeFromJSInitializer4.ts
new file mode 100644
index 0000000000..02d16c45a2
--- /dev/null
+++ b/tests/cases/conformance/salsa/typeFromJSInitializer4.ts
@@ -0,0 +1,29 @@
+// @allowJs: true
+// @checkJs: true
+// @noEmit: true
+// @strictNullChecks: false
+// @noImplicitAny: true
+// @Filename: a.js
+
+/** @type {number | undefined} */
+var n;
+
+// should get any on parameter initialisers
+function f(a = null, b = n, l = []) {
+ // a should be any
+ a = undefined
+ a = null
+ a = 1
+ a = true
+ a = {}
+ a = 'ok'
+
+ // b should be number | undefined, not any
+ b = 1
+ b = undefined
+ b = 'error'
+
+ // l should be any[]
+ l.push(1)
+ l.push('ok')
+}
diff --git a/tests/cases/conformance/salsa/typeFromPropertyAssignment23.ts b/tests/cases/conformance/salsa/typeFromPropertyAssignment23.ts
index 18923e0a5a..1dafa91c28 100644
--- a/tests/cases/conformance/salsa/typeFromPropertyAssignment23.ts
+++ b/tests/cases/conformance/salsa/typeFromPropertyAssignment23.ts
@@ -35,3 +35,6 @@ class NormalModule extends Module {
return 0
}
}
+let cc = new C();
+let dd = new D();
+let mo = new NormalModule();
\ No newline at end of file
diff --git a/tests/cases/conformance/statements/for-inStatements/for-inStatementsAsyncIdentifier.ts b/tests/cases/conformance/statements/for-inStatements/for-inStatementsAsyncIdentifier.ts
new file mode 100644
index 0000000000..ae63dd3136
--- /dev/null
+++ b/tests/cases/conformance/statements/for-inStatements/for-inStatementsAsyncIdentifier.ts
@@ -0,0 +1,4 @@
+// @target: esnext
+
+var async;
+for (async in { a: 1, b: 2 }) {}
diff --git a/tests/cases/conformance/statements/returnStatements/returnStatements.ts b/tests/cases/conformance/statements/returnStatements/returnStatements.ts
index ce764c1f11..945b98944c 100644
--- a/tests/cases/conformance/statements/returnStatements/returnStatements.ts
+++ b/tests/cases/conformance/statements/returnStatements/returnStatements.ts
@@ -21,3 +21,4 @@ function fn10(): I { return { id: 12 }; }
function fn11(): I { return new C(); }
function fn12(): C { return new D(); }
function fn13(): C { return null; }
+let q41 = new D();
\ No newline at end of file
diff --git a/tests/cases/conformance/statements/throwStatements/throwInEnclosingStatements.ts b/tests/cases/conformance/statements/throwStatements/throwInEnclosingStatements.ts
index c5875327b5..313b2b7169 100644
--- a/tests/cases/conformance/statements/throwStatements/throwInEnclosingStatements.ts
+++ b/tests/cases/conformance/statements/throwStatements/throwInEnclosingStatements.ts
@@ -45,3 +45,4 @@ var aa = {
throw this;
}
}
+let q42 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/any/anyAsGenericFunctionCall.ts b/tests/cases/conformance/types/any/anyAsGenericFunctionCall.ts
index 9529b5b9a3..7996e18343 100644
--- a/tests/cases/conformance/types/any/anyAsGenericFunctionCall.ts
+++ b/tests/cases/conformance/types/any/anyAsGenericFunctionCall.ts
@@ -7,4 +7,6 @@ var b = x('hello');
class C { foo: string; }
var c = x(x);
-var d = x(x);
\ No newline at end of file
+var d = x(x);
+
+let c1 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/any/assignAnyToEveryType.ts b/tests/cases/conformance/types/any/assignAnyToEveryType.ts
index 0af7d94d7b..aba7eb4753 100644
--- a/tests/cases/conformance/types/any/assignAnyToEveryType.ts
+++ b/tests/cases/conformance/types/any/assignAnyToEveryType.ts
@@ -42,4 +42,6 @@ M = x;
function k(a: T) {
a = x;
-}
\ No newline at end of file
+}
+
+let c1 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/any/assignEveryTypeToAny.ts b/tests/cases/conformance/types/any/assignEveryTypeToAny.ts
index 8613550fc5..0f7f258e87 100644
--- a/tests/cases/conformance/types/any/assignEveryTypeToAny.ts
+++ b/tests/cases/conformance/types/any/assignEveryTypeToAny.ts
@@ -52,4 +52,6 @@ x = { f(x: T) { return x; } }
function j(a: T) {
x = a;
-}
\ No newline at end of file
+}
+
+let c1 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/conditional/variance.ts b/tests/cases/conformance/types/conditional/variance.ts
index 1dd5db5c67..433eab8e01 100644
--- a/tests/cases/conformance/types/conditional/variance.ts
+++ b/tests/cases/conformance/types/conditional/variance.ts
@@ -25,3 +25,5 @@ class Bar {
Bar.instance.push(this);
}
}
+
+let ba = new Bar();
diff --git a/tests/cases/conformance/types/contextualTypes/partiallyAnnotatedFunction/partiallyAnnotatedFunctionInferenceWithTypeParameter.ts b/tests/cases/conformance/types/contextualTypes/partiallyAnnotatedFunction/partiallyAnnotatedFunctionInferenceWithTypeParameter.ts
index 530d506f64..87069a602d 100644
--- a/tests/cases/conformance/types/contextualTypes/partiallyAnnotatedFunction/partiallyAnnotatedFunctionInferenceWithTypeParameter.ts
+++ b/tests/cases/conformance/types/contextualTypes/partiallyAnnotatedFunction/partiallyAnnotatedFunctionInferenceWithTypeParameter.ts
@@ -31,3 +31,6 @@ testRest((t1: D, t2, t3) => {})
testRest((t1, t2: D, t3) => {})
testRest((t2: D, ...t3) => {})
testRest((t2, ...t3: D[]) => {})
+
+
+let d = new D();
diff --git a/tests/cases/conformance/types/import/importTypeAmbient.ts b/tests/cases/conformance/types/import/importTypeAmbient.ts
index b1ba463777..3345c3ac06 100644
--- a/tests/cases/conformance/types/import/importTypeAmbient.ts
+++ b/tests/cases/conformance/types/import/importTypeAmbient.ts
@@ -28,8 +28,8 @@ declare module "foo2" {
item: Bar.I;
constructor(input: Baz.J);
}
+
}
-
let y: import("foo2").Bar.I = { a: "", b: 0 };
class Bar2 {
@@ -40,3 +40,6 @@ class Bar2 {
let shim: typeof import("foo2") = {
Bar: Bar2
};
+
+var a;
+let ba1 = new Bar2(a);
diff --git a/tests/cases/conformance/types/import/importTypeGenericTypes.ts b/tests/cases/conformance/types/import/importTypeGenericTypes.ts
index 5bc3aa7802..cf808fc6e3 100644
--- a/tests/cases/conformance/types/import/importTypeGenericTypes.ts
+++ b/tests/cases/conformance/types/import/importTypeGenericTypes.ts
@@ -29,9 +29,10 @@ class Bar {
item: Bar.I;
constructor(input: Baz.J) {}
}
+let bbb = new Bar(null);
export { Bar }
-// @filename: usage.ts
+// @filename: usage.
export const x: import("./foo")<{x: number}> = { x: 0, y: 0, data: {x: 12} };
export let y: import("./foo2").Bar.I<{x: number}> = { a: "", b: 0, data: {x: 12} };
@@ -43,3 +44,5 @@ export class Bar2 {
export let shim: typeof import("./foo2") = {
Bar: Bar2
};
+
+let ba2 = new Bar2(1);
diff --git a/tests/cases/conformance/types/import/importTypeLocal.ts b/tests/cases/conformance/types/import/importTypeLocal.ts
index 4f29a22285..6fe5ab1c18 100644
--- a/tests/cases/conformance/types/import/importTypeLocal.ts
+++ b/tests/cases/conformance/types/import/importTypeLocal.ts
@@ -26,8 +26,11 @@ class Bar {
item: Bar.I;
constructor(input: Baz.J) {}
}
+let bbb = new Bar(null)
export { Bar }
+
+
// @filename: usage.ts
export const x: import("./foo") = { x: 0, y: 0 };
export let y: import("./foo2").Bar.I = { a: "", b: 0 };
@@ -40,3 +43,5 @@ export class Bar2 {
export let shim: typeof import("./foo2") = {
Bar: Bar2
};
+
+let ba2 = new Bar2();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/intersection/intersectionOfUnionNarrowing.ts b/tests/cases/conformance/types/intersection/intersectionOfUnionNarrowing.ts
new file mode 100644
index 0000000000..0f67b66bff
--- /dev/null
+++ b/tests/cases/conformance/types/intersection/intersectionOfUnionNarrowing.ts
@@ -0,0 +1,16 @@
+// @strict: true
+
+interface X {
+ a?: { aProp: string };
+ b?: { bProp: string };
+}
+type AorB = { a: object; b: undefined } | { a: undefined; b: object };
+
+declare const q: X & AorB;
+
+if (q.a !== undefined) {
+ q.a.aProp;
+} else {
+ // q.b is previously incorrectly inferred as potentially undefined
+ q.b.bProp;
+}
diff --git a/tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts b/tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts
index 56ff157a67..7c7d0b13e0 100644
--- a/tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts
+++ b/tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts
@@ -658,3 +658,23 @@ const cf2 = (t: T,
const s: string = t[k];
t.cool;
};
+
+let shape = new Shape();
+let ta1 = new TaggedShape();
+let it = new Item();
+let op = new Options();
+let com1 = new Component();
+let c11 = new C();
+let c12 = new C1();
+let ba1 = new Base();
+let per = new Person(1);
+let oth = new OtherPerson(1);
+var aa;
+let com2 = new Component1(aa);
+let com3 = new Component2(aa);
+let a11 = new A();
+let b11 = new B();
+let fo = new Form();
+let sam = new SampleClass(1);
+let ano = new AnotherSampleClass(1);
+let unb = new Unbounded();
diff --git a/tests/cases/conformance/types/literal/literalTypes2.ts b/tests/cases/conformance/types/literal/literalTypes2.ts
index 57e7a0bc74..46b1479857 100644
--- a/tests/cases/conformance/types/literal/literalTypes2.ts
+++ b/tests/cases/conformance/types/literal/literalTypes2.ts
@@ -176,3 +176,6 @@ type Bit = 0 | 1;
let aa = makeArray(0);
aa = append(aa, 1);
+
+let c1 = new C1();
+let c2 = new C2();
diff --git a/tests/cases/conformance/types/localTypes/localTypes2.ts b/tests/cases/conformance/types/localTypes/localTypes2.ts
index 79f1402c70..2b81f903ac 100644
--- a/tests/cases/conformance/types/localTypes/localTypes2.ts
+++ b/tests/cases/conformance/types/localTypes/localTypes2.ts
@@ -3,6 +3,7 @@ function f1() {
class C {
constructor(public x: number, public y: number) { }
}
+ let c = new C(1,2);
return C;
}
let C = f();
@@ -17,6 +18,7 @@ function f2() {
public x = x;
constructor(public y: number) { }
}
+ let c = new C(1);
return C;
}
let C = f(10);
@@ -31,6 +33,7 @@ function f3() {
public x = x;
public y = y;
}
+ let c = new C();
return C;
}
let C = f(10, 20);
diff --git a/tests/cases/conformance/types/localTypes/localTypes3.ts b/tests/cases/conformance/types/localTypes/localTypes3.ts
index 5eb3cf2850..7b1e536270 100644
--- a/tests/cases/conformance/types/localTypes/localTypes3.ts
+++ b/tests/cases/conformance/types/localTypes/localTypes3.ts
@@ -3,6 +3,7 @@ function f1() {
class C {
constructor(public x: X, public y: Y) { }
}
+ let c = new C(1,2);
return C;
}
let C = f();
@@ -17,6 +18,7 @@ function f2() {
public x = x;
constructor(public y: Y) { }
}
+ let c = new C(1);
return C;
}
let C = f(10);
@@ -31,6 +33,7 @@ function f3() {
public x = x;
public y = y;
}
+ let c = new C();
return C;
}
let C = f(10, "hello");
diff --git a/tests/cases/conformance/types/mapped/mappedTypeAsClauseRelationships.ts b/tests/cases/conformance/types/mapped/mappedTypeAsClauseRelationships.ts
new file mode 100644
index 0000000000..051192159e
--- /dev/null
+++ b/tests/cases/conformance/types/mapped/mappedTypeAsClauseRelationships.ts
@@ -0,0 +1,27 @@
+// From original issue #45212:
+type Methods = { [P in keyof T as T[P] extends Function ? P : never]: T[P] };
+type H = T[keyof Methods]; // Ok
+
+// `Filter` only filters out some keys of `T`.
+type Filter = { [P in keyof T as T[P] extends Function ? P : never]: T[P] };
+// `Modify` might modify some keys of `T`.
+type Modify = { [P in keyof T as P extends string? `bool${P}`: P]: T[P] };
+
+function fun(val: T) {
+ let x: Filter = val; // Ok
+ let y: Modify = val; // Error
+}
+
+type FilterInclOpt = { [P in keyof T as T[P] extends Function ? P : never]+?: T[P] };
+type ModifyInclOpt = { [P in keyof T as P extends string? `bool${P}`: never ]+?: T[P] };
+type FilterExclOpt = { [P in keyof T as T[P] extends Function ? P : never]-?: T[P] };
+type ModifyExclOpt = { [P in keyof T as P extends string? `bool${P}`: never ]-?: T[P] };
+
+function fun2(val: T) {
+ let x: FilterInclOpt = val; // Ok
+ let y: ModifyInclOpt = val; // Ok
+ let z: FilterExclOpt = val; // Error
+ let w: ModifyExclOpt = val; // Error
+}
+
+
diff --git a/tests/cases/conformance/types/mapped/mappedTypeProperties.ts b/tests/cases/conformance/types/mapped/mappedTypeProperties.ts
new file mode 100644
index 0000000000..407e0eaf56
--- /dev/null
+++ b/tests/cases/conformance/types/mapped/mappedTypeProperties.ts
@@ -0,0 +1,42 @@
+// @declaration: true
+export type PlaceType = 'openSky' | 'roofed' | 'garage'
+type Before = {
+ model: 'hour' | 'day';
+ [placeType in PlaceType]: void;
+}
+
+type After = {
+ [placeType in PlaceType]: void;
+ model: 'hour' | 'day'
+}
+
+type AfterQuestion = {
+ [placeType in PlaceType]?: void;
+ model: 'hour' | 'day';
+}
+type AfterMethod = {
+ [placeType in PlaceType]?: void;
+ model(duration: number): 'hour' | 'day';
+}
+
+type AfterImplicit = {
+ [placeType in PlaceType]
+ model: 'hour' | 'day';
+}
+type AfterImplicitQ = {
+ [placeType in PlaceType]?
+ model: 'hour' | 'day'
+}
+
+interface I {
+ [P in PlaceType]: any
+}
+class C {
+ [P in PlaceType]: any
+}
+const D = class {
+ [P in PlaceType]: any
+}
+const E = class {
+ [P in 'a' | 'b']: any
+}
diff --git a/tests/cases/conformance/types/mapped/mappedTypes3.ts b/tests/cases/conformance/types/mapped/mappedTypes3.ts
index bf5a4399b0..6ef1918898 100644
--- a/tests/cases/conformance/types/mapped/mappedTypes3.ts
+++ b/tests/cases/conformance/types/mapped/mappedTypes3.ts
@@ -37,4 +37,6 @@ function f3(bb: BoxifiedBacon) {
let b = unboxify(bb); // Explicit type parameter required
let bool = b.isPerfect;
let weight = bb.weight;
-}
\ No newline at end of file
+}
+
+let box = new Box();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/mapped/mappedTypesAndObjects.ts b/tests/cases/conformance/types/mapped/mappedTypesAndObjects.ts
index b3530b4696..66e25c6091 100644
--- a/tests/cases/conformance/types/mapped/mappedTypesAndObjects.ts
+++ b/tests/cases/conformance/types/mapped/mappedTypesAndObjects.ts
@@ -43,3 +43,5 @@ interface E3 extends Base {
class Form {
private values: {[P in keyof T]?: T[P]} = {}
}
+
+let f = new Form();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/members/classWithProtectedProperty.ts b/tests/cases/conformance/types/members/classWithProtectedProperty.ts
index 96bc615c02..a37828eef1 100644
--- a/tests/cases/conformance/types/members/classWithProtectedProperty.ts
+++ b/tests/cases/conformance/types/members/classWithProtectedProperty.ts
@@ -24,4 +24,6 @@ class D extends C {
var r7: string = C.f();
var r8: string = C.g();
}
-}
\ No newline at end of file
+}
+
+let d = new D();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/members/indexSignatures1.ts b/tests/cases/conformance/types/members/indexSignatures1.ts
new file mode 100644
index 0000000000..f888275683
--- /dev/null
+++ b/tests/cases/conformance/types/members/indexSignatures1.ts
@@ -0,0 +1,325 @@
+// @strict: true
+// @declaration: true
+// @target: esnext
+
+// Symbol index signature checking
+
+const sym = Symbol();
+
+function gg3(x: { [key: string]: string }, y: { [key: symbol]: string }, z: { [sym]: number }) {
+ x = z;
+ y = z; // Error
+}
+
+// Overlapping index signatures
+
+function gg1(x: { [key: `a${string}`]: string, [key: `${string}a`]: string }, y: { [key: `a${string}a`]: string }) {
+ x = y;
+ y = x;
+}
+
+interface IX { [key: `a${string}`]: string, [key: `${string}a`]: string }
+interface IY { [key: `a${string}a`]: string }
+
+function gg2(x: IX, y: IY) {
+ x = y; // Error
+ y = x;
+}
+
+// Intersection of multiple applicable index signatures
+
+declare let combo: { [x: `foo-${string}`]: 'a' | 'b' } & { [x: `${string}-bar`]: 'b' | 'c' };
+const x1 = combo['foo-test']; // 'a' | 'b'
+const x2 = combo['test-bar']; // 'b' | 'c'
+const x3 = combo['foo-test-bar']; // 'b' (('a' | 'b') & ('b' | 'c'))
+
+declare var str: string;
+
+const x4 = combo[`foo-${str}`];
+const x5 = combo[`${str}-bar`];
+const x6 = combo[`foo-${str}-bar`];
+
+declare let combo2: { [x: `${string}xxx${string}` & `${string}yyy${string}`]: string };
+
+const x7 = combo2['axxxbyyyc'];
+const x8 = combo2['ayyyxxxbc'];
+const x9 = combo2['axxxbbbyc']; // Error
+
+// Property access on template pattern index signature
+
+declare let dom: { [x: `data${string}`]: string };
+const y1 = dom['data123'];
+const y2 = dom.data123;
+
+// Excess property checking for template pattern index signature
+
+dom = { data123: 'hello' };
+dom = { date123: 'hello' }; // Error
+
+// Contextual typing by index signature with template literal pattern
+
+type Funcs = {
+ [key: `s${string}`]: (x: string) => void,
+ [key: `n${string}`]: (x: number) => void,
+}
+
+const funcs: Funcs = {
+ sfoo: x => x.length, // x: string
+ nfoo: x => x * 2, // n: number
+}
+
+// Duplicate index signature checking
+
+type Duplicates = {
+ [key: string | number]: any; // Error
+ [key: number | symbol]: any; // Error
+ [key: symbol | `foo${string}`]: any; // Error
+ [key: `foo${string}`]: any; // Error
+}
+
+// Conflicting index signature checking
+
+type Conflicting = {
+ [key: `a${string}`]: 'a';
+ [key: `${string}a`]: 'b';
+ [key: `a${string}a`]: 'c'; // Error
+}
+
+// Invalid index signatures
+
+type Invalid = {
+ [key: 'a' | 'b' | 'c']: string; // Error
+ [key: T | number]: string; // Error
+ [key: Error]: string; // Error
+ [key: T & string]: string; // Error
+}
+
+// Intersections in index signatures
+
+type Tag1 = { __tag1__: void };
+type Tag2 = { __tag2__: void };
+
+type TaggedString1 = string & Tag1;
+type TaggedString2 = string & Tag2;
+
+declare let s0: string;
+declare let s1: TaggedString1;
+declare let s2: TaggedString2;
+declare let s3: TaggedString1 | TaggedString2;
+declare let s4: TaggedString1 & TaggedString2;
+
+interface I1 { [key: TaggedString1]: string }
+interface I2 { [key: TaggedString2]: string }
+interface I3 { [key: TaggedString1 | TaggedString2]: string }
+interface I4 { [key: TaggedString1 & TaggedString2]: string }
+
+declare let i1: I1;
+declare let i2: I2;
+declare let i3: I3;
+declare let i4: I4;
+
+i1[s0]; // Error
+i1[s1];
+i1[s2]; // Error
+i1[s3]; // Error
+i1[s4];
+
+i2[s0]; // Error
+i2[s1]; // Error
+i2[s2];
+i2[s3]; // Error
+i2[s4];
+
+i3[s0]; // Error
+i3[s1];
+i3[s2];
+i3[s3];
+i3[s4];
+
+i4[s0]; // Error
+i4[s1]; // Error
+i4[s2]; // Error
+i4[s3]; // Error
+i4[s4];
+
+i1 = i2; // Error
+i1 = i3;
+i1 = i4; // Error
+
+i2 = i1; // Error
+i2 = i3;
+i2 = i4; // Error
+
+i3 = i1; // Error
+i3 = i2; // Error
+i3 = i4; // Error
+
+i4 = i1;
+i4 = i2;
+i4 = i3;
+
+declare let o1: { [key: TaggedString1]: string };
+declare let o2: { [key: TaggedString2]: string };
+declare let o3: { [key: TaggedString1 | TaggedString2]: string };
+declare let o4: { [key: TaggedString1 & TaggedString2]: string };
+
+o1[s0]; // Error
+o1[s1];
+o1[s2]; // Error
+o1[s3]; // Error
+o1[s4];
+
+o2[s0]; // Error
+o2[s1]; // Error
+o2[s2];
+o2[s3]; // Error
+o2[s4];
+
+o3[s0]; // Error
+o3[s1];
+o3[s2];
+o3[s3];
+o3[s4];
+
+o4[s0]; // Error
+o4[s1]; // Error
+o4[s2]; // Error
+o4[s3]; // Error
+o4[s4];
+
+o1 = o2;
+o1 = o3;
+o1 = o4;
+
+o2 = o1;
+o2 = o3;
+o2 = o4;
+
+o3 = o1;
+o3 = o2;
+o3 = o4;
+
+o4 = o1;
+o4 = o2;
+o4 = o3;
+
+// Index signatures inferred from computed property names
+
+const obj10 = {
+ ['x']: 0 as const,
+ ['a' + 'b']: 1 as const,
+};
+
+const obj11 = {
+ [1]: 2 as const,
+ [1 + 2]: 3 as const,
+};
+
+const obj12 = {
+ [sym]: 4 as const,
+ [Symbol()]: 5 as const,
+};
+
+const obj13 = {
+ ['x']: 0 as const,
+ ['a' + 'b']: 1 as const,
+ [1]: 2 as const,
+ [1 + 2]: 3 as const,
+ [sym]: 4 as const,
+ [Symbol()]: 5 as const,
+};
+
+// Repros from #1863
+
+const system = Symbol('system');
+const SomeSytePlugin = Symbol('SomeSytePlugin');
+
+interface Plugs {
+ [key: symbol]: (...args: any) => unknown;
+}
+
+const plugins = {
+ "user": {} as Plugs,
+ [system]: {} as Plugs
+};
+
+plugins[system][SomeSytePlugin] = () => console.log('awsome');
+plugins[system][SomeSytePlugin]();
+
+var theAnswer: symbol = Symbol('secret');
+var obj = {} as Record;
+obj[theAnswer] = 42;
+
+// Repro from #26470
+
+const directive = Symbol('directive');
+declare function foo(options: { [x in string]: (arg: TArg) => TRet } & { [directive]?: TDir }): void;
+
+let case1 = foo({
+ [directive]: (x: string) => 'str',
+ addOne: (x: number) => x + 1,
+ double: (x: number) => x + x,
+});
+
+let case2 = foo({
+ addOne: (x: number) => x + 1,
+ double: (x: number) => x + x,
+ [directive]: (x: string) => 'str',
+});
+
+let case3 = foo({
+ [directive]: 'str',
+ addOne: (x: number) => x + 1,
+ double: (x: number) => x + x,
+});
+
+// Repros from #42192
+
+type Pseudo = `&:${string}`;
+
+const AmIPseudo1: Pseudo = '&:test';
+const AmIPseudo: Pseudo = '&'; // Error
+
+type PseudoDeclaration = { [key in Pseudo]: string };
+
+const test: PseudoDeclaration = { 'someKey' : 'someValue' }; // Error
+
+type FieldPattern = `/${string}`;
+
+const path1: FieldPattern = '/one';
+const path2: FieldPattern = 'two'; // Error
+
+type PathsObject = { [P in FieldPattern]: object; };
+const pathObject: PathsObject = 123; // Error
+
+type IdType = `${number}-${number}-${number}-${number}`
+const id: IdType = '0000-0000-0000-0001';
+
+type A = Record;
+
+const a: A = { [id]: 'test' }
+
+let aid = a[id];
+
+// Repro from #44793
+
+interface AA {
+ a?: string;
+ b?: number;
+ [key: symbol]: string;
+}
+
+const aa: AA = { [sym]: '123' };
+
+const obj1: { [key: symbol]: string } = { [sym]: 'hello '};
+const obj2: { [key: string]: string } = { [sym]: 'hello '}; // Permitted for backwards compatibility
+const obj3: { [key: number]: string } = { [sym]: 'hello '}; // Error
+
+// Repro from #45772
+
+type Id = string & { __tag: 'id '};
+type Rec1 = { [key: Id]: number };
+type Rec2 = Record;
+
+type K1 = keyof Rec1; // Id
+type K2 = keyof Rec2; // Id
diff --git a/tests/cases/conformance/types/members/objectTypeHidingMembersOfObject.ts b/tests/cases/conformance/types/members/objectTypeHidingMembersOfObject.ts
index 1a7d6f2be4..bc489541ae 100644
--- a/tests/cases/conformance/types/members/objectTypeHidingMembersOfObject.ts
+++ b/tests/cases/conformance/types/members/objectTypeHidingMembersOfObject.ts
@@ -24,4 +24,6 @@ var b: {
valueOf(): void;
}
-var r4: void = b.valueOf();
\ No newline at end of file
+var r4: void = b.valueOf();
+
+let c1 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/members/objectTypePropertyAccess.ts b/tests/cases/conformance/types/members/objectTypePropertyAccess.ts
index a54890fce9..e3c2cca547 100644
--- a/tests/cases/conformance/types/members/objectTypePropertyAccess.ts
+++ b/tests/cases/conformance/types/members/objectTypePropertyAccess.ts
@@ -26,3 +26,5 @@ var r8 = a.toString();
var r9 = a['toString']();
var r10 = a.foo;
var r11 = a['foo'];
+
+let c1 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/members/objectTypeWithNumericProperty.ts b/tests/cases/conformance/types/members/objectTypeWithNumericProperty.ts
index 730ab43ec9..2c1b46b5d1 100644
--- a/tests/cases/conformance/types/members/objectTypeWithNumericProperty.ts
+++ b/tests/cases/conformance/types/members/objectTypeWithNumericProperty.ts
@@ -40,4 +40,6 @@ var b = {
var r1 = b[1];
var r2 = b[1.1];
var r3 = b['1'];
-var r4 = b['1.1'];
\ No newline at end of file
+var r4 = b['1.1'];
+
+let c1 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/members/objectTypeWithStringNamedPropertyOfIllegalCharacters.ts b/tests/cases/conformance/types/members/objectTypeWithStringNamedPropertyOfIllegalCharacters.ts
index 766f56bdd2..d67c011129 100644
--- a/tests/cases/conformance/types/members/objectTypeWithStringNamedPropertyOfIllegalCharacters.ts
+++ b/tests/cases/conformance/types/members/objectTypeWithStringNamedPropertyOfIllegalCharacters.ts
@@ -50,3 +50,5 @@ var r2 = b[" "];
var r3 = b["a b"];
// BUG 817263
var r4 = b["~!@#$%^&*()_+{}|:'<>?\/.,`"];
+
+let c1 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/members/typesWithSpecializedCallSignatures.ts b/tests/cases/conformance/types/members/typesWithSpecializedCallSignatures.ts
index 9eef3476f2..9aea8f6a18 100644
--- a/tests/cases/conformance/types/members/typesWithSpecializedCallSignatures.ts
+++ b/tests/cases/conformance/types/members/typesWithSpecializedCallSignatures.ts
@@ -38,4 +38,7 @@ a = i;
var r1: Derived1 = c.foo('hi');
var r2: Derived2 = c.foo('bye');
-var r3: Base = c.foo('hm');
\ No newline at end of file
+var r3: Base = c.foo('hm');
+
+// let dev1 = new Derived1();
+// let dev2 = new Derived2();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/members/typesWithSpecializedConstructSignatures.ts b/tests/cases/conformance/types/members/typesWithSpecializedConstructSignatures.ts
index 7c84e76f14..522fad55bf 100644
--- a/tests/cases/conformance/types/members/typesWithSpecializedConstructSignatures.ts
+++ b/tests/cases/conformance/types/members/typesWithSpecializedConstructSignatures.ts
@@ -36,4 +36,7 @@ a = i;
var r1 = new C('hi');
var r2: Derived2 = new i('bye');
-var r3: Base = new a('hm');
\ No newline at end of file
+var r3: Base = new a('hm');
+
+let dev1 = new Derived1();
+let dev2 = new Derived2();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/namedTypes/classWithOptionalParameter.ts b/tests/cases/conformance/types/namedTypes/classWithOptionalParameter.ts
index 82e7de4584..97001142ae 100644
--- a/tests/cases/conformance/types/namedTypes/classWithOptionalParameter.ts
+++ b/tests/cases/conformance/types/namedTypes/classWithOptionalParameter.ts
@@ -8,4 +8,7 @@ class C {
class C2 {
x?: T;
f?(x: T) {}
-}
\ No newline at end of file
+}
+
+let c = new C();
+let c2 = new C2();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/namedTypes/optionalMethods.ts b/tests/cases/conformance/types/namedTypes/optionalMethods.ts
index 932521425f..dc7fe5cf4c 100644
--- a/tests/cases/conformance/types/namedTypes/optionalMethods.ts
+++ b/tests/cases/conformance/types/namedTypes/optionalMethods.ts
@@ -56,3 +56,6 @@ class Derived extends Base {
a = 1;
f(): number { return 1; }
}
+
+let ba1 = new Bar();
+let dev = new Derived();
diff --git a/tests/cases/conformance/types/never/neverType.ts b/tests/cases/conformance/types/never/neverType.ts
index d58471d62a..e548194630 100644
--- a/tests/cases/conformance/types/never/neverType.ts
+++ b/tests/cases/conformance/types/never/neverType.ts
@@ -91,3 +91,5 @@ test(() => "hello");
test(() => fail());
test(() => { throw new Error(); })
test(errorCallback);
+
+let c1 = new C();
diff --git a/tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithoutReturnTypeAnnotationInference.ts b/tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithoutReturnTypeAnnotationInference.ts
index 1cc499c7d6..16fe9f1bc5 100644
--- a/tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithoutReturnTypeAnnotationInference.ts
+++ b/tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithoutReturnTypeAnnotationInference.ts
@@ -77,6 +77,7 @@ module M {
export var x = 1;
export class C { foo: string }
}
+let c2 = new M.C();
function foo11() {
return M;
}
@@ -119,4 +120,7 @@ module e1 { export var y = 1; }
function foo15() {
return e1;
}
-var r15 = foo15();
\ No newline at end of file
+var r15 = foo15();
+
+let c = new C();
+let c11 = new c1(1);
diff --git a/tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts b/tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts
index d5ff0c1f56..191117eb92 100644
--- a/tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts
+++ b/tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts
@@ -35,4 +35,6 @@ var b = {
foo(x, x) { },
a: function foo(x: number, x: string) { },
b: (x: T, x: T) => { }
-}
\ No newline at end of file
+}
+
+let c1 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithOptionalParameters.ts b/tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithOptionalParameters.ts
index 34edfba671..d285c45d78 100644
--- a/tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithOptionalParameters.ts
+++ b/tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithOptionalParameters.ts
@@ -52,3 +52,5 @@ b.a(1);
b.a(1, 2);
b.b();
b.b(1);
+
+let c1 = new C();
diff --git a/tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithOptionalParameters2.ts b/tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithOptionalParameters2.ts
index 4f31726f82..bdd01987b0 100644
--- a/tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithOptionalParameters2.ts
+++ b/tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithOptionalParameters2.ts
@@ -56,4 +56,6 @@ a(1);
a(1, 2);
a.foo(1);
a.foo(1, 2);
-a.foo(1, 2, 3);
\ No newline at end of file
+a.foo(1, 2, 3);
+
+let c1 = new C();
diff --git a/tests/cases/conformance/types/objectTypeLiteral/callSignatures/parametersWithNoAnnotationAreAny.ts b/tests/cases/conformance/types/objectTypeLiteral/callSignatures/parametersWithNoAnnotationAreAny.ts
index 432c905765..4c09ab1066 100644
--- a/tests/cases/conformance/types/objectTypeLiteral/callSignatures/parametersWithNoAnnotationAreAny.ts
+++ b/tests/cases/conformance/types/objectTypeLiteral/callSignatures/parametersWithNoAnnotationAreAny.ts
@@ -26,4 +26,6 @@ var b = {
return x;
},
b: (x) => x
-}
\ No newline at end of file
+}
+
+let c1 = new C();
diff --git a/tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.ts b/tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.ts
index 01f33fbd7b..0aeddb657c 100644
--- a/tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.ts
+++ b/tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.ts
@@ -62,3 +62,6 @@ var a3: {
foo(x: 'a');
foo(x: T);
}
+let c1 = new C();
+let c2 = new C2();
+let c3 = new C3();
diff --git a/tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsSubtypeOfNonSpecializedSignature.ts b/tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsSubtypeOfNonSpecializedSignature.ts
index 70735b8edd..06ca07fbe8 100644
--- a/tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsSubtypeOfNonSpecializedSignature.ts
+++ b/tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsSubtypeOfNonSpecializedSignature.ts
@@ -78,3 +78,6 @@ var a3: {
foo(x: 'a');
foo(x: T);
}
+let c1 = new C();
+let c2 = new C2();
+let c3 = new C3();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures.ts b/tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures.ts
index a8bf323850..6ea1c88cfb 100644
--- a/tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures.ts
+++ b/tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures.ts
@@ -23,3 +23,5 @@ var b = {
a: function foo(x: 'hi', y: 'hi') { },
b: (x: 'hi') => { }
}
+
+let c1 = new C();
diff --git a/tests/cases/conformance/types/objectTypeLiteral/callSignatures/typeParameterAsTypeArgument.ts b/tests/cases/conformance/types/objectTypeLiteral/callSignatures/typeParameterAsTypeArgument.ts
index ef33eef5d5..5e87397a9e 100644
--- a/tests/cases/conformance/types/objectTypeLiteral/callSignatures/typeParameterAsTypeArgument.ts
+++ b/tests/cases/conformance/types/objectTypeLiteral/callSignatures/typeParameterAsTypeArgument.ts
@@ -24,4 +24,6 @@ interface I {
//interface I {
// x: C;
-//}
+//}
+
+let c1 = new C();
diff --git a/tests/cases/conformance/types/objectTypeLiteral/constructSignatures/constructSignaturesWithOverloadsThatDifferOnlyByReturnType.ts b/tests/cases/conformance/types/objectTypeLiteral/constructSignatures/constructSignaturesWithOverloadsThatDifferOnlyByReturnType.ts
index 4ac60bd7f7..9a462477de 100644
--- a/tests/cases/conformance/types/objectTypeLiteral/constructSignatures/constructSignaturesWithOverloadsThatDifferOnlyByReturnType.ts
+++ b/tests/cases/conformance/types/objectTypeLiteral/constructSignatures/constructSignaturesWithOverloadsThatDifferOnlyByReturnType.ts
@@ -29,4 +29,7 @@ var a: {
var b: {
new (x: T, y: string): C2;
new (x: T, y: string): C; // error
-}
\ No newline at end of file
+}
+
+let c1 = new C(1);
+let c2 = new C2(1);
\ No newline at end of file
diff --git a/tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexingResults.ts b/tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexingResults.ts
index 3d7b7eba45..4af4aba5a9 100644
--- a/tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexingResults.ts
+++ b/tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexingResults.ts
@@ -53,4 +53,6 @@ var r2b = b2['2'];
var r3 = b2['3'];
var r4 = b2[1];
var r5 = b2[2];
-var r6 = b2[3];
\ No newline at end of file
+var r6 = b2[3];
+
+let c1 = new C();
diff --git a/tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexingResults.ts b/tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexingResults.ts
index f51b8e461e..48ccea819f 100644
--- a/tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexingResults.ts
+++ b/tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexingResults.ts
@@ -32,3 +32,5 @@ var b: { [x: string]: string } = { y: '' }
var r10 = b['y'];
var r11 = b['a'];
var r12 = b[1];
+
+let c1 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/objectTypeLiteral/propertySignatures/propertyNameWithoutTypeAnnotation.ts b/tests/cases/conformance/types/objectTypeLiteral/propertySignatures/propertyNameWithoutTypeAnnotation.ts
index 42f42eb312..ce53505fda 100644
--- a/tests/cases/conformance/types/objectTypeLiteral/propertySignatures/propertyNameWithoutTypeAnnotation.ts
+++ b/tests/cases/conformance/types/objectTypeLiteral/propertySignatures/propertyNameWithoutTypeAnnotation.ts
@@ -18,4 +18,6 @@ var b = {
var r1 = (new C()).foo;
var r2 = (null).foo;
var r3 = a.foo;
-var r4 = b.foo;
\ No newline at end of file
+var r4 = b.foo;
+
+let c1 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/objectTypeLiteral/propertySignatures/propertyNamesOfReservedWords.ts b/tests/cases/conformance/types/objectTypeLiteral/propertySignatures/propertyNamesOfReservedWords.ts
index 6673465381..e8589921f5 100644
--- a/tests/cases/conformance/types/objectTypeLiteral/propertySignatures/propertyNamesOfReservedWords.ts
+++ b/tests/cases/conformance/types/objectTypeLiteral/propertySignatures/propertyNamesOfReservedWords.ts
@@ -273,4 +273,6 @@ enum E {
}
var r7 = E.abstract;
-var r8 = E.as;
\ No newline at end of file
+var r8 = E.as;
+
+let c1 = new C();
diff --git a/tests/cases/conformance/types/objectTypeLiteral/propertySignatures/stringNamedPropertyAccess.ts b/tests/cases/conformance/types/objectTypeLiteral/propertySignatures/stringNamedPropertyAccess.ts
index dbea999036..9c6eea5968 100644
--- a/tests/cases/conformance/types/objectTypeLiteral/propertySignatures/stringNamedPropertyAccess.ts
+++ b/tests/cases/conformance/types/objectTypeLiteral/propertySignatures/stringNamedPropertyAccess.ts
@@ -20,4 +20,6 @@ var r3 = a["a b"];
var b = {
"a b": 1
}
-var r4 = b["a b"];
\ No newline at end of file
+var r4 = b["a b"];
+
+let c1 = new C();
diff --git a/tests/cases/conformance/types/primitives/number/extendNumberInterface.ts b/tests/cases/conformance/types/primitives/number/extendNumberInterface.ts
index 6aa6325ee3..68641deedd 100644
--- a/tests/cases/conformance/types/primitives/number/extendNumberInterface.ts
+++ b/tests/cases/conformance/types/primitives/number/extendNumberInterface.ts
@@ -7,4 +7,4 @@ var x = 1;
var a: string = x.doStuff();
var b: string = x.doOtherStuff('hm');
var c: string = x['doStuff']();
-var d: string = x['doOtherStuff']('hm');
\ No newline at end of file
+var d: string = x['doOtherStuff']('hm');
diff --git a/tests/cases/conformance/types/primitives/undefined/invalidUndefinedValues.ts b/tests/cases/conformance/types/primitives/undefined/invalidUndefinedValues.ts
index 58a5a54386..572d96843f 100644
--- a/tests/cases/conformance/types/primitives/undefined/invalidUndefinedValues.ts
+++ b/tests/cases/conformance/types/primitives/undefined/invalidUndefinedValues.ts
@@ -28,4 +28,6 @@ x = f;
enum E { A }
x = E;
-x = E.A;
\ No newline at end of file
+x = E.A;
+
+let c1 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/primitives/undefined/validUndefinedAssignments.ts b/tests/cases/conformance/types/primitives/undefined/validUndefinedAssignments.ts
index 71ae9f89a1..a1cad7a4a4 100644
--- a/tests/cases/conformance/types/primitives/undefined/validUndefinedAssignments.ts
+++ b/tests/cases/conformance/types/primitives/undefined/validUndefinedAssignments.ts
@@ -20,4 +20,6 @@ var h: { f(): void } = x;
function i(a: T) {
a = x;
-}
\ No newline at end of file
+}
+
+let c1 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/rest/objectRestParameter.ts b/tests/cases/conformance/types/rest/objectRestParameter.ts
index 5b6faeb797..a18f4afc49 100644
--- a/tests/cases/conformance/types/rest/objectRestParameter.ts
+++ b/tests/cases/conformance/types/rest/objectRestParameter.ts
@@ -19,3 +19,4 @@ function foobar({ bar={}, ...opts }: any = {}) {
foobar();
foobar({ baz: 'hello' });
foobar({ bar: { greeting: 'hello' } });
+let t1 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayOfFunctionTypes3.ts b/tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayOfFunctionTypes3.ts
index 9746dd287b..a518d15d97 100644
--- a/tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayOfFunctionTypes3.ts
+++ b/tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayOfFunctionTypes3.ts
@@ -23,4 +23,6 @@ var c2: { (x: number): number; (x: T): any; };
var z2 = [a2, b2, c2];
var r6 = z2[0];
-var r7 = r6(''); // any not string
\ No newline at end of file
+var r7 = r6(''); // any not string
+
+let c11 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/specifyingTypes/typeLiterals/functionLiteralForOverloads2.ts b/tests/cases/conformance/types/specifyingTypes/typeLiterals/functionLiteralForOverloads2.ts
index 4ba6a76000..1d686dcc89 100644
--- a/tests/cases/conformance/types/specifyingTypes/typeLiterals/functionLiteralForOverloads2.ts
+++ b/tests/cases/conformance/types/specifyingTypes/typeLiterals/functionLiteralForOverloads2.ts
@@ -25,4 +25,7 @@ var f2: {
var f3: {
new(x: string): D;
new(x: number): D;
-} = D;
\ No newline at end of file
+} = D;
+
+let c = new C('');
+let d = new D('');
\ No newline at end of file
diff --git a/tests/cases/conformance/types/specifyingTypes/typeQueries/typeQueryOnClass.ts b/tests/cases/conformance/types/specifyingTypes/typeQueries/typeQueryOnClass.ts
index 3e8ee82c74..4dd74a8b9b 100644
--- a/tests/cases/conformance/types/specifyingTypes/typeQueries/typeQueryOnClass.ts
+++ b/tests/cases/conformance/types/specifyingTypes/typeQueries/typeQueryOnClass.ts
@@ -53,4 +53,7 @@ class D {
var d: D;
var r3: typeof D;
-var r4: typeof d;
\ No newline at end of file
+var r4: typeof d;
+
+let c1 = new C(1);
+let d1 = new D(1);
\ No newline at end of file
diff --git a/tests/cases/conformance/types/specifyingTypes/typeQueries/typeQueryWithReservedWords.ts b/tests/cases/conformance/types/specifyingTypes/typeQueries/typeQueryWithReservedWords.ts
index 5fb9d2233f..ce1748f526 100644
--- a/tests/cases/conformance/types/specifyingTypes/typeQueries/typeQueryWithReservedWords.ts
+++ b/tests/cases/conformance/types/specifyingTypes/typeQueries/typeQueryWithReservedWords.ts
@@ -12,3 +12,4 @@ interface IScope {
delete: typeof Controller.prototype.delete; // Should not error
var: typeof Controller.prototype.var; // Should not error
}
+let c2 = new Controller();
diff --git a/tests/cases/conformance/types/specifyingTypes/typeQueries/typeofClass2.ts b/tests/cases/conformance/types/specifyingTypes/typeQueries/typeofClass2.ts
index df1898a543..4dcf244525 100644
--- a/tests/cases/conformance/types/specifyingTypes/typeQueries/typeofClass2.ts
+++ b/tests/cases/conformance/types/specifyingTypes/typeQueries/typeofClass2.ts
@@ -18,4 +18,7 @@ class D extends C {
var d: D;
var r1: typeof D;
-var r2: typeof d;
\ No newline at end of file
+var r2: typeof d;
+
+let c = new C(1);
+let d1 = new D(1);
\ No newline at end of file
diff --git a/tests/cases/conformance/types/specifyingTypes/typeQueries/typeofModuleWithoutExports.ts b/tests/cases/conformance/types/specifyingTypes/typeQueries/typeofModuleWithoutExports.ts
index 878885a8a9..53d74c3b71 100644
--- a/tests/cases/conformance/types/specifyingTypes/typeQueries/typeofModuleWithoutExports.ts
+++ b/tests/cases/conformance/types/specifyingTypes/typeQueries/typeofModuleWithoutExports.ts
@@ -3,6 +3,7 @@ module M {
class C {
foo: number;
}
+ var c = new C();
}
-var r: typeof M;
\ No newline at end of file
+var r: typeof M;
diff --git a/tests/cases/conformance/types/specifyingTypes/typeQueries/typeofThis.ts b/tests/cases/conformance/types/specifyingTypes/typeQueries/typeofThis.ts
new file mode 100644
index 0000000000..420604c550
--- /dev/null
+++ b/tests/cases/conformance/types/specifyingTypes/typeQueries/typeofThis.ts
@@ -0,0 +1,146 @@
+// @noImplicitThis: true
+// @strict: true
+
+class Test {
+ data = {};
+ constructor() {
+ var copy: typeof this.data = {};
+ }
+}
+
+class Test1 {
+ data = { foo: '' };
+ ['this'] = '';
+ constructor() {
+ var copy: typeof this.data = { foo: '' };
+ var foo: typeof this.data.foo = '';
+
+ var self: typeof this = this;
+ self.data;
+
+ var str: typeof this.this = '';
+ }
+}
+
+
+function Test2() {
+ let x: typeof this.no = 1;
+}
+
+function Test3(this: { no: number }) {
+ let x: typeof this.no = 1;
+}
+
+function Test4(this: { no: number } | undefined) {
+ let x: typeof this.no = 1;
+}
+
+class Test5 {
+ no = 1;
+
+ f = () => {
+ // should not capture this.
+ let x: typeof this.no = 1;
+ }
+}
+
+namespace Test6 {
+ export let f = () => {
+ let x: typeof this.no = 1;
+ }
+}
+
+module Test7 {
+ export let f = () => {
+ let x: typeof this.no = 1;
+ }
+}
+
+const Test8 = () => {
+ let x: typeof this.no = 1;
+}
+
+class Test9 {
+ no = 0;
+ this = 0;
+
+ f() {
+ if (this instanceof Test9D1) {
+ const d1: typeof this = this;
+ d1.f1();
+ }
+
+ if (this instanceof Test9D2) {
+ const d2: typeof this = this;
+ d2.f2();
+ }
+ }
+
+ g() {
+ if (this.no === 1) {
+ const no: typeof this.no = this.no;
+ }
+
+ if (this.this === 1) {
+ const no: typeof this.this = this.this;
+ }
+ }
+}
+
+class Test9D1 {
+ f1() {}
+}
+
+class Test9D2 {
+ f2() {}
+}
+
+class Test10 {
+ a?: { b?: string }
+
+ foo() {
+ let a: typeof this.a = undefined as any;
+ if (this.a) {
+ let a: typeof this.a = undefined as any; // should narrow to { b?: string }
+ let b: typeof this.a.b = undefined as any;
+
+ if (this.a.b) {
+ let b: typeof this.a.b = undefined as any; // should narrow to string
+ }
+ }
+ }
+}
+
+class Test11 {
+ this?: { x?: string };
+
+ foo() {
+ const o = this;
+ let bar: typeof o.this = {};
+
+ if (o.this && o.this.x) {
+ let y: string = o.this.x; // should narrow to string
+ }
+ }
+}
+
+class Tests12 {
+ test1() { // OK
+ type Test = typeof this;
+ }
+
+ test2() { // OK
+ for (;;) {}
+ type Test = typeof this;
+ }
+
+ test3() { // expected no compile errors
+ for (const dummy in []) {}
+ type Test = typeof this;
+ }
+
+ test4() { // expected no compile errors
+ for (const dummy of []) {}
+ type Test = typeof this;
+ }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/types/specifyingTypes/typeQueries/typeofThisWithImplicitThis.ts b/tests/cases/conformance/types/specifyingTypes/typeQueries/typeofThisWithImplicitThis.ts
new file mode 100644
index 0000000000..d99cceaa58
--- /dev/null
+++ b/tests/cases/conformance/types/specifyingTypes/typeQueries/typeofThisWithImplicitThis.ts
@@ -0,0 +1,5 @@
+// @noImplicitThis: false
+
+function Test1() {
+ let x: typeof this.no = 1
+}
diff --git a/tests/cases/conformance/types/spread/spreadDuplicate.ts b/tests/cases/conformance/types/spread/spreadDuplicate.ts
new file mode 100644
index 0000000000..f27a2529f0
--- /dev/null
+++ b/tests/cases/conformance/types/spread/spreadDuplicate.ts
@@ -0,0 +1,21 @@
+// @strict: true
+// @declaration: true
+
+// Repro from #44438
+
+declare let a: { a: string };
+declare let b: { a?: string };
+declare let c: { a: string | undefined };
+declare let d: { a?: string | undefined };
+
+declare let t: boolean;
+
+let a1 = { a: 123, ...a }; // string (Error)
+let b1 = { a: 123, ...b }; // string | number
+let c1 = { a: 123, ...c }; // string | undefined (Error)
+let d1 = { a: 123, ...d }; // string | number
+
+let a2 = { a: 123, ...(t ? a : {}) }; // string | number
+let b2 = { a: 123, ...(t ? b : {}) }; // string | number
+let c2 = { a: 123, ...(t ? c : {}) }; // string | number
+let d2 = { a: 123, ...(t ? d : {}) }; // string | number
diff --git a/tests/cases/conformance/types/spread/spreadDuplicateExact.ts b/tests/cases/conformance/types/spread/spreadDuplicateExact.ts
new file mode 100644
index 0000000000..e395af4ce5
--- /dev/null
+++ b/tests/cases/conformance/types/spread/spreadDuplicateExact.ts
@@ -0,0 +1,22 @@
+// @strict: true
+// @exactOptionalPropertyTypes: true
+// @declaration: true
+
+// Repro from #44438
+
+declare let a: { a: string };
+declare let b: { a?: string };
+declare let c: { a: string | undefined };
+declare let d: { a?: string | undefined };
+
+declare let t: boolean;
+
+let a1 = { a: 123, ...a }; // string (Error)
+let b1 = { a: 123, ...b }; // string | number
+let c1 = { a: 123, ...c }; // string | undefined (Error)
+let d1 = { a: 123, ...d }; // string | number | undefined
+
+let a2 = { a: 123, ...(t ? a : {}) }; // string | number
+let b2 = { a: 123, ...(t ? b : {}) }; // string | number
+let c2 = { a: 123, ...(t ? c : {}) }; // string | number | undefined
+let d2 = { a: 123, ...(t ? d : {}) }; // string | number | undefined
diff --git a/tests/cases/conformance/types/spread/spreadUnion4.ts b/tests/cases/conformance/types/spread/spreadUnion4.ts
new file mode 100644
index 0000000000..6a39ac3a3c
--- /dev/null
+++ b/tests/cases/conformance/types/spread/spreadUnion4.ts
@@ -0,0 +1,4 @@
+declare const a: { x: () => void }
+declare const b: { x?: () => void }
+
+const c = { ...a, ...b };
diff --git a/tests/cases/conformance/types/thisType/fluentClasses.ts b/tests/cases/conformance/types/thisType/fluentClasses.ts
index c9e791cb6f..0aad4efe17 100644
--- a/tests/cases/conformance/types/thisType/fluentClasses.ts
+++ b/tests/cases/conformance/types/thisType/fluentClasses.ts
@@ -15,3 +15,5 @@ class C extends B {
}
var c: C;
var z = c.foo().bar().baz(); // Fluent pattern
+let b1 = new B();
+let c1 = new C();
diff --git a/tests/cases/conformance/types/thisType/thisTypeAndConstraints.ts b/tests/cases/conformance/types/thisType/thisTypeAndConstraints.ts
index f46b251c3b..c6091fd7a2 100644
--- a/tests/cases/conformance/types/thisType/thisTypeAndConstraints.ts
+++ b/tests/cases/conformance/types/thisType/thisTypeAndConstraints.ts
@@ -19,3 +19,6 @@ class B {
x = x.self();
}
}
+
+let a = new A();
+let b = new B();
diff --git a/tests/cases/conformance/types/thisType/thisTypeInClasses.ts b/tests/cases/conformance/types/thisType/thisTypeInClasses.ts
index 6c650341fb..0d3913de7e 100644
--- a/tests/cases/conformance/types/thisType/thisTypeInClasses.ts
+++ b/tests/cases/conformance/types/thisType/thisTypeInClasses.ts
@@ -47,3 +47,9 @@ class C5 {
let x2 = undefined as this;
}
}
+
+let c1 = new C1();
+let c2 = new C2();
+let c3 = new C3();
+let c4 = new C4();
+let c5 = new C5();
diff --git a/tests/cases/conformance/types/thisType/thisTypeInFunctions3.ts b/tests/cases/conformance/types/thisType/thisTypeInFunctions3.ts
index 01d7fd0430..8fe03ac945 100644
--- a/tests/cases/conformance/types/thisType/thisTypeInFunctions3.ts
+++ b/tests/cases/conformance/types/thisType/thisTypeInFunctions3.ts
@@ -7,3 +7,6 @@ class Test extends Base {
this.check(this);
}
}
+
+let te = new Test();
+
diff --git a/tests/cases/conformance/types/thisType/thisTypeInTaggedTemplateCall.ts b/tests/cases/conformance/types/thisType/thisTypeInTaggedTemplateCall.ts
new file mode 100644
index 0000000000..c46933329b
--- /dev/null
+++ b/tests/cases/conformance/types/thisType/thisTypeInTaggedTemplateCall.ts
@@ -0,0 +1,10 @@
+// @target: esnext
+
+class Foo {
+ static m(this: new () => T, strings: TemplateStringsArray | string) {
+ return new this()
+ }
+}
+
+Foo.m`test`;
+(Foo.m)`test`;
diff --git a/tests/cases/conformance/types/tuple/readonlyArraysAndTuples2.ts b/tests/cases/conformance/types/tuple/readonlyArraysAndTuples2.ts
index 0f58f1971d..e03bc2a0c6 100644
--- a/tests/cases/conformance/types/tuple/readonlyArraysAndTuples2.ts
+++ b/tests/cases/conformance/types/tuple/readonlyArraysAndTuples2.ts
@@ -21,3 +21,5 @@ class A {
@someDec
k: readonly [string, number] = ['foo', 42];
}
+
+let a = new A();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeAliases/circularTypeAliasForUnionWithClass.ts b/tests/cases/conformance/types/typeAliases/circularTypeAliasForUnionWithClass.ts
index e7cca719f4..05fd3be85e 100644
--- a/tests/cases/conformance/types/typeAliases/circularTypeAliasForUnionWithClass.ts
+++ b/tests/cases/conformance/types/typeAliases/circularTypeAliasForUnionWithClass.ts
@@ -15,3 +15,7 @@ type T4 = string | I4;
class I4 {
[x: string]: T4;
}
+
+let i0 = new I0();
+let i3 = new I3();
+let i4 = new I4();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeAliases/classDoesNotDependOnBaseTypes.ts b/tests/cases/conformance/types/typeAliases/classDoesNotDependOnBaseTypes.ts
index 4cc3a72395..96d1b74b83 100644
--- a/tests/cases/conformance/types/typeAliases/classDoesNotDependOnBaseTypes.ts
+++ b/tests/cases/conformance/types/typeAliases/classDoesNotDependOnBaseTypes.ts
@@ -9,4 +9,6 @@ var x: StringTree;
if (typeof x !== "string") {
x[0] = "";
x[0] = new StringTreeCollection;
-}
\ No newline at end of file
+}
+
+let s1 = new StringTreeCollection();
diff --git a/tests/cases/conformance/types/typeAliases/typeAliases.ts b/tests/cases/conformance/types/typeAliases/typeAliases.ts
index b9d28f4cc3..32eb8473bf 100644
--- a/tests/cases/conformance/types/typeAliases/typeAliases.ts
+++ b/tests/cases/conformance/types/typeAliases/typeAliases.ts
@@ -77,4 +77,6 @@ var x: [string, boolean];
f16(x);
var y: StringAndBoolean = ["1", false];
-y[0].toLowerCase();
\ No newline at end of file
+y[0].toLowerCase();
+
+let c7 = new C7();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeParameters/typeArgumentLists/callGenericFunctionWithZeroTypeArguments.ts b/tests/cases/conformance/types/typeParameters/typeArgumentLists/callGenericFunctionWithZeroTypeArguments.ts
index 9a21c48ee1..b4a8dc7ba5 100644
--- a/tests/cases/conformance/types/typeParameters/typeArgumentLists/callGenericFunctionWithZeroTypeArguments.ts
+++ b/tests/cases/conformance/types/typeParameters/typeArgumentLists/callGenericFunctionWithZeroTypeArguments.ts
@@ -33,4 +33,7 @@ interface I2 {
f(x: T): T;
}
var i2: I2;
-var r7 = i2.f(1);
\ No newline at end of file
+var r7 = i2.f(1);
+
+let c1 = new C();
+let c2 = new C2();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction.ts b/tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction.ts
index ba1c5b003f..7490e2bd94 100644
--- a/tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction.ts
+++ b/tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction.ts
@@ -58,4 +58,7 @@ function foo2(x: T, y: U) {
//function foo2(x: T, y: U) {
// foo(x);
// foo(y);
-//}
\ No newline at end of file
+//}
+
+let c11 = new C();
+let c12 = new C2();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction3.ts b/tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction3.ts
index 6c32014789..dec6cdd0bd 100644
--- a/tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction3.ts
+++ b/tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction3.ts
@@ -38,4 +38,7 @@ var c2: { (x: T): T; (x: T, y: T): T };
var r9 = foo(function (x: U) { return x; });
var r10 = foo((x: U) => x);
var r12 = foo(i2);
-var r15 = foo(c2);
\ No newline at end of file
+var r15 = foo(c2);
+
+let c11 = new C();
+let c12 = new C2()
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeParameters/typeParameterLists/innerTypeParameterShadowingOuterOne2.ts b/tests/cases/conformance/types/typeParameters/typeParameterLists/innerTypeParameterShadowingOuterOne2.ts
index 60766c7e5e..4bd0b6c27f 100644
--- a/tests/cases/conformance/types/typeParameters/typeParameterLists/innerTypeParameterShadowingOuterOne2.ts
+++ b/tests/cases/conformance/types/typeParameters/typeParameterLists/innerTypeParameterShadowingOuterOne2.ts
@@ -34,4 +34,6 @@ class C2 {
// var x: U;
// x.getDate();
// }
-//}
\ No newline at end of file
+//}
+let c1 = new C();
+let c2 = new C2();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeParameters/typeParameterLists/propertyAccessOnTypeParameterWithConstraints.ts b/tests/cases/conformance/types/typeParameters/typeParameterLists/propertyAccessOnTypeParameterWithConstraints.ts
index b89016ecff..c10bef3300 100644
--- a/tests/cases/conformance/types/typeParameters/typeParameterLists/propertyAccessOnTypeParameterWithConstraints.ts
+++ b/tests/cases/conformance/types/typeParameters/typeParameterLists/propertyAccessOnTypeParameterWithConstraints.ts
@@ -31,4 +31,5 @@ var b = {
}
}
-var r4 = b.foo(new Date());
\ No newline at end of file
+var r4 = b.foo(new Date());
+let c = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeParameters/typeParameterLists/propertyAccessOnTypeParameterWithConstraints2.ts b/tests/cases/conformance/types/typeParameters/typeParameterLists/propertyAccessOnTypeParameterWithConstraints2.ts
index 10f3a49884..a9992c5aa1 100644
--- a/tests/cases/conformance/types/typeParameters/typeParameterLists/propertyAccessOnTypeParameterWithConstraints2.ts
+++ b/tests/cases/conformance/types/typeParameters/typeParameterLists/propertyAccessOnTypeParameterWithConstraints2.ts
@@ -61,7 +61,7 @@ var a: {
var r3 = a().foo();
var r3b = a()['foo']();
// parameter supplied for type argument inference to succeed
-var aB = new B();
+// var aB = new B();
var r3c = a(aB, aB).foo();
var r3d = a(aB, aB)['foo']();
@@ -78,4 +78,7 @@ var b = {
// }
//}
-var r4 = b.foo(aB, aB); // no inferences for T so constraint isn't satisfied, error
\ No newline at end of file
+var r4 = b.foo(aB, aB); // no inferences for T so constraint isn't satisfied, error
+
+let b1 = new B();
+let c1 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeParameters/typeParameterLists/propertyAccessOnTypeParameterWithConstraints3.ts b/tests/cases/conformance/types/typeParameters/typeParameterLists/propertyAccessOnTypeParameterWithConstraints3.ts
index 6167485f1b..73a10ae071 100644
--- a/tests/cases/conformance/types/typeParameters/typeParameterLists/propertyAccessOnTypeParameterWithConstraints3.ts
+++ b/tests/cases/conformance/types/typeParameters/typeParameterLists/propertyAccessOnTypeParameterWithConstraints3.ts
@@ -53,4 +53,6 @@ var b = {
}
}
-var r4 = b.foo(new B()); // valid call to an invalid function
\ No newline at end of file
+var r4 = b.foo(new B()); // valid call to an invalid function
+let b1 = new B();
+let c1 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeParameters/typeParameterLists/propertyAccessOnTypeParameterWithoutConstraints.ts b/tests/cases/conformance/types/typeParameters/typeParameterLists/propertyAccessOnTypeParameterWithoutConstraints.ts
index 1660d67a4e..b46569e9a4 100644
--- a/tests/cases/conformance/types/typeParameters/typeParameterLists/propertyAccessOnTypeParameterWithoutConstraints.ts
+++ b/tests/cases/conformance/types/typeParameters/typeParameterLists/propertyAccessOnTypeParameterWithoutConstraints.ts
@@ -28,4 +28,6 @@ var b = {
}
}
-var r4 = b.foo(1);
\ No newline at end of file
+var r4 = b.foo(1);
+
+let c = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeParameters/typeParameterLists/typeParameterUsedAsConstraint.ts b/tests/cases/conformance/types/typeParameters/typeParameterLists/typeParameterUsedAsConstraint.ts
index bade67badd..b9f3e54bb7 100644
--- a/tests/cases/conformance/types/typeParameters/typeParameterLists/typeParameterUsedAsConstraint.ts
+++ b/tests/cases/conformance/types/typeParameters/typeParameterLists/typeParameterUsedAsConstraint.ts
@@ -32,3 +32,10 @@ var a3: { (): void }
var a4: { (): void }
var a5: { (): void }
var a6: { (): void }
+
+let c1 = new C();
+let c2 = new C2();
+let c3 = new C3();
+let c4 = new C4();
+let c5 = new C5();
+let c6 = new C6();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/anyAssignabilityInInheritance.ts b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/anyAssignabilityInInheritance.ts
index cc154308a1..5dfa8f94d3 100644
--- a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/anyAssignabilityInInheritance.ts
+++ b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/anyAssignabilityInInheritance.ts
@@ -85,4 +85,8 @@ var r3 = foo3(a); // any
declare function foo18(x: {}): {};
declare function foo18(x: any): any;
-var r3 = foo3(a); // any
\ No newline at end of file
+var r3 = foo3(a); // any
+
+let aa1 = new A();
+let aa2 = new A2();
+let ccc = new CC();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/anyAssignableToEveryType.ts b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/anyAssignableToEveryType.ts
index 1c3bcc71ce..03e0089697 100644
--- a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/anyAssignableToEveryType.ts
+++ b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/anyAssignableToEveryType.ts
@@ -38,6 +38,7 @@ function foo(x: T, y: U, z: V) {
z = a;
}
+let cc = new C();
//function foo(x: T, y: U, z: V) {
// x = a;
// y = a;
diff --git a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/anyAssignableToEveryType2.ts b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/anyAssignableToEveryType2.ts
index 26f3eee594..74a517176d 100644
--- a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/anyAssignableToEveryType2.ts
+++ b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/anyAssignableToEveryType2.ts
@@ -127,3 +127,6 @@ interface I20 {
[x: string]: {};
foo: any;
}
+let aa = new A();
+let aa2 = new A2()
+let ccc = new c();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers.ts b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers.ts
index d7a94cc862..464edb67d3 100644
--- a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers.ts
+++ b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers.ts
@@ -40,6 +40,8 @@ module SimpleTypes {
a2 = b;
a2 = t2;
a2 = t;
+ let ss = new S();
+ let tt = new T();
}
module ObjectTypes {
@@ -81,5 +83,6 @@ module ObjectTypes {
a2 = b;
a2 = t2;
a2 = t;
-
+ let ss = new S();
+ let tt = new T();
}
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers2.ts b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers2.ts
index a45da06482..a9e3bc6141 100644
--- a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers2.ts
+++ b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers2.ts
@@ -39,3 +39,5 @@ b2 = a2;
a2 = b;
a2 = t2;
a2 = t;
+let qu1 = new S();
+let qu2 = new T();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers3.ts b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers3.ts
index 6e9a210db4..b96693de94 100644
--- a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers3.ts
+++ b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers3.ts
@@ -39,3 +39,5 @@ b2 = a2;
a2 = b;
a2 = t2;
a2 = t;
+let qi3 = new S();
+let qi4 = new T();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersNumericNames.ts b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersNumericNames.ts
index b25c949f42..7372988241 100644
--- a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersNumericNames.ts
+++ b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersNumericNames.ts
@@ -39,3 +39,5 @@ b2 = a2;
a2 = b;
a2 = t2;
a2 = t;
+let qi1 = new S();
+let qi2 = new T();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance2.ts b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance2.ts
index 9e6cd52ac2..c511bfa71a 100644
--- a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance2.ts
+++ b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance2.ts
@@ -66,4 +66,8 @@ interface I extends A {
a16: (x: T) => number[]; // ok
a17: (x: (a: T) => T) => T[]; // ok
a18: (x: (a: T) => T) => T[]; // ok, no inferences for T but assignable to any
-}
\ No newline at end of file
+}
+
+let qi14 = new Derived();
+let qi15 = new Derived2();
+let qi16 = new OtherDerived();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance4.ts b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance4.ts
index dd10ee7646..bb1f737657 100644
--- a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance4.ts
+++ b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance4.ts
@@ -46,4 +46,8 @@ interface I extends A {
a16: (x: { a: T; b: T }) => T[]; // ok, more general parameter type
a17: (x: (a: T) => T) => T[]; // ok
a18: (x: (a: T) => T) => any[]; // ok
-}
\ No newline at end of file
+}
+
+let qi14 = new Derived();
+let qi15 = new Derived2();
+let qi16 = new OtherDerived();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance5.ts b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance5.ts
index bf60d6518c..ef4e179af9 100644
--- a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance5.ts
+++ b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance5.ts
@@ -45,4 +45,7 @@ interface I extends B {
a12: >(x: Array, y: T) => Array; // ok, less specific parameter type
a13: >(x: Array, y: T) => T; // ok, T = Array, satisfies constraint, contextual signature instantiation succeeds
a14: (x: { a: T; b: U }) => T; // ok
-}
\ No newline at end of file
+}
+let qi14 = new Derived();
+let qi15 = new Derived2();
+let qi16 = new OtherDerived();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance2.ts b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance2.ts
index 65e4f4c962..8d842b7d7e 100644
--- a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance2.ts
+++ b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance2.ts
@@ -66,4 +66,8 @@ interface I extends A {
a16: new (x: T) => number[]; // ok
a17: new (x: new (a: T) => T) => T[]; // ok
a18: new (x: new (a: T) => T) => T[]; // ok, no inferences for T but assignable to any
-}
\ No newline at end of file
+}
+
+let qi14 = new Derived();
+let qi15 = new Derived2();
+let qi16 = new OtherDerived();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance4.ts b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance4.ts
index 9dfcf5548a..8b57d6a8c7 100644
--- a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance4.ts
+++ b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance4.ts
@@ -56,4 +56,7 @@ interface I extends A {
a18: new (x: T) => number[]; // ok, more general parameter type
a19: new (x: new (a: T) => T) => T[]; // ok
a20: new (x: new (a: T) => T) => any[]; // ok
-}
\ No newline at end of file
+}
+let qi14 = new Derived();
+let qi15 = new Derived2();
+let qi16 = new OtherDerived();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance5.ts b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance5.ts
index f33820218e..6ba5e454f6 100644
--- a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance5.ts
+++ b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance5.ts
@@ -45,4 +45,7 @@ interface I extends B {
a12: new >(x: Array, y: T) => Array; // ok, less specific parameter type
a13: new >(x: Array, y: T) => T; // ok, T = Array, satisfies constraint, contextual signature instantiation succeeds
a14: new (x: { a: T; b: U }) => T; // ok
-}
\ No newline at end of file
+}
+let qi14 = new Derived();
+let qi15 = new Derived2();
+let qi16 = new OtherDerived();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/everyTypeAssignableToAny.ts b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/everyTypeAssignableToAny.ts
index 6c8670abaa..407e128678 100644
--- a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/everyTypeAssignableToAny.ts
+++ b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/everyTypeAssignableToAny.ts
@@ -53,6 +53,8 @@ function foo(x: T, y: U, z: V) {
a = y;
a = z;
}
+
+let ccc = new C();
//function foo(x: T, y: U, z: V) {
// a = x;
// a = y;
diff --git a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/nullAssignableToEveryType.ts b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/nullAssignableToEveryType.ts
index b0f55331d7..cc755558ff 100644
--- a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/nullAssignableToEveryType.ts
+++ b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/nullAssignableToEveryType.ts
@@ -35,7 +35,7 @@ function foo(x: T, y: U, z: V) {
y = null;
z = null;
}
-
+let cc = new C();
//function foo(x: T, y: U, z: V) {
// x = null;
// y = null;
diff --git a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/undefinedAssignableToEveryType.ts b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/undefinedAssignableToEveryType.ts
index 5fc14274a1..f296781ef1 100644
--- a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/undefinedAssignableToEveryType.ts
+++ b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/undefinedAssignableToEveryType.ts
@@ -35,6 +35,7 @@ function foo(x: T, y: U, z: V) {
y = undefined;
z = undefined;
}
+let cc = new C();
//function foo(x: T, y: U, z: V) {
// x = undefined;
// y = undefined;
diff --git a/tests/cases/conformance/types/typeRelationships/bestCommonType/bestCommonTypeOfConditionalExpressions.ts b/tests/cases/conformance/types/typeRelationships/bestCommonType/bestCommonTypeOfConditionalExpressions.ts
index 5f02210478..1e1889cc10 100644
--- a/tests/cases/conformance/types/typeRelationships/bestCommonType/bestCommonTypeOfConditionalExpressions.ts
+++ b/tests/cases/conformance/types/typeRelationships/bestCommonType/bestCommonTypeOfConditionalExpressions.ts
@@ -23,4 +23,7 @@ var r11 = true ? base : derived2;
function foo5(t: T, u: U): Object {
return true ? t : u; // BCT is Object
-}
\ No newline at end of file
+}
+
+let qy10 = new Derived();
+let qy11 = new Derived2();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/bestCommonType/bestCommonTypeOfConditionalExpressions2.ts b/tests/cases/conformance/types/typeRelationships/bestCommonType/bestCommonTypeOfConditionalExpressions2.ts
index 8e6f345ea4..f1512e3536 100644
--- a/tests/cases/conformance/types/typeRelationships/bestCommonType/bestCommonTypeOfConditionalExpressions2.ts
+++ b/tests/cases/conformance/types/typeRelationships/bestCommonType/bestCommonTypeOfConditionalExpressions2.ts
@@ -21,4 +21,6 @@ function foo2(t: T, u: U) { // Error for referencing own type pa
function foo3(t: T, u: U) {
return true ? t : u;
-}
\ No newline at end of file
+}
+let qy8 = new Derived();
+let qy9 = new Derived2();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/bestCommonType/heterogeneousArrayLiterals.ts b/tests/cases/conformance/types/typeRelationships/bestCommonType/heterogeneousArrayLiterals.ts
index 0f498c570a..13ecea225a 100644
--- a/tests/cases/conformance/types/typeRelationships/bestCommonType/heterogeneousArrayLiterals.ts
+++ b/tests/cases/conformance/types/typeRelationships/bestCommonType/heterogeneousArrayLiterals.ts
@@ -99,6 +99,8 @@ function foo4(t: T, u: U) {
var k: Base[] = [t, u];
}
+let qy8 = new Derived();
+let qy9 = new Derived2();
//function foo3(t: T, u: U) {
// var a = [t, t]; // T[]
diff --git a/tests/cases/conformance/types/typeRelationships/instanceOf/narrowingConstrainedTypeVariable.ts b/tests/cases/conformance/types/typeRelationships/instanceOf/narrowingConstrainedTypeVariable.ts
index 04623503f9..491876d8ff 100644
--- a/tests/cases/conformance/types/typeRelationships/instanceOf/narrowingConstrainedTypeVariable.ts
+++ b/tests/cases/conformance/types/typeRelationships/instanceOf/narrowingConstrainedTypeVariable.ts
@@ -34,3 +34,6 @@ function f3(v: T | { x: string }) {
const y: { x: string } = v;
}
}
+let qy5 = new C();
+let qy6 = new D();
+let qy7 = new E();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/recursiveTypes/arrayLiteralsWithRecursiveGenerics.ts b/tests/cases/conformance/types/typeRelationships/recursiveTypes/arrayLiteralsWithRecursiveGenerics.ts
index e7260831a4..35de332a33 100644
--- a/tests/cases/conformance/types/typeRelationships/recursiveTypes/arrayLiteralsWithRecursiveGenerics.ts
+++ b/tests/cases/conformance/types/typeRelationships/recursiveTypes/arrayLiteralsWithRecursiveGenerics.ts
@@ -22,4 +22,8 @@ var ys = [list, list2]; // {}[]
var zs = [list, null]; // List[]
var myDerivedList: DerivedList;
-var as = [list, myDerivedList]; // List[]
\ No newline at end of file
+var as = [list, myDerivedList]; // List[]
+
+let li = new List();
+let der = new DerivedList();
+let my = new MyList();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/recursiveTypes/recursiveTypeInGenericConstraint.ts b/tests/cases/conformance/types/typeRelationships/recursiveTypes/recursiveTypeInGenericConstraint.ts
index ac6286bd81..e4d37f2abe 100644
--- a/tests/cases/conformance/types/typeRelationships/recursiveTypes/recursiveTypeInGenericConstraint.ts
+++ b/tests/cases/conformance/types/typeRelationships/recursiveTypes/recursiveTypeInGenericConstraint.ts
@@ -10,4 +10,7 @@ class D {
x: G>;
}
-var c1 = new Foo>(); // ok, circularity in assignment compat check causes success
\ No newline at end of file
+var c1 = new Foo>(); // ok, circularity in assignment compat check causes success
+let g = new G();
+let foo = new Foo();
+let d = new D();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/recursiveTypes/recursiveTypesUsedAsFunctionParameters.ts b/tests/cases/conformance/types/typeRelationships/recursiveTypes/recursiveTypesUsedAsFunctionParameters.ts
index 6eba1f2836..6cdf1db8be 100644
--- a/tests/cases/conformance/types/typeRelationships/recursiveTypes/recursiveTypesUsedAsFunctionParameters.ts
+++ b/tests/cases/conformance/types/typeRelationships/recursiveTypes/recursiveTypesUsedAsFunctionParameters.ts
@@ -40,4 +40,7 @@ function other, U>() {
var r = foo5(list);
var r2 = foo5(myList);
-}
\ No newline at end of file
+}
+
+let li = new List();
+let my = new MyList();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/nullIsSubtypeOfEverythingButUndefined.ts b/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/nullIsSubtypeOfEverythingButUndefined.ts
index 24f2ab71d4..ced02bcefe 100644
--- a/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/nullIsSubtypeOfEverythingButUndefined.ts
+++ b/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/nullIsSubtypeOfEverythingButUndefined.ts
@@ -88,3 +88,7 @@ var r19 = true ? null : new Object();
var r20 = true ? {} : null;
var r20 = true ? null : {};
+
+let c11 = new C1();
+let c12 = new C2();
+let c13 = new c();
diff --git a/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString.ts b/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString.ts
index c7e9c0fc8e..0f00bc8c02 100644
--- a/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString.ts
+++ b/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString.ts
@@ -97,4 +97,6 @@ function f15(x: any) { }
function f16(x: 'a');
function f16(x: U);
-function f16(x: any) { }
\ No newline at end of file
+function f16(x: any) { }
+
+let ccc = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfAny.ts b/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfAny.ts
index 0e5df54319..d785a27b7b 100644
--- a/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfAny.ts
+++ b/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfAny.ts
@@ -130,4 +130,7 @@ interface I19 {
interface I20 {
[x: string]: any;
foo: {};
-}
\ No newline at end of file
+}
+let a1 = new A();
+let a2 = new A2();
+let c1 = new c();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints2.ts b/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints2.ts
index 9edf4f5f41..990e4b8cc5 100644
--- a/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints2.ts
+++ b/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints2.ts
@@ -154,4 +154,7 @@ function f20(x: T) {
function f21(x: T) {
var r20 = true ? {} : x; // ok
var r20 = true ? x : {}; // ok
-}
\ No newline at end of file
+}
+
+let c1 = new C1();
+let c2 = new C2();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignatures2.ts b/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignatures2.ts
index e8ae73c5fb..4a29484b12 100644
--- a/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignatures2.ts
+++ b/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignatures2.ts
@@ -5,6 +5,7 @@ class Derived extends Base { bar: string; }
class Derived2 extends Derived { baz: string; }
class OtherDerived extends Base { bing: string; }
+
declare function foo1(a: (x: number) => number[]): typeof a;
declare function foo1(a: any): any;
@@ -169,3 +170,8 @@ var r17arg1 = (x: (a: T) => T) => null;
var r17 = foo17(r17arg1); // any
var r18arg1 = (x: (a: T) => T) => null;
var r18 = foo18(r18arg1);
+
+
+let der1 = new Derived();
+let der2 = new Derived2();
+let oth = new OtherDerived();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignatures3.ts b/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignatures3.ts
index 505919547f..51c890854f 100644
--- a/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignatures3.ts
+++ b/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignatures3.ts
@@ -103,6 +103,10 @@ module Errors {
var r9arg = (x: (a: T) => T) => null;
var r9 = foo17(r9arg); // (x: { (a: T): T; (a: T): T; }): any[]; (x: { (a: T): T; (a: T): T; }): any[];
+ let ba = new Base();
+ let der1 = new Derived();
+ let der2 = new Derived2();
+ let oth = new OtherDerived();
}
module WithGenericSignaturesInBaseType {
diff --git a/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignatures4.ts b/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignatures4.ts
index e86fc51d44..e043cec402 100644
--- a/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignatures4.ts
+++ b/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignatures4.ts
@@ -108,4 +108,8 @@ var r17arg = (x: (a: T) => T) => null;
var r17 = foo17(r17arg);
var r18arg = (x: (a: T) => T) => null;
-var r18 = foo18(r18arg);
\ No newline at end of file
+var r18 = foo18(r18arg);
+
+let der =new Derived();
+let der2 = new Derived2();
+let oth = new OtherDerived();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignatures2.ts b/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignatures2.ts
index 46d1c9e91d..683db9f182 100644
--- a/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignatures2.ts
+++ b/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignatures2.ts
@@ -169,3 +169,8 @@ var r17arg1: new (x: (a: T) => T) => T[];
var r17 = foo17(r17arg1); // any
var r18arg1: new (x: (a: T) => T) => T[];
var r18 = foo18(r18arg1);
+
+
+let der =new Derived();
+let der2 = new Derived2();
+let oth = new OtherDerived();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignatures3.ts b/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignatures3.ts
index 215a5d1d4d..bbaddcabfc 100644
--- a/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignatures3.ts
+++ b/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignatures3.ts
@@ -105,6 +105,10 @@ module Errors {
var r9arg: new (x: new (a: T) => T) => any[];
var r9 = foo17(r9arg); // // (x: { (a: T): T; (a: T): T; }): any[]; (x: { (a: T): T; (a: T): T; }): any[];
+ let ba = new Base();
+ let der1 = new Derived();
+ let der2 = new Derived2();
+ let oth = new OtherDerived();
}
module WithGenericSignaturesInBaseType {
diff --git a/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignatures4.ts b/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignatures4.ts
index 830139d3fa..5d5145d29d 100644
--- a/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignatures4.ts
+++ b/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignatures4.ts
@@ -108,4 +108,8 @@ var r17arg: new (x: new (a: T) => T) => T[];
var r17 = foo17(r17arg);
var r18arg: new (x: new (a: T) => T) => any[];
-var r18 = foo18(r18arg);
\ No newline at end of file
+var r18 = foo18(r18arg);
+
+let der =new Derived();
+let der2 = new Derived2();
+let oth = new OtherDerived();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignatures5.ts b/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignatures5.ts
index f33820218e..f3c1c5d20d 100644
--- a/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignatures5.ts
+++ b/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignatures5.ts
@@ -6,6 +6,7 @@ class Derived extends Base { bar: string; }
class Derived2 extends Derived { baz: string; }
class OtherDerived extends Base { bing: string; }
+
interface A { // T
// M's
a: new (x: number) => number[];
@@ -45,4 +46,7 @@ interface I extends B {
a12: new >(x: Array, y: T) => Array; // ok, less specific parameter type
a13: new >(x: Array, y: T) => T; // ok, T = Array, satisfies constraint, contextual signature instantiation succeeds
a14: new (x: { a: T; b: U }) => T; // ok
-}
\ No newline at end of file
+}
+let der =new Derived();
+let der2 = new Derived2();
+let oth = new OtherDerived();
diff --git a/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembers4.ts b/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembers4.ts
index b50e1f7106..2c99af9515 100644
--- a/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembers4.ts
+++ b/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembers4.ts
@@ -30,4 +30,8 @@ class A3 {
class B3 extends A3 {
'1.1': Derived; // ok, inherits '1'
-}
\ No newline at end of file
+}
+let der = new Derived();
+let b1 = new B();
+let b2 = new B2();
+let b3 = new B3();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/undefinedIsSubtypeOfEverything.ts b/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/undefinedIsSubtypeOfEverything.ts
index 7ee0906ee2..08c7e7d192 100644
--- a/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/undefinedIsSubtypeOfEverything.ts
+++ b/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/undefinedIsSubtypeOfEverything.ts
@@ -118,3 +118,28 @@ class D16 extends Base {
class D17 extends Base {
foo: {};
}
+
+
+let d0 = new D0();
+let da = new DA();
+let d1 = new D1()
+let d1a = new D1A()
+let d2 = new D2()
+let d2a = new D2A()
+let d3 = new D3()
+let d3a = new D1A()
+let d4 = new D4()
+let d5 = new D5()
+let d6 = new D6()
+let d7 = new D7()
+let d8 = new D8()
+let d9 = new D9()
+let d10 = new D10()
+let d11 = new D11()
+let d12 = new D12()
+let c1 = new c()
+let d13 = new D13()
+let d14 = new D14()
+let d15 = new D15()
+let d16 = new D16()
+let d17 = new D17()
diff --git a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentity.ts b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentity.ts
index 225a974181..acf6300dba 100644
--- a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentity.ts
+++ b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentity.ts
@@ -85,4 +85,8 @@ function foo13(x: any) { }
function foo14(x: I);
function foo14(x: typeof b); // error
-function foo14(x: any) { }
\ No newline at end of file
+function foo14(x: any) { }
+
+let a1 = new A();
+let b1 = new B();
+let c1 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentity2.ts b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentity2.ts
index fefde23a69..2427d26180 100644
--- a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentity2.ts
+++ b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentity2.ts
@@ -62,4 +62,7 @@ function foo13(x: any) { }
function foo14(x: I);
function foo14(x: typeof b); // ok
-function foo14(x: any) { }
\ No newline at end of file
+function foo14(x: any) { }
+let aa = new A();
+let bb = new B();
+let cc = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithCallSignatures.ts b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithCallSignatures.ts
index 94038f6df9..bb5d06c3fc 100644
--- a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithCallSignatures.ts
+++ b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithCallSignatures.ts
@@ -97,4 +97,7 @@ function foo14(x: any) { }
function foo15(x: I2);
function foo15(x: C); // ok
-function foo15(x: any) { }
\ No newline at end of file
+function foo15(x: any) { }
+let qy17 = new A();
+let qy18 = new B();
+let qy19 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithCallSignatures2.ts b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithCallSignatures2.ts
index 699f0f73f7..99aafb4b8a 100644
--- a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithCallSignatures2.ts
+++ b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithCallSignatures2.ts
@@ -97,4 +97,7 @@ function foo14(x: any) { }
function foo15(x: I2);
function foo15(x: C