diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 999a2cb6e15e7..872848a4bc827 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -8792,6 +8792,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } function serializeSymbol(symbol: Symbol, isPrivate: boolean, propertyAsAlias: boolean): void { + void getPropertiesOfType(getTypeOfSymbol(symbol)); // resolve symbol's type and properties, which should trigger any required merges // cache visited list based on merged symbol, since we want to use the unmerged top-level symbol, but // still skip reserializing it if we encounter the merged product later on const visitedSym = getMergedSymbol(symbol); @@ -48846,6 +48847,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { if (!sym) { return !node.locals ? [] : nodeBuilder.symbolTableToDeclarationStatements(node.locals, node, flags, tracker); } + resolveExternalModuleSymbol(sym); // ensures cjs export assignment is setup return !sym.exports ? [] : nodeBuilder.symbolTableToDeclarationStatements(sym.exports, node, flags, tracker); }, isImportRequiredByAugmentation, diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index d36e6bcdd459f..b4095144faed3 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -772,6 +772,20 @@ const commandOptionsWithoutBuild: CommandLineOption[] = [ defaultValueDescription: false, description: Diagnostics.Disable_emitting_comments, }, + { + name: "noCheck", + type: "boolean", + showInSimplifiedHelpView: false, + category: Diagnostics.Compiler_Diagnostics, + description: Diagnostics.Disable_full_type_checking_only_critical_parse_and_emit_errors_will_be_reported, + transpileOptionValue: undefined, + defaultValueDescription: false, + affectsSemanticDiagnostics: true, + affectsBuildInfo: true, + extraValidation() { + return [Diagnostics.Unknown_compiler_option_0, "noCheck"]; + }, + }, { name: "noEmit", type: "boolean", diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 7cddcaaa77976..5bfbe362238b0 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -6388,6 +6388,10 @@ "category": "Message", "code": 6804 }, + "Disable full type checking (only critical parse and emit errors will be reported).": { + "category": "Message", + "code": 6805 + }, "one of:": { "category": "Message", diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index b32c81fc1d313..2b95abb5db68c 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -848,8 +848,8 @@ export function emitFiles(resolver: EmitResolver, host: EmitHost, targetSourceFi const filesForEmit = forceDtsEmit ? sourceFiles : filter(sourceFiles, isSourceFileNotJson); // Setup and perform the transformation to retrieve declarations from the input files const inputListOrBundle = compilerOptions.outFile ? [factory.createBundle(filesForEmit)] : filesForEmit; - if (emitOnly && !getEmitDeclarations(compilerOptions)) { - // Checker wont collect the linked aliases since thats only done when declaration is enabled. + if ((emitOnly && !getEmitDeclarations(compilerOptions)) || compilerOptions.noCheck) { + // Checker wont collect the linked aliases since thats only done when declaration is enabled and checking is performed. // Do that here when emitting only dts files filesForEmit.forEach(collectLinkedAliases); } diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 6357894192746..9d1e7ff4735f0 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -4424,6 +4424,15 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg } } + if (options.noCheck) { + if (options.noEmit) { + createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noCheck", "noEmit"); + } + if (!options.emitDeclarationOnly) { + createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "noCheck", "emitDeclarationOnly"); + } + } + if ( options.emitDecoratorMetadata && !options.experimentalDecorators diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 70397a75908de..a24971091b90a 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -7270,6 +7270,7 @@ export interface CompilerOptions { moduleDetection?: ModuleDetectionKind; newLine?: NewLineKind; noEmit?: boolean; + /** @internal */ noCheck?: boolean; /** @internal */ noEmitForJsFiles?: boolean; noEmitHelpers?: boolean; noEmitOnError?: boolean; diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index a2426b253cc3d..aaabffebb2159 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -9967,6 +9967,7 @@ export function skipTypeChecking(sourceFile: SourceFile, options: CompilerOption // '/// ' directive. return (options.skipLibCheck && sourceFile.isDeclarationFile || options.skipDefaultLibCheck && sourceFile.hasNoDefaultLib) || + options.noCheck || host.isSourceOfProjectReferenceRedirect(sourceFile.fileName); } diff --git a/src/harness/harnessIO.ts b/src/harness/harnessIO.ts index 3c695239f7197..a9891d70921b0 100644 --- a/src/harness/harnessIO.ts +++ b/src/harness/harnessIO.ts @@ -303,6 +303,7 @@ export namespace Compiler { { name: "noTypesAndSymbols", type: "boolean", defaultValueDescription: false }, // Emitted js baseline will print full paths for every output file { name: "fullEmitPaths", type: "boolean", defaultValueDescription: false }, + { name: "noCheck", type: "boolean", defaultValueDescription: false }, { name: "reportDiagnostics", type: "boolean", defaultValueDescription: false }, // used to enable error collection in `transpile` baselines ]; @@ -371,6 +372,8 @@ export namespace Compiler { fileOptions?: any; } + export type CompileFilesResult = compiler.CompilationResult & { repeat(newOptions: TestCaseParser.CompilerSettings): CompileFilesResult; }; + export function compileFiles( inputFiles: TestFile[], otherFiles: TestFile[], @@ -379,7 +382,8 @@ export namespace Compiler { // Current directory is needed for rwcRunner to be able to use currentDirectory defined in json file currentDirectory: string | undefined, symlinks?: vfs.FileSet, - ): compiler.CompilationResult { + ): CompileFilesResult { + const originalCurrentDirectory = currentDirectory; const options: ts.CompilerOptions & HarnessOptions = compilerOptions ? ts.cloneCompilerOptions(compilerOptions) : { noResolve: false }; options.newLine = options.newLine || ts.NewLineKind.CarriageReturnLineFeed; options.noErrorTruncation = true; @@ -428,7 +432,8 @@ export namespace Compiler { const host = new fakes.CompilerHost(fs, options); const result = compiler.compileFiles(host, programFileNames, options, typeScriptVersion); result.symlinks = symlinks; - return result; + (result as CompileFilesResult).repeat = newOptions => compileFiles(inputFiles, otherFiles, { ...harnessSettings, ...newOptions }, compilerOptions, originalCurrentDirectory, symlinks); + return result as CompileFilesResult; } export interface DeclarationCompilationContext { @@ -944,7 +949,7 @@ export namespace Compiler { return "\n//// https://sokra.github.io/source-map-visualization" + hash + "\n"; } - export function doJsEmitBaseline(baselinePath: string, header: string, options: ts.CompilerOptions, result: compiler.CompilationResult, tsConfigFiles: readonly TestFile[], toBeCompiled: readonly TestFile[], otherFiles: readonly TestFile[], harnessSettings: TestCaseParser.CompilerSettings) { + export function doJsEmitBaseline(baselinePath: string, header: string, options: ts.CompilerOptions, result: CompileFilesResult, tsConfigFiles: readonly TestFile[], toBeCompiled: readonly TestFile[], otherFiles: readonly TestFile[], harnessSettings: TestCaseParser.CompilerSettings) { if (!options.noEmit && !options.emitDeclarationOnly && result.js.size === 0 && result.diagnostics.length === 0) { throw new Error("Expected at least one js file to be emitted or at least one error to be created."); } @@ -996,9 +1001,33 @@ export namespace Compiler { jsCode += "\r\n\r\n"; jsCode += getErrorBaseline(tsConfigFiles.concat(declFileCompilationResult.declInputFiles, declFileCompilationResult.declOtherFiles), declFileCompilationResult.declResult.diagnostics); } + else if (!options.noCheck && !options.noEmit && (options.composite || options.declaration || options.emitDeclarationOnly)) { + const withoutChecking = result.repeat({ noCheck: "true", emitDeclarationOnly: "true" }); + compareResultFileSets(withoutChecking.dts, result.dts); + } // eslint-disable-next-line no-restricted-syntax Baseline.runBaseline(baselinePath.replace(/\.tsx?/, ts.Extension.Js), jsCode.length > 0 ? tsCode + "\r\n\r\n" + jsCode : null); + + function compareResultFileSets(a: ReadonlyMap, b: ReadonlyMap) { + a.forEach((doc, key) => { + const original = b.get(key); + if (!original) { + jsCode += `\r\n\r\n!!!! File ${Utils.removeTestPathPrefixes(doc.file)} missing from original emit, but present in noCheck emit\r\n`; + jsCode += fileOutput(doc, harnessSettings); + } + else if (original.text !== doc.text) { + jsCode += `\r\n\r\n!!!! File ${Utils.removeTestPathPrefixes(doc.file)} differs from original emit in noCheck emit\r\n`; + const Diff = require("diff"); + const expected = original.text; + const actual = doc.text; + const patch = Diff.createTwoFilesPatch("Expected", "Actual", expected, actual, "The full check baseline", "with noCheck set"); + const fileName = harnessSettings.fullEmitPaths ? Utils.removeTestPathPrefixes(doc.file) : ts.getBaseFileName(doc.file); + jsCode += "//// [" + fileName + "]\r\n"; + jsCode += patch; + } + }); + } } function fileOutput(file: documents.TextDocument, harnessSettings: TestCaseParser.CompilerSettings): string { diff --git a/src/services/transpile.ts b/src/services/transpile.ts index a815243923825..b9179bcd2a198 100644 --- a/src/services/transpile.ts +++ b/src/services/transpile.ts @@ -75,6 +75,7 @@ export function transpileModule(input: string, transpileOptions: TranspileOption * - noResolve = true * - declaration = true * - emitDeclarationOnly = true + * - noCheck = true * Note that this declaration file may differ from one produced by a full program typecheck, * in that only types in the single input file are available to be used in the generated declarations. */ @@ -141,6 +142,7 @@ function transpileWorker(input: string, transpileOptions: TranspileOptions, decl options.declaration = true; options.emitDeclarationOnly = true; options.isolatedDeclarations = true; + options.noCheck = true; } else { options.declaration = false; diff --git a/src/testRunner/compilerRunner.ts b/src/testRunner/compilerRunner.ts index 4c905e38826e7..3d82d232ccc05 100644 --- a/src/testRunner/compilerRunner.ts +++ b/src/testRunner/compilerRunner.ts @@ -1,4 +1,3 @@ -import * as compiler from "./_namespaces/compiler"; import { Baseline, Compiler, @@ -171,7 +170,7 @@ class CompilerTest { private configuredName: string; private harnessSettings: TestCaseParser.CompilerSettings; private hasNonDtsFiles: boolean; - private result: compiler.CompilationResult; + private result: Compiler.CompileFilesResult; private options: ts.CompilerOptions; private tsConfigFiles: Compiler.TestFile[]; // equivalent to the files that will be passed on the command line diff --git a/src/testRunner/tests.ts b/src/testRunner/tests.ts index c211d221aa4c9..fffd8d92a6d05 100644 --- a/src/testRunner/tests.ts +++ b/src/testRunner/tests.ts @@ -86,6 +86,7 @@ import "./unittests/tsbuild/lateBoundSymbol"; import "./unittests/tsbuild/libraryResolution"; import "./unittests/tsbuild/moduleResolution"; import "./unittests/tsbuild/moduleSpecifiers"; +import "./unittests/tsbuild/noCheck"; import "./unittests/tsbuild/noEmit"; import "./unittests/tsbuild/noEmitOnError"; import "./unittests/tsbuild/outFile"; diff --git a/src/testRunner/unittests/tsbuild/noCheck.ts b/src/testRunner/unittests/tsbuild/noCheck.ts new file mode 100644 index 0000000000000..376289aeb7949 --- /dev/null +++ b/src/testRunner/unittests/tsbuild/noCheck.ts @@ -0,0 +1,86 @@ +import { + CommandLineOption, + optionDeclarations, +} from "../../_namespaces/ts"; +import { jsonToReadableText } from "../helpers"; +import { + noChangeRun, + verifyTsc, +} from "../helpers/tsc"; +import { loadProjectFromFiles } from "../helpers/vfs"; + +function verifyNoCheckFlag(variant: string) { + function verifyNoCheckWorker(subScenario: string, declAText: string, commandLineArgs: readonly string[]) { + verifyTsc({ + scenario: variant, + subScenario, + fs: () => + loadProjectFromFiles({ + "/src/a.ts": getATsContent(declAText), + "/src/tsconfig.json": jsonToReadableText({ + compilerOptions: { noCheck: true, emitDeclarationOnly: true, declaration: true }, + }), + }), + commandLineArgs, + edits: [ + noChangeRun, + { + caption: "Fix `a` error", + edit: fs => fs.writeFileSync("/src/a.ts", getATsContent(`const a = "hello"`)), + }, + noChangeRun, + { + caption: "Disable noCheck", + edit: fs => + fs.writeFileSync( + "/src/tsconfig.json", + jsonToReadableText({ + compilerOptions: { emitDeclarationOnly: true, declaration: true }, + }), + ), + }, + noChangeRun, + ], + baselinePrograms: true, + }); + + function getATsContent(declAText: string) { + return `const err: number = "error"; +${declAText}`; + } + } + + function verifyNoCheck(subScenario: string, aTsContent: string) { + verifyNoCheckWorker(subScenario, aTsContent, ["--b", "/src/tsconfig.json", "-v"]); + verifyNoCheckWorker(`${subScenario} with incremental`, aTsContent, ["--b", "/src/tsconfig.json", "-v", "--incremental"]); + } + + verifyNoCheck("syntax errors", `const a = "hello`); + verifyNoCheck("semantic errors", `const a: number = "hello"`); +} + +describe("unittests:: tsbuild:: noCheck", () => { + // Enable the `noCheck` option on the CLI for testing purposes, to ensure it works with incremental/build + let validate: CommandLineOption["extraValidation"]; + before(() => { + for (const opt of optionDeclarations) { + if (opt.name === "noCheck") { + validate = opt.extraValidation; + opt.extraValidation = () => undefined; + } + } + }); + after(() => { + for (const opt of optionDeclarations) { + if (opt.name === "noCheck") { + opt.extraValidation = validate; + } + } + }); + + verifyNoCheckFlag("noCheck"); +}); + +describe("unittests:: tsbuild:: noCheck:: errors", () => { + verifyNoCheckFlag("noCheck-errors"); +}); diff --git a/tests/baselines/reference/config/showConfig/Shows tsconfig for single option/noCheck/tsconfig.json b/tests/baselines/reference/config/showConfig/Shows tsconfig for single option/noCheck/tsconfig.json new file mode 100644 index 0000000000000..cd727e8ccdc88 --- /dev/null +++ b/tests/baselines/reference/config/showConfig/Shows tsconfig for single option/noCheck/tsconfig.json @@ -0,0 +1,3 @@ +{ + "compilerOptions": {} +} diff --git a/tests/baselines/reference/deferredLookupTypeResolution.js b/tests/baselines/reference/deferredLookupTypeResolution.js index 8069483245dc1..e422e226becee 100644 --- a/tests/baselines/reference/deferredLookupTypeResolution.js +++ b/tests/baselines/reference/deferredLookupTypeResolution.js @@ -62,3 +62,20 @@ declare function f3(x: 'a' | 'b'): { b: any; x: any; }; + + +!!!! File deferredLookupTypeResolution.d.ts differs from original emit in noCheck emit +//// [deferredLookupTypeResolution.d.ts] +=================================================================== +--- Expected The full check baseline ++++ Actual with noCheck set +@@ -15,8 +15,8 @@ + [P in A | B]: any; + }; + declare function f2(a: A): { [P in A | "x"]: any; }; + declare function f3(x: 'a' | 'b'): { ++ x: any; + a: any; + b: any; +- x: any; + }; diff --git a/tests/baselines/reference/indexSignatures1.js b/tests/baselines/reference/indexSignatures1.js index 68035dcd39231..e1b61cce64b32 100644 --- a/tests/baselines/reference/indexSignatures1.js +++ b/tests/baselines/reference/indexSignatures1.js @@ -680,3 +680,21 @@ type Rec1 = { type Rec2 = Record; type K1 = keyof Rec1; type K2 = keyof Rec2; + + +!!!! File indexSignatures1.d.ts differs from original emit in noCheck emit +//// [indexSignatures1.d.ts] +=================================================================== +--- Expected The full check baseline ++++ Actual with noCheck set +@@ -118,9 +118,9 @@ + [x: symbol]: 4 | 5; + [sym]: 4; + }; + declare const obj13: { +- [x: string]: 0 | 2 | 1 | 3; ++ [x: string]: 0 | 1 | 2 | 3; + [x: number]: 2 | 3; + [x: symbol]: 4 | 5; + x: 0; + 1: 2; diff --git a/tests/baselines/reference/jsDeclarationsCrossfileMerge.js b/tests/baselines/reference/jsDeclarationsCrossfileMerge.js index f4b06e5eaa883..ed5d9dbe7807f 100644 --- a/tests/baselines/reference/jsDeclarationsCrossfileMerge.js +++ b/tests/baselines/reference/jsDeclarationsCrossfileMerge.js @@ -27,3 +27,9 @@ module.exports.memberName = "thing"; declare const _exports: typeof m.default; export = _exports; import m = require("./exporter"); + + +!!!! File out/exporter.d.ts missing from original emit, but present in noCheck emit +//// [exporter.d.ts] +export default validate; +declare function validate(): void; diff --git a/tests/baselines/reference/noCheckDoesNotReportError.js b/tests/baselines/reference/noCheckDoesNotReportError.js new file mode 100644 index 0000000000000..266a7e67b0fda --- /dev/null +++ b/tests/baselines/reference/noCheckDoesNotReportError.js @@ -0,0 +1,10 @@ +//// [tests/cases/compiler/noCheckDoesNotReportError.ts] //// + +//// [noCheckDoesNotReportError.ts] +export const a: number = "not ok"; + + + + +//// [noCheckDoesNotReportError.d.ts] +export declare const a: number; diff --git a/tests/baselines/reference/noCheckDoesNotReportError.symbols b/tests/baselines/reference/noCheckDoesNotReportError.symbols new file mode 100644 index 0000000000000..47785ae771c7a --- /dev/null +++ b/tests/baselines/reference/noCheckDoesNotReportError.symbols @@ -0,0 +1,6 @@ +//// [tests/cases/compiler/noCheckDoesNotReportError.ts] //// + +=== noCheckDoesNotReportError.ts === +export const a: number = "not ok"; +>a : Symbol(a, Decl(noCheckDoesNotReportError.ts, 0, 12)) + diff --git a/tests/baselines/reference/noCheckDoesNotReportError.types b/tests/baselines/reference/noCheckDoesNotReportError.types new file mode 100644 index 0000000000000..dc2b679b4fb1c --- /dev/null +++ b/tests/baselines/reference/noCheckDoesNotReportError.types @@ -0,0 +1,9 @@ +//// [tests/cases/compiler/noCheckDoesNotReportError.ts] //// + +=== noCheckDoesNotReportError.ts === +export const a: number = "not ok"; +>a : number +> : ^^^^^^ +>"not ok" : "not ok" +> : ^^^^^^^^ + diff --git a/tests/baselines/reference/noCheckNoEmit.errors.txt b/tests/baselines/reference/noCheckNoEmit.errors.txt new file mode 100644 index 0000000000000..c7080758de82a --- /dev/null +++ b/tests/baselines/reference/noCheckNoEmit.errors.txt @@ -0,0 +1,9 @@ +error TS5053: Option 'emitDeclarationOnly' cannot be specified with option 'noEmit'. +error TS5053: Option 'noCheck' cannot be specified with option 'noEmit'. + + +!!! error TS5053: Option 'emitDeclarationOnly' cannot be specified with option 'noEmit'. +!!! error TS5053: Option 'noCheck' cannot be specified with option 'noEmit'. +==== noCheckNoEmit.ts (0 errors) ==== + export const a: number = "not ok"; + \ No newline at end of file diff --git a/tests/baselines/reference/noCheckNoEmit.symbols b/tests/baselines/reference/noCheckNoEmit.symbols new file mode 100644 index 0000000000000..ecab8da3b2f0a --- /dev/null +++ b/tests/baselines/reference/noCheckNoEmit.symbols @@ -0,0 +1,6 @@ +//// [tests/cases/compiler/noCheckNoEmit.ts] //// + +=== noCheckNoEmit.ts === +export const a: number = "not ok"; +>a : Symbol(a, Decl(noCheckNoEmit.ts, 0, 12)) + diff --git a/tests/baselines/reference/noCheckNoEmit.types b/tests/baselines/reference/noCheckNoEmit.types new file mode 100644 index 0000000000000..4ff6200a0d7e8 --- /dev/null +++ b/tests/baselines/reference/noCheckNoEmit.types @@ -0,0 +1,9 @@ +//// [tests/cases/compiler/noCheckNoEmit.ts] //// + +=== noCheckNoEmit.ts === +export const a: number = "not ok"; +>a : number +> : ^^^^^^ +>"not ok" : "not ok" +> : ^^^^^^^^ + diff --git a/tests/baselines/reference/noCheckRequiresEmitDeclarationOnly.errors.txt b/tests/baselines/reference/noCheckRequiresEmitDeclarationOnly.errors.txt new file mode 100644 index 0000000000000..1256c80887fe2 --- /dev/null +++ b/tests/baselines/reference/noCheckRequiresEmitDeclarationOnly.errors.txt @@ -0,0 +1,7 @@ +error TS5052: Option 'noCheck' cannot be specified without specifying option 'emitDeclarationOnly'. + + +!!! error TS5052: Option 'noCheck' cannot be specified without specifying option 'emitDeclarationOnly'. +==== noCheckRequiresEmitDeclarationOnly.ts (0 errors) ==== + export const a: number = "not ok"; + \ No newline at end of file diff --git a/tests/baselines/reference/noCheckRequiresEmitDeclarationOnly.js b/tests/baselines/reference/noCheckRequiresEmitDeclarationOnly.js new file mode 100644 index 0000000000000..f1cab81605ffe --- /dev/null +++ b/tests/baselines/reference/noCheckRequiresEmitDeclarationOnly.js @@ -0,0 +1,11 @@ +//// [tests/cases/compiler/noCheckRequiresEmitDeclarationOnly.ts] //// + +//// [noCheckRequiresEmitDeclarationOnly.ts] +export const a: number = "not ok"; + + +//// [noCheckRequiresEmitDeclarationOnly.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.a = void 0; +exports.a = "not ok"; diff --git a/tests/baselines/reference/noCheckRequiresEmitDeclarationOnly.symbols b/tests/baselines/reference/noCheckRequiresEmitDeclarationOnly.symbols new file mode 100644 index 0000000000000..ee29850bbc3ab --- /dev/null +++ b/tests/baselines/reference/noCheckRequiresEmitDeclarationOnly.symbols @@ -0,0 +1,6 @@ +//// [tests/cases/compiler/noCheckRequiresEmitDeclarationOnly.ts] //// + +=== noCheckRequiresEmitDeclarationOnly.ts === +export const a: number = "not ok"; +>a : Symbol(a, Decl(noCheckRequiresEmitDeclarationOnly.ts, 0, 12)) + diff --git a/tests/baselines/reference/noCheckRequiresEmitDeclarationOnly.types b/tests/baselines/reference/noCheckRequiresEmitDeclarationOnly.types new file mode 100644 index 0000000000000..561d967a23857 --- /dev/null +++ b/tests/baselines/reference/noCheckRequiresEmitDeclarationOnly.types @@ -0,0 +1,9 @@ +//// [tests/cases/compiler/noCheckRequiresEmitDeclarationOnly.ts] //// + +=== noCheckRequiresEmitDeclarationOnly.ts === +export const a: number = "not ok"; +>a : number +> : ^^^^^^ +>"not ok" : "not ok" +> : ^^^^^^^^ + diff --git a/tests/baselines/reference/noEmitOnError.js b/tests/baselines/reference/noEmitOnError.js new file mode 100644 index 0000000000000..d6e53fb9d4662 --- /dev/null +++ b/tests/baselines/reference/noEmitOnError.js @@ -0,0 +1,11 @@ +//// [tests/cases/compiler/noEmitOnError.ts] //// + +//// [noEmitOnError.ts] +var x: number = ""; + + + + +!!!! File noEmitOnError.d.ts missing from original emit, but present in noCheck emit +//// [noEmitOnError.d.ts] +declare var x: number; diff --git a/tests/baselines/reference/outModuleConcatCommonjs.js b/tests/baselines/reference/outModuleConcatCommonjs.js new file mode 100644 index 0000000000000..c6da7cf3337ea --- /dev/null +++ b/tests/baselines/reference/outModuleConcatCommonjs.js @@ -0,0 +1,23 @@ +//// [tests/cases/compiler/outModuleConcatCommonjs.ts] //// + +//// [a.ts] +export class A { } + +//// [b.ts] +import {A} from "./ref/a"; +export class B extends A { } + + + + +!!!! File all.d.ts missing from original emit, but present in noCheck emit +//// [all.d.ts] +declare module "ref/a" { + export class A { + } +} +declare module "b" { + import { A } from "ref/a"; + export class B extends A { + } +} diff --git a/tests/baselines/reference/outModuleConcatES6.js b/tests/baselines/reference/outModuleConcatES6.js new file mode 100644 index 0000000000000..f747cc7e351cb --- /dev/null +++ b/tests/baselines/reference/outModuleConcatES6.js @@ -0,0 +1,22 @@ +//// [tests/cases/compiler/outModuleConcatES6.ts] //// + +//// [a.ts] +export class A { } + +//// [b.ts] +import {A} from "./ref/a"; +export class B extends A { } + + + +!!!! File all.d.ts missing from original emit, but present in noCheck emit +//// [all.d.ts] +declare module "ref/a" { + export class A { + } +} +declare module "b" { + import { A } from "ref/a"; + export class B extends A { + } +} diff --git a/tests/baselines/reference/outModuleConcatUmd.js b/tests/baselines/reference/outModuleConcatUmd.js new file mode 100644 index 0000000000000..44bf3ae850709 --- /dev/null +++ b/tests/baselines/reference/outModuleConcatUmd.js @@ -0,0 +1,22 @@ +//// [tests/cases/compiler/outModuleConcatUmd.ts] //// + +//// [a.ts] +export class A { } + +//// [b.ts] +import {A} from "./ref/a"; +export class B extends A { } + + + +!!!! File all.d.ts missing from original emit, but present in noCheck emit +//// [all.d.ts] +declare module "ref/a" { + export class A { + } +} +declare module "b" { + import { A } from "ref/a"; + export class B extends A { + } +} diff --git a/tests/baselines/reference/tsbuild/noCheck-errors/semantic-errors-with-incremental.js b/tests/baselines/reference/tsbuild/noCheck-errors/semantic-errors-with-incremental.js new file mode 100644 index 0000000000000..6c04121b77f06 --- /dev/null +++ b/tests/baselines/reference/tsbuild/noCheck-errors/semantic-errors-with-incremental.js @@ -0,0 +1,481 @@ +currentDirectory:: / useCaseSensitiveFileNames: false +Input:: +//// [/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +declare const console: { log(msg: any): void; }; + +//// [/src/a.ts] +const err: number = "error"; +const a: number = "hello" + +//// [/src/tsconfig.json] +{ + "compilerOptions": { + "noCheck": true, + "emitDeclarationOnly": true, + "declaration": true + } +} + + + +Output:: +/lib/tsc --b /src/tsconfig.json -v --incremental +[12:00:08 AM] Projects in this build: + * src/tsconfig.json + +[12:00:09 AM] Project 'src/tsconfig.json' is out of date because output file 'src/tsconfig.tsbuildinfo' does not exist + +[12:00:10 AM] Building project '/src/tsconfig.json'... + +src/tsconfig.json:3:16 - error TS5023: Unknown compiler option 'noCheck'. + +3 "noCheck": true, +   ~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +Program root files: [ + "/src/a.ts" +] +Program options: { + "emitDeclarationOnly": true, + "declaration": true, + "incremental": true, + "configFilePath": "/src/tsconfig.json" +} +Program structureReused: Not +Program files:: +/lib/lib.d.ts +/src/a.ts + +No cached semantic diagnostics in the builder:: + +No shapes updated in the builder:: + + +//// [/src/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../lib/lib.d.ts","./a.ts"],"fileInfos":[{"version":"3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"9312413704-const err: number = \"error\";\nconst a: number = \"hello\"","signature":false,"affectsGlobalScope":true,"impliedFormat":1}],"root":[2],"options":{"declaration":true,"emitDeclarationOnly":true},"referencedMap":[],"changeFileSet":[1,2]},"version":"FakeTSVersion"} + +//// [/src/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../lib/lib.d.ts", + "./a.ts" + ], + "fileInfos": { + "../lib/lib.d.ts": { + "original": { + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": false, + "affectsGlobalScope": true, + "impliedFormat": 1 + }, + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + }, + "./a.ts": { + "original": { + "version": "9312413704-const err: number = \"error\";\nconst a: number = \"hello\"", + "signature": false, + "affectsGlobalScope": true, + "impliedFormat": 1 + }, + "version": "9312413704-const err: number = \"error\";\nconst a: number = \"hello\"", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + } + }, + "root": [ + [ + 2, + "./a.ts" + ] + ], + "options": { + "declaration": true, + "emitDeclarationOnly": true + }, + "referencedMap": {}, + "changeFileSet": [ + "../lib/lib.d.ts", + "./a.ts" + ] + }, + "version": "FakeTSVersion", + "size": 866 +} + + + +Change:: no-change-run +Input:: + + +Output:: +/lib/tsc --b /src/tsconfig.json -v --incremental +[12:00:14 AM] Projects in this build: + * src/tsconfig.json + +[12:00:15 AM] Project 'src/tsconfig.json' is out of date because buildinfo file 'src/tsconfig.tsbuildinfo' indicates that some of the changes were not emitted + +[12:00:16 AM] Building project '/src/tsconfig.json'... + +src/tsconfig.json:3:16 - error TS5023: Unknown compiler option 'noCheck'. + +3 "noCheck": true, +   ~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +Program root files: [ + "/src/a.ts" +] +Program options: { + "emitDeclarationOnly": true, + "declaration": true, + "incremental": true, + "configFilePath": "/src/tsconfig.json" +} +Program structureReused: Not +Program files:: +/lib/lib.d.ts +/src/a.ts + +No cached semantic diagnostics in the builder:: + +No shapes updated in the builder:: + + + + +Change:: Fix `a` error +Input:: +//// [/src/a.ts] +const err: number = "error"; +const a = "hello" + + + +Output:: +/lib/tsc --b /src/tsconfig.json -v --incremental +[12:00:18 AM] Projects in this build: + * src/tsconfig.json + +[12:00:19 AM] Project 'src/tsconfig.json' is out of date because buildinfo file 'src/tsconfig.tsbuildinfo' indicates that some of the changes were not emitted + +[12:00:20 AM] Building project '/src/tsconfig.json'... + +src/tsconfig.json:3:16 - error TS5023: Unknown compiler option 'noCheck'. + +3 "noCheck": true, +   ~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +Program root files: [ + "/src/a.ts" +] +Program options: { + "emitDeclarationOnly": true, + "declaration": true, + "incremental": true, + "configFilePath": "/src/tsconfig.json" +} +Program structureReused: Not +Program files:: +/lib/lib.d.ts +/src/a.ts + +No cached semantic diagnostics in the builder:: + +No shapes updated in the builder:: + + +//// [/src/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../lib/lib.d.ts","./a.ts"],"fileInfos":[{"version":"3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"6909448549-const err: number = \"error\";\nconst a = \"hello\"","signature":false,"affectsGlobalScope":true,"impliedFormat":1}],"root":[2],"options":{"declaration":true,"emitDeclarationOnly":true},"referencedMap":[],"changeFileSet":[1,2]},"version":"FakeTSVersion"} + +//// [/src/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../lib/lib.d.ts", + "./a.ts" + ], + "fileInfos": { + "../lib/lib.d.ts": { + "original": { + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": false, + "affectsGlobalScope": true, + "impliedFormat": 1 + }, + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + }, + "./a.ts": { + "original": { + "version": "6909448549-const err: number = \"error\";\nconst a = \"hello\"", + "signature": false, + "affectsGlobalScope": true, + "impliedFormat": 1 + }, + "version": "6909448549-const err: number = \"error\";\nconst a = \"hello\"", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + } + }, + "root": [ + [ + 2, + "./a.ts" + ] + ], + "options": { + "declaration": true, + "emitDeclarationOnly": true + }, + "referencedMap": {}, + "changeFileSet": [ + "../lib/lib.d.ts", + "./a.ts" + ] + }, + "version": "FakeTSVersion", + "size": 858 +} + + + +Change:: no-change-run +Input:: + + +Output:: +/lib/tsc --b /src/tsconfig.json -v --incremental +[12:00:24 AM] Projects in this build: + * src/tsconfig.json + +[12:00:25 AM] Project 'src/tsconfig.json' is out of date because buildinfo file 'src/tsconfig.tsbuildinfo' indicates that some of the changes were not emitted + +[12:00:26 AM] Building project '/src/tsconfig.json'... + +src/tsconfig.json:3:16 - error TS5023: Unknown compiler option 'noCheck'. + +3 "noCheck": true, +   ~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +Program root files: [ + "/src/a.ts" +] +Program options: { + "emitDeclarationOnly": true, + "declaration": true, + "incremental": true, + "configFilePath": "/src/tsconfig.json" +} +Program structureReused: Not +Program files:: +/lib/lib.d.ts +/src/a.ts + +No cached semantic diagnostics in the builder:: + +No shapes updated in the builder:: + + + + +Change:: Disable noCheck +Input:: +//// [/src/tsconfig.json] +{ + "compilerOptions": { + "emitDeclarationOnly": true, + "declaration": true + } +} + + + +Output:: +/lib/tsc --b /src/tsconfig.json -v --incremental +[12:00:28 AM] Projects in this build: + * src/tsconfig.json + +[12:00:29 AM] Project 'src/tsconfig.json' is out of date because buildinfo file 'src/tsconfig.tsbuildinfo' indicates that some of the changes were not emitted + +[12:00:30 AM] Building project '/src/tsconfig.json'... + +src/a.ts:1:7 - error TS2322: Type 'string' is not assignable to type 'number'. + +1 const err: number = "error"; +   ~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +Program root files: [ + "/src/a.ts" +] +Program options: { + "emitDeclarationOnly": true, + "declaration": true, + "incremental": true, + "configFilePath": "/src/tsconfig.json" +} +Program structureReused: Not +Program files:: +/lib/lib.d.ts +/src/a.ts + +Semantic diagnostics in builder refreshed for:: +/lib/lib.d.ts +/src/a.ts + +Shape signatures in builder refreshed for:: +/lib/lib.d.ts (used version) +/src/a.ts (computed .d.ts) + + +//// [/src/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../lib/lib.d.ts","./a.ts"],"fileInfos":[{"version":"3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedFormat":1},{"version":"6909448549-const err: number = \"error\";\nconst a = \"hello\"","signature":"-22441876417-declare const err: number;\ndeclare const a = \"hello\";\n","affectsGlobalScope":true,"impliedFormat":1}],"root":[2],"options":{"declaration":true,"emitDeclarationOnly":true},"referencedMap":[],"semanticDiagnosticsPerFile":[1,[2,[{"file":"./a.ts","start":6,"length":3,"code":2322,"category":1,"messageText":"Type 'string' is not assignable to type 'number'."}]]],"affectedFilesPendingEmit":[2]},"version":"FakeTSVersion"} + +//// [/src/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../lib/lib.d.ts", + "./a.ts" + ], + "fileInfos": { + "../lib/lib.d.ts": { + "original": { + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": 1 + }, + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + }, + "./a.ts": { + "original": { + "version": "6909448549-const err: number = \"error\";\nconst a = \"hello\"", + "signature": "-22441876417-declare const err: number;\ndeclare const a = \"hello\";\n", + "affectsGlobalScope": true, + "impliedFormat": 1 + }, + "version": "6909448549-const err: number = \"error\";\nconst a = \"hello\"", + "signature": "-22441876417-declare const err: number;\ndeclare const a = \"hello\";\n", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + } + }, + "root": [ + [ + 2, + "./a.ts" + ] + ], + "options": { + "declaration": true, + "emitDeclarationOnly": true + }, + "referencedMap": {}, + "semanticDiagnosticsPerFile": [ + "../lib/lib.d.ts", + [ + "./a.ts", + [ + { + "file": "./a.ts", + "start": 6, + "length": 3, + "code": 2322, + "category": 1, + "messageText": "Type 'string' is not assignable to type 'number'." + } + ] + ] + ], + "affectedFilesPendingEmit": [ + [ + "./a.ts", + "Dts" + ] + ] + }, + "version": "FakeTSVersion", + "size": 1086 +} + + + +Change:: no-change-run +Input:: + + +Output:: +/lib/tsc --b /src/tsconfig.json -v --incremental +[12:00:34 AM] Projects in this build: + * src/tsconfig.json + +[12:00:35 AM] Project 'src/tsconfig.json' is out of date because buildinfo file 'src/tsconfig.tsbuildinfo' indicates that some of the changes were not emitted + +[12:00:36 AM] Building project '/src/tsconfig.json'... + +src/a.ts:1:7 - error TS2322: Type 'string' is not assignable to type 'number'. + +1 const err: number = "error"; +   ~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +Program root files: [ + "/src/a.ts" +] +Program options: { + "emitDeclarationOnly": true, + "declaration": true, + "incremental": true, + "configFilePath": "/src/tsconfig.json" +} +Program structureReused: Not +Program files:: +/lib/lib.d.ts +/src/a.ts + +Semantic diagnostics in builder refreshed for:: + +No shapes updated in the builder:: + + diff --git a/tests/baselines/reference/tsbuild/noCheck-errors/semantic-errors.js b/tests/baselines/reference/tsbuild/noCheck-errors/semantic-errors.js new file mode 100644 index 0000000000000..be37c71338c36 --- /dev/null +++ b/tests/baselines/reference/tsbuild/noCheck-errors/semantic-errors.js @@ -0,0 +1,298 @@ +currentDirectory:: / useCaseSensitiveFileNames: false +Input:: +//// [/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +declare const console: { log(msg: any): void; }; + +//// [/src/a.ts] +const err: number = "error"; +const a: number = "hello" + +//// [/src/tsconfig.json] +{ + "compilerOptions": { + "noCheck": true, + "emitDeclarationOnly": true, + "declaration": true + } +} + + + +Output:: +/lib/tsc --b /src/tsconfig.json -v +[12:00:08 AM] Projects in this build: + * src/tsconfig.json + +[12:00:09 AM] Project 'src/tsconfig.json' is out of date because output file 'src/a.d.ts' does not exist + +[12:00:10 AM] Building project '/src/tsconfig.json'... + +src/tsconfig.json:3:16 - error TS5023: Unknown compiler option 'noCheck'. + +3 "noCheck": true, +   ~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +Program root files: [ + "/src/a.ts" +] +Program options: { + "emitDeclarationOnly": true, + "declaration": true, + "configFilePath": "/src/tsconfig.json" +} +Program structureReused: Not +Program files:: +/lib/lib.d.ts +/src/a.ts + +No cached semantic diagnostics in the builder:: + +No shapes updated in the builder:: + + + + +Change:: no-change-run +Input:: + + +Output:: +/lib/tsc --b /src/tsconfig.json -v +[12:00:11 AM] Projects in this build: + * src/tsconfig.json + +[12:00:12 AM] Project 'src/tsconfig.json' is out of date because output file 'src/a.d.ts' does not exist + +[12:00:13 AM] Building project '/src/tsconfig.json'... + +src/tsconfig.json:3:16 - error TS5023: Unknown compiler option 'noCheck'. + +3 "noCheck": true, +   ~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +Program root files: [ + "/src/a.ts" +] +Program options: { + "emitDeclarationOnly": true, + "declaration": true, + "configFilePath": "/src/tsconfig.json" +} +Program structureReused: Not +Program files:: +/lib/lib.d.ts +/src/a.ts + +No cached semantic diagnostics in the builder:: + +No shapes updated in the builder:: + + + + +Change:: Fix `a` error +Input:: +//// [/src/a.ts] +const err: number = "error"; +const a = "hello" + + + +Output:: +/lib/tsc --b /src/tsconfig.json -v +[12:00:15 AM] Projects in this build: + * src/tsconfig.json + +[12:00:16 AM] Project 'src/tsconfig.json' is out of date because output file 'src/a.d.ts' does not exist + +[12:00:17 AM] Building project '/src/tsconfig.json'... + +src/tsconfig.json:3:16 - error TS5023: Unknown compiler option 'noCheck'. + +3 "noCheck": true, +   ~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +Program root files: [ + "/src/a.ts" +] +Program options: { + "emitDeclarationOnly": true, + "declaration": true, + "configFilePath": "/src/tsconfig.json" +} +Program structureReused: Not +Program files:: +/lib/lib.d.ts +/src/a.ts + +No cached semantic diagnostics in the builder:: + +No shapes updated in the builder:: + + + + +Change:: no-change-run +Input:: + + +Output:: +/lib/tsc --b /src/tsconfig.json -v +[12:00:18 AM] Projects in this build: + * src/tsconfig.json + +[12:00:19 AM] Project 'src/tsconfig.json' is out of date because output file 'src/a.d.ts' does not exist + +[12:00:20 AM] Building project '/src/tsconfig.json'... + +src/tsconfig.json:3:16 - error TS5023: Unknown compiler option 'noCheck'. + +3 "noCheck": true, +   ~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +Program root files: [ + "/src/a.ts" +] +Program options: { + "emitDeclarationOnly": true, + "declaration": true, + "configFilePath": "/src/tsconfig.json" +} +Program structureReused: Not +Program files:: +/lib/lib.d.ts +/src/a.ts + +No cached semantic diagnostics in the builder:: + +No shapes updated in the builder:: + + + + +Change:: Disable noCheck +Input:: +//// [/src/tsconfig.json] +{ + "compilerOptions": { + "emitDeclarationOnly": true, + "declaration": true + } +} + + + +Output:: +/lib/tsc --b /src/tsconfig.json -v +[12:00:22 AM] Projects in this build: + * src/tsconfig.json + +[12:00:23 AM] Project 'src/tsconfig.json' is out of date because output file 'src/a.d.ts' does not exist + +[12:00:24 AM] Building project '/src/tsconfig.json'... + +src/a.ts:1:7 - error TS2322: Type 'string' is not assignable to type 'number'. + +1 const err: number = "error"; +   ~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +Program root files: [ + "/src/a.ts" +] +Program options: { + "emitDeclarationOnly": true, + "declaration": true, + "configFilePath": "/src/tsconfig.json" +} +Program structureReused: Not +Program files:: +/lib/lib.d.ts +/src/a.ts + +Semantic diagnostics in builder refreshed for:: +/lib/lib.d.ts +/src/a.ts + +Shape signatures in builder refreshed for:: +/lib/lib.d.ts (used version) +/src/a.ts (used version) + + + + +Change:: no-change-run +Input:: + + +Output:: +/lib/tsc --b /src/tsconfig.json -v +[12:00:25 AM] Projects in this build: + * src/tsconfig.json + +[12:00:26 AM] Project 'src/tsconfig.json' is out of date because output file 'src/a.d.ts' does not exist + +[12:00:27 AM] Building project '/src/tsconfig.json'... + +src/a.ts:1:7 - error TS2322: Type 'string' is not assignable to type 'number'. + +1 const err: number = "error"; +   ~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +Program root files: [ + "/src/a.ts" +] +Program options: { + "emitDeclarationOnly": true, + "declaration": true, + "configFilePath": "/src/tsconfig.json" +} +Program structureReused: Not +Program files:: +/lib/lib.d.ts +/src/a.ts + +Semantic diagnostics in builder refreshed for:: +/lib/lib.d.ts +/src/a.ts + +Shape signatures in builder refreshed for:: +/lib/lib.d.ts (used version) +/src/a.ts (used version) + + diff --git a/tests/baselines/reference/tsbuild/noCheck-errors/syntax-errors-with-incremental.js b/tests/baselines/reference/tsbuild/noCheck-errors/syntax-errors-with-incremental.js new file mode 100644 index 0000000000000..3ac1727d00498 --- /dev/null +++ b/tests/baselines/reference/tsbuild/noCheck-errors/syntax-errors-with-incremental.js @@ -0,0 +1,491 @@ +currentDirectory:: / useCaseSensitiveFileNames: false +Input:: +//// [/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +declare const console: { log(msg: any): void; }; + +//// [/src/a.ts] +const err: number = "error"; +const a = "hello + +//// [/src/tsconfig.json] +{ + "compilerOptions": { + "noCheck": true, + "emitDeclarationOnly": true, + "declaration": true + } +} + + + +Output:: +/lib/tsc --b /src/tsconfig.json -v --incremental +[12:00:08 AM] Projects in this build: + * src/tsconfig.json + +[12:00:09 AM] Project 'src/tsconfig.json' is out of date because output file 'src/tsconfig.tsbuildinfo' does not exist + +[12:00:10 AM] Building project '/src/tsconfig.json'... + +src/tsconfig.json:3:16 - error TS5023: Unknown compiler option 'noCheck'. + +3 "noCheck": true, +   ~~~~ + +src/a.ts:2:17 - error TS1002: Unterminated string literal. + +2 const a = "hello +    + + +Found 2 errors. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +Program root files: [ + "/src/a.ts" +] +Program options: { + "emitDeclarationOnly": true, + "declaration": true, + "incremental": true, + "configFilePath": "/src/tsconfig.json" +} +Program structureReused: Not +Program files:: +/lib/lib.d.ts +/src/a.ts + +No cached semantic diagnostics in the builder:: + +No shapes updated in the builder:: + + +//// [/src/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../lib/lib.d.ts","./a.ts"],"fileInfos":[{"version":"3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"8018408675-const err: number = \"error\";\nconst a = \"hello","signature":false,"affectsGlobalScope":true,"impliedFormat":1}],"root":[2],"options":{"declaration":true,"emitDeclarationOnly":true},"referencedMap":[],"changeFileSet":[1,2]},"version":"FakeTSVersion"} + +//// [/src/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../lib/lib.d.ts", + "./a.ts" + ], + "fileInfos": { + "../lib/lib.d.ts": { + "original": { + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": false, + "affectsGlobalScope": true, + "impliedFormat": 1 + }, + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + }, + "./a.ts": { + "original": { + "version": "8018408675-const err: number = \"error\";\nconst a = \"hello", + "signature": false, + "affectsGlobalScope": true, + "impliedFormat": 1 + }, + "version": "8018408675-const err: number = \"error\";\nconst a = \"hello", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + } + }, + "root": [ + [ + 2, + "./a.ts" + ] + ], + "options": { + "declaration": true, + "emitDeclarationOnly": true + }, + "referencedMap": {}, + "changeFileSet": [ + "../lib/lib.d.ts", + "./a.ts" + ] + }, + "version": "FakeTSVersion", + "size": 856 +} + + + +Change:: no-change-run +Input:: + + +Output:: +/lib/tsc --b /src/tsconfig.json -v --incremental +[12:00:14 AM] Projects in this build: + * src/tsconfig.json + +[12:00:15 AM] Project 'src/tsconfig.json' is out of date because buildinfo file 'src/tsconfig.tsbuildinfo' indicates that some of the changes were not emitted + +[12:00:16 AM] Building project '/src/tsconfig.json'... + +src/tsconfig.json:3:16 - error TS5023: Unknown compiler option 'noCheck'. + +3 "noCheck": true, +   ~~~~ + +src/a.ts:2:17 - error TS1002: Unterminated string literal. + +2 const a = "hello +    + + +Found 2 errors. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +Program root files: [ + "/src/a.ts" +] +Program options: { + "emitDeclarationOnly": true, + "declaration": true, + "incremental": true, + "configFilePath": "/src/tsconfig.json" +} +Program structureReused: Not +Program files:: +/lib/lib.d.ts +/src/a.ts + +No cached semantic diagnostics in the builder:: + +No shapes updated in the builder:: + + + + +Change:: Fix `a` error +Input:: +//// [/src/a.ts] +const err: number = "error"; +const a = "hello" + + + +Output:: +/lib/tsc --b /src/tsconfig.json -v --incremental +[12:00:18 AM] Projects in this build: + * src/tsconfig.json + +[12:00:19 AM] Project 'src/tsconfig.json' is out of date because buildinfo file 'src/tsconfig.tsbuildinfo' indicates that some of the changes were not emitted + +[12:00:20 AM] Building project '/src/tsconfig.json'... + +src/tsconfig.json:3:16 - error TS5023: Unknown compiler option 'noCheck'. + +3 "noCheck": true, +   ~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +Program root files: [ + "/src/a.ts" +] +Program options: { + "emitDeclarationOnly": true, + "declaration": true, + "incremental": true, + "configFilePath": "/src/tsconfig.json" +} +Program structureReused: Not +Program files:: +/lib/lib.d.ts +/src/a.ts + +No cached semantic diagnostics in the builder:: + +No shapes updated in the builder:: + + +//// [/src/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../lib/lib.d.ts","./a.ts"],"fileInfos":[{"version":"3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"6909448549-const err: number = \"error\";\nconst a = \"hello\"","signature":false,"affectsGlobalScope":true,"impliedFormat":1}],"root":[2],"options":{"declaration":true,"emitDeclarationOnly":true},"referencedMap":[],"changeFileSet":[1,2]},"version":"FakeTSVersion"} + +//// [/src/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../lib/lib.d.ts", + "./a.ts" + ], + "fileInfos": { + "../lib/lib.d.ts": { + "original": { + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": false, + "affectsGlobalScope": true, + "impliedFormat": 1 + }, + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + }, + "./a.ts": { + "original": { + "version": "6909448549-const err: number = \"error\";\nconst a = \"hello\"", + "signature": false, + "affectsGlobalScope": true, + "impliedFormat": 1 + }, + "version": "6909448549-const err: number = \"error\";\nconst a = \"hello\"", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + } + }, + "root": [ + [ + 2, + "./a.ts" + ] + ], + "options": { + "declaration": true, + "emitDeclarationOnly": true + }, + "referencedMap": {}, + "changeFileSet": [ + "../lib/lib.d.ts", + "./a.ts" + ] + }, + "version": "FakeTSVersion", + "size": 858 +} + + + +Change:: no-change-run +Input:: + + +Output:: +/lib/tsc --b /src/tsconfig.json -v --incremental +[12:00:24 AM] Projects in this build: + * src/tsconfig.json + +[12:00:25 AM] Project 'src/tsconfig.json' is out of date because buildinfo file 'src/tsconfig.tsbuildinfo' indicates that some of the changes were not emitted + +[12:00:26 AM] Building project '/src/tsconfig.json'... + +src/tsconfig.json:3:16 - error TS5023: Unknown compiler option 'noCheck'. + +3 "noCheck": true, +   ~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +Program root files: [ + "/src/a.ts" +] +Program options: { + "emitDeclarationOnly": true, + "declaration": true, + "incremental": true, + "configFilePath": "/src/tsconfig.json" +} +Program structureReused: Not +Program files:: +/lib/lib.d.ts +/src/a.ts + +No cached semantic diagnostics in the builder:: + +No shapes updated in the builder:: + + + + +Change:: Disable noCheck +Input:: +//// [/src/tsconfig.json] +{ + "compilerOptions": { + "emitDeclarationOnly": true, + "declaration": true + } +} + + + +Output:: +/lib/tsc --b /src/tsconfig.json -v --incremental +[12:00:28 AM] Projects in this build: + * src/tsconfig.json + +[12:00:29 AM] Project 'src/tsconfig.json' is out of date because buildinfo file 'src/tsconfig.tsbuildinfo' indicates that some of the changes were not emitted + +[12:00:30 AM] Building project '/src/tsconfig.json'... + +src/a.ts:1:7 - error TS2322: Type 'string' is not assignable to type 'number'. + +1 const err: number = "error"; +   ~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +Program root files: [ + "/src/a.ts" +] +Program options: { + "emitDeclarationOnly": true, + "declaration": true, + "incremental": true, + "configFilePath": "/src/tsconfig.json" +} +Program structureReused: Not +Program files:: +/lib/lib.d.ts +/src/a.ts + +Semantic diagnostics in builder refreshed for:: +/lib/lib.d.ts +/src/a.ts + +Shape signatures in builder refreshed for:: +/lib/lib.d.ts (used version) +/src/a.ts (computed .d.ts) + + +//// [/src/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../lib/lib.d.ts","./a.ts"],"fileInfos":[{"version":"3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedFormat":1},{"version":"6909448549-const err: number = \"error\";\nconst a = \"hello\"","signature":"-22441876417-declare const err: number;\ndeclare const a = \"hello\";\n","affectsGlobalScope":true,"impliedFormat":1}],"root":[2],"options":{"declaration":true,"emitDeclarationOnly":true},"referencedMap":[],"semanticDiagnosticsPerFile":[1,[2,[{"file":"./a.ts","start":6,"length":3,"code":2322,"category":1,"messageText":"Type 'string' is not assignable to type 'number'."}]]],"affectedFilesPendingEmit":[2]},"version":"FakeTSVersion"} + +//// [/src/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../lib/lib.d.ts", + "./a.ts" + ], + "fileInfos": { + "../lib/lib.d.ts": { + "original": { + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": 1 + }, + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + }, + "./a.ts": { + "original": { + "version": "6909448549-const err: number = \"error\";\nconst a = \"hello\"", + "signature": "-22441876417-declare const err: number;\ndeclare const a = \"hello\";\n", + "affectsGlobalScope": true, + "impliedFormat": 1 + }, + "version": "6909448549-const err: number = \"error\";\nconst a = \"hello\"", + "signature": "-22441876417-declare const err: number;\ndeclare const a = \"hello\";\n", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + } + }, + "root": [ + [ + 2, + "./a.ts" + ] + ], + "options": { + "declaration": true, + "emitDeclarationOnly": true + }, + "referencedMap": {}, + "semanticDiagnosticsPerFile": [ + "../lib/lib.d.ts", + [ + "./a.ts", + [ + { + "file": "./a.ts", + "start": 6, + "length": 3, + "code": 2322, + "category": 1, + "messageText": "Type 'string' is not assignable to type 'number'." + } + ] + ] + ], + "affectedFilesPendingEmit": [ + [ + "./a.ts", + "Dts" + ] + ] + }, + "version": "FakeTSVersion", + "size": 1086 +} + + + +Change:: no-change-run +Input:: + + +Output:: +/lib/tsc --b /src/tsconfig.json -v --incremental +[12:00:34 AM] Projects in this build: + * src/tsconfig.json + +[12:00:35 AM] Project 'src/tsconfig.json' is out of date because buildinfo file 'src/tsconfig.tsbuildinfo' indicates that some of the changes were not emitted + +[12:00:36 AM] Building project '/src/tsconfig.json'... + +src/a.ts:1:7 - error TS2322: Type 'string' is not assignable to type 'number'. + +1 const err: number = "error"; +   ~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +Program root files: [ + "/src/a.ts" +] +Program options: { + "emitDeclarationOnly": true, + "declaration": true, + "incremental": true, + "configFilePath": "/src/tsconfig.json" +} +Program structureReused: Not +Program files:: +/lib/lib.d.ts +/src/a.ts + +Semantic diagnostics in builder refreshed for:: + +No shapes updated in the builder:: + + diff --git a/tests/baselines/reference/tsbuild/noCheck-errors/syntax-errors.js b/tests/baselines/reference/tsbuild/noCheck-errors/syntax-errors.js new file mode 100644 index 0000000000000..ea1eac55da315 --- /dev/null +++ b/tests/baselines/reference/tsbuild/noCheck-errors/syntax-errors.js @@ -0,0 +1,308 @@ +currentDirectory:: / useCaseSensitiveFileNames: false +Input:: +//// [/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +declare const console: { log(msg: any): void; }; + +//// [/src/a.ts] +const err: number = "error"; +const a = "hello + +//// [/src/tsconfig.json] +{ + "compilerOptions": { + "noCheck": true, + "emitDeclarationOnly": true, + "declaration": true + } +} + + + +Output:: +/lib/tsc --b /src/tsconfig.json -v +[12:00:08 AM] Projects in this build: + * src/tsconfig.json + +[12:00:09 AM] Project 'src/tsconfig.json' is out of date because output file 'src/a.d.ts' does not exist + +[12:00:10 AM] Building project '/src/tsconfig.json'... + +src/tsconfig.json:3:16 - error TS5023: Unknown compiler option 'noCheck'. + +3 "noCheck": true, +   ~~~~ + +src/a.ts:2:17 - error TS1002: Unterminated string literal. + +2 const a = "hello +    + + +Found 2 errors. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +Program root files: [ + "/src/a.ts" +] +Program options: { + "emitDeclarationOnly": true, + "declaration": true, + "configFilePath": "/src/tsconfig.json" +} +Program structureReused: Not +Program files:: +/lib/lib.d.ts +/src/a.ts + +No cached semantic diagnostics in the builder:: + +No shapes updated in the builder:: + + + + +Change:: no-change-run +Input:: + + +Output:: +/lib/tsc --b /src/tsconfig.json -v +[12:00:11 AM] Projects in this build: + * src/tsconfig.json + +[12:00:12 AM] Project 'src/tsconfig.json' is out of date because output file 'src/a.d.ts' does not exist + +[12:00:13 AM] Building project '/src/tsconfig.json'... + +src/tsconfig.json:3:16 - error TS5023: Unknown compiler option 'noCheck'. + +3 "noCheck": true, +   ~~~~ + +src/a.ts:2:17 - error TS1002: Unterminated string literal. + +2 const a = "hello +    + + +Found 2 errors. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +Program root files: [ + "/src/a.ts" +] +Program options: { + "emitDeclarationOnly": true, + "declaration": true, + "configFilePath": "/src/tsconfig.json" +} +Program structureReused: Not +Program files:: +/lib/lib.d.ts +/src/a.ts + +No cached semantic diagnostics in the builder:: + +No shapes updated in the builder:: + + + + +Change:: Fix `a` error +Input:: +//// [/src/a.ts] +const err: number = "error"; +const a = "hello" + + + +Output:: +/lib/tsc --b /src/tsconfig.json -v +[12:00:15 AM] Projects in this build: + * src/tsconfig.json + +[12:00:16 AM] Project 'src/tsconfig.json' is out of date because output file 'src/a.d.ts' does not exist + +[12:00:17 AM] Building project '/src/tsconfig.json'... + +src/tsconfig.json:3:16 - error TS5023: Unknown compiler option 'noCheck'. + +3 "noCheck": true, +   ~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +Program root files: [ + "/src/a.ts" +] +Program options: { + "emitDeclarationOnly": true, + "declaration": true, + "configFilePath": "/src/tsconfig.json" +} +Program structureReused: Not +Program files:: +/lib/lib.d.ts +/src/a.ts + +No cached semantic diagnostics in the builder:: + +No shapes updated in the builder:: + + + + +Change:: no-change-run +Input:: + + +Output:: +/lib/tsc --b /src/tsconfig.json -v +[12:00:18 AM] Projects in this build: + * src/tsconfig.json + +[12:00:19 AM] Project 'src/tsconfig.json' is out of date because output file 'src/a.d.ts' does not exist + +[12:00:20 AM] Building project '/src/tsconfig.json'... + +src/tsconfig.json:3:16 - error TS5023: Unknown compiler option 'noCheck'. + +3 "noCheck": true, +   ~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +Program root files: [ + "/src/a.ts" +] +Program options: { + "emitDeclarationOnly": true, + "declaration": true, + "configFilePath": "/src/tsconfig.json" +} +Program structureReused: Not +Program files:: +/lib/lib.d.ts +/src/a.ts + +No cached semantic diagnostics in the builder:: + +No shapes updated in the builder:: + + + + +Change:: Disable noCheck +Input:: +//// [/src/tsconfig.json] +{ + "compilerOptions": { + "emitDeclarationOnly": true, + "declaration": true + } +} + + + +Output:: +/lib/tsc --b /src/tsconfig.json -v +[12:00:22 AM] Projects in this build: + * src/tsconfig.json + +[12:00:23 AM] Project 'src/tsconfig.json' is out of date because output file 'src/a.d.ts' does not exist + +[12:00:24 AM] Building project '/src/tsconfig.json'... + +src/a.ts:1:7 - error TS2322: Type 'string' is not assignable to type 'number'. + +1 const err: number = "error"; +   ~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +Program root files: [ + "/src/a.ts" +] +Program options: { + "emitDeclarationOnly": true, + "declaration": true, + "configFilePath": "/src/tsconfig.json" +} +Program structureReused: Not +Program files:: +/lib/lib.d.ts +/src/a.ts + +Semantic diagnostics in builder refreshed for:: +/lib/lib.d.ts +/src/a.ts + +Shape signatures in builder refreshed for:: +/lib/lib.d.ts (used version) +/src/a.ts (used version) + + + + +Change:: no-change-run +Input:: + + +Output:: +/lib/tsc --b /src/tsconfig.json -v +[12:00:25 AM] Projects in this build: + * src/tsconfig.json + +[12:00:26 AM] Project 'src/tsconfig.json' is out of date because output file 'src/a.d.ts' does not exist + +[12:00:27 AM] Building project '/src/tsconfig.json'... + +src/a.ts:1:7 - error TS2322: Type 'string' is not assignable to type 'number'. + +1 const err: number = "error"; +   ~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +Program root files: [ + "/src/a.ts" +] +Program options: { + "emitDeclarationOnly": true, + "declaration": true, + "configFilePath": "/src/tsconfig.json" +} +Program structureReused: Not +Program files:: +/lib/lib.d.ts +/src/a.ts + +Semantic diagnostics in builder refreshed for:: +/lib/lib.d.ts +/src/a.ts + +Shape signatures in builder refreshed for:: +/lib/lib.d.ts (used version) +/src/a.ts (used version) + + diff --git a/tests/baselines/reference/tsbuild/noCheck/semantic-errors-with-incremental-discrepancies.js b/tests/baselines/reference/tsbuild/noCheck/semantic-errors-with-incremental-discrepancies.js new file mode 100644 index 0000000000000..468987b4a1433 --- /dev/null +++ b/tests/baselines/reference/tsbuild/noCheck/semantic-errors-with-incremental-discrepancies.js @@ -0,0 +1,164 @@ +3:: Disable noCheck +*** Needs explanation +TsBuild info text without affectedFilesPendingEmit:: /src/tsconfig.tsbuildinfo.readable.baseline.txt:: +CleanBuild: +{ + "program": { + "fileInfos": { + "../lib/lib.d.ts": { + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + }, + "./a.ts": { + "version": "6909448549-const err: number = \"error\";\nconst a = \"hello\"", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + } + }, + "root": [ + [ + 2, + "./a.ts" + ] + ], + "options": { + "declaration": true, + "emitDeclarationOnly": true + }, + "referencedMap": {}, + "semanticDiagnosticsPerFile": [ + "../lib/lib.d.ts", + [ + "./a.ts", + [ + { + "file": "./a.ts", + "start": 6, + "length": 3, + "code": 2322, + "category": 1, + "messageText": "Type 'string' is not assignable to type 'number'." + } + ] + ] + ] + }, + "version": "FakeTSVersion" +} +IncrementalBuild: +{ + "program": { + "fileInfos": { + "../lib/lib.d.ts": { + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + }, + "./a.ts": { + "version": "6909448549-const err: number = \"error\";\nconst a = \"hello\"", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + } + }, + "root": [ + [ + 2, + "./a.ts" + ] + ], + "options": { + "declaration": true, + "emitDeclarationOnly": true, + "noCheck": true + }, + "referencedMap": {}, + "semanticDiagnosticsPerFile": [ + "../lib/lib.d.ts", + "./a.ts" + ] + }, + "version": "FakeTSVersion" +} +4:: no-change-run +*** Needs explanation +TsBuild info text without affectedFilesPendingEmit:: /src/tsconfig.tsbuildinfo.readable.baseline.txt:: +CleanBuild: +{ + "program": { + "fileInfos": { + "../lib/lib.d.ts": { + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + }, + "./a.ts": { + "version": "6909448549-const err: number = \"error\";\nconst a = \"hello\"", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + } + }, + "root": [ + [ + 2, + "./a.ts" + ] + ], + "options": { + "declaration": true, + "emitDeclarationOnly": true + }, + "referencedMap": {}, + "semanticDiagnosticsPerFile": [ + "../lib/lib.d.ts", + [ + "./a.ts", + [ + { + "file": "./a.ts", + "start": 6, + "length": 3, + "code": 2322, + "category": 1, + "messageText": "Type 'string' is not assignable to type 'number'." + } + ] + ] + ] + }, + "version": "FakeTSVersion" +} +IncrementalBuild: +{ + "program": { + "fileInfos": { + "../lib/lib.d.ts": { + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + }, + "./a.ts": { + "version": "6909448549-const err: number = \"error\";\nconst a = \"hello\"", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + } + }, + "root": [ + [ + 2, + "./a.ts" + ] + ], + "options": { + "declaration": true, + "emitDeclarationOnly": true, + "noCheck": true + }, + "referencedMap": {}, + "semanticDiagnosticsPerFile": [ + "../lib/lib.d.ts", + "./a.ts" + ] + }, + "version": "FakeTSVersion" +} \ No newline at end of file diff --git a/tests/baselines/reference/tsbuild/noCheck/semantic-errors-with-incremental.js b/tests/baselines/reference/tsbuild/noCheck/semantic-errors-with-incremental.js new file mode 100644 index 0000000000000..ab5535f4933bc --- /dev/null +++ b/tests/baselines/reference/tsbuild/noCheck/semantic-errors-with-incremental.js @@ -0,0 +1,360 @@ +currentDirectory:: / useCaseSensitiveFileNames: false +Input:: +//// [/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +declare const console: { log(msg: any): void; }; + +//// [/src/a.ts] +const err: number = "error"; +const a: number = "hello" + +//// [/src/tsconfig.json] +{ + "compilerOptions": { + "noCheck": true, + "emitDeclarationOnly": true, + "declaration": true + } +} + + + +Output:: +/lib/tsc --b /src/tsconfig.json -v --incremental +[12:00:08 AM] Projects in this build: + * src/tsconfig.json + +[12:00:09 AM] Project 'src/tsconfig.json' is out of date because output file 'src/tsconfig.tsbuildinfo' does not exist + +[12:00:10 AM] Building project '/src/tsconfig.json'... + +exitCode:: ExitStatus.Success +Program root files: [ + "/src/a.ts" +] +Program options: { + "noCheck": true, + "emitDeclarationOnly": true, + "declaration": true, + "incremental": true, + "configFilePath": "/src/tsconfig.json" +} +Program structureReused: Not +Program files:: +/lib/lib.d.ts +/src/a.ts + +Semantic diagnostics in builder refreshed for:: +/lib/lib.d.ts +/src/a.ts + +Shape signatures in builder refreshed for:: +/lib/lib.d.ts (used version) +/src/a.ts (computed .d.ts during emit) + + +//// [/src/a.d.ts] +declare const err: number; +declare const a: number; + + +//// [/src/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../lib/lib.d.ts","./a.ts"],"fileInfos":[{"version":"3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedFormat":1},{"version":"9312413704-const err: number = \"error\";\nconst a: number = \"hello\"","signature":"-22763377875-declare const err: number;\ndeclare const a: number;\n","affectsGlobalScope":true,"impliedFormat":1}],"root":[2],"options":{"declaration":true,"emitDeclarationOnly":true,"noCheck":true},"referencedMap":[],"semanticDiagnosticsPerFile":[1,2]},"version":"FakeTSVersion"} + +//// [/src/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../lib/lib.d.ts", + "./a.ts" + ], + "fileInfos": { + "../lib/lib.d.ts": { + "original": { + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": 1 + }, + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + }, + "./a.ts": { + "original": { + "version": "9312413704-const err: number = \"error\";\nconst a: number = \"hello\"", + "signature": "-22763377875-declare const err: number;\ndeclare const a: number;\n", + "affectsGlobalScope": true, + "impliedFormat": 1 + }, + "version": "9312413704-const err: number = \"error\";\nconst a: number = \"hello\"", + "signature": "-22763377875-declare const err: number;\ndeclare const a: number;\n", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + } + }, + "root": [ + [ + 2, + "./a.ts" + ] + ], + "options": { + "declaration": true, + "emitDeclarationOnly": true, + "noCheck": true + }, + "referencedMap": {}, + "semanticDiagnosticsPerFile": [ + "../lib/lib.d.ts", + "./a.ts" + ] + }, + "version": "FakeTSVersion", + "size": 940 +} + + + +Change:: no-change-run +Input:: + + +Output:: +/lib/tsc --b /src/tsconfig.json -v --incremental +[12:00:15 AM] Projects in this build: + * src/tsconfig.json + +[12:00:16 AM] Project 'src/tsconfig.json' is up to date because newest input 'src/a.ts' is older than output 'src/tsconfig.tsbuildinfo' + +exitCode:: ExitStatus.Success + + + + +Change:: Fix `a` error +Input:: +//// [/src/a.ts] +const err: number = "error"; +const a = "hello" + + + +Output:: +/lib/tsc --b /src/tsconfig.json -v --incremental +[12:00:18 AM] Projects in this build: + * src/tsconfig.json + +[12:00:19 AM] Project 'src/tsconfig.json' is out of date because output 'src/tsconfig.tsbuildinfo' is older than input 'src/a.ts' + +[12:00:20 AM] Building project '/src/tsconfig.json'... + +exitCode:: ExitStatus.Success +Program root files: [ + "/src/a.ts" +] +Program options: { + "noCheck": true, + "emitDeclarationOnly": true, + "declaration": true, + "incremental": true, + "configFilePath": "/src/tsconfig.json" +} +Program structureReused: Not +Program files:: +/lib/lib.d.ts +/src/a.ts + +Semantic diagnostics in builder refreshed for:: +/src/a.ts + +Shape signatures in builder refreshed for:: +/src/a.ts (computed .d.ts) + + +//// [/src/a.d.ts] +declare const err: number; +declare const a = "hello"; + + +//// [/src/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../lib/lib.d.ts","./a.ts"],"fileInfos":[{"version":"3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedFormat":1},{"version":"6909448549-const err: number = \"error\";\nconst a = \"hello\"","signature":"-22441876417-declare const err: number;\ndeclare const a = \"hello\";\n","affectsGlobalScope":true,"impliedFormat":1}],"root":[2],"options":{"declaration":true,"emitDeclarationOnly":true,"noCheck":true},"referencedMap":[],"semanticDiagnosticsPerFile":[1,2]},"version":"FakeTSVersion"} + +//// [/src/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../lib/lib.d.ts", + "./a.ts" + ], + "fileInfos": { + "../lib/lib.d.ts": { + "original": { + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": 1 + }, + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + }, + "./a.ts": { + "original": { + "version": "6909448549-const err: number = \"error\";\nconst a = \"hello\"", + "signature": "-22441876417-declare const err: number;\ndeclare const a = \"hello\";\n", + "affectsGlobalScope": true, + "impliedFormat": 1 + }, + "version": "6909448549-const err: number = \"error\";\nconst a = \"hello\"", + "signature": "-22441876417-declare const err: number;\ndeclare const a = \"hello\";\n", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + } + }, + "root": [ + [ + 2, + "./a.ts" + ] + ], + "options": { + "declaration": true, + "emitDeclarationOnly": true, + "noCheck": true + }, + "referencedMap": {}, + "semanticDiagnosticsPerFile": [ + "../lib/lib.d.ts", + "./a.ts" + ] + }, + "version": "FakeTSVersion", + "size": 936 +} + + + +Change:: no-change-run +Input:: + + +Output:: +/lib/tsc --b /src/tsconfig.json -v --incremental +[12:00:25 AM] Projects in this build: + * src/tsconfig.json + +[12:00:26 AM] Project 'src/tsconfig.json' is up to date because newest input 'src/a.ts' is older than output 'src/tsconfig.tsbuildinfo' + +exitCode:: ExitStatus.Success + + + + +Change:: Disable noCheck +Input:: +//// [/src/tsconfig.json] +{ + "compilerOptions": { + "emitDeclarationOnly": true, + "declaration": true + } +} + + + +Output:: +/lib/tsc --b /src/tsconfig.json -v --incremental +[12:00:28 AM] Projects in this build: + * src/tsconfig.json + +[12:00:29 AM] Project 'src/tsconfig.json' is out of date because output 'src/tsconfig.tsbuildinfo' is older than input 'src/tsconfig.json' + +[12:00:30 AM] Building project '/src/tsconfig.json'... + +src/a.ts:1:7 - error TS2322: Type 'string' is not assignable to type 'number'. + +1 const err: number = "error"; +   ~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +Program root files: [ + "/src/a.ts" +] +Program options: { + "emitDeclarationOnly": true, + "declaration": true, + "incremental": true, + "configFilePath": "/src/tsconfig.json" +} +Program structureReused: Not +Program files:: +/lib/lib.d.ts +/src/a.ts + +Semantic diagnostics in builder refreshed for:: +/lib/lib.d.ts +/src/a.ts + +No shapes updated in the builder:: + + + + +Change:: no-change-run +Input:: + + +Output:: +/lib/tsc --b /src/tsconfig.json -v --incremental +[12:00:31 AM] Projects in this build: + * src/tsconfig.json + +[12:00:32 AM] Project 'src/tsconfig.json' is out of date because output 'src/tsconfig.tsbuildinfo' is older than input 'src/tsconfig.json' + +[12:00:33 AM] Building project '/src/tsconfig.json'... + +src/a.ts:1:7 - error TS2322: Type 'string' is not assignable to type 'number'. + +1 const err: number = "error"; +   ~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +Program root files: [ + "/src/a.ts" +] +Program options: { + "emitDeclarationOnly": true, + "declaration": true, + "incremental": true, + "configFilePath": "/src/tsconfig.json" +} +Program structureReused: Not +Program files:: +/lib/lib.d.ts +/src/a.ts + +Semantic diagnostics in builder refreshed for:: +/lib/lib.d.ts +/src/a.ts + +No shapes updated in the builder:: + + diff --git a/tests/baselines/reference/tsbuild/noCheck/semantic-errors.js b/tests/baselines/reference/tsbuild/noCheck/semantic-errors.js new file mode 100644 index 0000000000000..5c10389bbb596 --- /dev/null +++ b/tests/baselines/reference/tsbuild/noCheck/semantic-errors.js @@ -0,0 +1,250 @@ +currentDirectory:: / useCaseSensitiveFileNames: false +Input:: +//// [/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +declare const console: { log(msg: any): void; }; + +//// [/src/a.ts] +const err: number = "error"; +const a: number = "hello" + +//// [/src/tsconfig.json] +{ + "compilerOptions": { + "noCheck": true, + "emitDeclarationOnly": true, + "declaration": true + } +} + + + +Output:: +/lib/tsc --b /src/tsconfig.json -v +[12:00:08 AM] Projects in this build: + * src/tsconfig.json + +[12:00:09 AM] Project 'src/tsconfig.json' is out of date because output file 'src/a.d.ts' does not exist + +[12:00:10 AM] Building project '/src/tsconfig.json'... + +exitCode:: ExitStatus.Success +Program root files: [ + "/src/a.ts" +] +Program options: { + "noCheck": true, + "emitDeclarationOnly": true, + "declaration": true, + "configFilePath": "/src/tsconfig.json" +} +Program structureReused: Not +Program files:: +/lib/lib.d.ts +/src/a.ts + +Semantic diagnostics in builder refreshed for:: +/lib/lib.d.ts +/src/a.ts + +Shape signatures in builder refreshed for:: +/lib/lib.d.ts (used version) +/src/a.ts (computed .d.ts during emit) + + +//// [/src/a.d.ts] +declare const err: number; +declare const a: number; + + + + +Change:: no-change-run +Input:: + + +Output:: +/lib/tsc --b /src/tsconfig.json -v +[12:00:12 AM] Projects in this build: + * src/tsconfig.json + +[12:00:13 AM] Project 'src/tsconfig.json' is up to date because newest input 'src/a.ts' is older than output 'src/a.d.ts' + +exitCode:: ExitStatus.Success + + + + +Change:: Fix `a` error +Input:: +//// [/src/a.ts] +const err: number = "error"; +const a = "hello" + + + +Output:: +/lib/tsc --b /src/tsconfig.json -v +[12:00:15 AM] Projects in this build: + * src/tsconfig.json + +[12:00:16 AM] Project 'src/tsconfig.json' is out of date because output 'src/a.d.ts' is older than input 'src/a.ts' + +[12:00:17 AM] Building project '/src/tsconfig.json'... + +exitCode:: ExitStatus.Success +Program root files: [ + "/src/a.ts" +] +Program options: { + "noCheck": true, + "emitDeclarationOnly": true, + "declaration": true, + "configFilePath": "/src/tsconfig.json" +} +Program structureReused: Not +Program files:: +/lib/lib.d.ts +/src/a.ts + +Semantic diagnostics in builder refreshed for:: +/lib/lib.d.ts +/src/a.ts + +Shape signatures in builder refreshed for:: +/lib/lib.d.ts (used version) +/src/a.ts (computed .d.ts during emit) + + +//// [/src/a.d.ts] +declare const err: number; +declare const a = "hello"; + + + + +Change:: no-change-run +Input:: + + +Output:: +/lib/tsc --b /src/tsconfig.json -v +[12:00:19 AM] Projects in this build: + * src/tsconfig.json + +[12:00:20 AM] Project 'src/tsconfig.json' is up to date because newest input 'src/a.ts' is older than output 'src/a.d.ts' + +exitCode:: ExitStatus.Success + + + + +Change:: Disable noCheck +Input:: +//// [/src/tsconfig.json] +{ + "compilerOptions": { + "emitDeclarationOnly": true, + "declaration": true + } +} + + + +Output:: +/lib/tsc --b /src/tsconfig.json -v +[12:00:22 AM] Projects in this build: + * src/tsconfig.json + +[12:00:23 AM] Project 'src/tsconfig.json' is out of date because output 'src/a.d.ts' is older than input 'src/tsconfig.json' + +[12:00:24 AM] Building project '/src/tsconfig.json'... + +src/a.ts:1:7 - error TS2322: Type 'string' is not assignable to type 'number'. + +1 const err: number = "error"; +   ~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +Program root files: [ + "/src/a.ts" +] +Program options: { + "emitDeclarationOnly": true, + "declaration": true, + "configFilePath": "/src/tsconfig.json" +} +Program structureReused: Not +Program files:: +/lib/lib.d.ts +/src/a.ts + +Semantic diagnostics in builder refreshed for:: +/lib/lib.d.ts +/src/a.ts + +Shape signatures in builder refreshed for:: +/lib/lib.d.ts (used version) +/src/a.ts (used version) + + + + +Change:: no-change-run +Input:: + + +Output:: +/lib/tsc --b /src/tsconfig.json -v +[12:00:25 AM] Projects in this build: + * src/tsconfig.json + +[12:00:26 AM] Project 'src/tsconfig.json' is out of date because output 'src/a.d.ts' is older than input 'src/tsconfig.json' + +[12:00:27 AM] Building project '/src/tsconfig.json'... + +src/a.ts:1:7 - error TS2322: Type 'string' is not assignable to type 'number'. + +1 const err: number = "error"; +   ~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +Program root files: [ + "/src/a.ts" +] +Program options: { + "emitDeclarationOnly": true, + "declaration": true, + "configFilePath": "/src/tsconfig.json" +} +Program structureReused: Not +Program files:: +/lib/lib.d.ts +/src/a.ts + +Semantic diagnostics in builder refreshed for:: +/lib/lib.d.ts +/src/a.ts + +Shape signatures in builder refreshed for:: +/lib/lib.d.ts (used version) +/src/a.ts (used version) + + diff --git a/tests/baselines/reference/tsbuild/noCheck/syntax-errors-with-incremental-discrepancies.js b/tests/baselines/reference/tsbuild/noCheck/syntax-errors-with-incremental-discrepancies.js new file mode 100644 index 0000000000000..468987b4a1433 --- /dev/null +++ b/tests/baselines/reference/tsbuild/noCheck/syntax-errors-with-incremental-discrepancies.js @@ -0,0 +1,164 @@ +3:: Disable noCheck +*** Needs explanation +TsBuild info text without affectedFilesPendingEmit:: /src/tsconfig.tsbuildinfo.readable.baseline.txt:: +CleanBuild: +{ + "program": { + "fileInfos": { + "../lib/lib.d.ts": { + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + }, + "./a.ts": { + "version": "6909448549-const err: number = \"error\";\nconst a = \"hello\"", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + } + }, + "root": [ + [ + 2, + "./a.ts" + ] + ], + "options": { + "declaration": true, + "emitDeclarationOnly": true + }, + "referencedMap": {}, + "semanticDiagnosticsPerFile": [ + "../lib/lib.d.ts", + [ + "./a.ts", + [ + { + "file": "./a.ts", + "start": 6, + "length": 3, + "code": 2322, + "category": 1, + "messageText": "Type 'string' is not assignable to type 'number'." + } + ] + ] + ] + }, + "version": "FakeTSVersion" +} +IncrementalBuild: +{ + "program": { + "fileInfos": { + "../lib/lib.d.ts": { + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + }, + "./a.ts": { + "version": "6909448549-const err: number = \"error\";\nconst a = \"hello\"", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + } + }, + "root": [ + [ + 2, + "./a.ts" + ] + ], + "options": { + "declaration": true, + "emitDeclarationOnly": true, + "noCheck": true + }, + "referencedMap": {}, + "semanticDiagnosticsPerFile": [ + "../lib/lib.d.ts", + "./a.ts" + ] + }, + "version": "FakeTSVersion" +} +4:: no-change-run +*** Needs explanation +TsBuild info text without affectedFilesPendingEmit:: /src/tsconfig.tsbuildinfo.readable.baseline.txt:: +CleanBuild: +{ + "program": { + "fileInfos": { + "../lib/lib.d.ts": { + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + }, + "./a.ts": { + "version": "6909448549-const err: number = \"error\";\nconst a = \"hello\"", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + } + }, + "root": [ + [ + 2, + "./a.ts" + ] + ], + "options": { + "declaration": true, + "emitDeclarationOnly": true + }, + "referencedMap": {}, + "semanticDiagnosticsPerFile": [ + "../lib/lib.d.ts", + [ + "./a.ts", + [ + { + "file": "./a.ts", + "start": 6, + "length": 3, + "code": 2322, + "category": 1, + "messageText": "Type 'string' is not assignable to type 'number'." + } + ] + ] + ] + }, + "version": "FakeTSVersion" +} +IncrementalBuild: +{ + "program": { + "fileInfos": { + "../lib/lib.d.ts": { + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + }, + "./a.ts": { + "version": "6909448549-const err: number = \"error\";\nconst a = \"hello\"", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + } + }, + "root": [ + [ + 2, + "./a.ts" + ] + ], + "options": { + "declaration": true, + "emitDeclarationOnly": true, + "noCheck": true + }, + "referencedMap": {}, + "semanticDiagnosticsPerFile": [ + "../lib/lib.d.ts", + "./a.ts" + ] + }, + "version": "FakeTSVersion" +} \ No newline at end of file diff --git a/tests/baselines/reference/tsbuild/noCheck/syntax-errors-with-incremental.js b/tests/baselines/reference/tsbuild/noCheck/syntax-errors-with-incremental.js new file mode 100644 index 0000000000000..0a2583af8beec --- /dev/null +++ b/tests/baselines/reference/tsbuild/noCheck/syntax-errors-with-incremental.js @@ -0,0 +1,388 @@ +currentDirectory:: / useCaseSensitiveFileNames: false +Input:: +//// [/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +declare const console: { log(msg: any): void; }; + +//// [/src/a.ts] +const err: number = "error"; +const a = "hello + +//// [/src/tsconfig.json] +{ + "compilerOptions": { + "noCheck": true, + "emitDeclarationOnly": true, + "declaration": true + } +} + + + +Output:: +/lib/tsc --b /src/tsconfig.json -v --incremental +[12:00:08 AM] Projects in this build: + * src/tsconfig.json + +[12:00:09 AM] Project 'src/tsconfig.json' is out of date because output file 'src/tsconfig.tsbuildinfo' does not exist + +[12:00:10 AM] Building project '/src/tsconfig.json'... + +src/a.ts:2:17 - error TS1002: Unterminated string literal. + +2 const a = "hello +    + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +Program root files: [ + "/src/a.ts" +] +Program options: { + "noCheck": true, + "emitDeclarationOnly": true, + "declaration": true, + "incremental": true, + "configFilePath": "/src/tsconfig.json" +} +Program structureReused: Not +Program files:: +/lib/lib.d.ts +/src/a.ts + +No cached semantic diagnostics in the builder:: + +No shapes updated in the builder:: + + +//// [/src/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../lib/lib.d.ts","./a.ts"],"fileInfos":[{"version":"3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"8018408675-const err: number = \"error\";\nconst a = \"hello","signature":false,"affectsGlobalScope":true,"impliedFormat":1}],"root":[2],"options":{"declaration":true,"emitDeclarationOnly":true,"noCheck":true},"referencedMap":[],"changeFileSet":[1,2]},"version":"FakeTSVersion"} + +//// [/src/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../lib/lib.d.ts", + "./a.ts" + ], + "fileInfos": { + "../lib/lib.d.ts": { + "original": { + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": false, + "affectsGlobalScope": true, + "impliedFormat": 1 + }, + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + }, + "./a.ts": { + "original": { + "version": "8018408675-const err: number = \"error\";\nconst a = \"hello", + "signature": false, + "affectsGlobalScope": true, + "impliedFormat": 1 + }, + "version": "8018408675-const err: number = \"error\";\nconst a = \"hello", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + } + }, + "root": [ + [ + 2, + "./a.ts" + ] + ], + "options": { + "declaration": true, + "emitDeclarationOnly": true, + "noCheck": true + }, + "referencedMap": {}, + "changeFileSet": [ + "../lib/lib.d.ts", + "./a.ts" + ] + }, + "version": "FakeTSVersion", + "size": 871 +} + + + +Change:: no-change-run +Input:: + + +Output:: +/lib/tsc --b /src/tsconfig.json -v --incremental +[12:00:14 AM] Projects in this build: + * src/tsconfig.json + +[12:00:15 AM] Project 'src/tsconfig.json' is out of date because buildinfo file 'src/tsconfig.tsbuildinfo' indicates that some of the changes were not emitted + +[12:00:16 AM] Building project '/src/tsconfig.json'... + +src/a.ts:2:17 - error TS1002: Unterminated string literal. + +2 const a = "hello +    + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +Program root files: [ + "/src/a.ts" +] +Program options: { + "noCheck": true, + "emitDeclarationOnly": true, + "declaration": true, + "incremental": true, + "configFilePath": "/src/tsconfig.json" +} +Program structureReused: Not +Program files:: +/lib/lib.d.ts +/src/a.ts + +No cached semantic diagnostics in the builder:: + +No shapes updated in the builder:: + + + + +Change:: Fix `a` error +Input:: +//// [/src/a.ts] +const err: number = "error"; +const a = "hello" + + + +Output:: +/lib/tsc --b /src/tsconfig.json -v --incremental +[12:00:18 AM] Projects in this build: + * src/tsconfig.json + +[12:00:19 AM] Project 'src/tsconfig.json' is out of date because buildinfo file 'src/tsconfig.tsbuildinfo' indicates that some of the changes were not emitted + +[12:00:20 AM] Building project '/src/tsconfig.json'... + +exitCode:: ExitStatus.Success +Program root files: [ + "/src/a.ts" +] +Program options: { + "noCheck": true, + "emitDeclarationOnly": true, + "declaration": true, + "incremental": true, + "configFilePath": "/src/tsconfig.json" +} +Program structureReused: Not +Program files:: +/lib/lib.d.ts +/src/a.ts + +Semantic diagnostics in builder refreshed for:: +/lib/lib.d.ts +/src/a.ts + +Shape signatures in builder refreshed for:: +/lib/lib.d.ts (used version) +/src/a.ts (computed .d.ts) + + +//// [/src/a.d.ts] +declare const err: number; +declare const a = "hello"; + + +//// [/src/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../lib/lib.d.ts","./a.ts"],"fileInfos":[{"version":"3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedFormat":1},{"version":"6909448549-const err: number = \"error\";\nconst a = \"hello\"","signature":"-22441876417-declare const err: number;\ndeclare const a = \"hello\";\n","affectsGlobalScope":true,"impliedFormat":1}],"root":[2],"options":{"declaration":true,"emitDeclarationOnly":true,"noCheck":true},"referencedMap":[],"semanticDiagnosticsPerFile":[1,2]},"version":"FakeTSVersion"} + +//// [/src/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../lib/lib.d.ts", + "./a.ts" + ], + "fileInfos": { + "../lib/lib.d.ts": { + "original": { + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": 1 + }, + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + }, + "./a.ts": { + "original": { + "version": "6909448549-const err: number = \"error\";\nconst a = \"hello\"", + "signature": "-22441876417-declare const err: number;\ndeclare const a = \"hello\";\n", + "affectsGlobalScope": true, + "impliedFormat": 1 + }, + "version": "6909448549-const err: number = \"error\";\nconst a = \"hello\"", + "signature": "-22441876417-declare const err: number;\ndeclare const a = \"hello\";\n", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + } + }, + "root": [ + [ + 2, + "./a.ts" + ] + ], + "options": { + "declaration": true, + "emitDeclarationOnly": true, + "noCheck": true + }, + "referencedMap": {}, + "semanticDiagnosticsPerFile": [ + "../lib/lib.d.ts", + "./a.ts" + ] + }, + "version": "FakeTSVersion", + "size": 936 +} + + + +Change:: no-change-run +Input:: + + +Output:: +/lib/tsc --b /src/tsconfig.json -v --incremental +[12:00:25 AM] Projects in this build: + * src/tsconfig.json + +[12:00:26 AM] Project 'src/tsconfig.json' is up to date because newest input 'src/a.ts' is older than output 'src/tsconfig.tsbuildinfo' + +exitCode:: ExitStatus.Success + + + + +Change:: Disable noCheck +Input:: +//// [/src/tsconfig.json] +{ + "compilerOptions": { + "emitDeclarationOnly": true, + "declaration": true + } +} + + + +Output:: +/lib/tsc --b /src/tsconfig.json -v --incremental +[12:00:28 AM] Projects in this build: + * src/tsconfig.json + +[12:00:29 AM] Project 'src/tsconfig.json' is out of date because output 'src/tsconfig.tsbuildinfo' is older than input 'src/tsconfig.json' + +[12:00:30 AM] Building project '/src/tsconfig.json'... + +src/a.ts:1:7 - error TS2322: Type 'string' is not assignable to type 'number'. + +1 const err: number = "error"; +   ~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +Program root files: [ + "/src/a.ts" +] +Program options: { + "emitDeclarationOnly": true, + "declaration": true, + "incremental": true, + "configFilePath": "/src/tsconfig.json" +} +Program structureReused: Not +Program files:: +/lib/lib.d.ts +/src/a.ts + +Semantic diagnostics in builder refreshed for:: +/lib/lib.d.ts +/src/a.ts + +No shapes updated in the builder:: + + + + +Change:: no-change-run +Input:: + + +Output:: +/lib/tsc --b /src/tsconfig.json -v --incremental +[12:00:31 AM] Projects in this build: + * src/tsconfig.json + +[12:00:32 AM] Project 'src/tsconfig.json' is out of date because output 'src/tsconfig.tsbuildinfo' is older than input 'src/tsconfig.json' + +[12:00:33 AM] Building project '/src/tsconfig.json'... + +src/a.ts:1:7 - error TS2322: Type 'string' is not assignable to type 'number'. + +1 const err: number = "error"; +   ~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +Program root files: [ + "/src/a.ts" +] +Program options: { + "emitDeclarationOnly": true, + "declaration": true, + "incremental": true, + "configFilePath": "/src/tsconfig.json" +} +Program structureReused: Not +Program files:: +/lib/lib.d.ts +/src/a.ts + +Semantic diagnostics in builder refreshed for:: +/lib/lib.d.ts +/src/a.ts + +No shapes updated in the builder:: + + diff --git a/tests/baselines/reference/tsbuild/noCheck/syntax-errors.js b/tests/baselines/reference/tsbuild/noCheck/syntax-errors.js new file mode 100644 index 0000000000000..ea2b9242669bd --- /dev/null +++ b/tests/baselines/reference/tsbuild/noCheck/syntax-errors.js @@ -0,0 +1,276 @@ +currentDirectory:: / useCaseSensitiveFileNames: false +Input:: +//// [/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +declare const console: { log(msg: any): void; }; + +//// [/src/a.ts] +const err: number = "error"; +const a = "hello + +//// [/src/tsconfig.json] +{ + "compilerOptions": { + "noCheck": true, + "emitDeclarationOnly": true, + "declaration": true + } +} + + + +Output:: +/lib/tsc --b /src/tsconfig.json -v +[12:00:08 AM] Projects in this build: + * src/tsconfig.json + +[12:00:09 AM] Project 'src/tsconfig.json' is out of date because output file 'src/a.d.ts' does not exist + +[12:00:10 AM] Building project '/src/tsconfig.json'... + +src/a.ts:2:17 - error TS1002: Unterminated string literal. + +2 const a = "hello +    + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +Program root files: [ + "/src/a.ts" +] +Program options: { + "noCheck": true, + "emitDeclarationOnly": true, + "declaration": true, + "configFilePath": "/src/tsconfig.json" +} +Program structureReused: Not +Program files:: +/lib/lib.d.ts +/src/a.ts + +No cached semantic diagnostics in the builder:: + +No shapes updated in the builder:: + + + + +Change:: no-change-run +Input:: + + +Output:: +/lib/tsc --b /src/tsconfig.json -v +[12:00:11 AM] Projects in this build: + * src/tsconfig.json + +[12:00:12 AM] Project 'src/tsconfig.json' is out of date because output file 'src/a.d.ts' does not exist + +[12:00:13 AM] Building project '/src/tsconfig.json'... + +src/a.ts:2:17 - error TS1002: Unterminated string literal. + +2 const a = "hello +    + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +Program root files: [ + "/src/a.ts" +] +Program options: { + "noCheck": true, + "emitDeclarationOnly": true, + "declaration": true, + "configFilePath": "/src/tsconfig.json" +} +Program structureReused: Not +Program files:: +/lib/lib.d.ts +/src/a.ts + +No cached semantic diagnostics in the builder:: + +No shapes updated in the builder:: + + + + +Change:: Fix `a` error +Input:: +//// [/src/a.ts] +const err: number = "error"; +const a = "hello" + + + +Output:: +/lib/tsc --b /src/tsconfig.json -v +[12:00:15 AM] Projects in this build: + * src/tsconfig.json + +[12:00:16 AM] Project 'src/tsconfig.json' is out of date because output file 'src/a.d.ts' does not exist + +[12:00:17 AM] Building project '/src/tsconfig.json'... + +exitCode:: ExitStatus.Success +Program root files: [ + "/src/a.ts" +] +Program options: { + "noCheck": true, + "emitDeclarationOnly": true, + "declaration": true, + "configFilePath": "/src/tsconfig.json" +} +Program structureReused: Not +Program files:: +/lib/lib.d.ts +/src/a.ts + +Semantic diagnostics in builder refreshed for:: +/lib/lib.d.ts +/src/a.ts + +Shape signatures in builder refreshed for:: +/lib/lib.d.ts (used version) +/src/a.ts (computed .d.ts during emit) + + +//// [/src/a.d.ts] +declare const err: number; +declare const a = "hello"; + + + + +Change:: no-change-run +Input:: + + +Output:: +/lib/tsc --b /src/tsconfig.json -v +[12:00:19 AM] Projects in this build: + * src/tsconfig.json + +[12:00:20 AM] Project 'src/tsconfig.json' is up to date because newest input 'src/a.ts' is older than output 'src/a.d.ts' + +exitCode:: ExitStatus.Success + + + + +Change:: Disable noCheck +Input:: +//// [/src/tsconfig.json] +{ + "compilerOptions": { + "emitDeclarationOnly": true, + "declaration": true + } +} + + + +Output:: +/lib/tsc --b /src/tsconfig.json -v +[12:00:22 AM] Projects in this build: + * src/tsconfig.json + +[12:00:23 AM] Project 'src/tsconfig.json' is out of date because output 'src/a.d.ts' is older than input 'src/tsconfig.json' + +[12:00:24 AM] Building project '/src/tsconfig.json'... + +src/a.ts:1:7 - error TS2322: Type 'string' is not assignable to type 'number'. + +1 const err: number = "error"; +   ~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +Program root files: [ + "/src/a.ts" +] +Program options: { + "emitDeclarationOnly": true, + "declaration": true, + "configFilePath": "/src/tsconfig.json" +} +Program structureReused: Not +Program files:: +/lib/lib.d.ts +/src/a.ts + +Semantic diagnostics in builder refreshed for:: +/lib/lib.d.ts +/src/a.ts + +Shape signatures in builder refreshed for:: +/lib/lib.d.ts (used version) +/src/a.ts (used version) + + + + +Change:: no-change-run +Input:: + + +Output:: +/lib/tsc --b /src/tsconfig.json -v +[12:00:25 AM] Projects in this build: + * src/tsconfig.json + +[12:00:26 AM] Project 'src/tsconfig.json' is out of date because output 'src/a.d.ts' is older than input 'src/tsconfig.json' + +[12:00:27 AM] Building project '/src/tsconfig.json'... + +src/a.ts:1:7 - error TS2322: Type 'string' is not assignable to type 'number'. + +1 const err: number = "error"; +   ~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +Program root files: [ + "/src/a.ts" +] +Program options: { + "emitDeclarationOnly": true, + "declaration": true, + "configFilePath": "/src/tsconfig.json" +} +Program structureReused: Not +Program files:: +/lib/lib.d.ts +/src/a.ts + +Semantic diagnostics in builder refreshed for:: +/lib/lib.d.ts +/src/a.ts + +Shape signatures in builder refreshed for:: +/lib/lib.d.ts (used version) +/src/a.ts (used version) + + diff --git a/tests/baselines/reference/typeReferenceDirectives11.js b/tests/baselines/reference/typeReferenceDirectives11.js new file mode 100644 index 0000000000000..5853619bf733b --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives11.js @@ -0,0 +1,23 @@ +//// [tests/cases/compiler/typeReferenceDirectives11.ts] //// + +//// [index.d.ts] +interface Lib { x } + +//// [mod1.ts] +export function foo(): Lib { return {x: 1} } + +//// [mod2.ts] +import {foo} from "./mod1"; +export const bar = foo(); + + + + +!!!! File /output.d.ts missing from original emit, but present in noCheck emit +//// [output.d.ts] +declare module "mod1" { + export function foo(): Lib; +} +declare module "mod2" { + export const bar: Lib; +} diff --git a/tests/baselines/reference/typeReferenceDirectives12.js b/tests/baselines/reference/typeReferenceDirectives12.js new file mode 100644 index 0000000000000..dd06ed073a709 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives12.js @@ -0,0 +1,60 @@ +//// [tests/cases/compiler/typeReferenceDirectives12.ts] //// + +//// [index.d.ts] +interface Lib { x } + +//// [main.ts] +export class Cls { + x +} + +//// [mod1.ts] +/// + +import {Cls} from "./main"; +Cls.prototype.foo = function() { return undefined; } + +declare module "./main" { + interface Cls { + foo(): Lib; + } + namespace Cls { + function bar(): Lib; + } +} + +//// [mod2.ts] +import { Cls } from "./main"; +import "./mod1"; + +export const cls = Cls; +export const foo = new Cls().foo(); +export const bar = Cls.bar(); + + + + +!!!! File /output.d.ts missing from original emit, but present in noCheck emit +//// [output.d.ts] +declare module "main" { + export class Cls { + x: any; + } +} +declare module "mod1" { + module "main" { + interface Cls { + foo(): Lib; + } + namespace Cls { + function bar(): Lib; + } + } +} +declare module "mod2" { + import { Cls } from "main"; + import "mod1"; + export const cls: typeof Cls; + export const foo: Lib; + export const bar: Lib; +} diff --git a/tests/baselines/reference/variadicTuples1.js b/tests/baselines/reference/variadicTuples1.js index ddc781c45d674..cf327f771e2b8 100644 --- a/tests/baselines/reference/variadicTuples1.js +++ b/tests/baselines/reference/variadicTuples1.js @@ -833,3 +833,21 @@ type U3 = [...[string, number], boolean]; type ToStringLength1 = `${T['length']}`; type ToStringLength2 = `${[...T]['length']}`; type AnyArr = [...any]; + + +!!!! File variadicTuples1.d.ts differs from original emit in noCheck emit +//// [variadicTuples1.d.ts] +=================================================================== +--- Expected The full check baseline ++++ Actual with noCheck set +@@ -17,9 +17,9 @@ + declare const tc2: [string, number]; + declare const tc3: [number, number, number, ...string[]]; + declare const tc4: [...string[], number, number, number]; + declare function concat2(t: T, u: U): (T[number] | U[number])[]; +-declare const tc5: (2 | 4 | 1 | 3 | 6 | 5)[]; ++declare const tc5: (1 | 2 | 3 | 6 | 4 | 5)[]; + declare function foo1(a: number, b: string, c: boolean, ...d: number[]): void; + declare function foo2(t1: [number, string], t2: [boolean], a1: number[]): void; + declare function foo3(x: number, ...args: [...T, number]): T; + declare function foo4(u: U): void; diff --git a/tests/baselines/reference/weakTypesAndLiterals01.js b/tests/baselines/reference/weakTypesAndLiterals01.js index 7781da9a9a174..99b96baa69bec 100644 --- a/tests/baselines/reference/weakTypesAndLiterals01.js +++ b/tests/baselines/reference/weakTypesAndLiterals01.js @@ -67,3 +67,20 @@ declare const f: (arg: LiteralsOrWeakTypes) => WeakTypes | "A" | "B"; declare const g: (arg: WeakTypes) => WeakTypes; declare const h: (arg: LiteralsOrWeakTypes) => LiteralsOrWeakTypes; declare const i: (arg: WeakTypes) => WeakTypes; + + +!!!! File weakTypesAndLiterals01.d.ts differs from original emit in noCheck emit +//// [weakTypesAndLiterals01.d.ts] +=================================================================== +--- Expected The full check baseline ++++ Actual with noCheck set +@@ -7,8 +7,8 @@ + otherOptionalProp?: number; + }; + type LiteralsOrWeakTypes = "A" | "B" | WeakTypes; + declare let aOrB: "A" | "B"; +-declare const f: (arg: LiteralsOrWeakTypes) => WeakTypes | "A" | "B"; ++declare const f: (arg: LiteralsOrWeakTypes) => "A" | "B" | WeakTypes; + declare const g: (arg: WeakTypes) => WeakTypes; + declare const h: (arg: LiteralsOrWeakTypes) => LiteralsOrWeakTypes; + declare const i: (arg: WeakTypes) => WeakTypes; diff --git a/tests/cases/compiler/noCheckDoesNotReportError.ts b/tests/cases/compiler/noCheckDoesNotReportError.ts new file mode 100644 index 0000000000000..abb4d79e8f264 --- /dev/null +++ b/tests/cases/compiler/noCheckDoesNotReportError.ts @@ -0,0 +1,6 @@ +// @noCheck: true +// @emitDeclarationOnly: true +// @declaration: true +// @strict: true + +export const a: number = "not ok"; diff --git a/tests/cases/compiler/noCheckNoEmit.ts b/tests/cases/compiler/noCheckNoEmit.ts new file mode 100644 index 0000000000000..019c461d7fabd --- /dev/null +++ b/tests/cases/compiler/noCheckNoEmit.ts @@ -0,0 +1,7 @@ +// @noCheck: true +// @emitDeclarationOnly: true +// @declaration: true +// @noEmit: true +// @strict: true + +export const a: number = "not ok"; diff --git a/tests/cases/compiler/noCheckRequiresEmitDeclarationOnly.ts b/tests/cases/compiler/noCheckRequiresEmitDeclarationOnly.ts new file mode 100644 index 0000000000000..f4a1cce81508f --- /dev/null +++ b/tests/cases/compiler/noCheckRequiresEmitDeclarationOnly.ts @@ -0,0 +1,4 @@ +// @noCheck: true +// @strict: true + +export const a: number = "not ok";