diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 39fb1b7ea338e..6b5ad01ed9da1 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -2870,18 +2870,27 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg // This is because in the -out scenario all files need to be emitted, and therefore all // files need to be type checked. And the way to specify that all files need to be type // checked is to not pass the file to getEmitResolver. - const emitResolver = getTypeChecker().getEmitResolver(options.outFile ? undefined : sourceFile, cancellationToken, forceDtsEmit); + const typeChecker = getTypeChecker(); + const emitResolver = typeChecker.getEmitResolver( + options.outFile ? undefined : sourceFile, + cancellationToken, + forceDtsEmit, + ); performance.mark("beforeEmit"); - const emitResult = emitFiles( - emitResolver, - getEmitHost(writeFileCallback), - sourceFile, - getTransformers(options, customTransformers, emitOnly), - emitOnly, - /*onlyBuildInfo*/ false, - forceDtsEmit, + const emitResult = typeChecker.runWithCancellationToken( + cancellationToken, + () => + emitFiles( + emitResolver, + getEmitHost(writeFileCallback), + sourceFile, + getTransformers(options, customTransformers, emitOnly), + emitOnly, + /*onlyBuildInfo*/ false, + forceDtsEmit, + ), ); performance.mark("afterEmit"); diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 198bb33fa9902..5dea8bb4d047a 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -5354,6 +5354,8 @@ export interface TypeChecker { * and the operation is cancelled, then it should be discarded, otherwise it is safe to keep. */ runWithCancellationToken(token: CancellationToken, cb: (checker: TypeChecker) => T): T; + /**@internal */ + runWithCancellationToken(token: CancellationToken | undefined, cb: (checker: TypeChecker) => T): T; // eslint-disable-line @typescript-eslint/unified-signatures /** @internal */ getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol: Symbol): readonly TypeParameter[] | undefined; /** @internal */ isDeclarationVisible(node: Declaration | AnyImportSyntax): boolean; diff --git a/src/testRunner/unittests/tsc/cancellationToken.ts b/src/testRunner/unittests/tsc/cancellationToken.ts index e66a2a51ab772..1570680b63fd1 100644 --- a/src/testRunner/unittests/tsc/cancellationToken.ts +++ b/src/testRunner/unittests/tsc/cancellationToken.ts @@ -17,7 +17,7 @@ import { libFile, } from "../helpers/virtualFileSystemWithWatch.js"; -describe("unittests:: tsc:: builder cancellationToken", () => { +describe("unittests:: tsc:: builder cancellationToken:: sheetal", () => { verifyCancellation(/*useBuildInfo*/ true, "when emitting buildInfo"); verifyCancellation(/*useBuildInfo*/ false, "when using state"); function verifyCancellation(useBuildInfo: boolean, scenario: string) { @@ -41,9 +41,9 @@ describe("unittests:: tsc:: builder cancellationToken", () => { const cFile: File = { path: `/user/username/projects/myproject/c.ts`, content: Utils.dedent` - export class C { + export var C = class CReal { d = 1; - }`, + };`, }; const dFile: File = { path: `/user/username/projects/myproject/d.ts`, diff --git a/tests/baselines/reference/tsc/cancellationToken/when-emitting-buildInfo.js b/tests/baselines/reference/tsc/cancellationToken/when-emitting-buildInfo.js index b6dff17c055ef..028c4b56a0894 100644 --- a/tests/baselines/reference/tsc/cancellationToken/when-emitting-buildInfo.js +++ b/tests/baselines/reference/tsc/cancellationToken/when-emitting-buildInfo.js @@ -13,9 +13,9 @@ export class B { } //// [/user/username/projects/myproject/c.ts] -export class C { +export var C = class CReal { d = 1; -} +}; //// [/user/username/projects/myproject/d.ts] export class D { } @@ -46,19 +46,20 @@ interface Array { length: number; [n: number]: T; } "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.C = void 0; -var C = /** @class */ (function () { - function C() { +exports.C = /** @class */ (function () { + function CReal() { this.d = 1; } - return C; + return CReal; }()); -exports.C = C; //// [/user/username/projects/myproject/c.d.ts] -export declare class C { - d: number; -} +export declare var C: { + new (): { + d: number; + }; +}; //// [/user/username/projects/myproject/b.js] @@ -76,9 +77,10 @@ exports.B = B; //// [/user/username/projects/myproject/b.d.ts] -import { C } from './c'; export declare class B { - c: C; + c: { + d: number; + }; } @@ -112,7 +114,7 @@ export declare class D { //// [/user/username/projects/myproject/tsconfig.tsbuildinfo] -{"program":{"fileNames":["../../../../a/lib/lib.d.ts","./c.ts","./b.ts","./a.ts","./d.ts"],"fileInfos":[{"version":"-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }","affectsGlobalScope":true,"impliedFormat":1},{"version":"-5130721255-export class C {\n d = 1;\n}","signature":"-6977846840-export declare class C {\n d: number;\n}\n","impliedFormat":1},{"version":"-6441446591-import {C} from './c';\nexport class B {\n c = new C();\n}","signature":"-165097315-import { C } from './c';\nexport declare class B {\n c: C;\n}\n","impliedFormat":1},{"version":"4878398349-import {B} from './b';\ndeclare var console: any;\nlet b = new B();\nconsole.log(b.c.d);","signature":"-3531856636-export {};\n","impliedFormat":1},{"version":"-7804761415-export class D { }","signature":"-8611429667-export declare class D {\n}\n","impliedFormat":1}],"root":[[2,5]],"options":{"declaration":true},"fileIdsList":[[3],[2]],"referencedMap":[[4,1],[3,2]],"semanticDiagnosticsPerFile":[1,4,3,2,5]},"version":"FakeTSVersion"} +{"program":{"fileNames":["../../../../a/lib/lib.d.ts","./c.ts","./b.ts","./a.ts","./d.ts"],"fileInfos":[{"version":"-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }","affectsGlobalScope":true,"impliedFormat":1},{"version":"6071811233-export var C = class CReal {\n d = 1;\n};","signature":"-2874569268-export declare var C: {\n new (): {\n d: number;\n };\n};\n","impliedFormat":1},{"version":"-6441446591-import {C} from './c';\nexport class B {\n c = new C();\n}","signature":"-12916012021-export declare class B {\n c: {\n d: number;\n };\n}\n","impliedFormat":1},{"version":"4878398349-import {B} from './b';\ndeclare var console: any;\nlet b = new B();\nconsole.log(b.c.d);","signature":"-3531856636-export {};\n","impliedFormat":1},{"version":"-7804761415-export class D { }","signature":"-8611429667-export declare class D {\n}\n","impliedFormat":1}],"root":[[2,5]],"options":{"declaration":true},"fileIdsList":[[3],[2]],"referencedMap":[[4,1],[3,2]],"semanticDiagnosticsPerFile":[1,4,3,2,5]},"version":"FakeTSVersion"} //// [/user/username/projects/myproject/tsconfig.tsbuildinfo.readable.baseline.txt] { @@ -146,22 +148,22 @@ export declare class D { }, "./c.ts": { "original": { - "version": "-5130721255-export class C {\n d = 1;\n}", - "signature": "-6977846840-export declare class C {\n d: number;\n}\n", + "version": "6071811233-export var C = class CReal {\n d = 1;\n};", + "signature": "-2874569268-export declare var C: {\n new (): {\n d: number;\n };\n};\n", "impliedFormat": 1 }, - "version": "-5130721255-export class C {\n d = 1;\n}", - "signature": "-6977846840-export declare class C {\n d: number;\n}\n", + "version": "6071811233-export var C = class CReal {\n d = 1;\n};", + "signature": "-2874569268-export declare var C: {\n new (): {\n d: number;\n };\n};\n", "impliedFormat": "commonjs" }, "./b.ts": { "original": { "version": "-6441446591-import {C} from './c';\nexport class B {\n c = new C();\n}", - "signature": "-165097315-import { C } from './c';\nexport declare class B {\n c: C;\n}\n", + "signature": "-12916012021-export declare class B {\n c: {\n d: number;\n };\n}\n", "impliedFormat": 1 }, "version": "-6441446591-import {C} from './c';\nexport class B {\n c = new C();\n}", - "signature": "-165097315-import { C } from './c';\nexport declare class B {\n c: C;\n}\n", + "signature": "-12916012021-export declare class B {\n c: {\n d: number;\n };\n}\n", "impliedFormat": "commonjs" }, "./a.ts": { @@ -219,7 +221,7 @@ export declare class D { ] }, "version": "FakeTSVersion", - "size": 1326 + "size": 1368 } @@ -262,9 +264,9 @@ Change:: Add change that affects d.ts Input:: //// [/user/username/projects/myproject/c.ts] -export class C { +export var C = class CReal { d = 1; -}export function foo() {} +};export function foo() {} Output:: @@ -273,7 +275,7 @@ Operation ws cancelled:: true //// [/user/username/projects/myproject/tsconfig.tsbuildinfo] -{"program":{"fileNames":["../../../../a/lib/lib.d.ts","./c.ts","./b.ts","./a.ts","./d.ts"],"fileInfos":[{"version":"-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }","affectsGlobalScope":true,"impliedFormat":1},{"version":"840271342-export class C {\n d = 1;\n}export function foo() {}","signature":"-6977846840-export declare class C {\n d: number;\n}\n","impliedFormat":1},{"version":"-6441446591-import {C} from './c';\nexport class B {\n c = new C();\n}","signature":"-165097315-import { C } from './c';\nexport declare class B {\n c: C;\n}\n","impliedFormat":1},{"version":"4878398349-import {B} from './b';\ndeclare var console: any;\nlet b = new B();\nconsole.log(b.c.d);","signature":"-3531856636-export {};\n","impliedFormat":1},{"version":"-7804761415-export class D { }","signature":"-8611429667-export declare class D {\n}\n","impliedFormat":1}],"root":[[2,5]],"options":{"declaration":true},"fileIdsList":[[3],[2]],"referencedMap":[[4,1],[3,2]],"semanticDiagnosticsPerFile":[1,3,5],"affectedFilesPendingEmit":[[4],2],"changeFileSet":[2]},"version":"FakeTSVersion"} +{"program":{"fileNames":["../../../../a/lib/lib.d.ts","./c.ts","./b.ts","./a.ts","./d.ts"],"fileInfos":[{"version":"-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }","affectsGlobalScope":true,"impliedFormat":1},{"version":"-8116587914-export var C = class CReal {\n d = 1;\n};export function foo() {}","signature":"-2874569268-export declare var C: {\n new (): {\n d: number;\n };\n};\n","impliedFormat":1},{"version":"-6441446591-import {C} from './c';\nexport class B {\n c = new C();\n}","signature":"-12916012021-export declare class B {\n c: {\n d: number;\n };\n}\n","impliedFormat":1},{"version":"4878398349-import {B} from './b';\ndeclare var console: any;\nlet b = new B();\nconsole.log(b.c.d);","signature":"-3531856636-export {};\n","impliedFormat":1},{"version":"-7804761415-export class D { }","signature":"-8611429667-export declare class D {\n}\n","impliedFormat":1}],"root":[[2,5]],"options":{"declaration":true},"fileIdsList":[[3],[2]],"referencedMap":[[4,1],[3,2]],"semanticDiagnosticsPerFile":[1,4,3,5],"changeFileSet":[2]},"version":"FakeTSVersion"} //// [/user/username/projects/myproject/tsconfig.tsbuildinfo.readable.baseline.txt] { @@ -307,22 +309,22 @@ Operation ws cancelled:: true }, "./c.ts": { "original": { - "version": "840271342-export class C {\n d = 1;\n}export function foo() {}", - "signature": "-6977846840-export declare class C {\n d: number;\n}\n", + "version": "-8116587914-export var C = class CReal {\n d = 1;\n};export function foo() {}", + "signature": "-2874569268-export declare var C: {\n new (): {\n d: number;\n };\n};\n", "impliedFormat": 1 }, - "version": "840271342-export class C {\n d = 1;\n}export function foo() {}", - "signature": "-6977846840-export declare class C {\n d: number;\n}\n", + "version": "-8116587914-export var C = class CReal {\n d = 1;\n};export function foo() {}", + "signature": "-2874569268-export declare var C: {\n new (): {\n d: number;\n };\n};\n", "impliedFormat": "commonjs" }, "./b.ts": { "original": { "version": "-6441446591-import {C} from './c';\nexport class B {\n c = new C();\n}", - "signature": "-165097315-import { C } from './c';\nexport declare class B {\n c: C;\n}\n", + "signature": "-12916012021-export declare class B {\n c: {\n d: number;\n };\n}\n", "impliedFormat": 1 }, "version": "-6441446591-import {C} from './c';\nexport class B {\n c = new C();\n}", - "signature": "-165097315-import { C } from './c';\nexport declare class B {\n c: C;\n}\n", + "signature": "-12916012021-export declare class B {\n c: {\n d: number;\n };\n}\n", "impliedFormat": "commonjs" }, "./a.ts": { @@ -373,27 +375,16 @@ Operation ws cancelled:: true }, "semanticDiagnosticsPerFile": [ "../../../../a/lib/lib.d.ts", + "./a.ts", "./b.ts", "./d.ts" ], - "affectedFilesPendingEmit": [ - [ - [ - "./a.ts" - ], - "Dts" - ], - [ - "./c.ts", - "Js | Dts" - ] - ], "changeFileSet": [ "./c.ts" ] }, "version": "FakeTSVersion", - "size": 1399 + "size": 1411 } @@ -418,12 +409,8 @@ Program files:: Semantic diagnostics in builder refreshed for:: /user/username/projects/myproject/c.ts -/user/username/projects/myproject/a.ts -Shape signatures in builder refreshed for:: -/user/username/projects/myproject/c.ts (computed .d.ts) -/user/username/projects/myproject/b.ts (computed .d.ts) -/user/username/projects/myproject/a.ts (used version) +No shapes updated in the builder:: exitCode:: ExitStatus.undefined @@ -436,20 +423,21 @@ Input:: Object.defineProperty(exports, "__esModule", { value: true }); exports.C = void 0; exports.foo = foo; -var C = /** @class */ (function () { - function C() { +exports.C = /** @class */ (function () { + function CReal() { this.d = 1; } - return C; + return CReal; }()); -exports.C = C; function foo() { } //// [/user/username/projects/myproject/c.d.ts] -export declare class C { - d: number; -} +export declare var C: { + new (): { + d: number; + }; +}; export declare function foo(): void; @@ -457,7 +445,7 @@ export declare function foo(): void; //// [/user/username/projects/myproject/b.d.ts] file written with same contents //// [/user/username/projects/myproject/a.d.ts] file written with same contents //// [/user/username/projects/myproject/tsconfig.tsbuildinfo] -{"program":{"fileNames":["../../../../a/lib/lib.d.ts","./c.ts","./b.ts","./a.ts","./d.ts"],"fileInfos":[{"version":"-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }","affectsGlobalScope":true,"impliedFormat":1},{"version":"840271342-export class C {\n d = 1;\n}export function foo() {}","signature":"-7819740442-export declare class C {\n d: number;\n}\nexport declare function foo(): void;\n","impliedFormat":1},{"version":"-6441446591-import {C} from './c';\nexport class B {\n c = new C();\n}","signature":"-165097315-import { C } from './c';\nexport declare class B {\n c: C;\n}\n","impliedFormat":1},{"version":"4878398349-import {B} from './b';\ndeclare var console: any;\nlet b = new B();\nconsole.log(b.c.d);","signature":"-3531856636-export {};\n","impliedFormat":1},{"version":"-7804761415-export class D { }","signature":"-8611429667-export declare class D {\n}\n","impliedFormat":1}],"root":[[2,5]],"options":{"declaration":true},"fileIdsList":[[3],[2]],"referencedMap":[[4,1],[3,2]],"semanticDiagnosticsPerFile":[1,4,3,2,5]},"version":"FakeTSVersion"} +{"program":{"fileNames":["../../../../a/lib/lib.d.ts","./c.ts","./b.ts","./a.ts","./d.ts"],"fileInfos":[{"version":"-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }","affectsGlobalScope":true,"impliedFormat":1},{"version":"-8116587914-export var C = class CReal {\n d = 1;\n};export function foo() {}","signature":"-544179862-export declare var C: {\n new (): {\n d: number;\n };\n};\nexport declare function foo(): void;\n","impliedFormat":1},{"version":"-6441446591-import {C} from './c';\nexport class B {\n c = new C();\n}","signature":"-12916012021-export declare class B {\n c: {\n d: number;\n };\n}\n","impliedFormat":1},{"version":"4878398349-import {B} from './b';\ndeclare var console: any;\nlet b = new B();\nconsole.log(b.c.d);","signature":"-3531856636-export {};\n","impliedFormat":1},{"version":"-7804761415-export class D { }","signature":"-8611429667-export declare class D {\n}\n","impliedFormat":1}],"root":[[2,5]],"options":{"declaration":true},"fileIdsList":[[3],[2]],"referencedMap":[[4,1],[3,2]],"semanticDiagnosticsPerFile":[1,4,3,2,5]},"version":"FakeTSVersion"} //// [/user/username/projects/myproject/tsconfig.tsbuildinfo.readable.baseline.txt] { @@ -491,22 +479,22 @@ export declare function foo(): void; }, "./c.ts": { "original": { - "version": "840271342-export class C {\n d = 1;\n}export function foo() {}", - "signature": "-7819740442-export declare class C {\n d: number;\n}\nexport declare function foo(): void;\n", + "version": "-8116587914-export var C = class CReal {\n d = 1;\n};export function foo() {}", + "signature": "-544179862-export declare var C: {\n new (): {\n d: number;\n };\n};\nexport declare function foo(): void;\n", "impliedFormat": 1 }, - "version": "840271342-export class C {\n d = 1;\n}export function foo() {}", - "signature": "-7819740442-export declare class C {\n d: number;\n}\nexport declare function foo(): void;\n", + "version": "-8116587914-export var C = class CReal {\n d = 1;\n};export function foo() {}", + "signature": "-544179862-export declare var C: {\n new (): {\n d: number;\n };\n};\nexport declare function foo(): void;\n", "impliedFormat": "commonjs" }, "./b.ts": { "original": { "version": "-6441446591-import {C} from './c';\nexport class B {\n c = new C();\n}", - "signature": "-165097315-import { C } from './c';\nexport declare class B {\n c: C;\n}\n", + "signature": "-12916012021-export declare class B {\n c: {\n d: number;\n };\n}\n", "impliedFormat": 1 }, "version": "-6441446591-import {C} from './c';\nexport class B {\n c = new C();\n}", - "signature": "-165097315-import { C } from './c';\nexport declare class B {\n c: C;\n}\n", + "signature": "-12916012021-export declare class B {\n c: {\n d: number;\n };\n}\n", "impliedFormat": "commonjs" }, "./a.ts": { @@ -564,7 +552,7 @@ export declare function foo(): void; ] }, "version": "FakeTSVersion", - "size": 1386 + "size": 1430 } diff --git a/tests/baselines/reference/tsc/cancellationToken/when-using-state.js b/tests/baselines/reference/tsc/cancellationToken/when-using-state.js index b1e4885668097..ec94b0431c6ef 100644 --- a/tests/baselines/reference/tsc/cancellationToken/when-using-state.js +++ b/tests/baselines/reference/tsc/cancellationToken/when-using-state.js @@ -13,9 +13,9 @@ export class B { } //// [/user/username/projects/myproject/c.ts] -export class C { +export var C = class CReal { d = 1; -} +}; //// [/user/username/projects/myproject/d.ts] export class D { } @@ -46,19 +46,20 @@ interface Array { length: number; [n: number]: T; } "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.C = void 0; -var C = /** @class */ (function () { - function C() { +exports.C = /** @class */ (function () { + function CReal() { this.d = 1; } - return C; + return CReal; }()); -exports.C = C; //// [/user/username/projects/myproject/c.d.ts] -export declare class C { - d: number; -} +export declare var C: { + new (): { + d: number; + }; +}; //// [/user/username/projects/myproject/b.js] @@ -76,9 +77,10 @@ exports.B = B; //// [/user/username/projects/myproject/b.d.ts] -import { C } from './c'; export declare class B { - c: C; + c: { + d: number; + }; } @@ -112,7 +114,7 @@ export declare class D { //// [/user/username/projects/myproject/tsconfig.tsbuildinfo] -{"program":{"fileNames":["../../../../a/lib/lib.d.ts","./c.ts","./b.ts","./a.ts","./d.ts"],"fileInfos":[{"version":"-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }","affectsGlobalScope":true,"impliedFormat":1},{"version":"-5130721255-export class C {\n d = 1;\n}","signature":"-6977846840-export declare class C {\n d: number;\n}\n","impliedFormat":1},{"version":"-6441446591-import {C} from './c';\nexport class B {\n c = new C();\n}","signature":"-165097315-import { C } from './c';\nexport declare class B {\n c: C;\n}\n","impliedFormat":1},{"version":"4878398349-import {B} from './b';\ndeclare var console: any;\nlet b = new B();\nconsole.log(b.c.d);","signature":"-3531856636-export {};\n","impliedFormat":1},{"version":"-7804761415-export class D { }","signature":"-8611429667-export declare class D {\n}\n","impliedFormat":1}],"root":[[2,5]],"options":{"declaration":true},"fileIdsList":[[3],[2]],"referencedMap":[[4,1],[3,2]],"semanticDiagnosticsPerFile":[1,4,3,2,5]},"version":"FakeTSVersion"} +{"program":{"fileNames":["../../../../a/lib/lib.d.ts","./c.ts","./b.ts","./a.ts","./d.ts"],"fileInfos":[{"version":"-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }","affectsGlobalScope":true,"impliedFormat":1},{"version":"6071811233-export var C = class CReal {\n d = 1;\n};","signature":"-2874569268-export declare var C: {\n new (): {\n d: number;\n };\n};\n","impliedFormat":1},{"version":"-6441446591-import {C} from './c';\nexport class B {\n c = new C();\n}","signature":"-12916012021-export declare class B {\n c: {\n d: number;\n };\n}\n","impliedFormat":1},{"version":"4878398349-import {B} from './b';\ndeclare var console: any;\nlet b = new B();\nconsole.log(b.c.d);","signature":"-3531856636-export {};\n","impliedFormat":1},{"version":"-7804761415-export class D { }","signature":"-8611429667-export declare class D {\n}\n","impliedFormat":1}],"root":[[2,5]],"options":{"declaration":true},"fileIdsList":[[3],[2]],"referencedMap":[[4,1],[3,2]],"semanticDiagnosticsPerFile":[1,4,3,2,5]},"version":"FakeTSVersion"} //// [/user/username/projects/myproject/tsconfig.tsbuildinfo.readable.baseline.txt] { @@ -146,22 +148,22 @@ export declare class D { }, "./c.ts": { "original": { - "version": "-5130721255-export class C {\n d = 1;\n}", - "signature": "-6977846840-export declare class C {\n d: number;\n}\n", + "version": "6071811233-export var C = class CReal {\n d = 1;\n};", + "signature": "-2874569268-export declare var C: {\n new (): {\n d: number;\n };\n};\n", "impliedFormat": 1 }, - "version": "-5130721255-export class C {\n d = 1;\n}", - "signature": "-6977846840-export declare class C {\n d: number;\n}\n", + "version": "6071811233-export var C = class CReal {\n d = 1;\n};", + "signature": "-2874569268-export declare var C: {\n new (): {\n d: number;\n };\n};\n", "impliedFormat": "commonjs" }, "./b.ts": { "original": { "version": "-6441446591-import {C} from './c';\nexport class B {\n c = new C();\n}", - "signature": "-165097315-import { C } from './c';\nexport declare class B {\n c: C;\n}\n", + "signature": "-12916012021-export declare class B {\n c: {\n d: number;\n };\n}\n", "impliedFormat": 1 }, "version": "-6441446591-import {C} from './c';\nexport class B {\n c = new C();\n}", - "signature": "-165097315-import { C } from './c';\nexport declare class B {\n c: C;\n}\n", + "signature": "-12916012021-export declare class B {\n c: {\n d: number;\n };\n}\n", "impliedFormat": "commonjs" }, "./a.ts": { @@ -219,7 +221,7 @@ export declare class D { ] }, "version": "FakeTSVersion", - "size": 1326 + "size": 1368 } @@ -262,9 +264,9 @@ Change:: Add change that affects d.ts Input:: //// [/user/username/projects/myproject/c.ts] -export class C { +export var C = class CReal { d = 1; -}export function foo() {} +};export function foo() {} Output:: @@ -273,7 +275,7 @@ Operation ws cancelled:: true //// [/user/username/projects/myproject/tsconfig.tsbuildinfo] -{"program":{"fileNames":["../../../../a/lib/lib.d.ts","./c.ts","./b.ts","./a.ts","./d.ts"],"fileInfos":[{"version":"-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }","affectsGlobalScope":true,"impliedFormat":1},{"version":"840271342-export class C {\n d = 1;\n}export function foo() {}","signature":"-6977846840-export declare class C {\n d: number;\n}\n","impliedFormat":1},{"version":"-6441446591-import {C} from './c';\nexport class B {\n c = new C();\n}","signature":"-165097315-import { C } from './c';\nexport declare class B {\n c: C;\n}\n","impliedFormat":1},{"version":"4878398349-import {B} from './b';\ndeclare var console: any;\nlet b = new B();\nconsole.log(b.c.d);","signature":"-3531856636-export {};\n","impliedFormat":1},{"version":"-7804761415-export class D { }","signature":"-8611429667-export declare class D {\n}\n","impliedFormat":1}],"root":[[2,5]],"options":{"declaration":true},"fileIdsList":[[3],[2]],"referencedMap":[[4,1],[3,2]],"semanticDiagnosticsPerFile":[1,3,5],"affectedFilesPendingEmit":[[4],2],"changeFileSet":[2]},"version":"FakeTSVersion"} +{"program":{"fileNames":["../../../../a/lib/lib.d.ts","./c.ts","./b.ts","./a.ts","./d.ts"],"fileInfos":[{"version":"-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }","affectsGlobalScope":true,"impliedFormat":1},{"version":"-8116587914-export var C = class CReal {\n d = 1;\n};export function foo() {}","signature":"-2874569268-export declare var C: {\n new (): {\n d: number;\n };\n};\n","impliedFormat":1},{"version":"-6441446591-import {C} from './c';\nexport class B {\n c = new C();\n}","signature":"-12916012021-export declare class B {\n c: {\n d: number;\n };\n}\n","impliedFormat":1},{"version":"4878398349-import {B} from './b';\ndeclare var console: any;\nlet b = new B();\nconsole.log(b.c.d);","signature":"-3531856636-export {};\n","impliedFormat":1},{"version":"-7804761415-export class D { }","signature":"-8611429667-export declare class D {\n}\n","impliedFormat":1}],"root":[[2,5]],"options":{"declaration":true},"fileIdsList":[[3],[2]],"referencedMap":[[4,1],[3,2]],"semanticDiagnosticsPerFile":[1,4,3,5],"changeFileSet":[2]},"version":"FakeTSVersion"} //// [/user/username/projects/myproject/tsconfig.tsbuildinfo.readable.baseline.txt] { @@ -307,22 +309,22 @@ Operation ws cancelled:: true }, "./c.ts": { "original": { - "version": "840271342-export class C {\n d = 1;\n}export function foo() {}", - "signature": "-6977846840-export declare class C {\n d: number;\n}\n", + "version": "-8116587914-export var C = class CReal {\n d = 1;\n};export function foo() {}", + "signature": "-2874569268-export declare var C: {\n new (): {\n d: number;\n };\n};\n", "impliedFormat": 1 }, - "version": "840271342-export class C {\n d = 1;\n}export function foo() {}", - "signature": "-6977846840-export declare class C {\n d: number;\n}\n", + "version": "-8116587914-export var C = class CReal {\n d = 1;\n};export function foo() {}", + "signature": "-2874569268-export declare var C: {\n new (): {\n d: number;\n };\n};\n", "impliedFormat": "commonjs" }, "./b.ts": { "original": { "version": "-6441446591-import {C} from './c';\nexport class B {\n c = new C();\n}", - "signature": "-165097315-import { C } from './c';\nexport declare class B {\n c: C;\n}\n", + "signature": "-12916012021-export declare class B {\n c: {\n d: number;\n };\n}\n", "impliedFormat": 1 }, "version": "-6441446591-import {C} from './c';\nexport class B {\n c = new C();\n}", - "signature": "-165097315-import { C } from './c';\nexport declare class B {\n c: C;\n}\n", + "signature": "-12916012021-export declare class B {\n c: {\n d: number;\n };\n}\n", "impliedFormat": "commonjs" }, "./a.ts": { @@ -373,27 +375,16 @@ Operation ws cancelled:: true }, "semanticDiagnosticsPerFile": [ "../../../../a/lib/lib.d.ts", + "./a.ts", "./b.ts", "./d.ts" ], - "affectedFilesPendingEmit": [ - [ - [ - "./a.ts" - ], - "Dts" - ], - [ - "./c.ts", - "Js | Dts" - ] - ], "changeFileSet": [ "./c.ts" ] }, "version": "FakeTSVersion", - "size": 1399 + "size": 1411 } @@ -418,12 +409,8 @@ Program files:: Semantic diagnostics in builder refreshed for:: /user/username/projects/myproject/c.ts -/user/username/projects/myproject/a.ts -Shape signatures in builder refreshed for:: -/user/username/projects/myproject/c.ts (computed .d.ts) -/user/username/projects/myproject/b.ts (computed .d.ts) -/user/username/projects/myproject/a.ts (used version) +No shapes updated in the builder:: exitCode:: ExitStatus.undefined @@ -436,20 +423,21 @@ Input:: Object.defineProperty(exports, "__esModule", { value: true }); exports.C = void 0; exports.foo = foo; -var C = /** @class */ (function () { - function C() { +exports.C = /** @class */ (function () { + function CReal() { this.d = 1; } - return C; + return CReal; }()); -exports.C = C; function foo() { } //// [/user/username/projects/myproject/c.d.ts] -export declare class C { - d: number; -} +export declare var C: { + new (): { + d: number; + }; +}; export declare function foo(): void; @@ -457,7 +445,7 @@ export declare function foo(): void; //// [/user/username/projects/myproject/b.d.ts] file written with same contents //// [/user/username/projects/myproject/a.d.ts] file written with same contents //// [/user/username/projects/myproject/tsconfig.tsbuildinfo] -{"program":{"fileNames":["../../../../a/lib/lib.d.ts","./c.ts","./b.ts","./a.ts","./d.ts"],"fileInfos":[{"version":"-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }","affectsGlobalScope":true,"impliedFormat":1},{"version":"840271342-export class C {\n d = 1;\n}export function foo() {}","signature":"-7819740442-export declare class C {\n d: number;\n}\nexport declare function foo(): void;\n","impliedFormat":1},{"version":"-6441446591-import {C} from './c';\nexport class B {\n c = new C();\n}","signature":"-165097315-import { C } from './c';\nexport declare class B {\n c: C;\n}\n","impliedFormat":1},{"version":"4878398349-import {B} from './b';\ndeclare var console: any;\nlet b = new B();\nconsole.log(b.c.d);","signature":"-3531856636-export {};\n","impliedFormat":1},{"version":"-7804761415-export class D { }","signature":"-8611429667-export declare class D {\n}\n","impliedFormat":1}],"root":[[2,5]],"options":{"declaration":true},"fileIdsList":[[3],[2]],"referencedMap":[[4,1],[3,2]],"semanticDiagnosticsPerFile":[1,4,3,2,5]},"version":"FakeTSVersion"} +{"program":{"fileNames":["../../../../a/lib/lib.d.ts","./c.ts","./b.ts","./a.ts","./d.ts"],"fileInfos":[{"version":"-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }","affectsGlobalScope":true,"impliedFormat":1},{"version":"-8116587914-export var C = class CReal {\n d = 1;\n};export function foo() {}","signature":"-544179862-export declare var C: {\n new (): {\n d: number;\n };\n};\nexport declare function foo(): void;\n","impliedFormat":1},{"version":"-6441446591-import {C} from './c';\nexport class B {\n c = new C();\n}","signature":"-12916012021-export declare class B {\n c: {\n d: number;\n };\n}\n","impliedFormat":1},{"version":"4878398349-import {B} from './b';\ndeclare var console: any;\nlet b = new B();\nconsole.log(b.c.d);","signature":"-3531856636-export {};\n","impliedFormat":1},{"version":"-7804761415-export class D { }","signature":"-8611429667-export declare class D {\n}\n","impliedFormat":1}],"root":[[2,5]],"options":{"declaration":true},"fileIdsList":[[3],[2]],"referencedMap":[[4,1],[3,2]],"semanticDiagnosticsPerFile":[1,4,3,2,5]},"version":"FakeTSVersion"} //// [/user/username/projects/myproject/tsconfig.tsbuildinfo.readable.baseline.txt] { @@ -491,22 +479,22 @@ export declare function foo(): void; }, "./c.ts": { "original": { - "version": "840271342-export class C {\n d = 1;\n}export function foo() {}", - "signature": "-7819740442-export declare class C {\n d: number;\n}\nexport declare function foo(): void;\n", + "version": "-8116587914-export var C = class CReal {\n d = 1;\n};export function foo() {}", + "signature": "-544179862-export declare var C: {\n new (): {\n d: number;\n };\n};\nexport declare function foo(): void;\n", "impliedFormat": 1 }, - "version": "840271342-export class C {\n d = 1;\n}export function foo() {}", - "signature": "-7819740442-export declare class C {\n d: number;\n}\nexport declare function foo(): void;\n", + "version": "-8116587914-export var C = class CReal {\n d = 1;\n};export function foo() {}", + "signature": "-544179862-export declare var C: {\n new (): {\n d: number;\n };\n};\nexport declare function foo(): void;\n", "impliedFormat": "commonjs" }, "./b.ts": { "original": { "version": "-6441446591-import {C} from './c';\nexport class B {\n c = new C();\n}", - "signature": "-165097315-import { C } from './c';\nexport declare class B {\n c: C;\n}\n", + "signature": "-12916012021-export declare class B {\n c: {\n d: number;\n };\n}\n", "impliedFormat": 1 }, "version": "-6441446591-import {C} from './c';\nexport class B {\n c = new C();\n}", - "signature": "-165097315-import { C } from './c';\nexport declare class B {\n c: C;\n}\n", + "signature": "-12916012021-export declare class B {\n c: {\n d: number;\n };\n}\n", "impliedFormat": "commonjs" }, "./a.ts": { @@ -564,7 +552,7 @@ export declare function foo(): void; ] }, "version": "FakeTSVersion", - "size": 1386 + "size": 1430 }