From 18269c0fc8a9dcccc8f9061e0c88f34f1135e1ca Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Fri, 3 Jan 2020 13:02:45 -0800 Subject: [PATCH] Add assumeChangesOnlyAffectDirectDependencies as a option to skip checking and generating .d.ts files for files indirectly importing affected file (#35711) * Baselining tsc --watch output * Add noIndirectImports as a option to skip checking and generating .d.ts files for files indirectly importing affected file Fixes #33329 * Rename option to assumeChangesOnlyAffectDirectDependencies * Description change as per feedback --- src/compiler/builder.ts | 4 +- src/compiler/commandLineParser.ts | 8 + src/compiler/diagnosticMessages.json | 4 + src/compiler/tsbuildPublic.ts | 1 + src/compiler/types.ts | 1 + .../unittests/tscWatch/emitAndErrorUpdates.ts | 12 + .../reference/api/tsserverlibrary.d.ts | 2 + tests/baselines/reference/api/typescript.d.ts | 2 + .../tsconfig.json | 5 + ...es-errors-when-deep-import-file-changes.js | 203 ++++++++++++ ...import-through-declaration-file-changes.js | 149 +++++++++ ...g-a-deep-multilevel-import-that-changes.js | 259 ++++++++++++++++ ...n-there-are-circular-import-and-exports.js | 290 ++++++++++++++++++ ...here-are-no-circular-import-and-exports.js | 257 ++++++++++++++++ .../with-noEmitOnError.js | 165 ++++++++++ ...es-errors-when-deep-import-file-changes.js | 179 +++++++++++ ...import-through-declaration-file-changes.js | 145 +++++++++ ...g-a-deep-multilevel-import-that-changes.js | 217 +++++++++++++ ...n-there-are-circular-import-and-exports.js | 243 +++++++++++++++ ...here-are-no-circular-import-and-exports.js | 219 +++++++++++++ .../with-noEmitOnError.js | 151 +++++++++ 21 files changed, 2515 insertions(+), 1 deletion(-) create mode 100644 tests/baselines/reference/showConfig/Shows tsconfig for single option/assumeChangesOnlyAffectDirectDependencies/tsconfig.json create mode 100644 tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies-and---declaration/deep-import-changes/updates-errors-when-deep-import-file-changes.js create mode 100644 tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies-and---declaration/deep-import-changes/updates-errors-when-deep-import-through-declaration-file-changes.js create mode 100644 tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies-and---declaration/updates-errors-in-file-not-exporting-a-deep-multilevel-import-that-changes.js create mode 100644 tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies-and---declaration/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js create mode 100644 tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies-and---declaration/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js create mode 100644 tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies-and---declaration/with-noEmitOnError.js create mode 100644 tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies/deep-import-changes/updates-errors-when-deep-import-file-changes.js create mode 100644 tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies/deep-import-changes/updates-errors-when-deep-import-through-declaration-file-changes.js create mode 100644 tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies/updates-errors-in-file-not-exporting-a-deep-multilevel-import-that-changes.js create mode 100644 tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js create mode 100644 tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js create mode 100644 tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies/with-noEmitOnError.js diff --git a/src/compiler/builder.ts b/src/compiler/builder.ts index 366bf3c39866c..0f6ce885ed2a4 100644 --- a/src/compiler/builder.ts +++ b/src/compiler/builder.ts @@ -433,7 +433,9 @@ namespace ts { return; } - forEachReferencingModulesOfExportOfAffectedFile(state, affectedFile, (state, path) => handleDtsMayChangeOf(state, path, cancellationToken, computeHash)); + if (!state.compilerOptions.assumeChangesOnlyAffectDirectDependencies) { + forEachReferencingModulesOfExportOfAffectedFile(state, affectedFile, (state, path) => handleDtsMayChangeOf(state, path, cancellationToken, computeHash)); + } } /** diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 543cd6ae88515..3ffa25fe340b1 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -202,6 +202,14 @@ namespace ts { description: Diagnostics.Enable_incremental_compilation, transpileOptionValue: undefined }, + { + name: "assumeChangesOnlyAffectDirectDependencies", + type: "boolean", + affectsSemanticDiagnostics: true, + affectsEmit: true, + category: Diagnostics.Advanced_Options, + description: Diagnostics.Have_recompiles_in_incremental_and_watch_assume_that_changes_within_a_file_will_only_affect_files_directly_depending_on_it + }, { name: "locale", type: "string", diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index d0d57483df3ba..d91267388bf4b 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -4366,6 +4366,10 @@ "category": "Message", "code": 6383 }, + "Have recompiles in '--incremental' and '--watch' assume that changes within a file will only affect files directly depending on it.": { + "category": "Message", + "code": 6384 + }, "The expected type comes from property '{0}' which is declared here on type '{1}'": { "category": "Message", diff --git a/src/compiler/tsbuildPublic.ts b/src/compiler/tsbuildPublic.ts index 901c09065191c..a7cadbf3bcb6d 100644 --- a/src/compiler/tsbuildPublic.ts +++ b/src/compiler/tsbuildPublic.ts @@ -16,6 +16,7 @@ namespace ts { /*@internal*/ listFiles?: boolean; /*@internal*/ pretty?: boolean; incremental?: boolean; + assumeChangesOnlyAffectDirectDependencies?: boolean; traceResolution?: boolean; /* @internal */ diagnostics?: boolean; diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 107f2b8155205..1f20906b8eb29 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -5070,6 +5070,7 @@ namespace ts { noUnusedLocals?: boolean; noUnusedParameters?: boolean; noImplicitUseStrict?: boolean; + assumeChangesOnlyAffectDirectDependencies?: boolean; noLib?: boolean; noResolve?: boolean; out?: string; diff --git a/src/testRunner/unittests/tscWatch/emitAndErrorUpdates.ts b/src/testRunner/unittests/tscWatch/emitAndErrorUpdates.ts index 620be52e3eec9..ca57ad939b73d 100644 --- a/src/testRunner/unittests/tscWatch/emitAndErrorUpdates.ts +++ b/src/testRunner/unittests/tscWatch/emitAndErrorUpdates.ts @@ -66,6 +66,18 @@ namespace ts.tscWatch { subScenario: `config with --isolatedModules and --declaration/${input.subScenario}`, configFile: () => changeCompilerOptions(input, { isolatedModules: true, declaration: true }) }); + + verifyEmitAndErrorUpdatesWorker({ + ...input, + subScenario: `config with --assumeChangesOnlyAffectDirectDependencies/${input.subScenario}`, + configFile: () => changeCompilerOptions(input, { assumeChangesOnlyAffectDirectDependencies: true }) + }); + + verifyEmitAndErrorUpdatesWorker({ + ...input, + subScenario: `config with --assumeChangesOnlyAffectDirectDependencies and --declaration/${input.subScenario}`, + configFile: () => changeCompilerOptions(input, { assumeChangesOnlyAffectDirectDependencies: true, declaration: true }) + }); } describe("deep import changes", () => { diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 0ac0f4c227ee4..ff2f7f29bba1b 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -2673,6 +2673,7 @@ declare namespace ts { noUnusedLocals?: boolean; noUnusedParameters?: boolean; noImplicitUseStrict?: boolean; + assumeChangesOnlyAffectDirectDependencies?: boolean; noLib?: boolean; noResolve?: boolean; out?: string; @@ -4779,6 +4780,7 @@ declare namespace ts { force?: boolean; verbose?: boolean; incremental?: boolean; + assumeChangesOnlyAffectDirectDependencies?: boolean; traceResolution?: boolean; [option: string]: CompilerOptionsValue | undefined; } diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 42432eac6e783..3312885b0c6bc 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -2673,6 +2673,7 @@ declare namespace ts { noUnusedLocals?: boolean; noUnusedParameters?: boolean; noImplicitUseStrict?: boolean; + assumeChangesOnlyAffectDirectDependencies?: boolean; noLib?: boolean; noResolve?: boolean; out?: string; @@ -4779,6 +4780,7 @@ declare namespace ts { force?: boolean; verbose?: boolean; incremental?: boolean; + assumeChangesOnlyAffectDirectDependencies?: boolean; traceResolution?: boolean; [option: string]: CompilerOptionsValue | undefined; } diff --git a/tests/baselines/reference/showConfig/Shows tsconfig for single option/assumeChangesOnlyAffectDirectDependencies/tsconfig.json b/tests/baselines/reference/showConfig/Shows tsconfig for single option/assumeChangesOnlyAffectDirectDependencies/tsconfig.json new file mode 100644 index 0000000000000..1f5155fb8f0be --- /dev/null +++ b/tests/baselines/reference/showConfig/Shows tsconfig for single option/assumeChangesOnlyAffectDirectDependencies/tsconfig.json @@ -0,0 +1,5 @@ +{ + "compilerOptions": { + "assumeChangesOnlyAffectDirectDependencies": true + } +} diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies-and---declaration/deep-import-changes/updates-errors-when-deep-import-file-changes.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies-and---declaration/deep-import-changes/updates-errors-when-deep-import-file-changes.js new file mode 100644 index 0000000000000..9f46249791d48 --- /dev/null +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies-and---declaration/deep-import-changes/updates-errors-when-deep-import-file-changes.js @@ -0,0 +1,203 @@ +/a/lib/tsc.js --w +//// [/user/username/projects/myproject/a.ts] +import {B} from './b'; +declare var console: any; +let b = new B(); +console.log(b.c.d); + +//// [/user/username/projects/myproject/b.ts] +import {C} from './c'; +export class B +{ + c = new C(); +} + +//// [/user/username/projects/myproject/c.ts] +export class C +{ + d = 1; +} + +//// [/user/username/projects/myproject/tsconfig.json] +{"compilerOptions":{"assumeChangesOnlyAffectDirectDependencies":true,"declaration":true}} + +//// [/a/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; } + +//// [/user/username/projects/myproject/c.js] +"use strict"; +exports.__esModule = true; +var C = /** @class */ (function () { + function C() { + this.d = 1; + } + return C; +}()); +exports.C = C; + + +//// [/user/username/projects/myproject/c.d.ts] +export declare class C { + d: number; +} + + +//// [/user/username/projects/myproject/b.js] +"use strict"; +exports.__esModule = true; +var c_1 = require("./c"); +var B = /** @class */ (function () { + function B() { + this.c = new c_1.C(); + } + return B; +}()); +exports.B = B; + + +//// [/user/username/projects/myproject/b.d.ts] +import { C } from './c'; +export declare class B { + c: C; +} + + +//// [/user/username/projects/myproject/a.js] +"use strict"; +exports.__esModule = true; +var b_1 = require("./b"); +var b = new b_1.B(); +console.log(b.c.d); + + +//// [/user/username/projects/myproject/a.d.ts] +export {}; + + + +Output:: +>> Screen clear +12:00:25 AM - Starting compilation in watch mode... + + + +12:00:38 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/c.ts"] +Program options: {"assumeChangesOnlyAffectDirectDependencies":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/c.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/c.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/a.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/user/username/projects/myproject/b.ts: + {"pollingInterval":250} +/user/username/projects/myproject/c.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Rename property d to d2 of class C + +//// [/user/username/projects/myproject/c.ts] +export class C +{ + d2 = 1; +} + +//// [/user/username/projects/myproject/c.js] +"use strict"; +exports.__esModule = true; +var C = /** @class */ (function () { + function C() { + this.d2 = 1; + } + return C; +}()); +exports.C = C; + + +//// [/user/username/projects/myproject/c.d.ts] +export declare class C { + d2: number; +} + + +//// [/user/username/projects/myproject/b.js] file written with same contents +//// [/user/username/projects/myproject/b.d.ts] file written with same contents + +Output:: +>> Screen clear +12:00:42 AM - File change detected. Starting incremental compilation... + + + +12:00:55 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/c.ts"] +Program options: {"assumeChangesOnlyAffectDirectDependencies":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/c.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/c.ts +/user/username/projects/myproject/b.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/user/username/projects/myproject/b.ts: + {"pollingInterval":250} +/user/username/projects/myproject/c.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies-and---declaration/deep-import-changes/updates-errors-when-deep-import-through-declaration-file-changes.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies-and---declaration/deep-import-changes/updates-errors-when-deep-import-through-declaration-file-changes.js new file mode 100644 index 0000000000000..64f5a555675a4 --- /dev/null +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies-and---declaration/deep-import-changes/updates-errors-when-deep-import-through-declaration-file-changes.js @@ -0,0 +1,149 @@ +/a/lib/tsc.js --w +//// [/user/username/projects/myproject/a.ts] +import {B} from './b'; +declare var console: any; +let b = new B(); +console.log(b.c.d); + +//// [/user/username/projects/myproject/b.d.ts] +import {C} from './c'; +export class B +{ + c: C; +} + +//// [/user/username/projects/myproject/c.d.ts] +export class C +{ + d: number; +} + +//// [/user/username/projects/myproject/tsconfig.json] +{"compilerOptions":{"assumeChangesOnlyAffectDirectDependencies":true,"declaration":true}} + +//// [/a/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; } + +//// [/user/username/projects/myproject/a.js] +"use strict"; +exports.__esModule = true; +var b_1 = require("./b"); +var b = new b_1.B(); +console.log(b.c.d); + + +//// [/user/username/projects/myproject/a.d.ts] +export {}; + + + +Output:: +>> Screen clear +12:00:25 AM - Starting compilation in watch mode... + + + +12:00:30 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.d.ts","/user/username/projects/myproject/c.d.ts"] +Program options: {"assumeChangesOnlyAffectDirectDependencies":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/c.d.ts +/user/username/projects/myproject/b.d.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/c.d.ts +/user/username/projects/myproject/b.d.ts +/user/username/projects/myproject/a.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/user/username/projects/myproject/b.d.ts: + {"pollingInterval":250} +/user/username/projects/myproject/c.d.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Rename property d to d2 of class C + +//// [/user/username/projects/myproject/c.d.ts] +export class C +{ + d2: number; +} + + +Output:: +>> Screen clear +12:00:34 AM - File change detected. Starting incremental compilation... + + + +12:00:35 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.d.ts","/user/username/projects/myproject/c.d.ts"] +Program options: {"assumeChangesOnlyAffectDirectDependencies":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/c.d.ts +/user/username/projects/myproject/b.d.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/c.d.ts +/user/username/projects/myproject/b.d.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/user/username/projects/myproject/b.d.ts: + {"pollingInterval":250} +/user/username/projects/myproject/c.d.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies-and---declaration/updates-errors-in-file-not-exporting-a-deep-multilevel-import-that-changes.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies-and---declaration/updates-errors-in-file-not-exporting-a-deep-multilevel-import-that-changes.js new file mode 100644 index 0000000000000..8dddd3fff925b --- /dev/null +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies-and---declaration/updates-errors-in-file-not-exporting-a-deep-multilevel-import-that-changes.js @@ -0,0 +1,259 @@ +/a/lib/tsc.js --w +//// [/user/username/projects/myproject/a.ts] +export interface Point { + name: string; + c: Coords; +} +export interface Coords { + x2: number; + y: number; +} + +//// [/user/username/projects/myproject/b.ts] +import { Point } from "./a"; +export interface PointWrapper extends Point { +} + +//// [/user/username/projects/myproject/c.ts] +import { PointWrapper } from "./b"; +export function getPoint(): PointWrapper { + return { + name: "test", + c: { + x: 1, + y: 2 + } + } +}; + +//// [/user/username/projects/myproject/d.ts] +import { getPoint } from "./c"; +getPoint().c.x; + +//// [/user/username/projects/myproject/e.ts] +import "./d"; + +//// [/user/username/projects/myproject/tsconfig.json] +{"compilerOptions":{"assumeChangesOnlyAffectDirectDependencies":true,"declaration":true}} + +//// [/a/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; } + +//// [/user/username/projects/myproject/a.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/myproject/a.d.ts] +export interface Point { + name: string; + c: Coords; +} +export interface Coords { + x2: number; + y: number; +} + + +//// [/user/username/projects/myproject/b.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/myproject/b.d.ts] +import { Point } from "./a"; +export interface PointWrapper extends Point { +} + + +//// [/user/username/projects/myproject/c.js] +"use strict"; +exports.__esModule = true; +function getPoint() { + return { + name: "test", + c: { + x: 1, + y: 2 + } + }; +} +exports.getPoint = getPoint; +; + + +//// [/user/username/projects/myproject/c.d.ts] +import { PointWrapper } from "./b"; +export declare function getPoint(): PointWrapper; + + +//// [/user/username/projects/myproject/d.js] +"use strict"; +exports.__esModule = true; +var c_1 = require("./c"); +c_1.getPoint().c.x; + + +//// [/user/username/projects/myproject/d.d.ts] +export {}; + + +//// [/user/username/projects/myproject/e.js] +"use strict"; +exports.__esModule = true; +require("./d"); + + +//// [/user/username/projects/myproject/e.d.ts] +import "./d"; + + + +Output:: +>> Screen clear +12:00:29 AM - Starting compilation in watch mode... + + +c.ts(6,13): error TS2322: Type '{ x: number; y: number; }' is not assignable to type 'Coords'. + Object literal may only specify known properties, and 'x' does not exist in type 'Coords'. + +d.ts(2,14): error TS2339: Property 'x' does not exist on type 'Coords'. + + +12:00:50 AM - Found 2 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/c.ts","/user/username/projects/myproject/d.ts","/user/username/projects/myproject/e.ts"] +Program options: {"assumeChangesOnlyAffectDirectDependencies":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/c.ts +/user/username/projects/myproject/d.ts +/user/username/projects/myproject/e.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/c.ts +/user/username/projects/myproject/d.ts +/user/username/projects/myproject/e.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/user/username/projects/myproject/b.ts: + {"pollingInterval":250} +/user/username/projects/myproject/c.ts: + {"pollingInterval":250} +/user/username/projects/myproject/d.ts: + {"pollingInterval":250} +/user/username/projects/myproject/e.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Rename property x2 to x of interface Coords + +//// [/user/username/projects/myproject/a.ts] +export interface Point { + name: string; + c: Coords; +} +export interface Coords { + x: number; + y: number; +} + +//// [/user/username/projects/myproject/a.js] file written with same contents +//// [/user/username/projects/myproject/a.d.ts] +export interface Point { + name: string; + c: Coords; +} +export interface Coords { + x: number; + y: number; +} + + +//// [/user/username/projects/myproject/b.js] file written with same contents +//// [/user/username/projects/myproject/b.d.ts] file written with same contents + +Output:: +>> Screen clear +12:00:54 AM - File change detected. Starting incremental compilation... + + +c.ts(6,13): error TS2322: Type '{ x: number; y: number; }' is not assignable to type 'Coords'. + Object literal may only specify known properties, and 'x' does not exist in type 'Coords'. + +d.ts(2,14): error TS2339: Property 'x' does not exist on type 'Coords'. + + +12:01:07 AM - Found 2 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/c.ts","/user/username/projects/myproject/d.ts","/user/username/projects/myproject/e.ts"] +Program options: {"assumeChangesOnlyAffectDirectDependencies":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/c.ts +/user/username/projects/myproject/d.ts +/user/username/projects/myproject/e.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/user/username/projects/myproject/b.ts: + {"pollingInterval":250} +/user/username/projects/myproject/c.ts: + {"pollingInterval":250} +/user/username/projects/myproject/d.ts: + {"pollingInterval":250} +/user/username/projects/myproject/e.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies-and---declaration/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies-and---declaration/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js new file mode 100644 index 0000000000000..b554a69a372c6 --- /dev/null +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies-and---declaration/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js @@ -0,0 +1,290 @@ +/a/lib/tsc.js --w +//// [/user/username/projects/myproject/lib1/tools/tools.interface.ts] +export interface ITest { + title: string; +} + +//// [/user/username/projects/myproject/lib1/tools/public.ts] +export * from "./tools.interface"; + +//// [/user/username/projects/myproject/app.ts] +import { Data } from "lib2/public"; +export class App { + public constructor() { + new Data().test(); + } +} + +//// [/user/username/projects/myproject/lib2/public.ts] +export * from "./data"; + +//// [/user/username/projects/myproject/lib1/public.ts] +export * from "./tools/public"; + +//// [/user/username/projects/myproject/lib2/data.ts] +import { ITest } from "lib1/public"; import { Data2 } from "./data2"; +export class Data { + public dat?: Data2; public test() { + const result: ITest = { + title: "title" + } + return result; + } +} + +//// [/user/username/projects/myproject/lib2/data2.ts] +import { Data } from "./data"; +export class Data2 { + public dat?: Data; +} + +//// [/user/username/projects/myproject/tsconfig.json] +{"files":["app.ts"],"compilerOptions":{"baseUrl":".","assumeChangesOnlyAffectDirectDependencies":true,"declaration":true}} + +//// [/a/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; } + +//// [/user/username/projects/myproject/lib1/tools/tools.interface.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/myproject/lib1/tools/tools.interface.d.ts] +export interface ITest { + title: string; +} + + +//// [/user/username/projects/myproject/lib1/tools/public.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/myproject/lib1/tools/public.d.ts] +export * from "./tools.interface"; + + +//// [/user/username/projects/myproject/lib1/public.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/myproject/lib1/public.d.ts] +export * from "./tools/public"; + + +//// [/user/username/projects/myproject/lib2/data2.js] +"use strict"; +exports.__esModule = true; +var Data2 = /** @class */ (function () { + function Data2() { + } + return Data2; +}()); +exports.Data2 = Data2; + + +//// [/user/username/projects/myproject/lib2/data2.d.ts] +import { Data } from "./data"; +export declare class Data2 { + dat?: Data; +} + + +//// [/user/username/projects/myproject/lib2/data.js] +"use strict"; +exports.__esModule = true; +var Data = /** @class */ (function () { + function Data() { + } + Data.prototype.test = function () { + var result = { + title: "title" + }; + return result; + }; + return Data; +}()); +exports.Data = Data; + + +//// [/user/username/projects/myproject/lib2/data.d.ts] +import { ITest } from "lib1/public"; +import { Data2 } from "./data2"; +export declare class Data { + dat?: Data2; + test(): ITest; +} + + +//// [/user/username/projects/myproject/lib2/public.js] +"use strict"; +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} +exports.__esModule = true; +__export(require("./data")); + + +//// [/user/username/projects/myproject/lib2/public.d.ts] +export * from "./data"; + + +//// [/user/username/projects/myproject/app.js] +"use strict"; +exports.__esModule = true; +var public_1 = require("lib2/public"); +var App = /** @class */ (function () { + function App() { + new public_1.Data().test(); + } + return App; +}()); +exports.App = App; + + +//// [/user/username/projects/myproject/app.d.ts] +export declare class App { + constructor(); +} + + + +Output:: +>> Screen clear +12:00:39 AM - Starting compilation in watch mode... + + + +12:01:08 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/app.ts"] +Program options: {"baseUrl":"/user/username/projects/myproject","assumeChangesOnlyAffectDirectDependencies":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/lib1/tools/tools.interface.ts +/user/username/projects/myproject/lib1/tools/public.ts +/user/username/projects/myproject/lib1/public.ts +/user/username/projects/myproject/lib2/data2.ts +/user/username/projects/myproject/lib2/data.ts +/user/username/projects/myproject/lib2/public.ts +/user/username/projects/myproject/app.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/lib1/tools/tools.interface.ts +/user/username/projects/myproject/lib1/tools/public.ts +/user/username/projects/myproject/lib1/public.ts +/user/username/projects/myproject/lib2/data2.ts +/user/username/projects/myproject/lib2/data.ts +/user/username/projects/myproject/lib2/public.ts +/user/username/projects/myproject/app.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/app.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/data.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/tools/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/tools/tools.interface.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/data2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Rename property title to title2 of interface ITest + +//// [/user/username/projects/myproject/lib1/tools/tools.interface.ts] +export interface ITest { + title2: string; +} + +//// [/user/username/projects/myproject/lib1/tools/tools.interface.js] file written with same contents +//// [/user/username/projects/myproject/lib1/tools/tools.interface.d.ts] +export interface ITest { + title2: string; +} + + +//// [/user/username/projects/myproject/lib1/tools/public.js] file written with same contents +//// [/user/username/projects/myproject/lib1/tools/public.d.ts] file written with same contents + +Output:: +>> Screen clear +12:01:12 AM - File change detected. Starting incremental compilation... + + + +12:01:25 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/app.ts"] +Program options: {"baseUrl":"/user/username/projects/myproject","assumeChangesOnlyAffectDirectDependencies":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/lib1/tools/tools.interface.ts +/user/username/projects/myproject/lib1/tools/public.ts +/user/username/projects/myproject/lib1/public.ts +/user/username/projects/myproject/lib2/data2.ts +/user/username/projects/myproject/lib2/data.ts +/user/username/projects/myproject/lib2/public.ts +/user/username/projects/myproject/app.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/lib1/tools/tools.interface.ts +/user/username/projects/myproject/lib1/tools/public.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/app.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/data.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/tools/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/tools/tools.interface.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/data2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies-and---declaration/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies-and---declaration/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js new file mode 100644 index 0000000000000..a9b7299030e55 --- /dev/null +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies-and---declaration/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js @@ -0,0 +1,257 @@ +/a/lib/tsc.js --w +//// [/user/username/projects/myproject/lib1/tools/tools.interface.ts] +export interface ITest { + title: string; +} + +//// [/user/username/projects/myproject/lib1/tools/public.ts] +export * from "./tools.interface"; + +//// [/user/username/projects/myproject/app.ts] +import { Data } from "lib2/public"; +export class App { + public constructor() { + new Data().test(); + } +} + +//// [/user/username/projects/myproject/lib2/public.ts] +export * from "./data"; + +//// [/user/username/projects/myproject/lib1/public.ts] +export * from "./tools/public"; + +//// [/user/username/projects/myproject/lib2/data.ts] +import { ITest } from "lib1/public"; +export class Data { + public test() { + const result: ITest = { + title: "title" + } + return result; + } +} + +//// [/user/username/projects/myproject/tsconfig.json] +{"files":["app.ts"],"compilerOptions":{"baseUrl":".","assumeChangesOnlyAffectDirectDependencies":true,"declaration":true}} + +//// [/a/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; } + +//// [/user/username/projects/myproject/lib1/tools/tools.interface.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/myproject/lib1/tools/tools.interface.d.ts] +export interface ITest { + title: string; +} + + +//// [/user/username/projects/myproject/lib1/tools/public.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/myproject/lib1/tools/public.d.ts] +export * from "./tools.interface"; + + +//// [/user/username/projects/myproject/lib1/public.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/myproject/lib1/public.d.ts] +export * from "./tools/public"; + + +//// [/user/username/projects/myproject/lib2/data.js] +"use strict"; +exports.__esModule = true; +var Data = /** @class */ (function () { + function Data() { + } + Data.prototype.test = function () { + var result = { + title: "title" + }; + return result; + }; + return Data; +}()); +exports.Data = Data; + + +//// [/user/username/projects/myproject/lib2/data.d.ts] +import { ITest } from "lib1/public"; +export declare class Data { + test(): ITest; +} + + +//// [/user/username/projects/myproject/lib2/public.js] +"use strict"; +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} +exports.__esModule = true; +__export(require("./data")); + + +//// [/user/username/projects/myproject/lib2/public.d.ts] +export * from "./data"; + + +//// [/user/username/projects/myproject/app.js] +"use strict"; +exports.__esModule = true; +var public_1 = require("lib2/public"); +var App = /** @class */ (function () { + function App() { + new public_1.Data().test(); + } + return App; +}()); +exports.App = App; + + +//// [/user/username/projects/myproject/app.d.ts] +export declare class App { + constructor(); +} + + + +Output:: +>> Screen clear +12:00:37 AM - Starting compilation in watch mode... + + + +12:01:02 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/app.ts"] +Program options: {"baseUrl":"/user/username/projects/myproject","assumeChangesOnlyAffectDirectDependencies":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/lib1/tools/tools.interface.ts +/user/username/projects/myproject/lib1/tools/public.ts +/user/username/projects/myproject/lib1/public.ts +/user/username/projects/myproject/lib2/data.ts +/user/username/projects/myproject/lib2/public.ts +/user/username/projects/myproject/app.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/lib1/tools/tools.interface.ts +/user/username/projects/myproject/lib1/tools/public.ts +/user/username/projects/myproject/lib1/public.ts +/user/username/projects/myproject/lib2/data.ts +/user/username/projects/myproject/lib2/public.ts +/user/username/projects/myproject/app.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/app.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/data.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/tools/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/tools/tools.interface.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Rename property title to title2 of interface ITest + +//// [/user/username/projects/myproject/lib1/tools/tools.interface.ts] +export interface ITest { + title2: string; +} + +//// [/user/username/projects/myproject/lib1/tools/tools.interface.js] file written with same contents +//// [/user/username/projects/myproject/lib1/tools/tools.interface.d.ts] +export interface ITest { + title2: string; +} + + +//// [/user/username/projects/myproject/lib1/tools/public.js] file written with same contents +//// [/user/username/projects/myproject/lib1/tools/public.d.ts] file written with same contents + +Output:: +>> Screen clear +12:01:06 AM - File change detected. Starting incremental compilation... + + + +12:01:19 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/app.ts"] +Program options: {"baseUrl":"/user/username/projects/myproject","assumeChangesOnlyAffectDirectDependencies":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/lib1/tools/tools.interface.ts +/user/username/projects/myproject/lib1/tools/public.ts +/user/username/projects/myproject/lib1/public.ts +/user/username/projects/myproject/lib2/data.ts +/user/username/projects/myproject/lib2/public.ts +/user/username/projects/myproject/app.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/lib1/tools/tools.interface.ts +/user/username/projects/myproject/lib1/tools/public.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/app.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/data.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/tools/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/tools/tools.interface.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies-and---declaration/with-noEmitOnError.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies-and---declaration/with-noEmitOnError.js new file mode 100644 index 0000000000000..0d8f7659fcaa9 --- /dev/null +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies-and---declaration/with-noEmitOnError.js @@ -0,0 +1,165 @@ +/a/lib/tsc.js --w +//// [/user/username/projects/noEmitOnError/shared/types/db.ts] +export interface A { + name: string; +} + +//// [/user/username/projects/noEmitOnError/src/main.ts] +import { A } from "../shared/types/db"; +const a = { + lastName: 'sdsd' +; + +//// [/user/username/projects/noEmitOnError/src/other.ts] +console.log("hi"); +export { } + +//// [/user/username/projects/noEmitOnError/tsconfig.json] +{"compilerOptions":{"outDir":"./dev-build","noEmitOnError":true,"assumeChangesOnlyAffectDirectDependencies":true,"declaration":true}} + +//// [/a/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; }; + + +Output:: +>> Screen clear +12:00:31 AM - Starting compilation in watch mode... + + +src/main.ts(4,1): error TS1005: ',' expected. + + +12:00:32 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/user/username/projects/noEmitOnError/shared/types/db.ts","/user/username/projects/noEmitOnError/src/main.ts","/user/username/projects/noEmitOnError/src/other.ts"] +Program options: {"outDir":"/user/username/projects/noEmitOnError/dev-build","noEmitOnError":true,"assumeChangesOnlyAffectDirectDependencies":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/noEmitOnError/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/noEmitOnError/shared/types/db.ts +/user/username/projects/noEmitOnError/src/main.ts +/user/username/projects/noEmitOnError/src/other.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/noEmitOnError/shared/types/db.ts +/user/username/projects/noEmitOnError/src/main.ts +/user/username/projects/noEmitOnError/src/other.ts + +WatchedFiles:: +/user/username/projects/noemitonerror/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/noemitonerror/shared/types/db.ts: + {"pollingInterval":250} +/user/username/projects/noemitonerror/src/main.ts: + {"pollingInterval":250} +/user/username/projects/noemitonerror/src/other.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/noemitonerror/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/noemitonerror: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Fix the error + +//// [/user/username/projects/noEmitOnError/src/main.ts] +import { A } from "../shared/types/db"; +const a = { + lastName: 'sdsd' +}; + +//// [/user/username/projects/noEmitOnError/dev-build/shared/types/db.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/noEmitOnError/dev-build/shared/types/db.d.ts] +export interface A { + name: string; +} + + +//// [/user/username/projects/noEmitOnError/dev-build/src/main.js] +"use strict"; +exports.__esModule = true; +var a = { + lastName: 'sdsd' +}; + + +//// [/user/username/projects/noEmitOnError/dev-build/src/main.d.ts] +export {}; + + +//// [/user/username/projects/noEmitOnError/dev-build/src/other.js] +"use strict"; +exports.__esModule = true; +console.log("hi"); + + +//// [/user/username/projects/noEmitOnError/dev-build/src/other.d.ts] +export {}; + + + +Output:: +>> Screen clear +12:00:36 AM - File change detected. Starting incremental compilation... + + + +12:00:59 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/noEmitOnError/shared/types/db.ts","/user/username/projects/noEmitOnError/src/main.ts","/user/username/projects/noEmitOnError/src/other.ts"] +Program options: {"outDir":"/user/username/projects/noEmitOnError/dev-build","noEmitOnError":true,"assumeChangesOnlyAffectDirectDependencies":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/noEmitOnError/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/noEmitOnError/shared/types/db.ts +/user/username/projects/noEmitOnError/src/main.ts +/user/username/projects/noEmitOnError/src/other.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/noEmitOnError/src/main.ts + +WatchedFiles:: +/user/username/projects/noemitonerror/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/noemitonerror/shared/types/db.ts: + {"pollingInterval":250} +/user/username/projects/noemitonerror/src/main.ts: + {"pollingInterval":250} +/user/username/projects/noemitonerror/src/other.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/noemitonerror/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/noemitonerror: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies/deep-import-changes/updates-errors-when-deep-import-file-changes.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies/deep-import-changes/updates-errors-when-deep-import-file-changes.js new file mode 100644 index 0000000000000..3c4b536c87422 --- /dev/null +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies/deep-import-changes/updates-errors-when-deep-import-file-changes.js @@ -0,0 +1,179 @@ +/a/lib/tsc.js --w +//// [/user/username/projects/myproject/a.ts] +import {B} from './b'; +declare var console: any; +let b = new B(); +console.log(b.c.d); + +//// [/user/username/projects/myproject/b.ts] +import {C} from './c'; +export class B +{ + c = new C(); +} + +//// [/user/username/projects/myproject/c.ts] +export class C +{ + d = 1; +} + +//// [/user/username/projects/myproject/tsconfig.json] +{"compilerOptions":{"assumeChangesOnlyAffectDirectDependencies":true}} + +//// [/a/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; } + +//// [/user/username/projects/myproject/c.js] +"use strict"; +exports.__esModule = true; +var C = /** @class */ (function () { + function C() { + this.d = 1; + } + return C; +}()); +exports.C = C; + + +//// [/user/username/projects/myproject/b.js] +"use strict"; +exports.__esModule = true; +var c_1 = require("./c"); +var B = /** @class */ (function () { + function B() { + this.c = new c_1.C(); + } + return B; +}()); +exports.B = B; + + +//// [/user/username/projects/myproject/a.js] +"use strict"; +exports.__esModule = true; +var b_1 = require("./b"); +var b = new b_1.B(); +console.log(b.c.d); + + + +Output:: +>> Screen clear +12:00:25 AM - Starting compilation in watch mode... + + + +12:00:32 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/c.ts"] +Program options: {"assumeChangesOnlyAffectDirectDependencies":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/c.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/c.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/a.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/user/username/projects/myproject/b.ts: + {"pollingInterval":250} +/user/username/projects/myproject/c.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Rename property d to d2 of class C + +//// [/user/username/projects/myproject/c.ts] +export class C +{ + d2 = 1; +} + +//// [/user/username/projects/myproject/c.js] +"use strict"; +exports.__esModule = true; +var C = /** @class */ (function () { + function C() { + this.d2 = 1; + } + return C; +}()); +exports.C = C; + + +//// [/user/username/projects/myproject/b.js] file written with same contents + +Output:: +>> Screen clear +12:00:36 AM - File change detected. Starting incremental compilation... + + + +12:00:43 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/c.ts"] +Program options: {"assumeChangesOnlyAffectDirectDependencies":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/c.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/c.ts +/user/username/projects/myproject/b.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/user/username/projects/myproject/b.ts: + {"pollingInterval":250} +/user/username/projects/myproject/c.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies/deep-import-changes/updates-errors-when-deep-import-through-declaration-file-changes.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies/deep-import-changes/updates-errors-when-deep-import-through-declaration-file-changes.js new file mode 100644 index 0000000000000..bce8664eae658 --- /dev/null +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies/deep-import-changes/updates-errors-when-deep-import-through-declaration-file-changes.js @@ -0,0 +1,145 @@ +/a/lib/tsc.js --w +//// [/user/username/projects/myproject/a.ts] +import {B} from './b'; +declare var console: any; +let b = new B(); +console.log(b.c.d); + +//// [/user/username/projects/myproject/b.d.ts] +import {C} from './c'; +export class B +{ + c: C; +} + +//// [/user/username/projects/myproject/c.d.ts] +export class C +{ + d: number; +} + +//// [/user/username/projects/myproject/tsconfig.json] +{"compilerOptions":{"assumeChangesOnlyAffectDirectDependencies":true}} + +//// [/a/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; } + +//// [/user/username/projects/myproject/a.js] +"use strict"; +exports.__esModule = true; +var b_1 = require("./b"); +var b = new b_1.B(); +console.log(b.c.d); + + + +Output:: +>> Screen clear +12:00:25 AM - Starting compilation in watch mode... + + + +12:00:28 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.d.ts","/user/username/projects/myproject/c.d.ts"] +Program options: {"assumeChangesOnlyAffectDirectDependencies":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/c.d.ts +/user/username/projects/myproject/b.d.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/c.d.ts +/user/username/projects/myproject/b.d.ts +/user/username/projects/myproject/a.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/user/username/projects/myproject/b.d.ts: + {"pollingInterval":250} +/user/username/projects/myproject/c.d.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Rename property d to d2 of class C + +//// [/user/username/projects/myproject/c.d.ts] +export class C +{ + d2: number; +} + + +Output:: +>> Screen clear +12:00:32 AM - File change detected. Starting incremental compilation... + + + +12:00:33 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.d.ts","/user/username/projects/myproject/c.d.ts"] +Program options: {"assumeChangesOnlyAffectDirectDependencies":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/c.d.ts +/user/username/projects/myproject/b.d.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/c.d.ts +/user/username/projects/myproject/b.d.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/user/username/projects/myproject/b.d.ts: + {"pollingInterval":250} +/user/username/projects/myproject/c.d.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies/updates-errors-in-file-not-exporting-a-deep-multilevel-import-that-changes.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies/updates-errors-in-file-not-exporting-a-deep-multilevel-import-that-changes.js new file mode 100644 index 0000000000000..b8c39b6484a9d --- /dev/null +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies/updates-errors-in-file-not-exporting-a-deep-multilevel-import-that-changes.js @@ -0,0 +1,217 @@ +/a/lib/tsc.js --w +//// [/user/username/projects/myproject/a.ts] +export interface Point { + name: string; + c: Coords; +} +export interface Coords { + x2: number; + y: number; +} + +//// [/user/username/projects/myproject/b.ts] +import { Point } from "./a"; +export interface PointWrapper extends Point { +} + +//// [/user/username/projects/myproject/c.ts] +import { PointWrapper } from "./b"; +export function getPoint(): PointWrapper { + return { + name: "test", + c: { + x: 1, + y: 2 + } + } +}; + +//// [/user/username/projects/myproject/d.ts] +import { getPoint } from "./c"; +getPoint().c.x; + +//// [/user/username/projects/myproject/e.ts] +import "./d"; + +//// [/user/username/projects/myproject/tsconfig.json] +{"compilerOptions":{"assumeChangesOnlyAffectDirectDependencies":true}} + +//// [/a/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; } + +//// [/user/username/projects/myproject/a.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/myproject/b.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/myproject/c.js] +"use strict"; +exports.__esModule = true; +function getPoint() { + return { + name: "test", + c: { + x: 1, + y: 2 + } + }; +} +exports.getPoint = getPoint; +; + + +//// [/user/username/projects/myproject/d.js] +"use strict"; +exports.__esModule = true; +var c_1 = require("./c"); +c_1.getPoint().c.x; + + +//// [/user/username/projects/myproject/e.js] +"use strict"; +exports.__esModule = true; +require("./d"); + + + +Output:: +>> Screen clear +12:00:29 AM - Starting compilation in watch mode... + + +c.ts(6,13): error TS2322: Type '{ x: number; y: number; }' is not assignable to type 'Coords'. + Object literal may only specify known properties, and 'x' does not exist in type 'Coords'. + +d.ts(2,14): error TS2339: Property 'x' does not exist on type 'Coords'. + + +12:00:40 AM - Found 2 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/c.ts","/user/username/projects/myproject/d.ts","/user/username/projects/myproject/e.ts"] +Program options: {"assumeChangesOnlyAffectDirectDependencies":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/c.ts +/user/username/projects/myproject/d.ts +/user/username/projects/myproject/e.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/c.ts +/user/username/projects/myproject/d.ts +/user/username/projects/myproject/e.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/user/username/projects/myproject/b.ts: + {"pollingInterval":250} +/user/username/projects/myproject/c.ts: + {"pollingInterval":250} +/user/username/projects/myproject/d.ts: + {"pollingInterval":250} +/user/username/projects/myproject/e.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Rename property x2 to x of interface Coords + +//// [/user/username/projects/myproject/a.ts] +export interface Point { + name: string; + c: Coords; +} +export interface Coords { + x: number; + y: number; +} + +//// [/user/username/projects/myproject/a.js] file written with same contents +//// [/user/username/projects/myproject/b.js] file written with same contents + +Output:: +>> Screen clear +12:00:44 AM - File change detected. Starting incremental compilation... + + +c.ts(6,13): error TS2322: Type '{ x: number; y: number; }' is not assignable to type 'Coords'. + Object literal may only specify known properties, and 'x' does not exist in type 'Coords'. + +d.ts(2,14): error TS2339: Property 'x' does not exist on type 'Coords'. + + +12:00:51 AM - Found 2 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/c.ts","/user/username/projects/myproject/d.ts","/user/username/projects/myproject/e.ts"] +Program options: {"assumeChangesOnlyAffectDirectDependencies":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/c.ts +/user/username/projects/myproject/d.ts +/user/username/projects/myproject/e.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/user/username/projects/myproject/b.ts: + {"pollingInterval":250} +/user/username/projects/myproject/c.ts: + {"pollingInterval":250} +/user/username/projects/myproject/d.ts: + {"pollingInterval":250} +/user/username/projects/myproject/e.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js new file mode 100644 index 0000000000000..19a4fe780eb01 --- /dev/null +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js @@ -0,0 +1,243 @@ +/a/lib/tsc.js --w +//// [/user/username/projects/myproject/lib1/tools/tools.interface.ts] +export interface ITest { + title: string; +} + +//// [/user/username/projects/myproject/lib1/tools/public.ts] +export * from "./tools.interface"; + +//// [/user/username/projects/myproject/app.ts] +import { Data } from "lib2/public"; +export class App { + public constructor() { + new Data().test(); + } +} + +//// [/user/username/projects/myproject/lib2/public.ts] +export * from "./data"; + +//// [/user/username/projects/myproject/lib1/public.ts] +export * from "./tools/public"; + +//// [/user/username/projects/myproject/lib2/data.ts] +import { ITest } from "lib1/public"; import { Data2 } from "./data2"; +export class Data { + public dat?: Data2; public test() { + const result: ITest = { + title: "title" + } + return result; + } +} + +//// [/user/username/projects/myproject/lib2/data2.ts] +import { Data } from "./data"; +export class Data2 { + public dat?: Data; +} + +//// [/user/username/projects/myproject/tsconfig.json] +{"files":["app.ts"],"compilerOptions":{"baseUrl":".","assumeChangesOnlyAffectDirectDependencies":true}} + +//// [/a/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; } + +//// [/user/username/projects/myproject/lib1/tools/tools.interface.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/myproject/lib1/tools/public.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/myproject/lib1/public.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/myproject/lib2/data2.js] +"use strict"; +exports.__esModule = true; +var Data2 = /** @class */ (function () { + function Data2() { + } + return Data2; +}()); +exports.Data2 = Data2; + + +//// [/user/username/projects/myproject/lib2/data.js] +"use strict"; +exports.__esModule = true; +var Data = /** @class */ (function () { + function Data() { + } + Data.prototype.test = function () { + var result = { + title: "title" + }; + return result; + }; + return Data; +}()); +exports.Data = Data; + + +//// [/user/username/projects/myproject/lib2/public.js] +"use strict"; +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} +exports.__esModule = true; +__export(require("./data")); + + +//// [/user/username/projects/myproject/app.js] +"use strict"; +exports.__esModule = true; +var public_1 = require("lib2/public"); +var App = /** @class */ (function () { + function App() { + new public_1.Data().test(); + } + return App; +}()); +exports.App = App; + + + +Output:: +>> Screen clear +12:00:39 AM - Starting compilation in watch mode... + + + +12:00:54 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/app.ts"] +Program options: {"baseUrl":"/user/username/projects/myproject","assumeChangesOnlyAffectDirectDependencies":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/lib1/tools/tools.interface.ts +/user/username/projects/myproject/lib1/tools/public.ts +/user/username/projects/myproject/lib1/public.ts +/user/username/projects/myproject/lib2/data2.ts +/user/username/projects/myproject/lib2/data.ts +/user/username/projects/myproject/lib2/public.ts +/user/username/projects/myproject/app.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/lib1/tools/tools.interface.ts +/user/username/projects/myproject/lib1/tools/public.ts +/user/username/projects/myproject/lib1/public.ts +/user/username/projects/myproject/lib2/data2.ts +/user/username/projects/myproject/lib2/data.ts +/user/username/projects/myproject/lib2/public.ts +/user/username/projects/myproject/app.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/app.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/data.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/tools/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/tools/tools.interface.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/data2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Rename property title to title2 of interface ITest + +//// [/user/username/projects/myproject/lib1/tools/tools.interface.ts] +export interface ITest { + title2: string; +} + +//// [/user/username/projects/myproject/lib1/tools/tools.interface.js] file written with same contents +//// [/user/username/projects/myproject/lib1/tools/public.js] file written with same contents + +Output:: +>> Screen clear +12:00:58 AM - File change detected. Starting incremental compilation... + + + +12:01:05 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/app.ts"] +Program options: {"baseUrl":"/user/username/projects/myproject","assumeChangesOnlyAffectDirectDependencies":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/lib1/tools/tools.interface.ts +/user/username/projects/myproject/lib1/tools/public.ts +/user/username/projects/myproject/lib1/public.ts +/user/username/projects/myproject/lib2/data2.ts +/user/username/projects/myproject/lib2/data.ts +/user/username/projects/myproject/lib2/public.ts +/user/username/projects/myproject/app.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/lib1/tools/tools.interface.ts +/user/username/projects/myproject/lib1/tools/public.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/app.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/data.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/tools/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/tools/tools.interface.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/data2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js new file mode 100644 index 0000000000000..b0d915d80867c --- /dev/null +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js @@ -0,0 +1,219 @@ +/a/lib/tsc.js --w +//// [/user/username/projects/myproject/lib1/tools/tools.interface.ts] +export interface ITest { + title: string; +} + +//// [/user/username/projects/myproject/lib1/tools/public.ts] +export * from "./tools.interface"; + +//// [/user/username/projects/myproject/app.ts] +import { Data } from "lib2/public"; +export class App { + public constructor() { + new Data().test(); + } +} + +//// [/user/username/projects/myproject/lib2/public.ts] +export * from "./data"; + +//// [/user/username/projects/myproject/lib1/public.ts] +export * from "./tools/public"; + +//// [/user/username/projects/myproject/lib2/data.ts] +import { ITest } from "lib1/public"; +export class Data { + public test() { + const result: ITest = { + title: "title" + } + return result; + } +} + +//// [/user/username/projects/myproject/tsconfig.json] +{"files":["app.ts"],"compilerOptions":{"baseUrl":".","assumeChangesOnlyAffectDirectDependencies":true}} + +//// [/a/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; } + +//// [/user/username/projects/myproject/lib1/tools/tools.interface.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/myproject/lib1/tools/public.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/myproject/lib1/public.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/myproject/lib2/data.js] +"use strict"; +exports.__esModule = true; +var Data = /** @class */ (function () { + function Data() { + } + Data.prototype.test = function () { + var result = { + title: "title" + }; + return result; + }; + return Data; +}()); +exports.Data = Data; + + +//// [/user/username/projects/myproject/lib2/public.js] +"use strict"; +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} +exports.__esModule = true; +__export(require("./data")); + + +//// [/user/username/projects/myproject/app.js] +"use strict"; +exports.__esModule = true; +var public_1 = require("lib2/public"); +var App = /** @class */ (function () { + function App() { + new public_1.Data().test(); + } + return App; +}()); +exports.App = App; + + + +Output:: +>> Screen clear +12:00:37 AM - Starting compilation in watch mode... + + + +12:00:50 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/app.ts"] +Program options: {"baseUrl":"/user/username/projects/myproject","assumeChangesOnlyAffectDirectDependencies":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/lib1/tools/tools.interface.ts +/user/username/projects/myproject/lib1/tools/public.ts +/user/username/projects/myproject/lib1/public.ts +/user/username/projects/myproject/lib2/data.ts +/user/username/projects/myproject/lib2/public.ts +/user/username/projects/myproject/app.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/lib1/tools/tools.interface.ts +/user/username/projects/myproject/lib1/tools/public.ts +/user/username/projects/myproject/lib1/public.ts +/user/username/projects/myproject/lib2/data.ts +/user/username/projects/myproject/lib2/public.ts +/user/username/projects/myproject/app.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/app.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/data.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/tools/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/tools/tools.interface.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Rename property title to title2 of interface ITest + +//// [/user/username/projects/myproject/lib1/tools/tools.interface.ts] +export interface ITest { + title2: string; +} + +//// [/user/username/projects/myproject/lib1/tools/tools.interface.js] file written with same contents +//// [/user/username/projects/myproject/lib1/tools/public.js] file written with same contents + +Output:: +>> Screen clear +12:00:54 AM - File change detected. Starting incremental compilation... + + + +12:01:01 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/app.ts"] +Program options: {"baseUrl":"/user/username/projects/myproject","assumeChangesOnlyAffectDirectDependencies":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/lib1/tools/tools.interface.ts +/user/username/projects/myproject/lib1/tools/public.ts +/user/username/projects/myproject/lib1/public.ts +/user/username/projects/myproject/lib2/data.ts +/user/username/projects/myproject/lib2/public.ts +/user/username/projects/myproject/app.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/lib1/tools/tools.interface.ts +/user/username/projects/myproject/lib1/tools/public.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/app.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/data.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/tools/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/tools/tools.interface.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies/with-noEmitOnError.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies/with-noEmitOnError.js new file mode 100644 index 0000000000000..f2aa1e833bf1a --- /dev/null +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies/with-noEmitOnError.js @@ -0,0 +1,151 @@ +/a/lib/tsc.js --w +//// [/user/username/projects/noEmitOnError/shared/types/db.ts] +export interface A { + name: string; +} + +//// [/user/username/projects/noEmitOnError/src/main.ts] +import { A } from "../shared/types/db"; +const a = { + lastName: 'sdsd' +; + +//// [/user/username/projects/noEmitOnError/src/other.ts] +console.log("hi"); +export { } + +//// [/user/username/projects/noEmitOnError/tsconfig.json] +{"compilerOptions":{"outDir":"./dev-build","noEmitOnError":true,"assumeChangesOnlyAffectDirectDependencies":true}} + +//// [/a/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; }; + + +Output:: +>> Screen clear +12:00:31 AM - Starting compilation in watch mode... + + +src/main.ts(4,1): error TS1005: ',' expected. + + +12:00:32 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/user/username/projects/noEmitOnError/shared/types/db.ts","/user/username/projects/noEmitOnError/src/main.ts","/user/username/projects/noEmitOnError/src/other.ts"] +Program options: {"outDir":"/user/username/projects/noEmitOnError/dev-build","noEmitOnError":true,"assumeChangesOnlyAffectDirectDependencies":true,"watch":true,"configFilePath":"/user/username/projects/noEmitOnError/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/noEmitOnError/shared/types/db.ts +/user/username/projects/noEmitOnError/src/main.ts +/user/username/projects/noEmitOnError/src/other.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/noEmitOnError/shared/types/db.ts +/user/username/projects/noEmitOnError/src/main.ts +/user/username/projects/noEmitOnError/src/other.ts + +WatchedFiles:: +/user/username/projects/noemitonerror/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/noemitonerror/shared/types/db.ts: + {"pollingInterval":250} +/user/username/projects/noemitonerror/src/main.ts: + {"pollingInterval":250} +/user/username/projects/noemitonerror/src/other.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/noemitonerror/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/noemitonerror: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Fix the error + +//// [/user/username/projects/noEmitOnError/src/main.ts] +import { A } from "../shared/types/db"; +const a = { + lastName: 'sdsd' +}; + +//// [/user/username/projects/noEmitOnError/dev-build/shared/types/db.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/noEmitOnError/dev-build/src/main.js] +"use strict"; +exports.__esModule = true; +var a = { + lastName: 'sdsd' +}; + + +//// [/user/username/projects/noEmitOnError/dev-build/src/other.js] +"use strict"; +exports.__esModule = true; +console.log("hi"); + + + +Output:: +>> Screen clear +12:00:36 AM - File change detected. Starting incremental compilation... + + + +12:00:53 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/noEmitOnError/shared/types/db.ts","/user/username/projects/noEmitOnError/src/main.ts","/user/username/projects/noEmitOnError/src/other.ts"] +Program options: {"outDir":"/user/username/projects/noEmitOnError/dev-build","noEmitOnError":true,"assumeChangesOnlyAffectDirectDependencies":true,"watch":true,"configFilePath":"/user/username/projects/noEmitOnError/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/noEmitOnError/shared/types/db.ts +/user/username/projects/noEmitOnError/src/main.ts +/user/username/projects/noEmitOnError/src/other.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/noEmitOnError/src/main.ts + +WatchedFiles:: +/user/username/projects/noemitonerror/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/noemitonerror/shared/types/db.ts: + {"pollingInterval":250} +/user/username/projects/noemitonerror/src/main.ts: + {"pollingInterval":250} +/user/username/projects/noemitonerror/src/other.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/noemitonerror/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/noemitonerror: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined