diff --git a/internal/execute/incremental/program.go b/internal/execute/incremental/program.go index 1512126297..2d306c27bd 100644 --- a/internal/execute/incremental/program.go +++ b/internal/execute/incremental/program.go @@ -320,7 +320,6 @@ func (p *Program) ensureHasErrorsForState(ctx context.Context, program *compiler len(program.GetConfigFileParsingDiagnostics()) > 0 || len(program.GetSyntacticDiagnostics(ctx, nil)) > 0 || len(program.GetProgramDiagnostics()) > 0 || - len(program.GetBindDiagnostics(ctx, nil)) > 0 || len(program.GetOptionsDiagnostics(ctx)) > 0 || len(program.GetGlobalDiagnostics(ctx)) > 0 { p.snapshot.hasErrors = core.TSTrue diff --git a/internal/execute/tsctests/tsc_test.go b/internal/execute/tsctests/tsc_test.go index b9a88f6196..e145bf178b 100644 --- a/internal/execute/tsctests/tsc_test.go +++ b/internal/execute/tsctests/tsc_test.go @@ -1602,6 +1602,34 @@ func TestTscIncremental(t *testing.T) { }, }, }, + { + subScenario: "when there is bind diagnostics thats ignored", + files: FileMap{ + "/home/src/workspaces/project/tsconfig.json": stringtestutil.Dedent(` + { + "compilerOptions": { + "skipLibCheck": true, + "incremental": true, + } + }`), + "/home/src/workspaces/project/a.ts": `export const a = 10;`, + "/home/src/workspaces/project/b.d.ts": stringtestutil.Dedent(` + interface NoName { + Profiler: new ({ sampleInterval: number, maxBufferSize: number }) => { + stop: () => Promise; + }; + } + `), + }, + commandLineArgs: []string{""}, + edits: []*tscEdit{ + noChange, + { + caption: "no change and tsc -b", + commandLineArgs: []string{"-b", "-v"}, + }, + }, + }, } for _, test := range testCases { diff --git a/testdata/baselines/reference/tsc/incremental/when-there-is-bind-diagnostics-thats-ignored.js b/testdata/baselines/reference/tsc/incremental/when-there-is-bind-diagnostics-thats-ignored.js new file mode 100644 index 0000000000..d6a1cd1182 --- /dev/null +++ b/testdata/baselines/reference/tsc/incremental/when-there-is-bind-diagnostics-thats-ignored.js @@ -0,0 +1,141 @@ +currentDirectory::/home/src/workspaces/project +useCaseSensitiveFileNames::true +Input:: +//// [/home/src/workspaces/project/a.ts] *new* +export const a = 10; +//// [/home/src/workspaces/project/b.d.ts] *new* +interface NoName { + Profiler: new ({ sampleInterval: number, maxBufferSize: number }) => { + stop: () => Promise; + }; +} +//// [/home/src/workspaces/project/tsconfig.json] *new* +{ + "compilerOptions": { + "skipLibCheck": true, + "incremental": true, + } +} + +tsgo +ExitStatus:: Success +Output:: +//// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* +/// +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 {} +interface SymbolConstructor { + (desc?: string | number): symbol; + for(name: string): symbol; + readonly toStringTag: symbol; +} +declare var Symbol: SymbolConstructor; +interface Symbol { + readonly [Symbol.toStringTag]: string; +} +declare const console: { log(msg: any): void; }; +//// [/home/src/workspaces/project/a.js] *new* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.a = void 0; +exports.a = 10; + +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *new* +{"version":"FakeTSVersion","root":[[2,3]],"fileNames":["lib.d.ts","./a.ts","./b.d.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \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 {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"3a1e9965f8602302ee6ae53756eac8be-export const a = 10;",{"version":"53a40371b72faeca3dac96d61d6fb24f-interface NoName {\n Profiler: new ({ sampleInterval: number, maxBufferSize: number }) => {\n stop: () => Promise;\n };\n}","affectsGlobalScope":true,"impliedNodeFormat":1}],"options":{"skipLibCheck":true}} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *new* +{ + "version": "FakeTSVersion", + "root": [ + { + "files": [ + "./a.ts", + "./b.d.ts" + ], + "original": [ + 2, + 3 + ] + } + ], + "fileNames": [ + "lib.d.ts", + "./a.ts", + "./b.d.ts" + ], + "fileInfos": [ + { + "fileName": "lib.d.ts", + "version": "8859c12c614ce56ba9a18e58384a198f-/// \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 {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };", + "signature": "8859c12c614ce56ba9a18e58384a198f-/// \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 {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "8859c12c614ce56ba9a18e58384a198f-/// \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 {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./a.ts", + "version": "3a1e9965f8602302ee6ae53756eac8be-export const a = 10;", + "signature": "3a1e9965f8602302ee6ae53756eac8be-export const a = 10;", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "./b.d.ts", + "version": "53a40371b72faeca3dac96d61d6fb24f-interface NoName {\n Profiler: new ({ sampleInterval: number, maxBufferSize: number }) => {\n stop: () => Promise;\n };\n}", + "signature": "53a40371b72faeca3dac96d61d6fb24f-interface NoName {\n Profiler: new ({ sampleInterval: number, maxBufferSize: number }) => {\n stop: () => Promise;\n };\n}", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "53a40371b72faeca3dac96d61d6fb24f-interface NoName {\n Profiler: new ({ sampleInterval: number, maxBufferSize: number }) => {\n stop: () => Promise;\n };\n}", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + } + ], + "options": { + "skipLibCheck": true + }, + "size": 1195 +} + +tsconfig.json:: +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.d.ts +*refresh* /home/src/workspaces/project/a.ts +*refresh* /home/src/workspaces/project/b.d.ts +Signatures:: + + +Edit [0]:: no change + +tsgo +ExitStatus:: Success +Output:: + +tsconfig.json:: +SemanticDiagnostics:: +Signatures:: + + +Edit [1]:: no change and tsc -b + +tsgo -b -v +ExitStatus:: Success +Output:: +[HH:MM:SS AM] Projects in this build: + * tsconfig.json + +[HH:MM:SS AM] Project 'tsconfig.json' is up to date because newest input 'b.d.ts' is older than output 'tsconfig.tsbuildinfo' + +