diff --git a/src/compiler/builder.ts b/src/compiler/builder.ts index fb26968e3983b..d820d9edf2b9c 100644 --- a/src/compiler/builder.ts +++ b/src/compiler/builder.ts @@ -50,6 +50,7 @@ import { getOptionsNameMap, getOwnKeys, getRelativePathFromDirectory, + getSourceFileOfNode, getTsBuildInfoEmitOutputFilePath, handleNoEmitOptions, HostForComputeHash, @@ -74,10 +75,13 @@ import { sameMap, SemanticDiagnosticsBuilderProgram, SignatureInfo, + skipAlias, skipTypeChecking, + some, SourceFile, sourceFileMayBeEmitted, SourceMapEmitResult, + SymbolFlags, toPath, tryAddToSet, WriteFileCallback, @@ -762,6 +766,7 @@ function handleDtsMayChangeOfAffectedFile( function handleDtsMayChangeOf( state: BuilderProgramState, path: Path, + invalidateJsFiles: boolean, cancellationToken: CancellationToken | undefined, host: BuilderProgramHost, ): void { @@ -785,7 +790,10 @@ function handleDtsMayChangeOf( /*useFileVersionAsSignature*/ true, ); // If not dts emit, nothing more to do - if (getEmitDeclarations(state.compilerOptions)) { + if (invalidateJsFiles) { + addToAffectedFilesPendingEmit(state, path, getBuilderFileEmit(state.compilerOptions)); + } + else if (getEmitDeclarations(state.compilerOptions)) { addToAffectedFilesPendingEmit(state, path, state.compilerOptions.declarationMap ? BuilderFileEmit.AllDts : BuilderFileEmit.Dts); } } @@ -814,6 +822,7 @@ function isChangedSignature(state: BuilderProgramState, path: Path) { function handleDtsMayChangeOfGlobalScope( state: BuilderProgramState, filePath: Path, + invalidateJsFiles: boolean, cancellationToken: CancellationToken | undefined, host: BuilderProgramHost, ): boolean { @@ -824,6 +833,7 @@ function handleDtsMayChangeOfGlobalScope( handleDtsMayChangeOf( state, file.resolvedPath, + invalidateJsFiles, cancellationToken, host, ) @@ -856,8 +866,16 @@ function handleDtsMayChangeOfReferencingExportOfAffectedFile( const currentPath = queue.pop()!; if (!seenFileNamesMap.has(currentPath)) { seenFileNamesMap.set(currentPath, true); - if (handleDtsMayChangeOfGlobalScope(state, currentPath, cancellationToken, host)) return; - handleDtsMayChangeOf(state, currentPath, cancellationToken, host); + if ( + handleDtsMayChangeOfGlobalScope( + state, + currentPath, + /*invalidateJsFiles*/ false, + cancellationToken, + host, + ) + ) return; + handleDtsMayChangeOf(state, currentPath, /*invalidateJsFiles*/ false, cancellationToken, host); if (isChangedSignature(state, currentPath)) { const currentSourceFile = Debug.checkDefined(state.program).getSourceFileByPath(currentPath)!; queue.push(...BuilderState.getReferencedByPaths(state, currentSourceFile.resolvedPath)); @@ -867,14 +885,26 @@ function handleDtsMayChangeOfReferencingExportOfAffectedFile( } const seenFileAndExportsOfFile = new Set(); + // If exported const enum, we need to ensure that js files are emitted as well since the const enum value changed + const invalidateJsFiles = !!affectedFile.symbol?.exports && !!forEachEntry( + affectedFile.symbol.exports, + exported => { + if ((exported.flags & SymbolFlags.ConstEnum) !== 0) return true; + const aliased = skipAlias(exported, state.program!.getTypeChecker()); + if (aliased === exported) return false; + return (aliased.flags & SymbolFlags.ConstEnum) !== 0 && + some(aliased.declarations, d => getSourceFileOfNode(d) === affectedFile); + }, + ); // Go through files that reference affected file and handle dts emit and semantic diagnostics for them and their references state.referencedMap.getKeys(affectedFile.resolvedPath)?.forEach(exportedFromPath => { - if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, host)) return true; + if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, invalidateJsFiles, cancellationToken, host)) return true; const references = state.referencedMap!.getKeys(exportedFromPath); return references && forEachKey(references, filePath => handleDtsMayChangeOfFileAndExportsOfFile( state, filePath, + invalidateJsFiles, seenFileAndExportsOfFile, cancellationToken, host, @@ -889,20 +919,22 @@ function handleDtsMayChangeOfReferencingExportOfAffectedFile( function handleDtsMayChangeOfFileAndExportsOfFile( state: BuilderProgramState, filePath: Path, + invalidateJsFiles: boolean, seenFileAndExportsOfFile: Set, cancellationToken: CancellationToken | undefined, host: BuilderProgramHost, ): boolean | undefined { if (!tryAddToSet(seenFileAndExportsOfFile, filePath)) return undefined; - if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, host)) return true; - handleDtsMayChangeOf(state, filePath, cancellationToken, host); + if (handleDtsMayChangeOfGlobalScope(state, filePath, invalidateJsFiles, cancellationToken, host)) return true; + handleDtsMayChangeOf(state, filePath, invalidateJsFiles, cancellationToken, host); // Remove the diagnostics of files that import this file and handle all its exports too state.referencedMap!.getKeys(filePath)?.forEach(referencingFilePath => handleDtsMayChangeOfFileAndExportsOfFile( state, referencingFilePath, + invalidateJsFiles, seenFileAndExportsOfFile, cancellationToken, host, diff --git a/src/testRunner/unittests/tsc/incremental.ts b/src/testRunner/unittests/tsc/incremental.ts index 1d6eeecc774d3..19799b6eecd34 100644 --- a/src/testRunner/unittests/tsc/incremental.ts +++ b/src/testRunner/unittests/tsc/incremental.ts @@ -1,6 +1,6 @@ import * as ts from "../../_namespaces/ts.js"; -import * as Utils from "../../_namespaces/Utils.js"; -import * as vfs from "../../_namespaces/vfs.js"; +import { dedent } from "../../_namespaces/Utils.js"; +import { FileSystem } from "../../_namespaces/vfs.js"; import { jsonToReadableText } from "../helpers.js"; import { compilerOptionsToConfigJson, @@ -27,7 +27,7 @@ describe("unittests:: tsc:: incremental::", () => { fs: () => loadProjectFromFiles({ "/src/project/src/main.ts": "export const x = 10;", - "/src/project/tsconfig.json": Utils.dedent` + "/src/project/tsconfig.json": dedent` { "compilerOptions": { "target": "es5", @@ -48,7 +48,7 @@ describe("unittests:: tsc:: incremental::", () => { fs: () => loadProjectFromFiles({ "/src/project/src/main.ts": "export const x = 10;", - "/src/project/tsconfig.json": Utils.dedent` + "/src/project/tsconfig.json": dedent` { "compilerOptions": { "incremental": true, @@ -85,7 +85,7 @@ describe("unittests:: tsc:: incremental::", () => { fs: () => loadProjectFromFiles({ "/src/project/src/main.ts": "export const x = 10;", - "/src/project/tsconfig.json": Utils.dedent` + "/src/project/tsconfig.json": dedent` { "compilerOptions": { "incremental": true, @@ -115,7 +115,7 @@ describe("unittests:: tsc:: incremental::", () => { }); describe("with noEmitOnError", () => { - let projFs: vfs.FileSystem; + let projFs: FileSystem; before(() => { projFs = getFsForNoEmitOnError(); }); @@ -275,25 +275,25 @@ const a: string = 10;`, function fs() { return loadProjectFromFiles({ - "/src/project/src/class.ts": Utils.dedent` + "/src/project/src/class.ts": dedent` export class classC { prop = 1; }`, - "/src/project/src/indirectClass.ts": Utils.dedent` + "/src/project/src/indirectClass.ts": dedent` import { classC } from './class'; export class indirectClass { classC = new classC(); }`, - "/src/project/src/directUse.ts": Utils.dedent` + "/src/project/src/directUse.ts": dedent` import { indirectClass } from './indirectClass'; new indirectClass().classC.prop;`, - "/src/project/src/indirectUse.ts": Utils.dedent` + "/src/project/src/indirectUse.ts": dedent` import { indirectClass } from './indirectClass'; new indirectClass().classC.prop;`, - "/src/project/src/noChangeFile.ts": Utils.dedent` + "/src/project/src/noChangeFile.ts": dedent` export function writeLog(s: string) { }`, - "/src/project/src/noChangeFileWithEmitSpecificError.ts": Utils.dedent` + "/src/project/src/noChangeFileWithEmitSpecificError.ts": dedent` function someFunc(arguments: boolean, ...rest: any[]) { }`, "/src/project/tsconfig.json": jsonToReadableText({ compilerOptions }), @@ -307,12 +307,12 @@ const a: string = 10;`, subScenario: `when global file is added, the signatures are updated`, fs: () => loadProjectFromFiles({ - "/src/project/src/main.ts": Utils.dedent` + "/src/project/src/main.ts": dedent` /// /// function main() { } `, - "/src/project/src/anotherFileWithSameReferenes.ts": Utils.dedent` + "/src/project/src/anotherFileWithSameReferenes.ts": dedent` /// /// function anotherFileWithSameReferenes() { } @@ -495,7 +495,7 @@ declare global { module: "esnext", }, }), - "/src/project/index.tsx": Utils.dedent` + "/src/project/index.tsx": dedent` declare namespace JSX { interface ElementChildrenAttribute { children: {}; } interface IntrinsicElements { div: {} } @@ -518,7 +518,7 @@ declare global { subScenario: "ts file with no-default-lib that augments the global scope", fs: () => loadProjectFromFiles({ - "/src/project/src/main.ts": Utils.dedent` + "/src/project/src/main.ts": dedent` /// /// @@ -529,7 +529,7 @@ declare global { export {}; `, - "/src/project/tsconfig.json": Utils.dedent` + "/src/project/tsconfig.json": dedent` { "compilerOptions": { "target": "ESNext", @@ -590,12 +590,12 @@ console.log(a);`, fs: () => loadProjectFromFiles({ "/src/project/tsconfig.json": jsonToReadableText({ compilerOptions: { declaration } }), - "/src/project/main.ts": Utils.dedent` + "/src/project/main.ts": dedent` import MessageablePerson from './MessageablePerson.js'; function logMessage( person: MessageablePerson ) { console.log( person.message ); }`, - "/src/project/MessageablePerson.ts": Utils.dedent` + "/src/project/MessageablePerson.ts": dedent` const Messageable = () => { return class MessageableClass { public message = 'hello'; @@ -609,7 +609,7 @@ console.log(a);`, appendText( fs, "/lib/lib.d.ts", - Utils.dedent` + dedent` type ReturnType any> = T extends (...args: any) => infer R ? R : any; type InstanceType any> = T extends abstract new (...args: any) => infer R ? R : any;`, ), @@ -922,12 +922,12 @@ console.log(a);`, }, include: ["src"], }), - "/src/project/src/box.ts": Utils.dedent` + "/src/project/src/box.ts": dedent` export interface Box { unbox(): T } `, - "/src/project/src/bug.js": Utils.dedent` + "/src/project/src/bug.js": dedent` import * as B from "./box.js" import * as W from "./wrap.js" @@ -947,7 +947,7 @@ console.log(a);`, export const bug = wrap({ n: box(1) }); `, - "/src/project/src/wrap.ts": Utils.dedent` + "/src/project/src/wrap.ts": dedent` export type Wrap = { [K in keyof C]: { wrapped: C[K] } } @@ -974,14 +974,14 @@ console.log(a);`, skipDefaultLibCheck: true, }, }), - "/src/project/index.ts": Utils.dedent` + "/src/project/index.ts": dedent` import ky from 'ky'; export const api = ky.extend({}); `, "/src/project/package.json": jsonToReadableText({ type: "module", }), - "/src/project/node_modules/ky/distribution/index.d.ts": Utils.dedent` + "/src/project/node_modules/ky/distribution/index.d.ts": dedent` type KyInstance = { extend(options: Record): KyInstance; } @@ -1003,4 +1003,79 @@ console.log(a);`, }, ], }); + + describe("with const enums", () => { + enum AliasType { + None = "", + SameFile = "aliased ", + DifferentFile = "aliased in different file ", + } + function fileWithEnum(withAlias: AliasType) { + return withAlias !== AliasType.DifferentFile ? "/src/project/b.d.ts" : "/src/project/worker.d.ts"; + } + function verify(withAlias: AliasType, preserveConstEnums: boolean) { + verifyTsc({ + scenario: "incremental", + subScenario: `with ${withAlias}const enums${preserveConstEnums ? " with preserveConstEnums" : ""}`, + commandLineArgs: ["-i", `/src/project/a.ts`, "--tsbuildinfofile", "/src/project/a.tsbuildinfo", ...preserveConstEnums ? ["--preserveConstEnums"] : []], + fs: () => + loadProjectFromFiles({ + "/src/project/a.ts": dedent` + import {A} from "./c" + let a = A.ONE + `, + "/src/project/b.d.ts": withAlias === AliasType.SameFile ? + dedent` + declare const enum AWorker { + ONE = 1 + } + export { AWorker as A }; + ` : + withAlias === AliasType.DifferentFile ? + dedent` + export { AWorker as A } from "./worker"; + ` : + dedent` + export const enum A { + ONE = 1 + } + `, + "/src/project/c.ts": dedent` + import {A} from "./b" + let b = A.ONE + export {A} + `, + "/src/project/worker.d.ts": dedent` + export const enum AWorker { + ONE = 1 + } + `, + }), + edits: [ + { + caption: "change enum value", + edit: fs => replaceText(fs, fileWithEnum(withAlias), "1", "2"), + }, + { + caption: "change enum value again", + edit: fs => replaceText(fs, fileWithEnum(withAlias), "2", "3"), + }, + { + caption: "something else changes in b.d.ts", + edit: fs => appendText(fs, "/src/project/b.d.ts", "export const randomThing = 10;"), + }, + { + caption: "something else changes in b.d.ts again", + edit: fs => appendText(fs, "/src/project/b.d.ts", "export const randomThing2 = 10;"), + }, + ], + }); + } + verify(/*withAlias*/ AliasType.None, /*preserveConstEnums*/ false); + verify(/*withAlias*/ AliasType.SameFile, /*preserveConstEnums*/ false); + verify(/*withAlias*/ AliasType.DifferentFile, /*preserveConstEnums*/ false); + verify(/*withAlias*/ AliasType.None, /*preserveConstEnums*/ true); + verify(/*withAlias*/ AliasType.SameFile, /*preserveConstEnums*/ true); + verify(/*withAlias*/ AliasType.DifferentFile, /*preserveConstEnums*/ true); + }); }); diff --git a/tests/baselines/reference/tsc/incremental/with-aliased-const-enums-with-preserveConstEnums.js b/tests/baselines/reference/tsc/incremental/with-aliased-const-enums-with-preserveConstEnums.js new file mode 100644 index 0000000000000..10acc4d96abda --- /dev/null +++ b/tests/baselines/reference/tsc/incremental/with-aliased-const-enums-with-preserveConstEnums.js @@ -0,0 +1,619 @@ +currentDirectory:: / useCaseSensitiveFileNames: false +Input:: +//// [/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +declare const console: { log(msg: any): void; }; + +//// [/src/project/a.ts] +import {A} from "./c" +let a = A.ONE + + +//// [/src/project/b.d.ts] +declare const enum AWorker { + ONE = 1 +} +export { AWorker as A }; + + +//// [/src/project/c.ts] +import {A} from "./b" +let b = A.ONE +export {A} + + +//// [/src/project/worker.d.ts] +export const enum AWorker { + ONE = 1 +} + + + + +Output:: +/lib/tsc -i /src/project/a.ts --tsbuildinfofile /src/project/a.tsbuildinfo --preserveConstEnums +exitCode:: ExitStatus.Success + + +//// [/src/project/a.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var a = 1 /* A.ONE */; + + +//// [/src/project/a.tsbuildinfo] +{"program":{"fileNames":["../../lib/lib.d.ts","./b.d.ts","./c.ts","./a.ts"],"fileInfos":[{"version":"3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedFormat":1},{"version":"-8804827199-declare const enum AWorker {\n ONE = 1\n}\nexport { AWorker as A };\n","impliedFormat":1},{"version":"-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n","impliedFormat":1},{"version":"-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n","impliedFormat":1}],"root":[4],"options":{"preserveConstEnums":true,"tsBuildInfoFile":"./a.tsbuildinfo"},"fileIdsList":[[3],[2]],"referencedMap":[[4,1],[3,2]],"semanticDiagnosticsPerFile":[1,4,2,3]},"version":"FakeTSVersion"} + +//// [/src/project/a.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../lib/lib.d.ts", + "./b.d.ts", + "./c.ts", + "./a.ts" + ], + "fileNamesList": [ + [ + "./c.ts" + ], + [ + "./b.d.ts" + ] + ], + "fileInfos": { + "../../lib/lib.d.ts": { + "original": { + "version": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": 1 + }, + "version": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + }, + "./b.d.ts": { + "original": { + "version": "-8804827199-declare const enum AWorker {\n ONE = 1\n}\nexport { AWorker as A };\n", + "impliedFormat": 1 + }, + "version": "-8804827199-declare const enum AWorker {\n ONE = 1\n}\nexport { AWorker as A };\n", + "signature": "-8804827199-declare const enum AWorker {\n ONE = 1\n}\nexport { AWorker as A };\n", + "impliedFormat": "commonjs" + }, + "./c.ts": { + "original": { + "version": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "impliedFormat": 1 + }, + "version": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "signature": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "impliedFormat": "commonjs" + }, + "./a.ts": { + "original": { + "version": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "impliedFormat": 1 + }, + "version": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "signature": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "impliedFormat": "commonjs" + } + }, + "root": [ + [ + 4, + "./a.ts" + ] + ], + "options": { + "preserveConstEnums": true, + "tsBuildInfoFile": "./a.tsbuildinfo" + }, + "referencedMap": { + "./a.ts": [ + "./c.ts" + ], + "./c.ts": [ + "./b.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./a.ts", + "./b.d.ts", + "./c.ts" + ] + }, + "version": "FakeTSVersion", + "size": 1091 +} + +//// [/src/project/c.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.A = void 0; +var b_1 = require("./b"); +Object.defineProperty(exports, "A", { enumerable: true, get: function () { return b_1.A; } }); +var b = 1 /* A.ONE */; + + + + +Change:: change enum value +Input:: +//// [/src/project/b.d.ts] +declare const enum AWorker { + ONE = 2 +} +export { AWorker as A }; + + + + +Output:: +/lib/tsc -i /src/project/a.ts --tsbuildinfofile /src/project/a.tsbuildinfo --preserveConstEnums +exitCode:: ExitStatus.Success + + +//// [/src/project/a.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var a = 2 /* A.ONE */; + + +//// [/src/project/a.tsbuildinfo] +{"program":{"fileNames":["../../lib/lib.d.ts","./b.d.ts","./c.ts","./a.ts"],"fileInfos":[{"version":"3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedFormat":1},{"version":"-13802607806-declare const enum AWorker {\n ONE = 2\n}\nexport { AWorker as A };\n","impliedFormat":1},{"version":"-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n","signature":"3259150197-import { A } from \"./b\";\nexport { A };\n","impliedFormat":1},{"version":"-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n","signature":"-3531856636-export {};\n","impliedFormat":1}],"root":[4],"options":{"preserveConstEnums":true,"tsBuildInfoFile":"./a.tsbuildinfo"},"fileIdsList":[[3],[2]],"referencedMap":[[4,1],[3,2]],"semanticDiagnosticsPerFile":[1,4,2,3]},"version":"FakeTSVersion"} + +//// [/src/project/a.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../lib/lib.d.ts", + "./b.d.ts", + "./c.ts", + "./a.ts" + ], + "fileNamesList": [ + [ + "./c.ts" + ], + [ + "./b.d.ts" + ] + ], + "fileInfos": { + "../../lib/lib.d.ts": { + "original": { + "version": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": 1 + }, + "version": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + }, + "./b.d.ts": { + "original": { + "version": "-13802607806-declare const enum AWorker {\n ONE = 2\n}\nexport { AWorker as A };\n", + "impliedFormat": 1 + }, + "version": "-13802607806-declare const enum AWorker {\n ONE = 2\n}\nexport { AWorker as A };\n", + "signature": "-13802607806-declare const enum AWorker {\n ONE = 2\n}\nexport { AWorker as A };\n", + "impliedFormat": "commonjs" + }, + "./c.ts": { + "original": { + "version": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "signature": "3259150197-import { A } from \"./b\";\nexport { A };\n", + "impliedFormat": 1 + }, + "version": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "signature": "3259150197-import { A } from \"./b\";\nexport { A };\n", + "impliedFormat": "commonjs" + }, + "./a.ts": { + "original": { + "version": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "signature": "-3531856636-export {};\n", + "impliedFormat": 1 + }, + "version": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "signature": "-3531856636-export {};\n", + "impliedFormat": "commonjs" + } + }, + "root": [ + [ + 4, + "./a.ts" + ] + ], + "options": { + "preserveConstEnums": true, + "tsBuildInfoFile": "./a.tsbuildinfo" + }, + "referencedMap": { + "./a.ts": [ + "./c.ts" + ], + "./c.ts": [ + "./b.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./a.ts", + "./b.d.ts", + "./c.ts" + ] + }, + "version": "FakeTSVersion", + "size": 1200 +} + +//// [/src/project/c.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.A = void 0; +var b_1 = require("./b"); +Object.defineProperty(exports, "A", { enumerable: true, get: function () { return b_1.A; } }); +var b = 2 /* A.ONE */; + + + + +Change:: change enum value again +Input:: +//// [/src/project/b.d.ts] +declare const enum AWorker { + ONE = 3 +} +export { AWorker as A }; + + + + +Output:: +/lib/tsc -i /src/project/a.ts --tsbuildinfofile /src/project/a.tsbuildinfo --preserveConstEnums +exitCode:: ExitStatus.Success + + +//// [/src/project/a.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var a = 3 /* A.ONE */; + + +//// [/src/project/a.tsbuildinfo] +{"program":{"fileNames":["../../lib/lib.d.ts","./b.d.ts","./c.ts","./a.ts"],"fileInfos":[{"version":"3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedFormat":1},{"version":"-10210453821-declare const enum AWorker {\n ONE = 3\n}\nexport { AWorker as A };\n","impliedFormat":1},{"version":"-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n","signature":"3259150197-import { A } from \"./b\";\nexport { A };\n","impliedFormat":1},{"version":"-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n","impliedFormat":1}],"root":[4],"options":{"preserveConstEnums":true,"tsBuildInfoFile":"./a.tsbuildinfo"},"fileIdsList":[[3],[2]],"referencedMap":[[4,1],[3,2]],"semanticDiagnosticsPerFile":[1,4,2,3]},"version":"FakeTSVersion"} + +//// [/src/project/a.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../lib/lib.d.ts", + "./b.d.ts", + "./c.ts", + "./a.ts" + ], + "fileNamesList": [ + [ + "./c.ts" + ], + [ + "./b.d.ts" + ] + ], + "fileInfos": { + "../../lib/lib.d.ts": { + "original": { + "version": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": 1 + }, + "version": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + }, + "./b.d.ts": { + "original": { + "version": "-10210453821-declare const enum AWorker {\n ONE = 3\n}\nexport { AWorker as A };\n", + "impliedFormat": 1 + }, + "version": "-10210453821-declare const enum AWorker {\n ONE = 3\n}\nexport { AWorker as A };\n", + "signature": "-10210453821-declare const enum AWorker {\n ONE = 3\n}\nexport { AWorker as A };\n", + "impliedFormat": "commonjs" + }, + "./c.ts": { + "original": { + "version": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "signature": "3259150197-import { A } from \"./b\";\nexport { A };\n", + "impliedFormat": 1 + }, + "version": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "signature": "3259150197-import { A } from \"./b\";\nexport { A };\n", + "impliedFormat": "commonjs" + }, + "./a.ts": { + "original": { + "version": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "impliedFormat": 1 + }, + "version": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "signature": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "impliedFormat": "commonjs" + } + }, + "root": [ + [ + 4, + "./a.ts" + ] + ], + "options": { + "preserveConstEnums": true, + "tsBuildInfoFile": "./a.tsbuildinfo" + }, + "referencedMap": { + "./a.ts": [ + "./c.ts" + ], + "./c.ts": [ + "./b.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./a.ts", + "./b.d.ts", + "./c.ts" + ] + }, + "version": "FakeTSVersion", + "size": 1161 +} + +//// [/src/project/c.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.A = void 0; +var b_1 = require("./b"); +Object.defineProperty(exports, "A", { enumerable: true, get: function () { return b_1.A; } }); +var b = 3 /* A.ONE */; + + + + +Change:: something else changes in b.d.ts +Input:: +//// [/src/project/b.d.ts] +declare const enum AWorker { + ONE = 3 +} +export { AWorker as A }; +export const randomThing = 10; + + + +Output:: +/lib/tsc -i /src/project/a.ts --tsbuildinfofile /src/project/a.tsbuildinfo --preserveConstEnums +exitCode:: ExitStatus.Success + + +//// [/src/project/a.js] file written with same contents +//// [/src/project/a.tsbuildinfo] +{"program":{"fileNames":["../../lib/lib.d.ts","./b.d.ts","./c.ts","./a.ts"],"fileInfos":[{"version":"3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedFormat":1},{"version":"-11645711104-declare const enum AWorker {\n ONE = 3\n}\nexport { AWorker as A };\nexport const randomThing = 10;","impliedFormat":1},{"version":"-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n","signature":"3259150197-import { A } from \"./b\";\nexport { A };\n","impliedFormat":1},{"version":"-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n","impliedFormat":1}],"root":[4],"options":{"preserveConstEnums":true,"tsBuildInfoFile":"./a.tsbuildinfo"},"fileIdsList":[[3],[2]],"referencedMap":[[4,1],[3,2]],"semanticDiagnosticsPerFile":[1,4,2,3]},"version":"FakeTSVersion"} + +//// [/src/project/a.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../lib/lib.d.ts", + "./b.d.ts", + "./c.ts", + "./a.ts" + ], + "fileNamesList": [ + [ + "./c.ts" + ], + [ + "./b.d.ts" + ] + ], + "fileInfos": { + "../../lib/lib.d.ts": { + "original": { + "version": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": 1 + }, + "version": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + }, + "./b.d.ts": { + "original": { + "version": "-11645711104-declare const enum AWorker {\n ONE = 3\n}\nexport { AWorker as A };\nexport const randomThing = 10;", + "impliedFormat": 1 + }, + "version": "-11645711104-declare const enum AWorker {\n ONE = 3\n}\nexport { AWorker as A };\nexport const randomThing = 10;", + "signature": "-11645711104-declare const enum AWorker {\n ONE = 3\n}\nexport { AWorker as A };\nexport const randomThing = 10;", + "impliedFormat": "commonjs" + }, + "./c.ts": { + "original": { + "version": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "signature": "3259150197-import { A } from \"./b\";\nexport { A };\n", + "impliedFormat": 1 + }, + "version": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "signature": "3259150197-import { A } from \"./b\";\nexport { A };\n", + "impliedFormat": "commonjs" + }, + "./a.ts": { + "original": { + "version": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "impliedFormat": 1 + }, + "version": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "signature": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "impliedFormat": "commonjs" + } + }, + "root": [ + [ + 4, + "./a.ts" + ] + ], + "options": { + "preserveConstEnums": true, + "tsBuildInfoFile": "./a.tsbuildinfo" + }, + "referencedMap": { + "./a.ts": [ + "./c.ts" + ], + "./c.ts": [ + "./b.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./a.ts", + "./b.d.ts", + "./c.ts" + ] + }, + "version": "FakeTSVersion", + "size": 1191 +} + +//// [/src/project/c.js] file written with same contents + + +Change:: something else changes in b.d.ts again +Input:: +//// [/src/project/b.d.ts] +declare const enum AWorker { + ONE = 3 +} +export { AWorker as A }; +export const randomThing = 10;export const randomThing2 = 10; + + + +Output:: +/lib/tsc -i /src/project/a.ts --tsbuildinfofile /src/project/a.tsbuildinfo --preserveConstEnums +exitCode:: ExitStatus.Success + + +//// [/src/project/a.js] file written with same contents +//// [/src/project/a.tsbuildinfo] +{"program":{"fileNames":["../../lib/lib.d.ts","./b.d.ts","./c.ts","./a.ts"],"fileInfos":[{"version":"3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedFormat":1},{"version":"-19677125073-declare const enum AWorker {\n ONE = 3\n}\nexport { AWorker as A };\nexport const randomThing = 10;export const randomThing2 = 10;","impliedFormat":1},{"version":"-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n","signature":"3259150197-import { A } from \"./b\";\nexport { A };\n","impliedFormat":1},{"version":"-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n","impliedFormat":1}],"root":[4],"options":{"preserveConstEnums":true,"tsBuildInfoFile":"./a.tsbuildinfo"},"fileIdsList":[[3],[2]],"referencedMap":[[4,1],[3,2]],"semanticDiagnosticsPerFile":[1,4,2,3]},"version":"FakeTSVersion"} + +//// [/src/project/a.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../lib/lib.d.ts", + "./b.d.ts", + "./c.ts", + "./a.ts" + ], + "fileNamesList": [ + [ + "./c.ts" + ], + [ + "./b.d.ts" + ] + ], + "fileInfos": { + "../../lib/lib.d.ts": { + "original": { + "version": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": 1 + }, + "version": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + }, + "./b.d.ts": { + "original": { + "version": "-19677125073-declare const enum AWorker {\n ONE = 3\n}\nexport { AWorker as A };\nexport const randomThing = 10;export const randomThing2 = 10;", + "impliedFormat": 1 + }, + "version": "-19677125073-declare const enum AWorker {\n ONE = 3\n}\nexport { AWorker as A };\nexport const randomThing = 10;export const randomThing2 = 10;", + "signature": "-19677125073-declare const enum AWorker {\n ONE = 3\n}\nexport { AWorker as A };\nexport const randomThing = 10;export const randomThing2 = 10;", + "impliedFormat": "commonjs" + }, + "./c.ts": { + "original": { + "version": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "signature": "3259150197-import { A } from \"./b\";\nexport { A };\n", + "impliedFormat": 1 + }, + "version": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "signature": "3259150197-import { A } from \"./b\";\nexport { A };\n", + "impliedFormat": "commonjs" + }, + "./a.ts": { + "original": { + "version": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "impliedFormat": 1 + }, + "version": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "signature": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "impliedFormat": "commonjs" + } + }, + "root": [ + [ + 4, + "./a.ts" + ] + ], + "options": { + "preserveConstEnums": true, + "tsBuildInfoFile": "./a.tsbuildinfo" + }, + "referencedMap": { + "./a.ts": [ + "./c.ts" + ], + "./c.ts": [ + "./b.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./a.ts", + "./b.d.ts", + "./c.ts" + ] + }, + "version": "FakeTSVersion", + "size": 1222 +} + +//// [/src/project/c.js] file written with same contents diff --git a/tests/baselines/reference/tsc/incremental/with-aliased-const-enums.js b/tests/baselines/reference/tsc/incremental/with-aliased-const-enums.js new file mode 100644 index 0000000000000..0ef28f7269deb --- /dev/null +++ b/tests/baselines/reference/tsc/incremental/with-aliased-const-enums.js @@ -0,0 +1,605 @@ +currentDirectory:: / useCaseSensitiveFileNames: false +Input:: +//// [/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +declare const console: { log(msg: any): void; }; + +//// [/src/project/a.ts] +import {A} from "./c" +let a = A.ONE + + +//// [/src/project/b.d.ts] +declare const enum AWorker { + ONE = 1 +} +export { AWorker as A }; + + +//// [/src/project/c.ts] +import {A} from "./b" +let b = A.ONE +export {A} + + +//// [/src/project/worker.d.ts] +export const enum AWorker { + ONE = 1 +} + + + + +Output:: +/lib/tsc -i /src/project/a.ts --tsbuildinfofile /src/project/a.tsbuildinfo +exitCode:: ExitStatus.Success + + +//// [/src/project/a.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var a = 1 /* A.ONE */; + + +//// [/src/project/a.tsbuildinfo] +{"program":{"fileNames":["../../lib/lib.d.ts","./b.d.ts","./c.ts","./a.ts"],"fileInfos":[{"version":"3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedFormat":1},{"version":"-8804827199-declare const enum AWorker {\n ONE = 1\n}\nexport { AWorker as A };\n","impliedFormat":1},{"version":"-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n","impliedFormat":1},{"version":"-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n","impliedFormat":1}],"root":[4],"options":{"tsBuildInfoFile":"./a.tsbuildinfo"},"fileIdsList":[[3],[2]],"referencedMap":[[4,1],[3,2]],"semanticDiagnosticsPerFile":[1,4,2,3]},"version":"FakeTSVersion"} + +//// [/src/project/a.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../lib/lib.d.ts", + "./b.d.ts", + "./c.ts", + "./a.ts" + ], + "fileNamesList": [ + [ + "./c.ts" + ], + [ + "./b.d.ts" + ] + ], + "fileInfos": { + "../../lib/lib.d.ts": { + "original": { + "version": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": 1 + }, + "version": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + }, + "./b.d.ts": { + "original": { + "version": "-8804827199-declare const enum AWorker {\n ONE = 1\n}\nexport { AWorker as A };\n", + "impliedFormat": 1 + }, + "version": "-8804827199-declare const enum AWorker {\n ONE = 1\n}\nexport { AWorker as A };\n", + "signature": "-8804827199-declare const enum AWorker {\n ONE = 1\n}\nexport { AWorker as A };\n", + "impliedFormat": "commonjs" + }, + "./c.ts": { + "original": { + "version": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "impliedFormat": 1 + }, + "version": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "signature": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "impliedFormat": "commonjs" + }, + "./a.ts": { + "original": { + "version": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "impliedFormat": 1 + }, + "version": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "signature": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "impliedFormat": "commonjs" + } + }, + "root": [ + [ + 4, + "./a.ts" + ] + ], + "options": { + "tsBuildInfoFile": "./a.tsbuildinfo" + }, + "referencedMap": { + "./a.ts": [ + "./c.ts" + ], + "./c.ts": [ + "./b.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./a.ts", + "./b.d.ts", + "./c.ts" + ] + }, + "version": "FakeTSVersion", + "size": 1065 +} + +//// [/src/project/c.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var b = 1 /* A.ONE */; + + + + +Change:: change enum value +Input:: +//// [/src/project/b.d.ts] +declare const enum AWorker { + ONE = 2 +} +export { AWorker as A }; + + + + +Output:: +/lib/tsc -i /src/project/a.ts --tsbuildinfofile /src/project/a.tsbuildinfo +exitCode:: ExitStatus.Success + + +//// [/src/project/a.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var a = 2 /* A.ONE */; + + +//// [/src/project/a.tsbuildinfo] +{"program":{"fileNames":["../../lib/lib.d.ts","./b.d.ts","./c.ts","./a.ts"],"fileInfos":[{"version":"3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedFormat":1},{"version":"-13802607806-declare const enum AWorker {\n ONE = 2\n}\nexport { AWorker as A };\n","impliedFormat":1},{"version":"-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n","signature":"3259150197-import { A } from \"./b\";\nexport { A };\n","impliedFormat":1},{"version":"-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n","signature":"-3531856636-export {};\n","impliedFormat":1}],"root":[4],"options":{"tsBuildInfoFile":"./a.tsbuildinfo"},"fileIdsList":[[3],[2]],"referencedMap":[[4,1],[3,2]],"semanticDiagnosticsPerFile":[1,4,2,3]},"version":"FakeTSVersion"} + +//// [/src/project/a.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../lib/lib.d.ts", + "./b.d.ts", + "./c.ts", + "./a.ts" + ], + "fileNamesList": [ + [ + "./c.ts" + ], + [ + "./b.d.ts" + ] + ], + "fileInfos": { + "../../lib/lib.d.ts": { + "original": { + "version": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": 1 + }, + "version": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + }, + "./b.d.ts": { + "original": { + "version": "-13802607806-declare const enum AWorker {\n ONE = 2\n}\nexport { AWorker as A };\n", + "impliedFormat": 1 + }, + "version": "-13802607806-declare const enum AWorker {\n ONE = 2\n}\nexport { AWorker as A };\n", + "signature": "-13802607806-declare const enum AWorker {\n ONE = 2\n}\nexport { AWorker as A };\n", + "impliedFormat": "commonjs" + }, + "./c.ts": { + "original": { + "version": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "signature": "3259150197-import { A } from \"./b\";\nexport { A };\n", + "impliedFormat": 1 + }, + "version": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "signature": "3259150197-import { A } from \"./b\";\nexport { A };\n", + "impliedFormat": "commonjs" + }, + "./a.ts": { + "original": { + "version": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "signature": "-3531856636-export {};\n", + "impliedFormat": 1 + }, + "version": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "signature": "-3531856636-export {};\n", + "impliedFormat": "commonjs" + } + }, + "root": [ + [ + 4, + "./a.ts" + ] + ], + "options": { + "tsBuildInfoFile": "./a.tsbuildinfo" + }, + "referencedMap": { + "./a.ts": [ + "./c.ts" + ], + "./c.ts": [ + "./b.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./a.ts", + "./b.d.ts", + "./c.ts" + ] + }, + "version": "FakeTSVersion", + "size": 1174 +} + +//// [/src/project/c.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var b = 2 /* A.ONE */; + + + + +Change:: change enum value again +Input:: +//// [/src/project/b.d.ts] +declare const enum AWorker { + ONE = 3 +} +export { AWorker as A }; + + + + +Output:: +/lib/tsc -i /src/project/a.ts --tsbuildinfofile /src/project/a.tsbuildinfo +exitCode:: ExitStatus.Success + + +//// [/src/project/a.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var a = 3 /* A.ONE */; + + +//// [/src/project/a.tsbuildinfo] +{"program":{"fileNames":["../../lib/lib.d.ts","./b.d.ts","./c.ts","./a.ts"],"fileInfos":[{"version":"3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedFormat":1},{"version":"-10210453821-declare const enum AWorker {\n ONE = 3\n}\nexport { AWorker as A };\n","impliedFormat":1},{"version":"-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n","signature":"3259150197-import { A } from \"./b\";\nexport { A };\n","impliedFormat":1},{"version":"-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n","impliedFormat":1}],"root":[4],"options":{"tsBuildInfoFile":"./a.tsbuildinfo"},"fileIdsList":[[3],[2]],"referencedMap":[[4,1],[3,2]],"semanticDiagnosticsPerFile":[1,4,2,3]},"version":"FakeTSVersion"} + +//// [/src/project/a.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../lib/lib.d.ts", + "./b.d.ts", + "./c.ts", + "./a.ts" + ], + "fileNamesList": [ + [ + "./c.ts" + ], + [ + "./b.d.ts" + ] + ], + "fileInfos": { + "../../lib/lib.d.ts": { + "original": { + "version": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": 1 + }, + "version": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + }, + "./b.d.ts": { + "original": { + "version": "-10210453821-declare const enum AWorker {\n ONE = 3\n}\nexport { AWorker as A };\n", + "impliedFormat": 1 + }, + "version": "-10210453821-declare const enum AWorker {\n ONE = 3\n}\nexport { AWorker as A };\n", + "signature": "-10210453821-declare const enum AWorker {\n ONE = 3\n}\nexport { AWorker as A };\n", + "impliedFormat": "commonjs" + }, + "./c.ts": { + "original": { + "version": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "signature": "3259150197-import { A } from \"./b\";\nexport { A };\n", + "impliedFormat": 1 + }, + "version": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "signature": "3259150197-import { A } from \"./b\";\nexport { A };\n", + "impliedFormat": "commonjs" + }, + "./a.ts": { + "original": { + "version": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "impliedFormat": 1 + }, + "version": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "signature": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "impliedFormat": "commonjs" + } + }, + "root": [ + [ + 4, + "./a.ts" + ] + ], + "options": { + "tsBuildInfoFile": "./a.tsbuildinfo" + }, + "referencedMap": { + "./a.ts": [ + "./c.ts" + ], + "./c.ts": [ + "./b.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./a.ts", + "./b.d.ts", + "./c.ts" + ] + }, + "version": "FakeTSVersion", + "size": 1135 +} + +//// [/src/project/c.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var b = 3 /* A.ONE */; + + + + +Change:: something else changes in b.d.ts +Input:: +//// [/src/project/b.d.ts] +declare const enum AWorker { + ONE = 3 +} +export { AWorker as A }; +export const randomThing = 10; + + + +Output:: +/lib/tsc -i /src/project/a.ts --tsbuildinfofile /src/project/a.tsbuildinfo +exitCode:: ExitStatus.Success + + +//// [/src/project/a.js] file written with same contents +//// [/src/project/a.tsbuildinfo] +{"program":{"fileNames":["../../lib/lib.d.ts","./b.d.ts","./c.ts","./a.ts"],"fileInfos":[{"version":"3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedFormat":1},{"version":"-11645711104-declare const enum AWorker {\n ONE = 3\n}\nexport { AWorker as A };\nexport const randomThing = 10;","impliedFormat":1},{"version":"-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n","signature":"3259150197-import { A } from \"./b\";\nexport { A };\n","impliedFormat":1},{"version":"-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n","impliedFormat":1}],"root":[4],"options":{"tsBuildInfoFile":"./a.tsbuildinfo"},"fileIdsList":[[3],[2]],"referencedMap":[[4,1],[3,2]],"semanticDiagnosticsPerFile":[1,4,2,3]},"version":"FakeTSVersion"} + +//// [/src/project/a.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../lib/lib.d.ts", + "./b.d.ts", + "./c.ts", + "./a.ts" + ], + "fileNamesList": [ + [ + "./c.ts" + ], + [ + "./b.d.ts" + ] + ], + "fileInfos": { + "../../lib/lib.d.ts": { + "original": { + "version": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": 1 + }, + "version": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + }, + "./b.d.ts": { + "original": { + "version": "-11645711104-declare const enum AWorker {\n ONE = 3\n}\nexport { AWorker as A };\nexport const randomThing = 10;", + "impliedFormat": 1 + }, + "version": "-11645711104-declare const enum AWorker {\n ONE = 3\n}\nexport { AWorker as A };\nexport const randomThing = 10;", + "signature": "-11645711104-declare const enum AWorker {\n ONE = 3\n}\nexport { AWorker as A };\nexport const randomThing = 10;", + "impliedFormat": "commonjs" + }, + "./c.ts": { + "original": { + "version": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "signature": "3259150197-import { A } from \"./b\";\nexport { A };\n", + "impliedFormat": 1 + }, + "version": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "signature": "3259150197-import { A } from \"./b\";\nexport { A };\n", + "impliedFormat": "commonjs" + }, + "./a.ts": { + "original": { + "version": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "impliedFormat": 1 + }, + "version": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "signature": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "impliedFormat": "commonjs" + } + }, + "root": [ + [ + 4, + "./a.ts" + ] + ], + "options": { + "tsBuildInfoFile": "./a.tsbuildinfo" + }, + "referencedMap": { + "./a.ts": [ + "./c.ts" + ], + "./c.ts": [ + "./b.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./a.ts", + "./b.d.ts", + "./c.ts" + ] + }, + "version": "FakeTSVersion", + "size": 1165 +} + +//// [/src/project/c.js] file written with same contents + + +Change:: something else changes in b.d.ts again +Input:: +//// [/src/project/b.d.ts] +declare const enum AWorker { + ONE = 3 +} +export { AWorker as A }; +export const randomThing = 10;export const randomThing2 = 10; + + + +Output:: +/lib/tsc -i /src/project/a.ts --tsbuildinfofile /src/project/a.tsbuildinfo +exitCode:: ExitStatus.Success + + +//// [/src/project/a.js] file written with same contents +//// [/src/project/a.tsbuildinfo] +{"program":{"fileNames":["../../lib/lib.d.ts","./b.d.ts","./c.ts","./a.ts"],"fileInfos":[{"version":"3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedFormat":1},{"version":"-19677125073-declare const enum AWorker {\n ONE = 3\n}\nexport { AWorker as A };\nexport const randomThing = 10;export const randomThing2 = 10;","impliedFormat":1},{"version":"-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n","signature":"3259150197-import { A } from \"./b\";\nexport { A };\n","impliedFormat":1},{"version":"-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n","impliedFormat":1}],"root":[4],"options":{"tsBuildInfoFile":"./a.tsbuildinfo"},"fileIdsList":[[3],[2]],"referencedMap":[[4,1],[3,2]],"semanticDiagnosticsPerFile":[1,4,2,3]},"version":"FakeTSVersion"} + +//// [/src/project/a.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../lib/lib.d.ts", + "./b.d.ts", + "./c.ts", + "./a.ts" + ], + "fileNamesList": [ + [ + "./c.ts" + ], + [ + "./b.d.ts" + ] + ], + "fileInfos": { + "../../lib/lib.d.ts": { + "original": { + "version": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": 1 + }, + "version": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + }, + "./b.d.ts": { + "original": { + "version": "-19677125073-declare const enum AWorker {\n ONE = 3\n}\nexport { AWorker as A };\nexport const randomThing = 10;export const randomThing2 = 10;", + "impliedFormat": 1 + }, + "version": "-19677125073-declare const enum AWorker {\n ONE = 3\n}\nexport { AWorker as A };\nexport const randomThing = 10;export const randomThing2 = 10;", + "signature": "-19677125073-declare const enum AWorker {\n ONE = 3\n}\nexport { AWorker as A };\nexport const randomThing = 10;export const randomThing2 = 10;", + "impliedFormat": "commonjs" + }, + "./c.ts": { + "original": { + "version": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "signature": "3259150197-import { A } from \"./b\";\nexport { A };\n", + "impliedFormat": 1 + }, + "version": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "signature": "3259150197-import { A } from \"./b\";\nexport { A };\n", + "impliedFormat": "commonjs" + }, + "./a.ts": { + "original": { + "version": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "impliedFormat": 1 + }, + "version": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "signature": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "impliedFormat": "commonjs" + } + }, + "root": [ + [ + 4, + "./a.ts" + ] + ], + "options": { + "tsBuildInfoFile": "./a.tsbuildinfo" + }, + "referencedMap": { + "./a.ts": [ + "./c.ts" + ], + "./c.ts": [ + "./b.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./a.ts", + "./b.d.ts", + "./c.ts" + ] + }, + "version": "FakeTSVersion", + "size": 1196 +} + +//// [/src/project/c.js] file written with same contents diff --git a/tests/baselines/reference/tsc/incremental/with-aliased-in-different-file-const-enums-with-preserveConstEnums.js b/tests/baselines/reference/tsc/incremental/with-aliased-in-different-file-const-enums-with-preserveConstEnums.js new file mode 100644 index 0000000000000..9ba8d4b29715c --- /dev/null +++ b/tests/baselines/reference/tsc/incremental/with-aliased-in-different-file-const-enums-with-preserveConstEnums.js @@ -0,0 +1,690 @@ +currentDirectory:: / useCaseSensitiveFileNames: false +Input:: +//// [/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +declare const console: { log(msg: any): void; }; + +//// [/src/project/a.ts] +import {A} from "./c" +let a = A.ONE + + +//// [/src/project/b.d.ts] +export { AWorker as A } from "./worker"; + + +//// [/src/project/c.ts] +import {A} from "./b" +let b = A.ONE +export {A} + + +//// [/src/project/worker.d.ts] +export const enum AWorker { + ONE = 1 +} + + + + +Output:: +/lib/tsc -i /src/project/a.ts --tsbuildinfofile /src/project/a.tsbuildinfo --preserveConstEnums +exitCode:: ExitStatus.Success + + +//// [/src/project/a.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var a = 1 /* A.ONE */; + + +//// [/src/project/a.tsbuildinfo] +{"program":{"fileNames":["../../lib/lib.d.ts","./worker.d.ts","./b.d.ts","./c.ts","./a.ts"],"fileInfos":[{"version":"3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedFormat":1},{"version":"-10088995516-export const enum AWorker {\n ONE = 1\n}\n","impliedFormat":1},{"version":"-6488945853-export { AWorker as A } from \"./worker\";\n","impliedFormat":1},{"version":"-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n","impliedFormat":1},{"version":"-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n","impliedFormat":1}],"root":[5],"options":{"preserveConstEnums":true,"tsBuildInfoFile":"./a.tsbuildinfo"},"fileIdsList":[[4],[2],[3]],"referencedMap":[[5,1],[3,2],[4,3]],"semanticDiagnosticsPerFile":[1,5,3,4,2]},"version":"FakeTSVersion"} + +//// [/src/project/a.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../lib/lib.d.ts", + "./worker.d.ts", + "./b.d.ts", + "./c.ts", + "./a.ts" + ], + "fileNamesList": [ + [ + "./c.ts" + ], + [ + "./worker.d.ts" + ], + [ + "./b.d.ts" + ] + ], + "fileInfos": { + "../../lib/lib.d.ts": { + "original": { + "version": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": 1 + }, + "version": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + }, + "./worker.d.ts": { + "original": { + "version": "-10088995516-export const enum AWorker {\n ONE = 1\n}\n", + "impliedFormat": 1 + }, + "version": "-10088995516-export const enum AWorker {\n ONE = 1\n}\n", + "signature": "-10088995516-export const enum AWorker {\n ONE = 1\n}\n", + "impliedFormat": "commonjs" + }, + "./b.d.ts": { + "original": { + "version": "-6488945853-export { AWorker as A } from \"./worker\";\n", + "impliedFormat": 1 + }, + "version": "-6488945853-export { AWorker as A } from \"./worker\";\n", + "signature": "-6488945853-export { AWorker as A } from \"./worker\";\n", + "impliedFormat": "commonjs" + }, + "./c.ts": { + "original": { + "version": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "impliedFormat": 1 + }, + "version": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "signature": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "impliedFormat": "commonjs" + }, + "./a.ts": { + "original": { + "version": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "impliedFormat": 1 + }, + "version": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "signature": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "impliedFormat": "commonjs" + } + }, + "root": [ + [ + 5, + "./a.ts" + ] + ], + "options": { + "preserveConstEnums": true, + "tsBuildInfoFile": "./a.tsbuildinfo" + }, + "referencedMap": { + "./a.ts": [ + "./c.ts" + ], + "./b.d.ts": [ + "./worker.d.ts" + ], + "./c.ts": [ + "./b.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./a.ts", + "./b.d.ts", + "./c.ts", + "./worker.d.ts" + ] + }, + "version": "FakeTSVersion", + "size": 1182 +} + +//// [/src/project/c.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.A = void 0; +var b_1 = require("./b"); +Object.defineProperty(exports, "A", { enumerable: true, get: function () { return b_1.A; } }); +var b = 1 /* A.ONE */; + + + + +Change:: change enum value +Input:: +//// [/src/project/worker.d.ts] +export const enum AWorker { + ONE = 2 +} + + + + +Output:: +/lib/tsc -i /src/project/a.ts --tsbuildinfofile /src/project/a.tsbuildinfo --preserveConstEnums +exitCode:: ExitStatus.Success + + +//// [/src/project/a.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var a = 2 /* A.ONE */; + + +//// [/src/project/a.tsbuildinfo] +{"program":{"fileNames":["../../lib/lib.d.ts","./worker.d.ts","./b.d.ts","./c.ts","./a.ts"],"fileInfos":[{"version":"3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedFormat":1},{"version":"-10088959579-export const enum AWorker {\n ONE = 2\n}\n","impliedFormat":1},{"version":"-6488945853-export { AWorker as A } from \"./worker\";\n","impliedFormat":1},{"version":"-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n","impliedFormat":1},{"version":"-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n","impliedFormat":1}],"root":[5],"options":{"preserveConstEnums":true,"tsBuildInfoFile":"./a.tsbuildinfo"},"fileIdsList":[[4],[2],[3]],"referencedMap":[[5,1],[3,2],[4,3]],"semanticDiagnosticsPerFile":[1,5,3,4,2]},"version":"FakeTSVersion"} + +//// [/src/project/a.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../lib/lib.d.ts", + "./worker.d.ts", + "./b.d.ts", + "./c.ts", + "./a.ts" + ], + "fileNamesList": [ + [ + "./c.ts" + ], + [ + "./worker.d.ts" + ], + [ + "./b.d.ts" + ] + ], + "fileInfos": { + "../../lib/lib.d.ts": { + "original": { + "version": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": 1 + }, + "version": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + }, + "./worker.d.ts": { + "original": { + "version": "-10088959579-export const enum AWorker {\n ONE = 2\n}\n", + "impliedFormat": 1 + }, + "version": "-10088959579-export const enum AWorker {\n ONE = 2\n}\n", + "signature": "-10088959579-export const enum AWorker {\n ONE = 2\n}\n", + "impliedFormat": "commonjs" + }, + "./b.d.ts": { + "original": { + "version": "-6488945853-export { AWorker as A } from \"./worker\";\n", + "impliedFormat": 1 + }, + "version": "-6488945853-export { AWorker as A } from \"./worker\";\n", + "signature": "-6488945853-export { AWorker as A } from \"./worker\";\n", + "impliedFormat": "commonjs" + }, + "./c.ts": { + "original": { + "version": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "impliedFormat": 1 + }, + "version": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "signature": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "impliedFormat": "commonjs" + }, + "./a.ts": { + "original": { + "version": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "impliedFormat": 1 + }, + "version": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "signature": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "impliedFormat": "commonjs" + } + }, + "root": [ + [ + 5, + "./a.ts" + ] + ], + "options": { + "preserveConstEnums": true, + "tsBuildInfoFile": "./a.tsbuildinfo" + }, + "referencedMap": { + "./a.ts": [ + "./c.ts" + ], + "./b.d.ts": [ + "./worker.d.ts" + ], + "./c.ts": [ + "./b.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./a.ts", + "./b.d.ts", + "./c.ts", + "./worker.d.ts" + ] + }, + "version": "FakeTSVersion", + "size": 1182 +} + +//// [/src/project/c.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.A = void 0; +var b_1 = require("./b"); +Object.defineProperty(exports, "A", { enumerable: true, get: function () { return b_1.A; } }); +var b = 2 /* A.ONE */; + + + + +Change:: change enum value again +Input:: +//// [/src/project/worker.d.ts] +export const enum AWorker { + ONE = 3 +} + + + + +Output:: +/lib/tsc -i /src/project/a.ts --tsbuildinfofile /src/project/a.tsbuildinfo --preserveConstEnums +exitCode:: ExitStatus.Success + + +//// [/src/project/a.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var a = 3 /* A.ONE */; + + +//// [/src/project/a.tsbuildinfo] +{"program":{"fileNames":["../../lib/lib.d.ts","./worker.d.ts","./b.d.ts","./c.ts","./a.ts"],"fileInfos":[{"version":"3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedFormat":1},{"version":"-10088923642-export const enum AWorker {\n ONE = 3\n}\n","impliedFormat":1},{"version":"-6488945853-export { AWorker as A } from \"./worker\";\n","impliedFormat":1},{"version":"-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n","impliedFormat":1},{"version":"-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n","impliedFormat":1}],"root":[5],"options":{"preserveConstEnums":true,"tsBuildInfoFile":"./a.tsbuildinfo"},"fileIdsList":[[4],[2],[3]],"referencedMap":[[5,1],[3,2],[4,3]],"semanticDiagnosticsPerFile":[1,5,3,4,2]},"version":"FakeTSVersion"} + +//// [/src/project/a.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../lib/lib.d.ts", + "./worker.d.ts", + "./b.d.ts", + "./c.ts", + "./a.ts" + ], + "fileNamesList": [ + [ + "./c.ts" + ], + [ + "./worker.d.ts" + ], + [ + "./b.d.ts" + ] + ], + "fileInfos": { + "../../lib/lib.d.ts": { + "original": { + "version": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": 1 + }, + "version": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + }, + "./worker.d.ts": { + "original": { + "version": "-10088923642-export const enum AWorker {\n ONE = 3\n}\n", + "impliedFormat": 1 + }, + "version": "-10088923642-export const enum AWorker {\n ONE = 3\n}\n", + "signature": "-10088923642-export const enum AWorker {\n ONE = 3\n}\n", + "impliedFormat": "commonjs" + }, + "./b.d.ts": { + "original": { + "version": "-6488945853-export { AWorker as A } from \"./worker\";\n", + "impliedFormat": 1 + }, + "version": "-6488945853-export { AWorker as A } from \"./worker\";\n", + "signature": "-6488945853-export { AWorker as A } from \"./worker\";\n", + "impliedFormat": "commonjs" + }, + "./c.ts": { + "original": { + "version": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "impliedFormat": 1 + }, + "version": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "signature": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "impliedFormat": "commonjs" + }, + "./a.ts": { + "original": { + "version": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "impliedFormat": 1 + }, + "version": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "signature": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "impliedFormat": "commonjs" + } + }, + "root": [ + [ + 5, + "./a.ts" + ] + ], + "options": { + "preserveConstEnums": true, + "tsBuildInfoFile": "./a.tsbuildinfo" + }, + "referencedMap": { + "./a.ts": [ + "./c.ts" + ], + "./b.d.ts": [ + "./worker.d.ts" + ], + "./c.ts": [ + "./b.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./a.ts", + "./b.d.ts", + "./c.ts", + "./worker.d.ts" + ] + }, + "version": "FakeTSVersion", + "size": 1182 +} + +//// [/src/project/c.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.A = void 0; +var b_1 = require("./b"); +Object.defineProperty(exports, "A", { enumerable: true, get: function () { return b_1.A; } }); +var b = 3 /* A.ONE */; + + + + +Change:: something else changes in b.d.ts +Input:: +//// [/src/project/b.d.ts] +export { AWorker as A } from "./worker"; +export const randomThing = 10; + + + +Output:: +/lib/tsc -i /src/project/a.ts --tsbuildinfofile /src/project/a.tsbuildinfo --preserveConstEnums +exitCode:: ExitStatus.Success + + +//// [/src/project/a.js] file written with same contents +//// [/src/project/a.tsbuildinfo] +{"program":{"fileNames":["../../lib/lib.d.ts","./worker.d.ts","./b.d.ts","./c.ts","./a.ts"],"fileInfos":[{"version":"3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedFormat":1},{"version":"-10088923642-export const enum AWorker {\n ONE = 3\n}\n","impliedFormat":1},{"version":"-7383473792-export { AWorker as A } from \"./worker\";\nexport const randomThing = 10;","impliedFormat":1},{"version":"-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n","signature":"3259150197-import { A } from \"./b\";\nexport { A };\n","impliedFormat":1},{"version":"-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n","signature":"-3531856636-export {};\n","impliedFormat":1}],"root":[5],"options":{"preserveConstEnums":true,"tsBuildInfoFile":"./a.tsbuildinfo"},"fileIdsList":[[4],[2],[3]],"referencedMap":[[5,1],[3,2],[4,3]],"semanticDiagnosticsPerFile":[1,5,3,4,2]},"version":"FakeTSVersion"} + +//// [/src/project/a.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../lib/lib.d.ts", + "./worker.d.ts", + "./b.d.ts", + "./c.ts", + "./a.ts" + ], + "fileNamesList": [ + [ + "./c.ts" + ], + [ + "./worker.d.ts" + ], + [ + "./b.d.ts" + ] + ], + "fileInfos": { + "../../lib/lib.d.ts": { + "original": { + "version": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": 1 + }, + "version": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + }, + "./worker.d.ts": { + "original": { + "version": "-10088923642-export const enum AWorker {\n ONE = 3\n}\n", + "impliedFormat": 1 + }, + "version": "-10088923642-export const enum AWorker {\n ONE = 3\n}\n", + "signature": "-10088923642-export const enum AWorker {\n ONE = 3\n}\n", + "impliedFormat": "commonjs" + }, + "./b.d.ts": { + "original": { + "version": "-7383473792-export { AWorker as A } from \"./worker\";\nexport const randomThing = 10;", + "impliedFormat": 1 + }, + "version": "-7383473792-export { AWorker as A } from \"./worker\";\nexport const randomThing = 10;", + "signature": "-7383473792-export { AWorker as A } from \"./worker\";\nexport const randomThing = 10;", + "impliedFormat": "commonjs" + }, + "./c.ts": { + "original": { + "version": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "signature": "3259150197-import { A } from \"./b\";\nexport { A };\n", + "impliedFormat": 1 + }, + "version": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "signature": "3259150197-import { A } from \"./b\";\nexport { A };\n", + "impliedFormat": "commonjs" + }, + "./a.ts": { + "original": { + "version": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "signature": "-3531856636-export {};\n", + "impliedFormat": 1 + }, + "version": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "signature": "-3531856636-export {};\n", + "impliedFormat": "commonjs" + } + }, + "root": [ + [ + 5, + "./a.ts" + ] + ], + "options": { + "preserveConstEnums": true, + "tsBuildInfoFile": "./a.tsbuildinfo" + }, + "referencedMap": { + "./a.ts": [ + "./c.ts" + ], + "./b.d.ts": [ + "./worker.d.ts" + ], + "./c.ts": [ + "./b.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./a.ts", + "./b.d.ts", + "./c.ts", + "./worker.d.ts" + ] + }, + "version": "FakeTSVersion", + "size": 1320 +} + +//// [/src/project/c.js] file written with same contents + + +Change:: something else changes in b.d.ts again +Input:: +//// [/src/project/b.d.ts] +export { AWorker as A } from "./worker"; +export const randomThing = 10;export const randomThing2 = 10; + + + +Output:: +/lib/tsc -i /src/project/a.ts --tsbuildinfofile /src/project/a.tsbuildinfo --preserveConstEnums +exitCode:: ExitStatus.Success + + +//// [/src/project/a.tsbuildinfo] +{"program":{"fileNames":["../../lib/lib.d.ts","./worker.d.ts","./b.d.ts","./c.ts","./a.ts"],"fileInfos":[{"version":"3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedFormat":1},{"version":"-10088923642-export const enum AWorker {\n ONE = 3\n}\n","impliedFormat":1},{"version":"2191846063-export { AWorker as A } from \"./worker\";\nexport const randomThing = 10;export const randomThing2 = 10;","impliedFormat":1},{"version":"-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n","signature":"3259150197-import { A } from \"./b\";\nexport { A };\n","impliedFormat":1},{"version":"-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n","impliedFormat":1}],"root":[5],"options":{"preserveConstEnums":true,"tsBuildInfoFile":"./a.tsbuildinfo"},"fileIdsList":[[4],[2],[3]],"referencedMap":[[5,1],[3,2],[4,3]],"semanticDiagnosticsPerFile":[1,5,3,4,2]},"version":"FakeTSVersion"} + +//// [/src/project/a.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../lib/lib.d.ts", + "./worker.d.ts", + "./b.d.ts", + "./c.ts", + "./a.ts" + ], + "fileNamesList": [ + [ + "./c.ts" + ], + [ + "./worker.d.ts" + ], + [ + "./b.d.ts" + ] + ], + "fileInfos": { + "../../lib/lib.d.ts": { + "original": { + "version": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": 1 + }, + "version": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + }, + "./worker.d.ts": { + "original": { + "version": "-10088923642-export const enum AWorker {\n ONE = 3\n}\n", + "impliedFormat": 1 + }, + "version": "-10088923642-export const enum AWorker {\n ONE = 3\n}\n", + "signature": "-10088923642-export const enum AWorker {\n ONE = 3\n}\n", + "impliedFormat": "commonjs" + }, + "./b.d.ts": { + "original": { + "version": "2191846063-export { AWorker as A } from \"./worker\";\nexport const randomThing = 10;export const randomThing2 = 10;", + "impliedFormat": 1 + }, + "version": "2191846063-export { AWorker as A } from \"./worker\";\nexport const randomThing = 10;export const randomThing2 = 10;", + "signature": "2191846063-export { AWorker as A } from \"./worker\";\nexport const randomThing = 10;export const randomThing2 = 10;", + "impliedFormat": "commonjs" + }, + "./c.ts": { + "original": { + "version": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "signature": "3259150197-import { A } from \"./b\";\nexport { A };\n", + "impliedFormat": 1 + }, + "version": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "signature": "3259150197-import { A } from \"./b\";\nexport { A };\n", + "impliedFormat": "commonjs" + }, + "./a.ts": { + "original": { + "version": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "impliedFormat": 1 + }, + "version": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "signature": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "impliedFormat": "commonjs" + } + }, + "root": [ + [ + 5, + "./a.ts" + ] + ], + "options": { + "preserveConstEnums": true, + "tsBuildInfoFile": "./a.tsbuildinfo" + }, + "referencedMap": { + "./a.ts": [ + "./c.ts" + ], + "./b.d.ts": [ + "./worker.d.ts" + ], + "./c.ts": [ + "./b.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./a.ts", + "./b.d.ts", + "./c.ts", + "./worker.d.ts" + ] + }, + "version": "FakeTSVersion", + "size": 1311 +} + +//// [/src/project/c.js] file written with same contents diff --git a/tests/baselines/reference/tsc/incremental/with-aliased-in-different-file-const-enums.js b/tests/baselines/reference/tsc/incremental/with-aliased-in-different-file-const-enums.js new file mode 100644 index 0000000000000..79fe3178bb374 --- /dev/null +++ b/tests/baselines/reference/tsc/incremental/with-aliased-in-different-file-const-enums.js @@ -0,0 +1,676 @@ +currentDirectory:: / useCaseSensitiveFileNames: false +Input:: +//// [/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +declare const console: { log(msg: any): void; }; + +//// [/src/project/a.ts] +import {A} from "./c" +let a = A.ONE + + +//// [/src/project/b.d.ts] +export { AWorker as A } from "./worker"; + + +//// [/src/project/c.ts] +import {A} from "./b" +let b = A.ONE +export {A} + + +//// [/src/project/worker.d.ts] +export const enum AWorker { + ONE = 1 +} + + + + +Output:: +/lib/tsc -i /src/project/a.ts --tsbuildinfofile /src/project/a.tsbuildinfo +exitCode:: ExitStatus.Success + + +//// [/src/project/a.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var a = 1 /* A.ONE */; + + +//// [/src/project/a.tsbuildinfo] +{"program":{"fileNames":["../../lib/lib.d.ts","./worker.d.ts","./b.d.ts","./c.ts","./a.ts"],"fileInfos":[{"version":"3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedFormat":1},{"version":"-10088995516-export const enum AWorker {\n ONE = 1\n}\n","impliedFormat":1},{"version":"-6488945853-export { AWorker as A } from \"./worker\";\n","impliedFormat":1},{"version":"-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n","impliedFormat":1},{"version":"-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n","impliedFormat":1}],"root":[5],"options":{"tsBuildInfoFile":"./a.tsbuildinfo"},"fileIdsList":[[4],[2],[3]],"referencedMap":[[5,1],[3,2],[4,3]],"semanticDiagnosticsPerFile":[1,5,3,4,2]},"version":"FakeTSVersion"} + +//// [/src/project/a.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../lib/lib.d.ts", + "./worker.d.ts", + "./b.d.ts", + "./c.ts", + "./a.ts" + ], + "fileNamesList": [ + [ + "./c.ts" + ], + [ + "./worker.d.ts" + ], + [ + "./b.d.ts" + ] + ], + "fileInfos": { + "../../lib/lib.d.ts": { + "original": { + "version": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": 1 + }, + "version": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + }, + "./worker.d.ts": { + "original": { + "version": "-10088995516-export const enum AWorker {\n ONE = 1\n}\n", + "impliedFormat": 1 + }, + "version": "-10088995516-export const enum AWorker {\n ONE = 1\n}\n", + "signature": "-10088995516-export const enum AWorker {\n ONE = 1\n}\n", + "impliedFormat": "commonjs" + }, + "./b.d.ts": { + "original": { + "version": "-6488945853-export { AWorker as A } from \"./worker\";\n", + "impliedFormat": 1 + }, + "version": "-6488945853-export { AWorker as A } from \"./worker\";\n", + "signature": "-6488945853-export { AWorker as A } from \"./worker\";\n", + "impliedFormat": "commonjs" + }, + "./c.ts": { + "original": { + "version": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "impliedFormat": 1 + }, + "version": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "signature": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "impliedFormat": "commonjs" + }, + "./a.ts": { + "original": { + "version": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "impliedFormat": 1 + }, + "version": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "signature": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "impliedFormat": "commonjs" + } + }, + "root": [ + [ + 5, + "./a.ts" + ] + ], + "options": { + "tsBuildInfoFile": "./a.tsbuildinfo" + }, + "referencedMap": { + "./a.ts": [ + "./c.ts" + ], + "./b.d.ts": [ + "./worker.d.ts" + ], + "./c.ts": [ + "./b.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./a.ts", + "./b.d.ts", + "./c.ts", + "./worker.d.ts" + ] + }, + "version": "FakeTSVersion", + "size": 1156 +} + +//// [/src/project/c.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var b = 1 /* A.ONE */; + + + + +Change:: change enum value +Input:: +//// [/src/project/worker.d.ts] +export const enum AWorker { + ONE = 2 +} + + + + +Output:: +/lib/tsc -i /src/project/a.ts --tsbuildinfofile /src/project/a.tsbuildinfo +exitCode:: ExitStatus.Success + + +//// [/src/project/a.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var a = 2 /* A.ONE */; + + +//// [/src/project/a.tsbuildinfo] +{"program":{"fileNames":["../../lib/lib.d.ts","./worker.d.ts","./b.d.ts","./c.ts","./a.ts"],"fileInfos":[{"version":"3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedFormat":1},{"version":"-10088959579-export const enum AWorker {\n ONE = 2\n}\n","impliedFormat":1},{"version":"-6488945853-export { AWorker as A } from \"./worker\";\n","impliedFormat":1},{"version":"-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n","impliedFormat":1},{"version":"-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n","impliedFormat":1}],"root":[5],"options":{"tsBuildInfoFile":"./a.tsbuildinfo"},"fileIdsList":[[4],[2],[3]],"referencedMap":[[5,1],[3,2],[4,3]],"semanticDiagnosticsPerFile":[1,5,3,4,2]},"version":"FakeTSVersion"} + +//// [/src/project/a.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../lib/lib.d.ts", + "./worker.d.ts", + "./b.d.ts", + "./c.ts", + "./a.ts" + ], + "fileNamesList": [ + [ + "./c.ts" + ], + [ + "./worker.d.ts" + ], + [ + "./b.d.ts" + ] + ], + "fileInfos": { + "../../lib/lib.d.ts": { + "original": { + "version": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": 1 + }, + "version": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + }, + "./worker.d.ts": { + "original": { + "version": "-10088959579-export const enum AWorker {\n ONE = 2\n}\n", + "impliedFormat": 1 + }, + "version": "-10088959579-export const enum AWorker {\n ONE = 2\n}\n", + "signature": "-10088959579-export const enum AWorker {\n ONE = 2\n}\n", + "impliedFormat": "commonjs" + }, + "./b.d.ts": { + "original": { + "version": "-6488945853-export { AWorker as A } from \"./worker\";\n", + "impliedFormat": 1 + }, + "version": "-6488945853-export { AWorker as A } from \"./worker\";\n", + "signature": "-6488945853-export { AWorker as A } from \"./worker\";\n", + "impliedFormat": "commonjs" + }, + "./c.ts": { + "original": { + "version": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "impliedFormat": 1 + }, + "version": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "signature": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "impliedFormat": "commonjs" + }, + "./a.ts": { + "original": { + "version": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "impliedFormat": 1 + }, + "version": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "signature": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "impliedFormat": "commonjs" + } + }, + "root": [ + [ + 5, + "./a.ts" + ] + ], + "options": { + "tsBuildInfoFile": "./a.tsbuildinfo" + }, + "referencedMap": { + "./a.ts": [ + "./c.ts" + ], + "./b.d.ts": [ + "./worker.d.ts" + ], + "./c.ts": [ + "./b.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./a.ts", + "./b.d.ts", + "./c.ts", + "./worker.d.ts" + ] + }, + "version": "FakeTSVersion", + "size": 1156 +} + +//// [/src/project/c.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var b = 2 /* A.ONE */; + + + + +Change:: change enum value again +Input:: +//// [/src/project/worker.d.ts] +export const enum AWorker { + ONE = 3 +} + + + + +Output:: +/lib/tsc -i /src/project/a.ts --tsbuildinfofile /src/project/a.tsbuildinfo +exitCode:: ExitStatus.Success + + +//// [/src/project/a.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var a = 3 /* A.ONE */; + + +//// [/src/project/a.tsbuildinfo] +{"program":{"fileNames":["../../lib/lib.d.ts","./worker.d.ts","./b.d.ts","./c.ts","./a.ts"],"fileInfos":[{"version":"3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedFormat":1},{"version":"-10088923642-export const enum AWorker {\n ONE = 3\n}\n","impliedFormat":1},{"version":"-6488945853-export { AWorker as A } from \"./worker\";\n","impliedFormat":1},{"version":"-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n","impliedFormat":1},{"version":"-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n","impliedFormat":1}],"root":[5],"options":{"tsBuildInfoFile":"./a.tsbuildinfo"},"fileIdsList":[[4],[2],[3]],"referencedMap":[[5,1],[3,2],[4,3]],"semanticDiagnosticsPerFile":[1,5,3,4,2]},"version":"FakeTSVersion"} + +//// [/src/project/a.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../lib/lib.d.ts", + "./worker.d.ts", + "./b.d.ts", + "./c.ts", + "./a.ts" + ], + "fileNamesList": [ + [ + "./c.ts" + ], + [ + "./worker.d.ts" + ], + [ + "./b.d.ts" + ] + ], + "fileInfos": { + "../../lib/lib.d.ts": { + "original": { + "version": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": 1 + }, + "version": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + }, + "./worker.d.ts": { + "original": { + "version": "-10088923642-export const enum AWorker {\n ONE = 3\n}\n", + "impliedFormat": 1 + }, + "version": "-10088923642-export const enum AWorker {\n ONE = 3\n}\n", + "signature": "-10088923642-export const enum AWorker {\n ONE = 3\n}\n", + "impliedFormat": "commonjs" + }, + "./b.d.ts": { + "original": { + "version": "-6488945853-export { AWorker as A } from \"./worker\";\n", + "impliedFormat": 1 + }, + "version": "-6488945853-export { AWorker as A } from \"./worker\";\n", + "signature": "-6488945853-export { AWorker as A } from \"./worker\";\n", + "impliedFormat": "commonjs" + }, + "./c.ts": { + "original": { + "version": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "impliedFormat": 1 + }, + "version": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "signature": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "impliedFormat": "commonjs" + }, + "./a.ts": { + "original": { + "version": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "impliedFormat": 1 + }, + "version": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "signature": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "impliedFormat": "commonjs" + } + }, + "root": [ + [ + 5, + "./a.ts" + ] + ], + "options": { + "tsBuildInfoFile": "./a.tsbuildinfo" + }, + "referencedMap": { + "./a.ts": [ + "./c.ts" + ], + "./b.d.ts": [ + "./worker.d.ts" + ], + "./c.ts": [ + "./b.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./a.ts", + "./b.d.ts", + "./c.ts", + "./worker.d.ts" + ] + }, + "version": "FakeTSVersion", + "size": 1156 +} + +//// [/src/project/c.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var b = 3 /* A.ONE */; + + + + +Change:: something else changes in b.d.ts +Input:: +//// [/src/project/b.d.ts] +export { AWorker as A } from "./worker"; +export const randomThing = 10; + + + +Output:: +/lib/tsc -i /src/project/a.ts --tsbuildinfofile /src/project/a.tsbuildinfo +exitCode:: ExitStatus.Success + + +//// [/src/project/a.js] file written with same contents +//// [/src/project/a.tsbuildinfo] +{"program":{"fileNames":["../../lib/lib.d.ts","./worker.d.ts","./b.d.ts","./c.ts","./a.ts"],"fileInfos":[{"version":"3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedFormat":1},{"version":"-10088923642-export const enum AWorker {\n ONE = 3\n}\n","impliedFormat":1},{"version":"-7383473792-export { AWorker as A } from \"./worker\";\nexport const randomThing = 10;","impliedFormat":1},{"version":"-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n","signature":"3259150197-import { A } from \"./b\";\nexport { A };\n","impliedFormat":1},{"version":"-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n","signature":"-3531856636-export {};\n","impliedFormat":1}],"root":[5],"options":{"tsBuildInfoFile":"./a.tsbuildinfo"},"fileIdsList":[[4],[2],[3]],"referencedMap":[[5,1],[3,2],[4,3]],"semanticDiagnosticsPerFile":[1,5,3,4,2]},"version":"FakeTSVersion"} + +//// [/src/project/a.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../lib/lib.d.ts", + "./worker.d.ts", + "./b.d.ts", + "./c.ts", + "./a.ts" + ], + "fileNamesList": [ + [ + "./c.ts" + ], + [ + "./worker.d.ts" + ], + [ + "./b.d.ts" + ] + ], + "fileInfos": { + "../../lib/lib.d.ts": { + "original": { + "version": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": 1 + }, + "version": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + }, + "./worker.d.ts": { + "original": { + "version": "-10088923642-export const enum AWorker {\n ONE = 3\n}\n", + "impliedFormat": 1 + }, + "version": "-10088923642-export const enum AWorker {\n ONE = 3\n}\n", + "signature": "-10088923642-export const enum AWorker {\n ONE = 3\n}\n", + "impliedFormat": "commonjs" + }, + "./b.d.ts": { + "original": { + "version": "-7383473792-export { AWorker as A } from \"./worker\";\nexport const randomThing = 10;", + "impliedFormat": 1 + }, + "version": "-7383473792-export { AWorker as A } from \"./worker\";\nexport const randomThing = 10;", + "signature": "-7383473792-export { AWorker as A } from \"./worker\";\nexport const randomThing = 10;", + "impliedFormat": "commonjs" + }, + "./c.ts": { + "original": { + "version": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "signature": "3259150197-import { A } from \"./b\";\nexport { A };\n", + "impliedFormat": 1 + }, + "version": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "signature": "3259150197-import { A } from \"./b\";\nexport { A };\n", + "impliedFormat": "commonjs" + }, + "./a.ts": { + "original": { + "version": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "signature": "-3531856636-export {};\n", + "impliedFormat": 1 + }, + "version": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "signature": "-3531856636-export {};\n", + "impliedFormat": "commonjs" + } + }, + "root": [ + [ + 5, + "./a.ts" + ] + ], + "options": { + "tsBuildInfoFile": "./a.tsbuildinfo" + }, + "referencedMap": { + "./a.ts": [ + "./c.ts" + ], + "./b.d.ts": [ + "./worker.d.ts" + ], + "./c.ts": [ + "./b.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./a.ts", + "./b.d.ts", + "./c.ts", + "./worker.d.ts" + ] + }, + "version": "FakeTSVersion", + "size": 1294 +} + +//// [/src/project/c.js] file written with same contents + + +Change:: something else changes in b.d.ts again +Input:: +//// [/src/project/b.d.ts] +export { AWorker as A } from "./worker"; +export const randomThing = 10;export const randomThing2 = 10; + + + +Output:: +/lib/tsc -i /src/project/a.ts --tsbuildinfofile /src/project/a.tsbuildinfo +exitCode:: ExitStatus.Success + + +//// [/src/project/a.tsbuildinfo] +{"program":{"fileNames":["../../lib/lib.d.ts","./worker.d.ts","./b.d.ts","./c.ts","./a.ts"],"fileInfos":[{"version":"3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedFormat":1},{"version":"-10088923642-export const enum AWorker {\n ONE = 3\n}\n","impliedFormat":1},{"version":"2191846063-export { AWorker as A } from \"./worker\";\nexport const randomThing = 10;export const randomThing2 = 10;","impliedFormat":1},{"version":"-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n","signature":"3259150197-import { A } from \"./b\";\nexport { A };\n","impliedFormat":1},{"version":"-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n","impliedFormat":1}],"root":[5],"options":{"tsBuildInfoFile":"./a.tsbuildinfo"},"fileIdsList":[[4],[2],[3]],"referencedMap":[[5,1],[3,2],[4,3]],"semanticDiagnosticsPerFile":[1,5,3,4,2]},"version":"FakeTSVersion"} + +//// [/src/project/a.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../lib/lib.d.ts", + "./worker.d.ts", + "./b.d.ts", + "./c.ts", + "./a.ts" + ], + "fileNamesList": [ + [ + "./c.ts" + ], + [ + "./worker.d.ts" + ], + [ + "./b.d.ts" + ] + ], + "fileInfos": { + "../../lib/lib.d.ts": { + "original": { + "version": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": 1 + }, + "version": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + }, + "./worker.d.ts": { + "original": { + "version": "-10088923642-export const enum AWorker {\n ONE = 3\n}\n", + "impliedFormat": 1 + }, + "version": "-10088923642-export const enum AWorker {\n ONE = 3\n}\n", + "signature": "-10088923642-export const enum AWorker {\n ONE = 3\n}\n", + "impliedFormat": "commonjs" + }, + "./b.d.ts": { + "original": { + "version": "2191846063-export { AWorker as A } from \"./worker\";\nexport const randomThing = 10;export const randomThing2 = 10;", + "impliedFormat": 1 + }, + "version": "2191846063-export { AWorker as A } from \"./worker\";\nexport const randomThing = 10;export const randomThing2 = 10;", + "signature": "2191846063-export { AWorker as A } from \"./worker\";\nexport const randomThing = 10;export const randomThing2 = 10;", + "impliedFormat": "commonjs" + }, + "./c.ts": { + "original": { + "version": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "signature": "3259150197-import { A } from \"./b\";\nexport { A };\n", + "impliedFormat": 1 + }, + "version": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "signature": "3259150197-import { A } from \"./b\";\nexport { A };\n", + "impliedFormat": "commonjs" + }, + "./a.ts": { + "original": { + "version": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "impliedFormat": 1 + }, + "version": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "signature": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "impliedFormat": "commonjs" + } + }, + "root": [ + [ + 5, + "./a.ts" + ] + ], + "options": { + "tsBuildInfoFile": "./a.tsbuildinfo" + }, + "referencedMap": { + "./a.ts": [ + "./c.ts" + ], + "./b.d.ts": [ + "./worker.d.ts" + ], + "./c.ts": [ + "./b.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./a.ts", + "./b.d.ts", + "./c.ts", + "./worker.d.ts" + ] + }, + "version": "FakeTSVersion", + "size": 1285 +} + +//// [/src/project/c.js] file written with same contents diff --git a/tests/baselines/reference/tsc/incremental/with-const-enums-with-preserveConstEnums.js b/tests/baselines/reference/tsc/incremental/with-const-enums-with-preserveConstEnums.js new file mode 100644 index 0000000000000..4f2251d237d44 --- /dev/null +++ b/tests/baselines/reference/tsc/incremental/with-const-enums-with-preserveConstEnums.js @@ -0,0 +1,614 @@ +currentDirectory:: / useCaseSensitiveFileNames: false +Input:: +//// [/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +declare const console: { log(msg: any): void; }; + +//// [/src/project/a.ts] +import {A} from "./c" +let a = A.ONE + + +//// [/src/project/b.d.ts] +export const enum A { + ONE = 1 +} + + +//// [/src/project/c.ts] +import {A} from "./b" +let b = A.ONE +export {A} + + +//// [/src/project/worker.d.ts] +export const enum AWorker { + ONE = 1 +} + + + + +Output:: +/lib/tsc -i /src/project/a.ts --tsbuildinfofile /src/project/a.tsbuildinfo --preserveConstEnums +exitCode:: ExitStatus.Success + + +//// [/src/project/a.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var a = 1 /* A.ONE */; + + +//// [/src/project/a.tsbuildinfo] +{"program":{"fileNames":["../../lib/lib.d.ts","./b.d.ts","./c.ts","./a.ts"],"fileInfos":[{"version":"3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedFormat":1},{"version":"-7434209142-export const enum A {\n ONE = 1\n}\n","impliedFormat":1},{"version":"-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n","impliedFormat":1},{"version":"-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n","impliedFormat":1}],"root":[4],"options":{"preserveConstEnums":true,"tsBuildInfoFile":"./a.tsbuildinfo"},"fileIdsList":[[3],[2]],"referencedMap":[[4,1],[3,2]],"semanticDiagnosticsPerFile":[1,4,2,3]},"version":"FakeTSVersion"} + +//// [/src/project/a.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../lib/lib.d.ts", + "./b.d.ts", + "./c.ts", + "./a.ts" + ], + "fileNamesList": [ + [ + "./c.ts" + ], + [ + "./b.d.ts" + ] + ], + "fileInfos": { + "../../lib/lib.d.ts": { + "original": { + "version": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": 1 + }, + "version": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + }, + "./b.d.ts": { + "original": { + "version": "-7434209142-export const enum A {\n ONE = 1\n}\n", + "impliedFormat": 1 + }, + "version": "-7434209142-export const enum A {\n ONE = 1\n}\n", + "signature": "-7434209142-export const enum A {\n ONE = 1\n}\n", + "impliedFormat": "commonjs" + }, + "./c.ts": { + "original": { + "version": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "impliedFormat": 1 + }, + "version": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "signature": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "impliedFormat": "commonjs" + }, + "./a.ts": { + "original": { + "version": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "impliedFormat": 1 + }, + "version": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "signature": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "impliedFormat": "commonjs" + } + }, + "root": [ + [ + 4, + "./a.ts" + ] + ], + "options": { + "preserveConstEnums": true, + "tsBuildInfoFile": "./a.tsbuildinfo" + }, + "referencedMap": { + "./a.ts": [ + "./c.ts" + ], + "./c.ts": [ + "./b.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./a.ts", + "./b.d.ts", + "./c.ts" + ] + }, + "version": "FakeTSVersion", + "size": 1058 +} + +//// [/src/project/c.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.A = void 0; +var b_1 = require("./b"); +Object.defineProperty(exports, "A", { enumerable: true, get: function () { return b_1.A; } }); +var b = 1 /* A.ONE */; + + + + +Change:: change enum value +Input:: +//// [/src/project/b.d.ts] +export const enum A { + ONE = 2 +} + + + + +Output:: +/lib/tsc -i /src/project/a.ts --tsbuildinfofile /src/project/a.tsbuildinfo --preserveConstEnums +exitCode:: ExitStatus.Success + + +//// [/src/project/a.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var a = 2 /* A.ONE */; + + +//// [/src/project/a.tsbuildinfo] +{"program":{"fileNames":["../../lib/lib.d.ts","./b.d.ts","./c.ts","./a.ts"],"fileInfos":[{"version":"3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedFormat":1},{"version":"-7434173205-export const enum A {\n ONE = 2\n}\n","impliedFormat":1},{"version":"-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n","signature":"3259150197-import { A } from \"./b\";\nexport { A };\n","impliedFormat":1},{"version":"-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n","signature":"-3531856636-export {};\n","impliedFormat":1}],"root":[4],"options":{"preserveConstEnums":true,"tsBuildInfoFile":"./a.tsbuildinfo"},"fileIdsList":[[3],[2]],"referencedMap":[[4,1],[3,2]],"semanticDiagnosticsPerFile":[1,4,2,3]},"version":"FakeTSVersion"} + +//// [/src/project/a.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../lib/lib.d.ts", + "./b.d.ts", + "./c.ts", + "./a.ts" + ], + "fileNamesList": [ + [ + "./c.ts" + ], + [ + "./b.d.ts" + ] + ], + "fileInfos": { + "../../lib/lib.d.ts": { + "original": { + "version": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": 1 + }, + "version": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + }, + "./b.d.ts": { + "original": { + "version": "-7434173205-export const enum A {\n ONE = 2\n}\n", + "impliedFormat": 1 + }, + "version": "-7434173205-export const enum A {\n ONE = 2\n}\n", + "signature": "-7434173205-export const enum A {\n ONE = 2\n}\n", + "impliedFormat": "commonjs" + }, + "./c.ts": { + "original": { + "version": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "signature": "3259150197-import { A } from \"./b\";\nexport { A };\n", + "impliedFormat": 1 + }, + "version": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "signature": "3259150197-import { A } from \"./b\";\nexport { A };\n", + "impliedFormat": "commonjs" + }, + "./a.ts": { + "original": { + "version": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "signature": "-3531856636-export {};\n", + "impliedFormat": 1 + }, + "version": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "signature": "-3531856636-export {};\n", + "impliedFormat": "commonjs" + } + }, + "root": [ + [ + 4, + "./a.ts" + ] + ], + "options": { + "preserveConstEnums": true, + "tsBuildInfoFile": "./a.tsbuildinfo" + }, + "referencedMap": { + "./a.ts": [ + "./c.ts" + ], + "./c.ts": [ + "./b.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./a.ts", + "./b.d.ts", + "./c.ts" + ] + }, + "version": "FakeTSVersion", + "size": 1166 +} + +//// [/src/project/c.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.A = void 0; +var b_1 = require("./b"); +Object.defineProperty(exports, "A", { enumerable: true, get: function () { return b_1.A; } }); +var b = 2 /* A.ONE */; + + + + +Change:: change enum value again +Input:: +//// [/src/project/b.d.ts] +export const enum A { + ONE = 3 +} + + + + +Output:: +/lib/tsc -i /src/project/a.ts --tsbuildinfofile /src/project/a.tsbuildinfo --preserveConstEnums +exitCode:: ExitStatus.Success + + +//// [/src/project/a.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var a = 3 /* A.ONE */; + + +//// [/src/project/a.tsbuildinfo] +{"program":{"fileNames":["../../lib/lib.d.ts","./b.d.ts","./c.ts","./a.ts"],"fileInfos":[{"version":"3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedFormat":1},{"version":"-7434137268-export const enum A {\n ONE = 3\n}\n","impliedFormat":1},{"version":"-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n","signature":"3259150197-import { A } from \"./b\";\nexport { A };\n","impliedFormat":1},{"version":"-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n","impliedFormat":1}],"root":[4],"options":{"preserveConstEnums":true,"tsBuildInfoFile":"./a.tsbuildinfo"},"fileIdsList":[[3],[2]],"referencedMap":[[4,1],[3,2]],"semanticDiagnosticsPerFile":[1,4,2,3]},"version":"FakeTSVersion"} + +//// [/src/project/a.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../lib/lib.d.ts", + "./b.d.ts", + "./c.ts", + "./a.ts" + ], + "fileNamesList": [ + [ + "./c.ts" + ], + [ + "./b.d.ts" + ] + ], + "fileInfos": { + "../../lib/lib.d.ts": { + "original": { + "version": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": 1 + }, + "version": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + }, + "./b.d.ts": { + "original": { + "version": "-7434137268-export const enum A {\n ONE = 3\n}\n", + "impliedFormat": 1 + }, + "version": "-7434137268-export const enum A {\n ONE = 3\n}\n", + "signature": "-7434137268-export const enum A {\n ONE = 3\n}\n", + "impliedFormat": "commonjs" + }, + "./c.ts": { + "original": { + "version": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "signature": "3259150197-import { A } from \"./b\";\nexport { A };\n", + "impliedFormat": 1 + }, + "version": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "signature": "3259150197-import { A } from \"./b\";\nexport { A };\n", + "impliedFormat": "commonjs" + }, + "./a.ts": { + "original": { + "version": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "impliedFormat": 1 + }, + "version": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "signature": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "impliedFormat": "commonjs" + } + }, + "root": [ + [ + 4, + "./a.ts" + ] + ], + "options": { + "preserveConstEnums": true, + "tsBuildInfoFile": "./a.tsbuildinfo" + }, + "referencedMap": { + "./a.ts": [ + "./c.ts" + ], + "./c.ts": [ + "./b.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./a.ts", + "./b.d.ts", + "./c.ts" + ] + }, + "version": "FakeTSVersion", + "size": 1127 +} + +//// [/src/project/c.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.A = void 0; +var b_1 = require("./b"); +Object.defineProperty(exports, "A", { enumerable: true, get: function () { return b_1.A; } }); +var b = 3 /* A.ONE */; + + + + +Change:: something else changes in b.d.ts +Input:: +//// [/src/project/b.d.ts] +export const enum A { + ONE = 3 +} +export const randomThing = 10; + + + +Output:: +/lib/tsc -i /src/project/a.ts --tsbuildinfofile /src/project/a.tsbuildinfo --preserveConstEnums +exitCode:: ExitStatus.Success + + +//// [/src/project/a.js] file written with same contents +//// [/src/project/a.tsbuildinfo] +{"program":{"fileNames":["../../lib/lib.d.ts","./b.d.ts","./c.ts","./a.ts"],"fileInfos":[{"version":"3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedFormat":1},{"version":"-1392741047-export const enum A {\n ONE = 3\n}\nexport const randomThing = 10;","impliedFormat":1},{"version":"-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n","signature":"3259150197-import { A } from \"./b\";\nexport { A };\n","impliedFormat":1},{"version":"-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n","impliedFormat":1}],"root":[4],"options":{"preserveConstEnums":true,"tsBuildInfoFile":"./a.tsbuildinfo"},"fileIdsList":[[3],[2]],"referencedMap":[[4,1],[3,2]],"semanticDiagnosticsPerFile":[1,4,2,3]},"version":"FakeTSVersion"} + +//// [/src/project/a.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../lib/lib.d.ts", + "./b.d.ts", + "./c.ts", + "./a.ts" + ], + "fileNamesList": [ + [ + "./c.ts" + ], + [ + "./b.d.ts" + ] + ], + "fileInfos": { + "../../lib/lib.d.ts": { + "original": { + "version": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": 1 + }, + "version": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + }, + "./b.d.ts": { + "original": { + "version": "-1392741047-export const enum A {\n ONE = 3\n}\nexport const randomThing = 10;", + "impliedFormat": 1 + }, + "version": "-1392741047-export const enum A {\n ONE = 3\n}\nexport const randomThing = 10;", + "signature": "-1392741047-export const enum A {\n ONE = 3\n}\nexport const randomThing = 10;", + "impliedFormat": "commonjs" + }, + "./c.ts": { + "original": { + "version": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "signature": "3259150197-import { A } from \"./b\";\nexport { A };\n", + "impliedFormat": 1 + }, + "version": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "signature": "3259150197-import { A } from \"./b\";\nexport { A };\n", + "impliedFormat": "commonjs" + }, + "./a.ts": { + "original": { + "version": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "impliedFormat": 1 + }, + "version": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "signature": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "impliedFormat": "commonjs" + } + }, + "root": [ + [ + 4, + "./a.ts" + ] + ], + "options": { + "preserveConstEnums": true, + "tsBuildInfoFile": "./a.tsbuildinfo" + }, + "referencedMap": { + "./a.ts": [ + "./c.ts" + ], + "./c.ts": [ + "./b.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./a.ts", + "./b.d.ts", + "./c.ts" + ] + }, + "version": "FakeTSVersion", + "size": 1157 +} + +//// [/src/project/c.js] file written with same contents + + +Change:: something else changes in b.d.ts again +Input:: +//// [/src/project/b.d.ts] +export const enum A { + ONE = 3 +} +export const randomThing = 10;export const randomThing2 = 10; + + + +Output:: +/lib/tsc -i /src/project/a.ts --tsbuildinfofile /src/project/a.tsbuildinfo --preserveConstEnums +exitCode:: ExitStatus.Success + + +//// [/src/project/a.js] file written with same contents +//// [/src/project/a.tsbuildinfo] +{"program":{"fileNames":["../../lib/lib.d.ts","./b.d.ts","./c.ts","./a.ts"],"fileInfos":[{"version":"3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedFormat":1},{"version":"-11013141160-export const enum A {\n ONE = 3\n}\nexport const randomThing = 10;export const randomThing2 = 10;","impliedFormat":1},{"version":"-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n","signature":"3259150197-import { A } from \"./b\";\nexport { A };\n","impliedFormat":1},{"version":"-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n","impliedFormat":1}],"root":[4],"options":{"preserveConstEnums":true,"tsBuildInfoFile":"./a.tsbuildinfo"},"fileIdsList":[[3],[2]],"referencedMap":[[4,1],[3,2]],"semanticDiagnosticsPerFile":[1,4,2,3]},"version":"FakeTSVersion"} + +//// [/src/project/a.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../lib/lib.d.ts", + "./b.d.ts", + "./c.ts", + "./a.ts" + ], + "fileNamesList": [ + [ + "./c.ts" + ], + [ + "./b.d.ts" + ] + ], + "fileInfos": { + "../../lib/lib.d.ts": { + "original": { + "version": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": 1 + }, + "version": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + }, + "./b.d.ts": { + "original": { + "version": "-11013141160-export const enum A {\n ONE = 3\n}\nexport const randomThing = 10;export const randomThing2 = 10;", + "impliedFormat": 1 + }, + "version": "-11013141160-export const enum A {\n ONE = 3\n}\nexport const randomThing = 10;export const randomThing2 = 10;", + "signature": "-11013141160-export const enum A {\n ONE = 3\n}\nexport const randomThing = 10;export const randomThing2 = 10;", + "impliedFormat": "commonjs" + }, + "./c.ts": { + "original": { + "version": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "signature": "3259150197-import { A } from \"./b\";\nexport { A };\n", + "impliedFormat": 1 + }, + "version": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "signature": "3259150197-import { A } from \"./b\";\nexport { A };\n", + "impliedFormat": "commonjs" + }, + "./a.ts": { + "original": { + "version": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "impliedFormat": 1 + }, + "version": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "signature": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "impliedFormat": "commonjs" + } + }, + "root": [ + [ + 4, + "./a.ts" + ] + ], + "options": { + "preserveConstEnums": true, + "tsBuildInfoFile": "./a.tsbuildinfo" + }, + "referencedMap": { + "./a.ts": [ + "./c.ts" + ], + "./c.ts": [ + "./b.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./a.ts", + "./b.d.ts", + "./c.ts" + ] + }, + "version": "FakeTSVersion", + "size": 1189 +} + +//// [/src/project/c.js] file written with same contents diff --git a/tests/baselines/reference/tsc/incremental/with-const-enums.js b/tests/baselines/reference/tsc/incremental/with-const-enums.js new file mode 100644 index 0000000000000..4bb504e7c7761 --- /dev/null +++ b/tests/baselines/reference/tsc/incremental/with-const-enums.js @@ -0,0 +1,600 @@ +currentDirectory:: / useCaseSensitiveFileNames: false +Input:: +//// [/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +declare const console: { log(msg: any): void; }; + +//// [/src/project/a.ts] +import {A} from "./c" +let a = A.ONE + + +//// [/src/project/b.d.ts] +export const enum A { + ONE = 1 +} + + +//// [/src/project/c.ts] +import {A} from "./b" +let b = A.ONE +export {A} + + +//// [/src/project/worker.d.ts] +export const enum AWorker { + ONE = 1 +} + + + + +Output:: +/lib/tsc -i /src/project/a.ts --tsbuildinfofile /src/project/a.tsbuildinfo +exitCode:: ExitStatus.Success + + +//// [/src/project/a.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var a = 1 /* A.ONE */; + + +//// [/src/project/a.tsbuildinfo] +{"program":{"fileNames":["../../lib/lib.d.ts","./b.d.ts","./c.ts","./a.ts"],"fileInfos":[{"version":"3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedFormat":1},{"version":"-7434209142-export const enum A {\n ONE = 1\n}\n","impliedFormat":1},{"version":"-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n","impliedFormat":1},{"version":"-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n","impliedFormat":1}],"root":[4],"options":{"tsBuildInfoFile":"./a.tsbuildinfo"},"fileIdsList":[[3],[2]],"referencedMap":[[4,1],[3,2]],"semanticDiagnosticsPerFile":[1,4,2,3]},"version":"FakeTSVersion"} + +//// [/src/project/a.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../lib/lib.d.ts", + "./b.d.ts", + "./c.ts", + "./a.ts" + ], + "fileNamesList": [ + [ + "./c.ts" + ], + [ + "./b.d.ts" + ] + ], + "fileInfos": { + "../../lib/lib.d.ts": { + "original": { + "version": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": 1 + }, + "version": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + }, + "./b.d.ts": { + "original": { + "version": "-7434209142-export const enum A {\n ONE = 1\n}\n", + "impliedFormat": 1 + }, + "version": "-7434209142-export const enum A {\n ONE = 1\n}\n", + "signature": "-7434209142-export const enum A {\n ONE = 1\n}\n", + "impliedFormat": "commonjs" + }, + "./c.ts": { + "original": { + "version": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "impliedFormat": 1 + }, + "version": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "signature": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "impliedFormat": "commonjs" + }, + "./a.ts": { + "original": { + "version": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "impliedFormat": 1 + }, + "version": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "signature": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "impliedFormat": "commonjs" + } + }, + "root": [ + [ + 4, + "./a.ts" + ] + ], + "options": { + "tsBuildInfoFile": "./a.tsbuildinfo" + }, + "referencedMap": { + "./a.ts": [ + "./c.ts" + ], + "./c.ts": [ + "./b.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./a.ts", + "./b.d.ts", + "./c.ts" + ] + }, + "version": "FakeTSVersion", + "size": 1032 +} + +//// [/src/project/c.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var b = 1 /* A.ONE */; + + + + +Change:: change enum value +Input:: +//// [/src/project/b.d.ts] +export const enum A { + ONE = 2 +} + + + + +Output:: +/lib/tsc -i /src/project/a.ts --tsbuildinfofile /src/project/a.tsbuildinfo +exitCode:: ExitStatus.Success + + +//// [/src/project/a.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var a = 2 /* A.ONE */; + + +//// [/src/project/a.tsbuildinfo] +{"program":{"fileNames":["../../lib/lib.d.ts","./b.d.ts","./c.ts","./a.ts"],"fileInfos":[{"version":"3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedFormat":1},{"version":"-7434173205-export const enum A {\n ONE = 2\n}\n","impliedFormat":1},{"version":"-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n","signature":"3259150197-import { A } from \"./b\";\nexport { A };\n","impliedFormat":1},{"version":"-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n","signature":"-3531856636-export {};\n","impliedFormat":1}],"root":[4],"options":{"tsBuildInfoFile":"./a.tsbuildinfo"},"fileIdsList":[[3],[2]],"referencedMap":[[4,1],[3,2]],"semanticDiagnosticsPerFile":[1,4,2,3]},"version":"FakeTSVersion"} + +//// [/src/project/a.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../lib/lib.d.ts", + "./b.d.ts", + "./c.ts", + "./a.ts" + ], + "fileNamesList": [ + [ + "./c.ts" + ], + [ + "./b.d.ts" + ] + ], + "fileInfos": { + "../../lib/lib.d.ts": { + "original": { + "version": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": 1 + }, + "version": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + }, + "./b.d.ts": { + "original": { + "version": "-7434173205-export const enum A {\n ONE = 2\n}\n", + "impliedFormat": 1 + }, + "version": "-7434173205-export const enum A {\n ONE = 2\n}\n", + "signature": "-7434173205-export const enum A {\n ONE = 2\n}\n", + "impliedFormat": "commonjs" + }, + "./c.ts": { + "original": { + "version": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "signature": "3259150197-import { A } from \"./b\";\nexport { A };\n", + "impliedFormat": 1 + }, + "version": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "signature": "3259150197-import { A } from \"./b\";\nexport { A };\n", + "impliedFormat": "commonjs" + }, + "./a.ts": { + "original": { + "version": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "signature": "-3531856636-export {};\n", + "impliedFormat": 1 + }, + "version": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "signature": "-3531856636-export {};\n", + "impliedFormat": "commonjs" + } + }, + "root": [ + [ + 4, + "./a.ts" + ] + ], + "options": { + "tsBuildInfoFile": "./a.tsbuildinfo" + }, + "referencedMap": { + "./a.ts": [ + "./c.ts" + ], + "./c.ts": [ + "./b.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./a.ts", + "./b.d.ts", + "./c.ts" + ] + }, + "version": "FakeTSVersion", + "size": 1140 +} + +//// [/src/project/c.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var b = 2 /* A.ONE */; + + + + +Change:: change enum value again +Input:: +//// [/src/project/b.d.ts] +export const enum A { + ONE = 3 +} + + + + +Output:: +/lib/tsc -i /src/project/a.ts --tsbuildinfofile /src/project/a.tsbuildinfo +exitCode:: ExitStatus.Success + + +//// [/src/project/a.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var a = 3 /* A.ONE */; + + +//// [/src/project/a.tsbuildinfo] +{"program":{"fileNames":["../../lib/lib.d.ts","./b.d.ts","./c.ts","./a.ts"],"fileInfos":[{"version":"3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedFormat":1},{"version":"-7434137268-export const enum A {\n ONE = 3\n}\n","impliedFormat":1},{"version":"-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n","signature":"3259150197-import { A } from \"./b\";\nexport { A };\n","impliedFormat":1},{"version":"-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n","impliedFormat":1}],"root":[4],"options":{"tsBuildInfoFile":"./a.tsbuildinfo"},"fileIdsList":[[3],[2]],"referencedMap":[[4,1],[3,2]],"semanticDiagnosticsPerFile":[1,4,2,3]},"version":"FakeTSVersion"} + +//// [/src/project/a.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../lib/lib.d.ts", + "./b.d.ts", + "./c.ts", + "./a.ts" + ], + "fileNamesList": [ + [ + "./c.ts" + ], + [ + "./b.d.ts" + ] + ], + "fileInfos": { + "../../lib/lib.d.ts": { + "original": { + "version": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": 1 + }, + "version": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + }, + "./b.d.ts": { + "original": { + "version": "-7434137268-export const enum A {\n ONE = 3\n}\n", + "impliedFormat": 1 + }, + "version": "-7434137268-export const enum A {\n ONE = 3\n}\n", + "signature": "-7434137268-export const enum A {\n ONE = 3\n}\n", + "impliedFormat": "commonjs" + }, + "./c.ts": { + "original": { + "version": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "signature": "3259150197-import { A } from \"./b\";\nexport { A };\n", + "impliedFormat": 1 + }, + "version": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "signature": "3259150197-import { A } from \"./b\";\nexport { A };\n", + "impliedFormat": "commonjs" + }, + "./a.ts": { + "original": { + "version": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "impliedFormat": 1 + }, + "version": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "signature": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "impliedFormat": "commonjs" + } + }, + "root": [ + [ + 4, + "./a.ts" + ] + ], + "options": { + "tsBuildInfoFile": "./a.tsbuildinfo" + }, + "referencedMap": { + "./a.ts": [ + "./c.ts" + ], + "./c.ts": [ + "./b.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./a.ts", + "./b.d.ts", + "./c.ts" + ] + }, + "version": "FakeTSVersion", + "size": 1101 +} + +//// [/src/project/c.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var b = 3 /* A.ONE */; + + + + +Change:: something else changes in b.d.ts +Input:: +//// [/src/project/b.d.ts] +export const enum A { + ONE = 3 +} +export const randomThing = 10; + + + +Output:: +/lib/tsc -i /src/project/a.ts --tsbuildinfofile /src/project/a.tsbuildinfo +exitCode:: ExitStatus.Success + + +//// [/src/project/a.js] file written with same contents +//// [/src/project/a.tsbuildinfo] +{"program":{"fileNames":["../../lib/lib.d.ts","./b.d.ts","./c.ts","./a.ts"],"fileInfos":[{"version":"3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedFormat":1},{"version":"-1392741047-export const enum A {\n ONE = 3\n}\nexport const randomThing = 10;","impliedFormat":1},{"version":"-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n","signature":"3259150197-import { A } from \"./b\";\nexport { A };\n","impliedFormat":1},{"version":"-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n","impliedFormat":1}],"root":[4],"options":{"tsBuildInfoFile":"./a.tsbuildinfo"},"fileIdsList":[[3],[2]],"referencedMap":[[4,1],[3,2]],"semanticDiagnosticsPerFile":[1,4,2,3]},"version":"FakeTSVersion"} + +//// [/src/project/a.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../lib/lib.d.ts", + "./b.d.ts", + "./c.ts", + "./a.ts" + ], + "fileNamesList": [ + [ + "./c.ts" + ], + [ + "./b.d.ts" + ] + ], + "fileInfos": { + "../../lib/lib.d.ts": { + "original": { + "version": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": 1 + }, + "version": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + }, + "./b.d.ts": { + "original": { + "version": "-1392741047-export const enum A {\n ONE = 3\n}\nexport const randomThing = 10;", + "impliedFormat": 1 + }, + "version": "-1392741047-export const enum A {\n ONE = 3\n}\nexport const randomThing = 10;", + "signature": "-1392741047-export const enum A {\n ONE = 3\n}\nexport const randomThing = 10;", + "impliedFormat": "commonjs" + }, + "./c.ts": { + "original": { + "version": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "signature": "3259150197-import { A } from \"./b\";\nexport { A };\n", + "impliedFormat": 1 + }, + "version": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "signature": "3259150197-import { A } from \"./b\";\nexport { A };\n", + "impliedFormat": "commonjs" + }, + "./a.ts": { + "original": { + "version": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "impliedFormat": 1 + }, + "version": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "signature": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "impliedFormat": "commonjs" + } + }, + "root": [ + [ + 4, + "./a.ts" + ] + ], + "options": { + "tsBuildInfoFile": "./a.tsbuildinfo" + }, + "referencedMap": { + "./a.ts": [ + "./c.ts" + ], + "./c.ts": [ + "./b.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./a.ts", + "./b.d.ts", + "./c.ts" + ] + }, + "version": "FakeTSVersion", + "size": 1131 +} + +//// [/src/project/c.js] file written with same contents + + +Change:: something else changes in b.d.ts again +Input:: +//// [/src/project/b.d.ts] +export const enum A { + ONE = 3 +} +export const randomThing = 10;export const randomThing2 = 10; + + + +Output:: +/lib/tsc -i /src/project/a.ts --tsbuildinfofile /src/project/a.tsbuildinfo +exitCode:: ExitStatus.Success + + +//// [/src/project/a.js] file written with same contents +//// [/src/project/a.tsbuildinfo] +{"program":{"fileNames":["../../lib/lib.d.ts","./b.d.ts","./c.ts","./a.ts"],"fileInfos":[{"version":"3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedFormat":1},{"version":"-11013141160-export const enum A {\n ONE = 3\n}\nexport const randomThing = 10;export const randomThing2 = 10;","impliedFormat":1},{"version":"-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n","signature":"3259150197-import { A } from \"./b\";\nexport { A };\n","impliedFormat":1},{"version":"-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n","impliedFormat":1}],"root":[4],"options":{"tsBuildInfoFile":"./a.tsbuildinfo"},"fileIdsList":[[3],[2]],"referencedMap":[[4,1],[3,2]],"semanticDiagnosticsPerFile":[1,4,2,3]},"version":"FakeTSVersion"} + +//// [/src/project/a.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../lib/lib.d.ts", + "./b.d.ts", + "./c.ts", + "./a.ts" + ], + "fileNamesList": [ + [ + "./c.ts" + ], + [ + "./b.d.ts" + ] + ], + "fileInfos": { + "../../lib/lib.d.ts": { + "original": { + "version": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": 1 + }, + "version": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + }, + "./b.d.ts": { + "original": { + "version": "-11013141160-export const enum A {\n ONE = 3\n}\nexport const randomThing = 10;export const randomThing2 = 10;", + "impliedFormat": 1 + }, + "version": "-11013141160-export const enum A {\n ONE = 3\n}\nexport const randomThing = 10;export const randomThing2 = 10;", + "signature": "-11013141160-export const enum A {\n ONE = 3\n}\nexport const randomThing = 10;export const randomThing2 = 10;", + "impliedFormat": "commonjs" + }, + "./c.ts": { + "original": { + "version": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "signature": "3259150197-import { A } from \"./b\";\nexport { A };\n", + "impliedFormat": 1 + }, + "version": "-3548623266-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}\n", + "signature": "3259150197-import { A } from \"./b\";\nexport { A };\n", + "impliedFormat": "commonjs" + }, + "./a.ts": { + "original": { + "version": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "impliedFormat": 1 + }, + "version": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "signature": "-5009241479-import {A} from \"./c\"\nlet a = A.ONE\n", + "impliedFormat": "commonjs" + } + }, + "root": [ + [ + 4, + "./a.ts" + ] + ], + "options": { + "tsBuildInfoFile": "./a.tsbuildinfo" + }, + "referencedMap": { + "./a.ts": [ + "./c.ts" + ], + "./c.ts": [ + "./b.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./a.ts", + "./b.d.ts", + "./c.ts" + ] + }, + "version": "FakeTSVersion", + "size": 1163 +} + +//// [/src/project/c.js] file written with same contents