diff --git a/.gitignore b/.gitignore index a220522b5f0cb..da24307954912 100644 --- a/.gitignore +++ b/.gitignore @@ -81,4 +81,14 @@ tests/cases/user/*/**/*.d.ts tests/baselines/reference/dt .failed-tests TEST-results.xml -package-lock.json \ No newline at end of file +package-lock.json +tests/cases/user/TypeScript-React-Starter/TypeScript-React-Starter +tests/cases/user/TypeScript-Node-Starter/TypeScript-Node-Starter +tests/cases/user/TypeScript-React-Native-Starter/TypeScript-React-Native-Starter +tests/cases/user/TypeScript-Vue-Starter/TypeScript-Vue-Starter +tests/cases/user/TypeScript-WeChat-Starter/TypeScript-WeChat-Starter +tests/cases/user/create-react-app/create-react-app +tests/cases/user/webpack/webpack +tests/cases/user/puppeteer/puppeteer +tests/cases/user/axios-src/axios-src +tests/cases/user/prettier/prettier \ No newline at end of file diff --git a/.gitmodules b/.gitmodules index 0e4e0b3ed773c..e69de29bb2d1d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,40 +0,0 @@ -[submodule "tests/cases/user/TypeScript-React-Starter/TypeScript-React-Starter"] - path = tests/cases/user/TypeScript-React-Starter/TypeScript-React-Starter - url = https://github.com/Microsoft/TypeScript-React-Starter - ignore = all -[submodule "tests/cases/user/TypeScript-Node-Starter/TypeScript-Node-Starter"] - path = tests/cases/user/TypeScript-Node-Starter/TypeScript-Node-Starter - url = https://github.com/Microsoft/TypeScript-Node-Starter.git - ignore = all -[submodule "tests/cases/user/TypeScript-React-Native-Starter/TypeScript-React-Native-Starter"] - path = tests/cases/user/TypeScript-React-Native-Starter/TypeScript-React-Native-Starter - url = https://github.com/Microsoft/TypeScript-React-Native-Starter.git - ignore = all -[submodule "tests/cases/user/TypeScript-Vue-Starter/TypeScript-Vue-Starter"] - path = tests/cases/user/TypeScript-Vue-Starter/TypeScript-Vue-Starter - url = https://github.com/Microsoft/TypeScript-Vue-Starter.git - ignore = all -[submodule "tests/cases/user/TypeScript-WeChat-Starter/TypeScript-WeChat-Starter"] - path = tests/cases/user/TypeScript-WeChat-Starter/TypeScript-WeChat-Starter - url = https://github.com/Microsoft/TypeScript-WeChat-Starter.git - ignore = all -[submodule "tests/cases/user/create-react-app/create-react-app"] - path = tests/cases/user/create-react-app/create-react-app - url = https://github.com/facebook/create-react-app.git - ignore = all -[submodule "tests/cases/user/webpack/webpack"] - path = tests/cases/user/webpack/webpack - url = https://github.com/webpack/webpack.git - ignore = all -[submodule "tests/cases/user/puppeteer/puppeteer"] - path = tests/cases/user/puppeteer/puppeteer - url = https://github.com/GoogleChrome/puppeteer.git - ignore = all -[submodule "tests/cases/user/axios-src/axios-src"] - path = tests/cases/user/axios-src/axios-src - url = https://github.com/axios/axios.git - ignore = all -[submodule "tests/cases/user/prettier/prettier"] - path = tests/cases/user/prettier/prettier - url = https://github.com/prettier/prettier.git - ignore = all diff --git a/.vscode/settings.json b/.vscode/settings.json index 4f481751900d2..14f7984e7e9c4 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -6,8 +6,7 @@ } ], "eslint.options": { - "rulePaths": ["../scripts/eslint/built/rules/"], + "rulePaths": ["./scripts/eslint/built/rules/"], "ext": [".ts"] - }, - "eslint.workingDirectories": ["./src", "./scripts"] + } } \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 18c0a352cbdcb..4b804414ab5c7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -71,7 +71,7 @@ Design changes will not be accepted at this time. If you have a design change pr You will need to complete a Contributor License Agreement (CLA). Briefly, this agreement testifies that you are granting us permission to use the submitted change according to the terms of the project's license, and that the work being submitted is under appropriate copyright. -Please submit a Contributor License Agreement (CLA) before submitting a pull request. You may visit https://cla.microsoft.com to sign digitally. Alternatively, download the agreement ([Microsoft Contribution License Agreement.pdf](https://opensource.microsoft.com/pdf/microsoft-contribution-license-agreement.pdf)), sign, scan, and email it back to . Be sure to include your github user name along with the agreement. Once we have received the signed CLA, we'll review the request. +Please submit a Contributor License Agreement (CLA) before submitting a pull request. You may visit https://cla.microsoft.com to sign digitally. Alternatively, download the agreement ([Microsoft Contribution License Agreement.pdf](https://opensource.microsoft.com/pdf/microsoft-contribution-license-agreement.pdf)), sign, scan, and email it back to . Be sure to include your GitHub user name along with the agreement. Once we have received the signed CLA, we'll review the request. ## Housekeeping @@ -148,7 +148,7 @@ You will probably only want to debug one test at a time: gulp runtests-browser --tests=2dArrays ``` -You can specify which browser to use for debugging. Currently Chrome and IE are supported: +You can specify which browser to use for debugging. Currently, Chrome and IE are supported: ```Shell gulp runtests-browser --tests=2dArrays --browser=chrome diff --git a/Gulpfile.js b/Gulpfile.js index 51127f9822d77..1f930e3b01967 100644 --- a/Gulpfile.js +++ b/Gulpfile.js @@ -333,6 +333,8 @@ task("run-eslint-rules-tests").description = "Runs the eslint rule tests"; const lintFoldStart = async () => { if (fold.isTravis()) console.log(fold.start("lint")); }; const lintFoldEnd = async () => { if (fold.isTravis()) console.log(fold.end("lint")); }; + +/** @type { (folder: string) => { (): Promise; displayName?: string } } */ const eslint = (folder) => async () => { const ESLINTRC_CI = ".eslintrc.ci.json"; const isCIEnv = cmdLineOptions.ci || process.env.CI === "true"; diff --git a/package.json b/package.json index 478538926ce94..7a59b95a130f6 100644 --- a/package.json +++ b/package.json @@ -102,6 +102,7 @@ "xml2js": "^0.4.19" }, "scripts": { + "prepare": "gulp build-eslint-rules", "pretest": "gulp tests", "test": "gulp runtests-parallel --light=false", "test:eslint-rules": "gulp run-eslint-rules-tests", diff --git a/scripts/post-vsts-artifact-comment.js b/scripts/post-vsts-artifact-comment.js index 6d84294bcfe13..5b1685ae04034 100644 --- a/scripts/post-vsts-artifact-comment.js +++ b/scripts/post-vsts-artifact-comment.js @@ -28,6 +28,10 @@ async function main() { type: "token", token: process.argv[2] }); + + // Please keep the strings "an installable tgz" and "packed" in this message, as well as the devDependencies section, + // so that the playgrounds deployment process can find these comments. + await gh.issues.createComment({ number: +process.env.SOURCE_ISSUE, owner: "Microsoft", @@ -43,6 +47,9 @@ async function main() { and then running \`npm install\`. ` }); + + // Send a ping to https://github.com/orta/make-monaco-builds#pull-request-builds + await gh.request("POST /repos/orta/make-monaco-builds/dispatches", { event_type: +process.env.SOURCE_ISSUE }) } main().catch(async e => { @@ -61,4 +68,4 @@ main().catch(async e => { body: `Hey @${process.env.REQUESTING_USER}, something went wrong when looking for the build artifact. ([You can check the log here](https://typescript.visualstudio.com/TypeScript/_build/index?buildId=${process.env.BUILD_BUILDID}&_a=summary)).` }); } -}); \ No newline at end of file +}); diff --git a/scripts/processDiagnosticMessages.ts b/scripts/processDiagnosticMessages.ts index 4bdf3ca0178c8..7577707340aa0 100644 --- a/scripts/processDiagnosticMessages.ts +++ b/scripts/processDiagnosticMessages.ts @@ -6,6 +6,7 @@ interface DiagnosticDetails { code: number; reportsUnnecessary?: {}; isEarly?: boolean; + elidedInCompatabilityPyramid?: boolean; } type InputDiagnosticMessageTable = Map; @@ -63,14 +64,15 @@ function buildInfoFileOutput(messageTable: InputDiagnosticMessageTable, inputFil "// generated from '" + inputFilePathRel + "' by '" + thisFilePathRel.replace(/\\/g, "/") + "'\r\n" + "/* @internal */\r\n" + "namespace ts {\r\n" + - " function diag(code: number, category: DiagnosticCategory, key: string, message: string, reportsUnnecessary?: {}): DiagnosticMessage {\r\n" + - " return { code, category, key, message, reportsUnnecessary };\r\n" + + " function diag(code: number, category: DiagnosticCategory, key: string, message: string, reportsUnnecessary?: {}, elidedInCompatabilityPyramid?: boolean): DiagnosticMessage {\r\n" + + " return { code, category, key, message, reportsUnnecessary, elidedInCompatabilityPyramid };\r\n" + " }\r\n" + " export const Diagnostics = {\r\n"; - messageTable.forEach(({ code, category, reportsUnnecessary }, name) => { + messageTable.forEach(({ code, category, reportsUnnecessary, elidedInCompatabilityPyramid }, name) => { const propName = convertPropertyName(name); const argReportsUnnecessary = reportsUnnecessary ? `, /*reportsUnnecessary*/ ${reportsUnnecessary}` : ""; - result += ` ${propName}: diag(${code}, DiagnosticCategory.${category}, "${createKey(propName, code)}", ${JSON.stringify(name)}${argReportsUnnecessary}),\r\n`; + const argElidedInCompatabilityPyramid = elidedInCompatabilityPyramid ? `${!reportsUnnecessary ? ", /*reportsUnnecessary*/ undefined" : ""}, /*elidedInCompatabilityPyramid*/ ${elidedInCompatabilityPyramid}` : ""; + result += ` ${propName}: diag(${code}, DiagnosticCategory.${category}, "${createKey(propName, code)}", ${JSON.stringify(name)}${argReportsUnnecessary}${argElidedInCompatabilityPyramid}),\r\n`; }); result += " };\r\n}"; diff --git a/scripts/types/ambient.d.ts b/scripts/types/ambient.d.ts index 9ea70adee5058..d48de7c05d7b4 100644 --- a/scripts/types/ambient.d.ts +++ b/scripts/types/ambient.d.ts @@ -76,10 +76,15 @@ declare module "undertaker" { interface TaskFunctionParams { flags?: Record; } + interface TaskFunctionWrapped { + description: string + flags: { [name: string]: string } + } } declare module "gulp-sourcemaps" { interface WriteOptions { destPath?: string; } -} \ No newline at end of file + +} diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index 3bc03cdbab90e..1d6627987e151 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -564,7 +564,7 @@ namespace ts { if (!isIIFE) { currentFlow = { flags: FlowFlags.Start }; if (containerFlags & (ContainerFlags.IsFunctionExpression | ContainerFlags.IsObjectLiteralOrClassExpressionMethod)) { - currentFlow.container = node; + currentFlow.node = node; } } // We create a return control flow graph for IIFEs and constructors. For constructors @@ -581,6 +581,7 @@ namespace ts { if (!(currentFlow.flags & FlowFlags.Unreachable) && containerFlags & ContainerFlags.IsFunctionLike && nodeIsPresent((node).body)) { node.flags |= NodeFlags.HasImplicitReturn; if (hasExplicitReturn) node.flags |= NodeFlags.HasExplicitReturn; + (node).endFlowNode = currentFlow; } if (node.kind === SyntaxKind.SourceFile) { node.flags |= emitFlags; @@ -671,6 +672,9 @@ namespace ts { bindJSDoc(node); return; } + if (node.kind >= SyntaxKind.FirstStatement && node.kind <= SyntaxKind.LastStatement && !options.allowUnreachableCode) { + node.flowNode = currentFlow; + } switch (node.kind) { case SyntaxKind.WhileStatement: bindWhileStatement(node); @@ -708,6 +712,9 @@ namespace ts { case SyntaxKind.CaseClause: bindCaseClause(node); break; + case SyntaxKind.ExpressionStatement: + bindExpressionStatement(node); + break; case SyntaxKind.LabeledStatement: bindLabeledStatement(node); break; @@ -845,17 +852,11 @@ namespace ts { } function createBranchLabel(): FlowLabel { - return { - flags: FlowFlags.BranchLabel, - antecedents: undefined - }; + return { flags: FlowFlags.BranchLabel, antecedents: undefined }; } function createLoopLabel(): FlowLabel { - return { - flags: FlowFlags.LoopLabel, - antecedents: undefined - }; + return { flags: FlowFlags.LoopLabel, antecedents: undefined }; } function setFlowNodeReferenced(flow: FlowNode) { @@ -885,7 +886,7 @@ namespace ts { return antecedent; } setFlowNodeReferenced(antecedent); - return flowNodeCreated({ flags, expression, antecedent }); + return flowNodeCreated({ flags, antecedent, node: expression }); } function createFlowSwitchClause(antecedent: FlowNode, switchStatement: SwitchStatement, clauseStart: number, clauseEnd: number): FlowNode { @@ -893,7 +894,7 @@ namespace ts { return antecedent; } setFlowNodeReferenced(antecedent); - return flowNodeCreated({ flags: FlowFlags.SwitchClause, switchStatement, clauseStart, clauseEnd, antecedent }); + return flowNodeCreated({ flags: FlowFlags.SwitchClause, antecedent, switchStatement, clauseStart, clauseEnd }); } function createFlowAssignment(antecedent: FlowNode, node: Expression | VariableDeclaration | BindingElement): FlowNode { @@ -901,10 +902,14 @@ namespace ts { return flowNodeCreated({ flags: FlowFlags.Assignment, antecedent, node }); } + function createFlowCall(antecedent: FlowNode, node: CallExpression): FlowNode { + setFlowNodeReferenced(antecedent); + return flowNodeCreated({ flags: FlowFlags.Call, antecedent, node }); + } + function createFlowArrayMutation(antecedent: FlowNode, node: CallExpression | BinaryExpression): FlowNode { setFlowNodeReferenced(antecedent); - const res: FlowArrayMutation = flowNodeCreated({ flags: FlowFlags.ArrayMutation, antecedent, node }); - return res; + return flowNodeCreated({ flags: FlowFlags.ArrayMutation, antecedent, node }); } function finishFlowLabel(flow: FlowLabel): FlowNode { @@ -1030,12 +1035,12 @@ namespace ts { function bindForInOrForOfStatement(node: ForInOrOfStatement): void { const preLoopLabel = createLoopLabel(); const postLoopLabel = createBranchLabel(); + bind(node.expression); addAntecedent(preLoopLabel, currentFlow); currentFlow = preLoopLabel; if (node.kind === SyntaxKind.ForOfStatement) { bind(node.awaitModifier); } - bind(node.expression); addAntecedent(postLoopLabel, currentFlow); bind(node.initializer); if (node.initializer.kind !== SyntaxKind.VariableDeclarationList) { @@ -1222,7 +1227,8 @@ namespace ts { addAntecedent(postSwitchLabel, currentFlow); const hasDefault = forEach(node.caseBlock.clauses, c => c.kind === SyntaxKind.DefaultClause); // We mark a switch statement as possibly exhaustive if it has no default clause and if all - // case clauses have unreachable end points (e.g. they all return). + // case clauses have unreachable end points (e.g. they all return). Note, we no longer need + // this property in control flow analysis, it's there only for backwards compatibility. node.possiblyExhaustive = !hasDefault && !postSwitchLabel.antecedents; if (!hasDefault) { addAntecedent(postSwitchLabel, createFlowSwitchClause(preSwitchCaseFlow, node, 0, 0)); @@ -1281,6 +1287,24 @@ namespace ts { activeLabels!.pop(); } + function isDottedName(node: Expression): boolean { + return node.kind === SyntaxKind.Identifier || node.kind === SyntaxKind.ThisKeyword || + node.kind === SyntaxKind.PropertyAccessExpression && isDottedName((node).expression) || + node.kind === SyntaxKind.ParenthesizedExpression && isDottedName((node).expression); + } + + function bindExpressionStatement(node: ExpressionStatement): void { + bind(node.expression); + // A top level call expression with a dotted function name and at least one argument + // is potentially an assertion and is therefore included in the control flow. + if (node.expression.kind === SyntaxKind.CallExpression) { + const call = node.expression; + if (isDottedName(call.expression)) { + currentFlow = createFlowCall(currentFlow, call); + } + } + } + function bindLabeledStatement(node: LabeledStatement): void { const preStatementLabel = createLoopLabel(); const postStatementLabel = createBranchLabel(); @@ -2859,7 +2883,7 @@ namespace ts { // If this is a property-parameter, then also declare the property symbol into the // containing class. - if (isParameterPropertyDeclaration(node)) { + if (isParameterPropertyDeclaration(node, node.parent)) { const classDeclaration = node.parent.parent; declareSymbol(classDeclaration.symbol.members!, classDeclaration.symbol, node, SymbolFlags.Property | (node.questionToken ? SymbolFlags.Optional : SymbolFlags.None), SymbolFlags.PropertyExcludes); } diff --git a/src/compiler/builder.ts b/src/compiler/builder.ts index 441e9bbcfc967..7451eb678b4cb 100644 --- a/src/compiler/builder.ts +++ b/src/compiler/builder.ts @@ -60,6 +60,10 @@ namespace ts { * Files pending to be emitted */ affectedFilesPendingEmit?: readonly Path[] | undefined; + /** + * Files pending to be emitted kind. + */ + affectedFilesPendingEmitKind?: ReadonlyMap | undefined; /** * Current index to retrieve pending affected file */ @@ -70,6 +74,11 @@ namespace ts { hasReusableDiagnostic?: true; } + export const enum BuilderFileEmit { + DtsOnly, + Full + } + /** * State to store the changed files, affected files and cache semantic diagnostics */ @@ -127,7 +136,11 @@ namespace ts { /** * Files pending to be emitted */ - affectedFilesPendingEmit: readonly Path[] | undefined; + affectedFilesPendingEmit: Path[] | undefined; + /** + * Files pending to be emitted kind. + */ + affectedFilesPendingEmitKind: Map | undefined; /** * Current index to retrieve pending affected file */ @@ -139,7 +152,7 @@ namespace ts { /** * Already seen emitted files */ - seenEmittedFiles: Map | undefined; + seenEmittedFiles: Map | undefined; /** * true if program has been emitted */ @@ -160,8 +173,7 @@ namespace ts { const compilerOptions = newProgram.getCompilerOptions(); state.compilerOptions = compilerOptions; // With --out or --outFile, any change affects all semantic diagnostics so no need to cache them - // With --isolatedModules, emitting changed file doesnt emit dependent files so we cant know of dependent files to retrieve errors so dont cache the errors - if (!compilerOptions.outFile && !compilerOptions.out && !compilerOptions.isolatedModules) { + if (!compilerOptions.outFile && !compilerOptions.out) { state.semanticDiagnosticsPerFile = createMap(); } state.changedFilesSet = createMap(); @@ -186,7 +198,8 @@ namespace ts { copyEntries(changedFilesSet, state.changedFilesSet); } if (!compilerOptions.outFile && !compilerOptions.out && oldState!.affectedFilesPendingEmit) { - state.affectedFilesPendingEmit = oldState!.affectedFilesPendingEmit; + state.affectedFilesPendingEmit = oldState!.affectedFilesPendingEmit.slice(); + state.affectedFilesPendingEmitKind = cloneMapOrUndefined(oldState!.affectedFilesPendingEmitKind); state.affectedFilesPendingEmitIndex = oldState!.affectedFilesPendingEmitIndex; } } @@ -233,7 +246,7 @@ namespace ts { if (oldCompilerOptions && compilerOptionsAffectEmit(compilerOptions, oldCompilerOptions)) { // Add all files to affectedFilesPendingEmit since emit changed - addToAffectedFilesPendingEmit(state, newProgram.getSourceFiles().map(f => f.path)); + newProgram.getSourceFiles().forEach(f => addToAffectedFilesPendingEmit(state, f.path, BuilderFileEmit.Full)); Debug.assert(state.seenAffectedFiles === undefined); state.seenAffectedFiles = createMap(); } @@ -243,7 +256,7 @@ namespace ts { function convertToDiagnostics(diagnostics: readonly ReusableDiagnostic[], newProgram: Program, getCanonicalFileName: GetCanonicalFileName): readonly Diagnostic[] { if (!diagnostics.length) return emptyArray; - const buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(getOutputPathForBuildInfo(newProgram.getCompilerOptions())!, newProgram.getCurrentDirectory())); + const buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(getTsBuildInfoEmitOutputFilePath(newProgram.getCompilerOptions())!, newProgram.getCurrentDirectory())); return diagnostics.map(diagnostic => { const result: Diagnostic = convertToDiagnosticRelatedInformation(diagnostic, newProgram, toPath); result.reportsUnnecessary = diagnostic.reportsUnnecessary; @@ -295,7 +308,8 @@ namespace ts { newState.semanticDiagnosticsFromOldState = cloneMapOrUndefined(state.semanticDiagnosticsFromOldState); newState.program = state.program; newState.compilerOptions = state.compilerOptions; - newState.affectedFilesPendingEmit = state.affectedFilesPendingEmit; + newState.affectedFilesPendingEmit = state.affectedFilesPendingEmit && state.affectedFilesPendingEmit.slice(); + newState.affectedFilesPendingEmitKind = cloneMapOrUndefined(state.affectedFilesPendingEmitKind); newState.affectedFilesPendingEmitIndex = state.affectedFilesPendingEmitIndex; newState.seenEmittedFiles = cloneMapOrUndefined(state.seenEmittedFiles); newState.programEmitComplete = state.programEmitComplete; @@ -373,19 +387,24 @@ namespace ts { /** * Returns next file to be emitted from files that retrieved semantic diagnostics but did not emit yet */ - function getNextAffectedFilePendingEmit(state: BuilderProgramState): SourceFile | undefined { + function getNextAffectedFilePendingEmit(state: BuilderProgramState) { const { affectedFilesPendingEmit } = state; if (affectedFilesPendingEmit) { const seenEmittedFiles = state.seenEmittedFiles || (state.seenEmittedFiles = createMap()); for (let i = state.affectedFilesPendingEmitIndex!; i < affectedFilesPendingEmit.length; i++) { const affectedFile = Debug.assertDefined(state.program).getSourceFileByPath(affectedFilesPendingEmit[i]); - if (affectedFile && !seenEmittedFiles.has(affectedFile.path)) { - // emit this file - state.affectedFilesPendingEmitIndex = i; - return affectedFile; + if (affectedFile) { + const seenKind = seenEmittedFiles.get(affectedFile.path); + const emitKind = Debug.assertDefined(Debug.assertDefined(state.affectedFilesPendingEmitKind).get(affectedFile.path)); + if (seenKind === undefined || seenKind < emitKind) { + // emit this file + state.affectedFilesPendingEmitIndex = i; + return { affectedFile, emitKind }; + } } } state.affectedFilesPendingEmit = undefined; + state.affectedFilesPendingEmitKind = undefined; state.affectedFilesPendingEmitIndex = undefined; } return undefined; @@ -406,7 +425,7 @@ namespace ts { const options = program.getCompilerOptions(); forEach(program.getSourceFiles(), f => program.isSourceFileDefaultLibrary(f) && - !skipTypeChecking(f, options) && + !skipTypeChecking(f, options, program) && removeSemanticDiagnosticsOf(state, f.path) ); } @@ -442,7 +461,7 @@ namespace ts { ); // If not dts emit, nothing more to do if (getEmitDeclarations(state.compilerOptions)) { - addToAffectedFilesPendingEmit(state, [path]); + addToAffectedFilesPendingEmit(state, path, BuilderFileEmit.DtsOnly); } } } @@ -463,16 +482,43 @@ namespace ts { return !state.semanticDiagnosticsFromOldState.size; } + function isChangedSignagure(state: BuilderProgramState, path: Path) { + const newSignature = Debug.assertDefined(state.currentAffectedFilesSignatures).get(path); + const oldSignagure = Debug.assertDefined(state.fileInfos.get(path)).signature; + return newSignature !== oldSignagure; + } + /** * Iterate on referencing modules that export entities from affected file */ function forEachReferencingModulesOfExportOfAffectedFile(state: BuilderProgramState, affectedFile: SourceFile, fn: (state: BuilderProgramState, filePath: Path) => boolean) { // If there was change in signature (dts output) for the changed file, // then only we need to handle pending file emit - if (!state.exportedModulesMap || state.affectedFiles!.length === 1 || !state.changedFilesSet.has(affectedFile.path)) { + if (!state.exportedModulesMap || !state.changedFilesSet.has(affectedFile.path)) { return; } + if (!isChangedSignagure(state, affectedFile.path)) return; + + // Since isolated modules dont change js files, files affected by change in signature is itself + // But we need to cleanup semantic diagnostics and queue dts emit for affected files + if (state.compilerOptions.isolatedModules) { + const seenFileNamesMap = createMap(); + seenFileNamesMap.set(affectedFile.path, true); + const queue = BuilderState.getReferencedByPaths(state, affectedFile.resolvedPath); + while (queue.length > 0) { + const currentPath = queue.pop()!; + if (!seenFileNamesMap.has(currentPath)) { + seenFileNamesMap.set(currentPath, true); + const result = fn(state, currentPath); + if (result && isChangedSignagure(state, currentPath)) { + const currentSourceFile = Debug.assertDefined(state.program).getSourceFileByPath(currentPath)!; + queue.push(...BuilderState.getReferencedByPaths(state, currentSourceFile.resolvedPath)); + } + } + } + } + Debug.assert(!!state.currentAffectedFilesExportedModulesMap); const seenFileAndExportsOfFile = createMap(); // Go through exported modules from cache first @@ -548,7 +594,13 @@ namespace ts { * This is called after completing operation on the next affected file. * The operations here are postponed to ensure that cancellation during the iteration is handled correctly */ - function doneWithAffectedFile(state: BuilderProgramState, affected: SourceFile | Program, isPendingEmit?: boolean, isBuildInfoEmit?: boolean, isEmitResult?: boolean) { + function doneWithAffectedFile( + state: BuilderProgramState, + affected: SourceFile | Program, + emitKind?: BuilderFileEmit, + isPendingEmit?: boolean, + isBuildInfoEmit?: boolean + ) { if (isBuildInfoEmit) { state.emittedBuildInfo = true; } @@ -558,8 +610,8 @@ namespace ts { } else { state.seenAffectedFiles!.set((affected as SourceFile).path, true); - if (isEmitResult) { - (state.seenEmittedFiles || (state.seenEmittedFiles = createMap())).set((affected as SourceFile).path, true); + if (emitKind !== undefined) { + (state.seenEmittedFiles || (state.seenEmittedFiles = createMap())).set((affected as SourceFile).path, emitKind); } if (isPendingEmit) { state.affectedFilesPendingEmitIndex!++; @@ -573,16 +625,23 @@ namespace ts { /** * Returns the result with affected file */ - function toAffectedFileResult(state: BuilderProgramState, result: T, affected: SourceFile | Program, isPendingEmit?: boolean, isBuildInfoEmit?: boolean): AffectedFileResult { - doneWithAffectedFile(state, affected, isPendingEmit, isBuildInfoEmit); + function toAffectedFileResult(state: BuilderProgramState, result: T, affected: SourceFile | Program): AffectedFileResult { + doneWithAffectedFile(state, affected); return { result, affected }; } /** * Returns the result with affected file */ - function toAffectedFileEmitResult(state: BuilderProgramState, result: EmitResult, affected: SourceFile | Program, isPendingEmit?: boolean, isBuildInfoEmit?: boolean): AffectedFileResult { - doneWithAffectedFile(state, affected, isPendingEmit, isBuildInfoEmit, /*isEmitResult*/ true); + function toAffectedFileEmitResult( + state: BuilderProgramState, + result: EmitResult, + affected: SourceFile | Program, + emitKind: BuilderFileEmit, + isPendingEmit?: boolean, + isBuildInfoEmit?: boolean + ): AffectedFileResult { + doneWithAffectedFile(state, affected, emitKind, isPendingEmit, isBuildInfoEmit); return { result, affected }; } @@ -623,7 +682,7 @@ namespace ts { function getProgramBuildInfo(state: Readonly, getCanonicalFileName: GetCanonicalFileName): ProgramBuildInfo | undefined { if (state.compilerOptions.outFile || state.compilerOptions.out) return undefined; const currentDirectory = Debug.assertDefined(state.program).getCurrentDirectory(); - const buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(getOutputPathForBuildInfo(state.compilerOptions)!, currentDirectory)); + const buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(getTsBuildInfoEmitOutputFilePath(state.compilerOptions)!, currentDirectory)); const fileInfos: MapLike = {}; state.fileInfos.forEach((value, key) => { const signature = state.currentAffectedFilesSignatures && state.currentAffectedFilesSignatures.get(key); @@ -849,11 +908,12 @@ namespace ts { */ function emitNextAffectedFile(writeFile?: WriteFileCallback, cancellationToken?: CancellationToken, emitOnlyDtsFiles?: boolean, customTransformers?: CustomTransformers): AffectedFileResult { let affected = getNextAffectedFile(state, cancellationToken, computeHash); + let emitKind = BuilderFileEmit.Full; let isPendingEmitFile = false; if (!affected) { if (!state.compilerOptions.out && !state.compilerOptions.outFile) { - affected = getNextAffectedFilePendingEmit(state); - if (!affected) { + const pendingAffectedFile = getNextAffectedFilePendingEmit(state); + if (!pendingAffectedFile) { if (state.emittedBuildInfo) { return undefined; } @@ -865,10 +925,12 @@ namespace ts { // Otherwise just affected file affected.emitBuildInfo(writeFile || maybeBind(host, host.writeFile), cancellationToken), affected, + /*emitKind*/ BuilderFileEmit.Full, /*isPendingEmitFile*/ false, /*isBuildInfoEmit*/ true ); } + ({ affectedFile: affected, emitKind } = pendingAffectedFile); isPendingEmitFile = true; } else { @@ -886,10 +948,17 @@ namespace ts { state, // When whole program is affected, do emit only once (eg when --out or --outFile is specified) // Otherwise just affected file - Debug.assertDefined(state.program).emit(affected === state.program ? undefined : affected as SourceFile, writeFile || maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers), + Debug.assertDefined(state.program).emit( + affected === state.program ? undefined : affected as SourceFile, + writeFile || maybeBind(host, host.writeFile), + cancellationToken, + emitOnlyDtsFiles || emitKind === BuilderFileEmit.DtsOnly, + customTransformers + ), affected, + emitKind, isPendingEmitFile, - ); + ); } /** @@ -953,7 +1022,7 @@ namespace ts { // Add file to affected file pending emit to handle for later emit time if (kind === BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram) { - addToAffectedFilesPendingEmit(state, [(affected as SourceFile).path]); + addToAffectedFilesPendingEmit(state, (affected as SourceFile).path, BuilderFileEmit.Full); } // Get diagnostics for the affected file if its not ignored @@ -1006,8 +1075,14 @@ namespace ts { } } - function addToAffectedFilesPendingEmit(state: BuilderProgramState, affectedFilesPendingEmit: readonly Path[]) { - state.affectedFilesPendingEmit = concatenate(state.affectedFilesPendingEmit, affectedFilesPendingEmit); + function addToAffectedFilesPendingEmit(state: BuilderProgramState, affectedFilePendingEmit: Path, kind: BuilderFileEmit) { + if (!state.affectedFilesPendingEmit) state.affectedFilesPendingEmit = []; + if (!state.affectedFilesPendingEmitKind) state.affectedFilesPendingEmitKind = createMap(); + + const existingKind = state.affectedFilesPendingEmitKind.get(affectedFilePendingEmit); + state.affectedFilesPendingEmit.push(affectedFilePendingEmit); + state.affectedFilesPendingEmitKind.set(affectedFilePendingEmit, existingKind || kind); + // affectedFilesPendingEmitIndex === undefined // - means the emit state.affectedFilesPendingEmit was undefined before adding current affected files // so start from 0 as array would be affectedFilesPendingEmit diff --git a/src/compiler/builderState.ts b/src/compiler/builderState.ts index a76365311a24e..b34a0bf837030 100644 --- a/src/compiler/builderState.ts +++ b/src/compiler/builderState.ts @@ -15,9 +15,9 @@ namespace ts { /*@internal*/ namespace ts { export function getFileEmitOutput(program: Program, sourceFile: SourceFile, emitOnlyDtsFiles: boolean, - cancellationToken?: CancellationToken, customTransformers?: CustomTransformers): EmitOutput { + cancellationToken?: CancellationToken, customTransformers?: CustomTransformers, forceDtsEmit?: boolean): EmitOutput { const outputFiles: OutputFile[] = []; - const emitResult = program.emit(sourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers); + const emitResult = program.emit(sourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers, forceDtsEmit); return { outputFiles, emitSkipped: emitResult.emitSkipped, exportedModulesFromDeclarationEmit: emitResult.exportedModulesFromDeclarationEmit }; function writeFile(fileName: string, text: string, writeByteOrderMark: boolean) { @@ -344,7 +344,14 @@ namespace ts.BuilderState { } } else { - const emitOutput = getFileEmitOutput(programOfThisState, sourceFile, /*emitOnlyDtsFiles*/ true, cancellationToken); + const emitOutput = getFileEmitOutput( + programOfThisState, + sourceFile, + /*emitOnlyDtsFiles*/ true, + cancellationToken, + /*customTransformers*/ undefined, + /*forceDtsEmit*/ true + ); const firstDts = emitOutput.outputFiles && programOfThisState.getCompilerOptions().declarationMap ? emitOutput.outputFiles.length > 1 ? emitOutput.outputFiles[1] : undefined : @@ -459,7 +466,7 @@ namespace ts.BuilderState { /** * Gets the files referenced by the the file path */ - function getReferencedByPaths(state: Readonly, referencedFilePath: Path) { + export function getReferencedByPaths(state: Readonly, referencedFilePath: Path) { return arrayFrom(mapDefinedIterator(state.referencedMap!.entries(), ([filePath, referencesInFile]) => referencesInFile.has(referencedFilePath) ? filePath as Path : undefined )); diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 20dbc7962fa34..6433308174a85 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -177,6 +177,7 @@ namespace ts { const enum ContextFlags { None = 0, Signature = 1 << 0, // Obtaining contextual signature + NoConstraints = 1 << 1, // Don't obtain type variable constraints } const enum AccessFlags { @@ -522,6 +523,9 @@ namespace ts { }, getApparentType, getUnionType, + isTypeAssignableTo: (source, target) => { + return isTypeAssignableTo(source, target); + }, createAnonymousType, createSignature, createSymbol, @@ -568,7 +572,7 @@ namespace ts { return node && getTypeArgumentConstraint(node); }, getSuggestionDiagnostics: (file, ct) => { - if (skipTypeChecking(file, compilerOptions)) { + if (skipTypeChecking(file, compilerOptions, host)) { return emptyArray; } @@ -671,6 +675,7 @@ namespace ts { const silentNeverType = createIntrinsicType(TypeFlags.Never, "never"); const nonInferrableType = createIntrinsicType(TypeFlags.Never, "never", ObjectFlags.NonInferrableType); const implicitNeverType = createIntrinsicType(TypeFlags.Never, "never"); + const unreachableNeverType = createIntrinsicType(TypeFlags.Never, "never"); const nonPrimitiveType = createIntrinsicType(TypeFlags.NonPrimitive, "object"); const stringNumberSymbolType = getUnionType([stringType, numberType, esSymbolType]); const keyofConstraintType = keyofStringsOnly ? stringType : stringNumberSymbolType; @@ -701,7 +706,7 @@ namespace ts { markerSubType.constraint = markerSuperType; const markerOtherType = createTypeParameter(); - const noTypePredicate = createIdentifierTypePredicate("<>", 0, anyType); + const noTypePredicate = createTypePredicate(TypePredicateKind.Identifier, "<>", 0, anyType); const anySignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, /*resolvedTypePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false); const unknownSignature = createSignature(undefined, undefined, undefined, emptyArray, errorType, /*resolvedTypePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false); @@ -819,6 +824,9 @@ namespace ts { let flowLoopCount = 0; let sharedFlowCount = 0; let flowAnalysisDisabled = false; + let flowInvocationCount = 0; + let lastFlowNode: FlowNode | undefined; + let lastFlowNodeReachable: boolean; const emptyStringType = getLiteralType(""); const zeroType = getLiteralType(0); @@ -834,13 +842,13 @@ namespace ts { const symbolLinks: SymbolLinks[] = []; const nodeLinks: NodeLinks[] = []; const flowLoopCaches: Map[] = []; - const flowAssignmentKeys: string[] = []; - const flowAssignmentTypes: FlowType[] = []; + const flowAssignmentTypes: Type[] = []; const flowLoopNodes: FlowNode[] = []; const flowLoopKeys: string[] = []; const flowLoopTypes: Type[][] = []; const sharedFlowNodes: FlowNode[] = []; const sharedFlowTypes: FlowType[] = []; + const flowNodeReachable: (boolean | undefined)[] = []; const potentialThisCollisions: Node[] = []; const potentialNewTargetCollisions: Node[] = []; const awaitedTypeStack: number[] = []; @@ -4246,11 +4254,14 @@ namespace ts { let returnTypeNode: TypeNode | undefined; const typePredicate = getTypePredicateOfSignature(signature); if (typePredicate) { - const parameterName = typePredicate.kind === TypePredicateKind.Identifier ? + const assertsModifier = typePredicate.kind === TypePredicateKind.AssertsThis || typePredicate.kind === TypePredicateKind.AssertsIdentifier ? + createToken(SyntaxKind.AssertsKeyword) : + undefined; + const parameterName = typePredicate.kind === TypePredicateKind.Identifier || typePredicate.kind === TypePredicateKind.AssertsIdentifier ? setEmitFlags(createIdentifier(typePredicate.parameterName), EmitFlags.NoAsciiEscaping) : createThisTypeNode(); - const typeNode = typeToTypeNodeHelper(typePredicate.type, context); - returnTypeNode = createTypePredicateNode(parameterName, typeNode); + const typeNode = typePredicate.type && typeToTypeNodeHelper(typePredicate.type, context); + returnTypeNode = createTypePredicateNodeWithModifier(assertsModifier, parameterName, typeNode); } else { const returnType = getReturnTypeOfSignature(signature); @@ -4717,9 +4728,10 @@ namespace ts { return writer ? typePredicateToStringWorker(writer).getText() : usingSingleLineStringWriter(typePredicateToStringWorker); function typePredicateToStringWorker(writer: EmitTextWriter) { - const predicate = createTypePredicateNode( - typePredicate.kind === TypePredicateKind.Identifier ? createIdentifier(typePredicate.parameterName) : createThisTypeNode(), - nodeBuilder.typeToTypeNode(typePredicate.type, enclosingDeclaration, toNodeBuilderFlags(flags) | NodeBuilderFlags.IgnoreErrors | NodeBuilderFlags.WriteTypeParametersInQualifiedName)!, // TODO: GH#18217 + const predicate = createTypePredicateNodeWithModifier( + typePredicate.kind === TypePredicateKind.AssertsThis || typePredicate.kind === TypePredicateKind.AssertsIdentifier ? createToken(SyntaxKind.AssertsKeyword) : undefined, + typePredicate.kind === TypePredicateKind.Identifier || typePredicate.kind === TypePredicateKind.AssertsIdentifier ? createIdentifier(typePredicate.parameterName) : createThisTypeNode(), + typePredicate.type && nodeBuilder.typeToTypeNode(typePredicate.type, enclosingDeclaration, toNodeBuilderFlags(flags) | NodeBuilderFlags.IgnoreErrors | NodeBuilderFlags.WriteTypeParametersInQualifiedName)! // TODO: GH#18217 ); const printer = createPrinter({ removeComments: true }); const sourceFile = enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration); @@ -5984,7 +5996,9 @@ namespace ts { function getBaseTypeVariableOfClass(symbol: Symbol) { const baseConstructorType = getBaseConstructorTypeOfClass(getDeclaredTypeOfClassOrInterface(symbol)); - return baseConstructorType.flags & TypeFlags.TypeVariable ? baseConstructorType : undefined; + return baseConstructorType.flags & TypeFlags.TypeVariable ? baseConstructorType : + baseConstructorType.flags & TypeFlags.Intersection ? find((baseConstructorType as IntersectionType).types, t => !!(t.flags & TypeFlags.TypeVariable)) : + undefined; } function getTypeOfFuncClassEnumModule(symbol: Symbol): Type { @@ -6262,12 +6276,12 @@ namespace ts { } function isConstructorType(type: Type): boolean { - if (isValidBaseType(type) && getSignaturesOfType(type, SignatureKind.Construct).length > 0) { + if (getSignaturesOfType(type, SignatureKind.Construct).length > 0) { return true; } if (type.flags & TypeFlags.TypeVariable) { const constraint = getBaseConstraintOfType(type); - return !!constraint && isValidBaseType(constraint) && isMixinConstructorType(constraint); + return !!constraint && isMixinConstructorType(constraint); } return false; } @@ -6428,9 +6442,16 @@ namespace ts { return true; } - // A valid base type is `any`, any non-generic object type or intersection of non-generic - // object types. + // A valid base type is `any`, an object type or intersection of object types. function isValidBaseType(type: Type): type is BaseType { + if (type.flags & TypeFlags.TypeParameter) { + const constraint = getBaseConstraintOfType(type); + if (constraint) { + return isValidBaseType(constraint); + } + } + // TODO: Given that we allow type parmeters here now, is this `!isGenericMappedType(type)` check really needed? + // There's no reason a `T` should be allowed while a `Readonly` should not. return !!(type.flags & (TypeFlags.Object | TypeFlags.NonPrimitive | TypeFlags.Any)) && !isGenericMappedType(type) || !!(type.flags & TypeFlags.Intersection) && every((type).types, isValidBaseType); } @@ -7955,10 +7976,10 @@ namespace ts { return hasNonCircularBaseConstraint(type) ? getConstraintFromConditionalType(type) : undefined; } - function getUnionConstraintOfIntersection(type: IntersectionType, targetIsUnion: boolean) { + function getEffectiveConstraintOfIntersection(types: readonly Type[], targetIsUnion: boolean) { let constraints: Type[] | undefined; let hasDisjointDomainType = false; - for (const t of type.types) { + for (const t of types) { if (t.flags & TypeFlags.Instantiable) { // We keep following constraints as long as we have an instantiable type that is known // not to be circular or infinite (hence we stop on index access types). @@ -7968,6 +7989,9 @@ namespace ts { } if (constraint) { constraints = append(constraints, constraint); + if (targetIsUnion) { + constraints = append(constraints, t); + } } } else if (t.flags & TypeFlags.DisjointDomains) { @@ -7980,7 +8004,7 @@ namespace ts { if (hasDisjointDomainType) { // We add any types belong to one of the disjoint domains because they might cause the final // intersection operation to reduce the union constraints. - for (const t of type.types) { + for (const t of types) { if (t.flags & TypeFlags.DisjointDomains) { constraints = append(constraints, t); } @@ -8484,12 +8508,8 @@ namespace ts { return isBracketed || !!typeExpression && typeExpression.type.kind === SyntaxKind.JSDocOptionalType; } - function createIdentifierTypePredicate(parameterName: string, parameterIndex: number, type: Type): IdentifierTypePredicate { - return { kind: TypePredicateKind.Identifier, parameterName, parameterIndex, type }; - } - - function createThisTypePredicate(type: Type): ThisTypePredicate { - return { kind: TypePredicateKind.This, type }; + function createTypePredicate(kind: TypePredicateKind, parameterName: string | undefined, parameterIndex: number | undefined, type: Type | undefined): TypePredicate { + return { kind, parameterName, parameterIndex, type } as TypePredicate; } /** @@ -8724,10 +8744,6 @@ namespace ts { } } - function signatureHasTypePredicate(signature: Signature): boolean { - return getTypePredicateOfSignature(signature) !== undefined; - } - function getTypePredicateOfSignature(signature: Signature): TypePredicate | undefined { if (!signature.resolvedTypePredicate) { if (signature.target) { @@ -8755,18 +8771,13 @@ namespace ts { return signature.resolvedTypePredicate === noTypePredicate ? undefined : signature.resolvedTypePredicate; } - function createTypePredicateFromTypePredicateNode(node: TypePredicateNode, signature: Signature): IdentifierTypePredicate | ThisTypePredicate { - const { parameterName } = node; - const type = getTypeFromTypeNode(node.type); - if (parameterName.kind === SyntaxKind.Identifier) { - return createIdentifierTypePredicate( - parameterName.escapedText as string, - findIndex(signature.parameters, p => p.escapedName === parameterName.escapedText), - type); - } - else { - return createThisTypePredicate(type); - } + function createTypePredicateFromTypePredicateNode(node: TypePredicateNode, signature: Signature): TypePredicate { + const parameterName = node.parameterName; + const type = node.type && getTypeFromTypeNode(node.type); + return parameterName.kind === SyntaxKind.ThisType ? + createTypePredicate(node.assertsModifier ? TypePredicateKind.AssertsThis : TypePredicateKind.This, /*parameterName*/ undefined, /*parameterIndex*/ undefined, type) : + createTypePredicate(node.assertsModifier ? TypePredicateKind.AssertsIdentifier : TypePredicateKind.Identifier, parameterName.escapedText as string, + findIndex(signature.parameters, p => p.escapedName === parameterName.escapedText), type); } function getReturnTypeOfSignature(signature: Signature): Type { @@ -8971,9 +8982,8 @@ namespace ts { return undefined; } - function getConstraintDeclaration(type: TypeParameter) { - const decl = type.symbol && getDeclarationOfKind(type.symbol, SyntaxKind.TypeParameter); - return decl && getEffectiveConstraintOfTypeParameter(decl); + function getConstraintDeclaration(type: TypeParameter): TypeNode | undefined { + return mapDefined(filter(type.symbol && type.symbol.declarations, isTypeParameterDeclaration), getEffectiveConstraintOfTypeParameter)[0]; } function getInferredTypeParameterConstraint(typeParameter: TypeParameter) { @@ -9856,7 +9866,7 @@ namespace ts { const types: Type[] = []; for (const sig of signatures) { const pred = getTypePredicateOfSignature(sig); - if (!pred) { + if (!pred || pred.kind === TypePredicateKind.AssertsThis || pred.kind === TypePredicateKind.AssertsIdentifier) { continue; } @@ -9876,15 +9886,11 @@ namespace ts { return undefined; } const unionType = getUnionType(types); - return isIdentifierTypePredicate(first) - ? createIdentifierTypePredicate(first.parameterName, first.parameterIndex, unionType) - : createThisTypePredicate(unionType); + return createTypePredicate(first.kind, first.parameterName, first.parameterIndex, unionType); } function typePredicateKindsMatch(a: TypePredicate, b: TypePredicate): boolean { - return isIdentifierTypePredicate(a) - ? isIdentifierTypePredicate(b) && a.parameterIndex === b.parameterIndex - : !isIdentifierTypePredicate(b); + return a.kind === b.kind && a.parameterIndex === b.parameterIndex; } // This function assumes the constituent type list is sorted and deduplicated. @@ -11184,7 +11190,7 @@ namespace ts { case SyntaxKind.TypeReference: return getTypeFromTypeReference(node); case SyntaxKind.TypePredicate: - return booleanType; + return (node).assertsModifier ? voidType : booleanType; case SyntaxKind.ExpressionWithTypeArguments: return getTypeFromTypeReference(node); case SyntaxKind.TypeQuery: @@ -11342,21 +11348,8 @@ namespace ts { return result; } - function instantiateTypePredicate(predicate: TypePredicate, mapper: TypeMapper): ThisTypePredicate | IdentifierTypePredicate { - if (isIdentifierTypePredicate(predicate)) { - return { - kind: TypePredicateKind.Identifier, - parameterName: predicate.parameterName, - parameterIndex: predicate.parameterIndex, - type: instantiateType(predicate.type, mapper) - }; - } - else { - return { - kind: TypePredicateKind.This, - type: instantiateType(predicate.type, mapper) - }; - } + function instantiateTypePredicate(predicate: TypePredicate, mapper: TypeMapper): TypePredicate { + return createTypePredicate(predicate.kind, predicate.parameterName, predicate.parameterIndex, instantiateType(predicate.type, mapper)); } function instantiateSignature(signature: Signature, mapper: TypeMapper, eraseTypeParameters?: boolean): Signature { @@ -12320,7 +12313,7 @@ namespace ts { target: Signature, ignoreReturnTypes: boolean): boolean { return compareSignaturesRelated(source, target, CallbackCheck.None, ignoreReturnTypes, /*reportErrors*/ false, - /*errorReporter*/ undefined, compareTypesAssignable) !== Ternary.False; + /*errorReporter*/ undefined, /*errorReporter*/ undefined, compareTypesAssignable) !== Ternary.False; } type ErrorReporter = (message: DiagnosticMessage, arg0?: string, arg1?: string) => void; @@ -12343,6 +12336,7 @@ namespace ts { ignoreReturnTypes: boolean, reportErrors: boolean, errorReporter: ErrorReporter | undefined, + incompatibleErrorReporter: ((source: Type, target: Type) => void) | undefined, compareTypes: TypeComparer): Ternary { // TODO (drosen): De-duplicate code between related functions. if (source === target) { @@ -12409,11 +12403,11 @@ namespace ts { // with respect to T. const sourceSig = callbackCheck ? undefined : getSingleCallSignature(getNonNullableType(sourceType)); const targetSig = callbackCheck ? undefined : getSingleCallSignature(getNonNullableType(targetType)); - const callbacks = sourceSig && targetSig && !signatureHasTypePredicate(sourceSig) && !signatureHasTypePredicate(targetSig) && + const callbacks = sourceSig && targetSig && !getTypePredicateOfSignature(sourceSig) && !getTypePredicateOfSignature(targetSig) && (getFalsyFlags(sourceType) & TypeFlags.Nullable) === (getFalsyFlags(targetType) & TypeFlags.Nullable); const related = callbacks ? // TODO: GH#18217 It will work if they're both `undefined`, but not if only one is - compareSignaturesRelated(targetSig!, sourceSig!, strictVariance ? CallbackCheck.Strict : CallbackCheck.Bivariant, /*ignoreReturnTypes*/ false, reportErrors, errorReporter, compareTypes) : + compareSignaturesRelated(targetSig!, sourceSig!, strictVariance ? CallbackCheck.Strict : CallbackCheck.Bivariant, /*ignoreReturnTypes*/ false, reportErrors, errorReporter, incompatibleErrorReporter, compareTypes) : !callbackCheck && !strictVariance && compareTypes(sourceType, targetType, /*reportErrors*/ false) || compareTypes(targetType, sourceType, reportErrors); if (!related) { if (reportErrors) { @@ -12459,6 +12453,9 @@ namespace ts { // wouldn't be co-variant for T without this rule. result &= callbackCheck === CallbackCheck.Bivariant && compareTypes(targetReturnType, sourceReturnType, /*reportErrors*/ false) || compareTypes(sourceReturnType, targetReturnType, reportErrors); + if (!result && reportErrors && incompatibleErrorReporter) { + incompatibleErrorReporter(sourceReturnType, targetReturnType); + } } } @@ -12480,7 +12477,7 @@ namespace ts { return Ternary.False; } - if (source.kind === TypePredicateKind.Identifier) { + if (source.kind === TypePredicateKind.Identifier || source.kind === TypePredicateKind.AssertsIdentifier) { if (source.parameterIndex !== (target as IdentifierTypePredicate).parameterIndex) { if (reportErrors) { errorReporter!(Diagnostics.Parameter_0_is_not_in_the_same_position_as_parameter_1, source.parameterName, (target as IdentifierTypePredicate).parameterName); @@ -12490,7 +12487,9 @@ namespace ts { } } - const related = compareTypes(source.type, target.type, reportErrors); + const related = source.type === target.type ? Ternary.True : + source.type && target.type ? compareTypes(source.type, target.type, reportErrors) : + Ternary.False; if (related === Ternary.False && reportErrors) { errorReporter!(Diagnostics.Type_predicate_0_is_not_assignable_to_1, typePredicateToString(source), typePredicateToString(target)); } @@ -12545,12 +12544,12 @@ namespace ts { return true; } const id = getSymbolId(sourceSymbol) + "," + getSymbolId(targetSymbol); - const relation = enumRelation.get(id); - if (relation !== undefined && !(relation === RelationComparisonResult.Failed && errorReporter)) { - return relation === RelationComparisonResult.Succeeded; + const entry = enumRelation.get(id); + if (entry !== undefined && !(!(entry & RelationComparisonResult.Reported) && entry & RelationComparisonResult.Failed && errorReporter)) { + return !!(entry & RelationComparisonResult.Succeeded); } if (sourceSymbol.escapedName !== targetSymbol.escapedName || !(sourceSymbol.flags & SymbolFlags.RegularEnum) || !(targetSymbol.flags & SymbolFlags.RegularEnum)) { - enumRelation.set(id, RelationComparisonResult.FailedAndReported); + enumRelation.set(id, RelationComparisonResult.Failed | RelationComparisonResult.Reported); return false; } const targetEnumType = getTypeOfSymbol(targetSymbol); @@ -12561,7 +12560,7 @@ namespace ts { if (errorReporter) { errorReporter(Diagnostics.Property_0_is_missing_in_type_1, symbolName(property), typeToString(getDeclaredTypeOfSymbol(targetSymbol), /*enclosingDeclaration*/ undefined, TypeFormatFlags.UseFullyQualifiedType)); - enumRelation.set(id, RelationComparisonResult.FailedAndReported); + enumRelation.set(id, RelationComparisonResult.Failed | RelationComparisonResult.Reported); } else { enumRelation.set(id, RelationComparisonResult.Failed); @@ -12626,7 +12625,7 @@ namespace ts { if (source.flags & TypeFlags.Object && target.flags & TypeFlags.Object) { const related = relation.get(getRelationKey(source, target, relation)); if (related !== undefined) { - return related === RelationComparisonResult.Succeeded; + return !!(related & RelationComparisonResult.Succeeded); } } if (source.flags & TypeFlags.StructuredOrInstantiable || target.flags & TypeFlags.StructuredOrInstantiable) { @@ -12668,11 +12667,16 @@ namespace ts { let depth = 0; let expandingFlags = ExpandingFlags.None; let overflow = false; - let overrideNextErrorInfo: DiagnosticMessageChain | undefined; + let overrideNextErrorInfo = 0; // How many `reportRelationError` calls should be skipped in the elaboration pyramid + let lastSkippedInfo: [Type, Type] | undefined; + let incompatibleStack: [DiagnosticMessage, (string | number)?, (string | number)?, (string | number)?, (string | number)?][] = []; Debug.assert(relation !== identityRelation || !errorNode, "no error reporting in identity checking"); const result = isRelatedTo(source, target, /*reportErrors*/ !!errorNode, headMessage); + if (incompatibleStack.length) { + reportIncompatibleStack(); + } if (overflow) { const diag = error(errorNode, Diagnostics.Excessive_stack_depth_comparing_types_0_and_1, typeToString(source), typeToString(target)); if (errorOutputContainer) { @@ -12717,8 +12721,134 @@ namespace ts { } return result !== Ternary.False; + function resetErrorInfo(saved: ReturnType) { + errorInfo = saved.errorInfo; + lastSkippedInfo = saved.lastSkippedInfo; + incompatibleStack = saved.incompatibleStack; + overrideNextErrorInfo = saved.overrideNextErrorInfo; + relatedInfo = saved.relatedInfo; + } + + function captureErrorCalculationState() { + return { + errorInfo, + lastSkippedInfo, + incompatibleStack: incompatibleStack.slice(), + overrideNextErrorInfo, + relatedInfo: !relatedInfo ? undefined : relatedInfo.slice() as ([DiagnosticRelatedInformation, ...DiagnosticRelatedInformation[]] | undefined) + }; + } + + function reportIncompatibleError(message: DiagnosticMessage, arg0?: string | number, arg1?: string | number, arg2?: string | number, arg3?: string | number) { + overrideNextErrorInfo++; // Suppress the next relation error + lastSkippedInfo = undefined; // Reset skipped info cache + incompatibleStack.push([message, arg0, arg1, arg2, arg3]); + } + + function reportIncompatibleStack() { + const stack = incompatibleStack; + incompatibleStack = []; + const info = lastSkippedInfo; + lastSkippedInfo = undefined; + if (stack.length === 1) { + reportError(...stack[0]); + if (info) { + // Actually do the last relation error + reportRelationError(/*headMessage*/ undefined, ...info); + } + return; + } + // The first error will be the innermost, while the last will be the outermost - so by popping off the end, + // we can build from left to right + let path = ""; + const secondaryRootErrors: typeof incompatibleStack = []; + while (stack.length) { + const [msg, ...args] = stack.pop()!; + switch (msg.code) { + case Diagnostics.Types_of_property_0_are_incompatible.code: { + // Parenthesize a `new` if there is one + if (path.indexOf("new ") === 0) { + path = `(${path})`; + } + const str = "" + args[0]; + // If leading, just print back the arg (irrespective of if it's a valid identifier) + if (path.length === 0) { + path = `${str}`; + } + // Otherwise write a dotted name if possible + else if (isIdentifierText(str, compilerOptions.target)) { + path = `${path}.${str}`; + } + // Failing that, check if the name is already a computed name + else if (str[0] === "[" && str[str.length - 1] === "]") { + path = `${path}${str}`; + } + // And finally write out a computed name as a last resort + else { + path = `${path}[${str}]`; + } + break; + } + case Diagnostics.Call_signature_return_types_0_and_1_are_incompatible.code: + case Diagnostics.Construct_signature_return_types_0_and_1_are_incompatible.code: + case Diagnostics.Call_signatures_with_no_arguments_have_incompatible_return_types_0_and_1.code: + case Diagnostics.Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1.code: { + if (path.length === 0) { + // Don't flatten signature compatability errors at the start of a chain - instead prefer + // to unify (the with no arguments bit is excessive for printback) and print them back + let mappedMsg = msg; + if (msg.code === Diagnostics.Call_signatures_with_no_arguments_have_incompatible_return_types_0_and_1.code) { + mappedMsg = Diagnostics.Call_signature_return_types_0_and_1_are_incompatible; + } + else if (msg.code === Diagnostics.Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1.code) { + mappedMsg = Diagnostics.Construct_signature_return_types_0_and_1_are_incompatible; + } + secondaryRootErrors.unshift([mappedMsg, args[0], args[1]]); + } + else { + const prefix = (msg.code === Diagnostics.Construct_signature_return_types_0_and_1_are_incompatible.code || + msg.code === Diagnostics.Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1.code) + ? "new " + : ""; + const params = (msg.code === Diagnostics.Call_signatures_with_no_arguments_have_incompatible_return_types_0_and_1.code || + msg.code === Diagnostics.Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1.code) + ? "" + : "..."; + path = `${prefix}${path}(${params})`; + } + break; + } + default: + return Debug.fail(`Unhandled Diagnostic: ${msg.code}`); + } + } + if (path) { + reportError(path[path.length - 1] === ")" + ? Diagnostics.The_types_returned_by_0_are_incompatible_between_these_types + : Diagnostics.The_types_of_0_are_incompatible_between_these_types, + path + ); + } + else { + // Remove the innermost secondary error as it will duplicate the error already reported by `reportRelationError` on entry + secondaryRootErrors.shift(); + } + for (const [msg, ...args] of secondaryRootErrors) { + const originalValue = msg.elidedInCompatabilityPyramid; + msg.elidedInCompatabilityPyramid = false; // Teporarily override elision to ensure error is reported + reportError(msg, ...args); + msg.elidedInCompatabilityPyramid = originalValue; + } + if (info) { + // Actually do the last relation error + reportRelationError(/*headMessage*/ undefined, ...info); + } + } + function reportError(message: DiagnosticMessage, arg0?: string | number, arg1?: string | number, arg2?: string | number, arg3?: string | number): void { Debug.assert(!!errorNode); + if (incompatibleStack.length) reportIncompatibleStack(); + if (message.elidedInCompatabilityPyramid) return; errorInfo = chainDiagnosticMessages(errorInfo, message, arg0, arg1, arg2, arg3); } @@ -12733,6 +12863,7 @@ namespace ts { } function reportRelationError(message: DiagnosticMessage | undefined, source: Type, target: Type) { + if (incompatibleStack.length) reportIncompatibleStack(); const [sourceType, targetType] = getTypeNamesForErrorDisplay(source, target); if (target.flags & TypeFlags.TypeParameter && target.immediateBaseConstraint !== undefined && isTypeAssignableTo(source, target.immediateBaseConstraint)) { @@ -12890,7 +13021,7 @@ namespace ts { } let result = Ternary.False; - const saveErrorInfo = errorInfo; + const saveErrorInfo = captureErrorCalculationState(); let isIntersectionConstituent = !!isApparentIntersectionConstituent; // Note that these checks are specifically ordered to produce correct results. In particular, @@ -12940,11 +13071,11 @@ namespace ts { } if (!result && (source.flags & TypeFlags.StructuredOrInstantiable || target.flags & TypeFlags.StructuredOrInstantiable)) { if (result = recursiveTypeRelatedTo(source, target, reportErrors, isIntersectionConstituent)) { - errorInfo = saveErrorInfo; + resetErrorInfo(saveErrorInfo); } } } - if (!result && source.flags & TypeFlags.Intersection) { + if (!result && source.flags & (TypeFlags.Intersection | TypeFlags.TypeParameter)) { // The combined constraint of an intersection type is the intersection of the constraints of // the constituents. When an intersection type contains instantiable types with union type // constraints, there are situations where we need to examine the combined constraint. One is @@ -12954,22 +13085,31 @@ namespace ts { // we need to check this constraint against a union on the target side. Also, given a type // variable V constrained to 'string | number', 'V & number' has a combined constraint of // 'string & number | number & number' which reduces to just 'number'. - const constraint = getUnionConstraintOfIntersection(source, !!(target.flags & TypeFlags.Union)); - if (constraint) { - if (result = isRelatedTo(constraint, target, reportErrors, /*headMessage*/ undefined, isIntersectionConstituent)) { - errorInfo = saveErrorInfo; + // This also handles type parameters, as a type parameter with a union constraint compared against a union + // needs to have its constraint hoisted into an intersection with said type parameter, this way + // the type param can be compared with itself in the target (with the influence of its constraint to match other parts) + // For example, if `T extends 1 | 2` and `U extends 2 | 3` and we compare `T & U` to `T & U & (1 | 2 | 3)` + const constraint = getEffectiveConstraintOfIntersection(source.flags & TypeFlags.Intersection ? (source).types: [source], !!(target.flags & TypeFlags.Union)); + if (constraint && (source.flags & TypeFlags.Intersection || target.flags & TypeFlags.Union)) { + if (everyType(constraint, c => c !== source)) { // Skip comparison if expansion contains the source itself + // TODO: Stack errors so we get a pyramid for the "normal" comparison above, _and_ a second for this + if (result = isRelatedTo(constraint, target, /*reportErrors*/ false, /*headMessage*/ undefined, isIntersectionConstituent)) { + resetErrorInfo(saveErrorInfo); + } } } } if (!result && reportErrors) { - let maybeSuppress = overrideNextErrorInfo; - overrideNextErrorInfo = undefined; + let maybeSuppress = overrideNextErrorInfo > 0; + if (maybeSuppress) { + overrideNextErrorInfo--; + } if (source.flags & TypeFlags.Object && target.flags & TypeFlags.Object) { const currentError = errorInfo; tryElaborateArrayLikeErrors(source, target, reportErrors); if (errorInfo !== currentError) { - maybeSuppress = errorInfo; + maybeSuppress = !!errorInfo; } } if (source.flags & TypeFlags.Object && target.flags & TypeFlags.Primitive) { @@ -12989,6 +13129,7 @@ namespace ts { } } if (!headMessage && maybeSuppress) { + lastSkippedInfo = [source, target]; // Used by, eg, missing property checking to replace the top-level message with a more informative one return result; } @@ -13041,6 +13182,11 @@ namespace ts { // JsxAttributes has an object-literal flag and undergo same type-assignablity check as normal object-literal. // However, using an object-literal error message will be very confusing to the users so we give different a message. // TODO: Spelling suggestions for excess jsx attributes (needs new diagnostic messages) + if (prop.valueDeclaration && isJsxAttribute(prop.valueDeclaration)) { + // Note that extraneous children (as in `extra`) don't pass this check, + // since `children` is a SyntaxKind.PropertySignature instead of a SyntaxKind.JsxAttribute. + errorNode = prop.valueDeclaration.name; + } reportError(Diagnostics.Property_0_does_not_exist_on_type_1, symbolToString(prop), typeToString(errorTarget)); } else { @@ -13300,18 +13446,6 @@ namespace ts { return result; } - function propagateSidebandVarianceFlags(typeArguments: readonly Type[], variances: VarianceFlags[]) { - for (let i = 0; i < variances.length; i++) { - const v = variances[i]; - if (v & VarianceFlags.Unmeasurable) { - instantiateType(typeArguments[i], reportUnmeasurableMarkers); - } - if (v & VarianceFlags.Unreliable) { - instantiateType(typeArguments[i], reportUnreliableMarkers); - } - } - } - // Determine if possibly recursive types are related. First, check if the result is already available in the global cache. // Second, check if we have already started a comparison of the given two types in which case we assume the result to be true. // Third, check if both types are part of deeply nested chains of generic type instantiations and if so assume the types are @@ -13322,24 +13456,24 @@ namespace ts { return Ternary.False; } const id = getRelationKey(source, target, relation); - const related = relation.get(id); - if (related !== undefined) { - if (reportErrors && related === RelationComparisonResult.Failed) { + const entry = relation.get(id); + if (entry !== undefined) { + if (reportErrors && entry & RelationComparisonResult.Failed && !(entry & RelationComparisonResult.Reported)) { // We are elaborating errors and the cached result is an unreported failure. The result will be reported // as a failure, and should be updated as a reported failure by the bottom of this function. } else { if (outofbandVarianceMarkerHandler) { // We're in the middle of variance checking - integrate any unmeasurable/unreliable flags from this cached component - if (source.flags & (TypeFlags.Object | TypeFlags.Conditional) && source.aliasSymbol && - source.aliasTypeArguments && source.aliasSymbol === target.aliasSymbol) { - propagateSidebandVarianceFlags(source.aliasTypeArguments, getAliasVariances(source.aliasSymbol)); + const saved = entry & RelationComparisonResult.ReportsMask; + if (saved & RelationComparisonResult.ReportsUnmeasurable) { + instantiateType(source, reportUnmeasurableMarkers); } - if (getObjectFlags(source) & ObjectFlags.Reference && getObjectFlags(target) & ObjectFlags.Reference && (source).target === (target).target && length((source).typeArguments)) { - propagateSidebandVarianceFlags((source).typeArguments!, getVariances((source).target)); + if (saved & RelationComparisonResult.ReportsUnreliable) { + instantiateType(source, reportUnreliableMarkers); } } - return related === RelationComparisonResult.Succeeded ? Ternary.True : Ternary.False; + return entry & RelationComparisonResult.Succeeded ? Ternary.True : Ternary.False; } } if (!maybeKeys) { @@ -13368,14 +13502,26 @@ namespace ts { const saveExpandingFlags = expandingFlags; if (!(expandingFlags & ExpandingFlags.Source) && isDeeplyNestedType(source, sourceStack, depth)) expandingFlags |= ExpandingFlags.Source; if (!(expandingFlags & ExpandingFlags.Target) && isDeeplyNestedType(target, targetStack, depth)) expandingFlags |= ExpandingFlags.Target; + let originalHandler: typeof outofbandVarianceMarkerHandler; + let propagatingVarianceFlags: RelationComparisonResult = 0; + if (outofbandVarianceMarkerHandler) { + originalHandler = outofbandVarianceMarkerHandler; + outofbandVarianceMarkerHandler = onlyUnreliable => { + propagatingVarianceFlags |= onlyUnreliable ? RelationComparisonResult.ReportsUnreliable : RelationComparisonResult.ReportsUnmeasurable; + return originalHandler!(onlyUnreliable); + }; + } const result = expandingFlags !== ExpandingFlags.Both ? structuredTypeRelatedTo(source, target, reportErrors, isIntersectionConstituent) : Ternary.Maybe; + if (outofbandVarianceMarkerHandler) { + outofbandVarianceMarkerHandler = originalHandler; + } expandingFlags = saveExpandingFlags; depth--; if (result) { if (result === Ternary.True || depth === 0) { // If result is definitely true, record all maybe keys as having succeeded for (let i = maybeStart; i < maybeCount; i++) { - relation.set(maybeKeys[i], RelationComparisonResult.Succeeded); + relation.set(maybeKeys[i], RelationComparisonResult.Succeeded | propagatingVarianceFlags); } maybeCount = maybeStart; } @@ -13383,7 +13529,7 @@ namespace ts { else { // A false result goes straight into global cache (when something is false under // assumptions it will also be false without assumptions) - relation.set(id, reportErrors ? RelationComparisonResult.FailedAndReported : RelationComparisonResult.Failed); + relation.set(id, (reportErrors ? RelationComparisonResult.Reported : 0) | RelationComparisonResult.Failed | propagatingVarianceFlags); maybeCount = maybeStart; } return result; @@ -13425,7 +13571,7 @@ namespace ts { let result: Ternary; let originalErrorInfo: DiagnosticMessageChain | undefined; let varianceCheckFailed = false; - const saveErrorInfo = errorInfo; + const saveErrorInfo = captureErrorCalculationState(); // We limit alias variance probing to only object and conditional types since their alias behavior // is more predictable than other, interned types, which may or may not have an alias depending on @@ -13517,7 +13663,7 @@ namespace ts { } } originalErrorInfo = errorInfo; - errorInfo = saveErrorInfo; + resetErrorInfo(saveErrorInfo); } } } @@ -13529,7 +13675,7 @@ namespace ts { result &= isRelatedTo((source).indexType, (target).indexType, reportErrors); } if (result) { - errorInfo = saveErrorInfo; + resetErrorInfo(saveErrorInfo); return result; } } @@ -13538,25 +13684,25 @@ namespace ts { if (!constraint || (source.flags & TypeFlags.TypeParameter && constraint.flags & TypeFlags.Any)) { // A type variable with no constraint is not related to the non-primitive object type. if (result = isRelatedTo(emptyObjectType, extractTypesOfKind(target, ~TypeFlags.NonPrimitive))) { - errorInfo = saveErrorInfo; + resetErrorInfo(saveErrorInfo); return result; } } // hi-speed no-this-instantiation check (less accurate, but avoids costly `this`-instantiation when the constraint will suffice), see #28231 for report on why this is needed else if (result = isRelatedTo(constraint, target, /*reportErrors*/ false, /*headMessage*/ undefined, isIntersectionConstituent)) { - errorInfo = saveErrorInfo; + resetErrorInfo(saveErrorInfo); return result; } // slower, fuller, this-instantiated check (necessary when comparing raw `this` types from base classes), see `subclassWithPolymorphicThisIsAssignable.ts` test for example else if (result = isRelatedTo(getTypeWithThisArgument(constraint, source), target, reportErrors, /*headMessage*/ undefined, isIntersectionConstituent)) { - errorInfo = saveErrorInfo; + resetErrorInfo(saveErrorInfo); return result; } } } else if (source.flags & TypeFlags.Index) { if (result = isRelatedTo(keyofConstraintType, target, reportErrors)) { - errorInfo = saveErrorInfo; + resetErrorInfo(saveErrorInfo); return result; } } @@ -13581,7 +13727,7 @@ namespace ts { result &= isRelatedTo(getFalseTypeFromConditionalType(source), getFalseTypeFromConditionalType(target), reportErrors); } if (result) { - errorInfo = saveErrorInfo; + resetErrorInfo(saveErrorInfo); return result; } } @@ -13590,14 +13736,14 @@ namespace ts { const distributiveConstraint = getConstraintOfDistributiveConditionalType(source); if (distributiveConstraint) { if (result = isRelatedTo(distributiveConstraint, target, reportErrors)) { - errorInfo = saveErrorInfo; + resetErrorInfo(saveErrorInfo); return result; } } const defaultConstraint = getDefaultConstraintOfConditionalType(source); if (defaultConstraint) { if (result = isRelatedTo(defaultConstraint, target, reportErrors)) { - errorInfo = saveErrorInfo; + resetErrorInfo(saveErrorInfo); return result; } } @@ -13611,7 +13757,7 @@ namespace ts { if (isGenericMappedType(target)) { if (isGenericMappedType(source)) { if (result = mappedTypeRelatedTo(source, target, reportErrors)) { - errorInfo = saveErrorInfo; + resetErrorInfo(saveErrorInfo); return result; } } @@ -13657,7 +13803,7 @@ namespace ts { // relates to X. Thus, we include intersection types on the source side here. if (source.flags & (TypeFlags.Object | TypeFlags.Intersection) && target.flags & TypeFlags.Object) { // Report structural errors only if we haven't reported any errors yet - const reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo && !sourceIsPrimitive; + const reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo.errorInfo && !sourceIsPrimitive; result = propertiesRelatedTo(source, target, reportStructuralErrors, /*excludedProperties*/ undefined, isIntersectionConstituent); if (result) { result &= signaturesRelatedTo(source, target, SignatureKind.Call, reportStructuralErrors); @@ -13672,7 +13818,7 @@ namespace ts { } } if (varianceCheckFailed && result) { - errorInfo = originalErrorInfo || errorInfo || saveErrorInfo; // Use variance error (there is no structural one) and return false + errorInfo = originalErrorInfo || errorInfo || saveErrorInfo.errorInfo; // Use variance error (there is no structural one) and return false } else if (result) { return result; @@ -13704,7 +13850,7 @@ namespace ts { // We elide the variance-based error elaborations, since those might not be too helpful, since we'll potentially // be assuming identity of the type parameter. originalErrorInfo = undefined; - errorInfo = saveErrorInfo; + resetErrorInfo(saveErrorInfo); return undefined; } const allowStructuralFallback = targetTypeArguments && hasCovariantVoidArgument(targetTypeArguments, variances); @@ -13732,7 +13878,7 @@ namespace ts { // comparison unexpectedly succeeds. This can happen when the structural comparison result // is a Ternary.Maybe for example caused by the recursion depth limiter. originalErrorInfo = errorInfo; - errorInfo = saveErrorInfo; + resetErrorInfo(saveErrorInfo); } } } @@ -13966,7 +14112,7 @@ namespace ts { const related = isPropertySymbolTypeRelated(sourceProp, targetProp, getTypeOfSourceProperty, reportErrors, isIntersectionConstituent); if (!related) { if (reportErrors) { - reportError(Diagnostics.Types_of_property_0_are_incompatible, symbolToString(targetProp)); + reportIncompatibleError(Diagnostics.Types_of_property_0_are_incompatible, symbolToString(targetProp)); } return Ternary.False; } @@ -14008,8 +14154,8 @@ namespace ts { if (length(unmatchedProperty.declarations)) { associateRelatedInfo(createDiagnosticForNode(unmatchedProperty.declarations[0], Diagnostics._0_is_declared_here, propName)); } - if (shouldSkipElaboration) { - overrideNextErrorInfo = errorInfo; + if (shouldSkipElaboration && errorInfo) { + overrideNextErrorInfo++; } } else if (tryElaborateArrayLikeErrors(source, target, /*reportErrors*/ false)) { @@ -14019,8 +14165,8 @@ namespace ts { else { reportError(Diagnostics.Type_0_is_missing_the_following_properties_from_type_1_Colon_2, typeToString(source), typeToString(target), map(props, p => symbolToString(p)).join(", ")); } - if (shouldSkipElaboration) { - overrideNextErrorInfo = errorInfo; + if (shouldSkipElaboration && errorInfo) { + overrideNextErrorInfo++; } } // ELSE: No array like or unmatched property error - just issue top level error (errorInfo = undefined) @@ -14143,7 +14289,8 @@ namespace ts { } let result = Ternary.True; - const saveErrorInfo = errorInfo; + const saveErrorInfo = captureErrorCalculationState(); + const incompatibleReporter = kind === SignatureKind.Construct ? reportIncompatibleConstructSignatureReturn : reportIncompatibleCallSignatureReturn; if (getObjectFlags(source) & ObjectFlags.Instantiated && getObjectFlags(target) & ObjectFlags.Instantiated && source.symbol === target.symbol) { // We have instantiations of the same anonymous type (which typically will be the type of a @@ -14151,7 +14298,7 @@ namespace ts { // of the much more expensive N * M comparison matrix we explore below. We erase type parameters // as they are known to always be the same. for (let i = 0; i < targetSignatures.length; i++) { - const related = signatureRelatedTo(sourceSignatures[i], targetSignatures[i], /*erase*/ true, reportErrors); + const related = signatureRelatedTo(sourceSignatures[i], targetSignatures[i], /*erase*/ true, reportErrors, incompatibleReporter(sourceSignatures[i], targetSignatures[i])); if (!related) { return Ternary.False; } @@ -14165,17 +14312,17 @@ namespace ts { // this regardless of the number of signatures, but the potential costs are prohibitive due // to the quadratic nature of the logic below. const eraseGenerics = relation === comparableRelation || !!compilerOptions.noStrictGenericChecks; - result = signatureRelatedTo(sourceSignatures[0], targetSignatures[0], eraseGenerics, reportErrors); + result = signatureRelatedTo(sourceSignatures[0], targetSignatures[0], eraseGenerics, reportErrors, incompatibleReporter(sourceSignatures[0], targetSignatures[0])); } else { outer: for (const t of targetSignatures) { // Only elaborate errors from the first failure let shouldElaborateErrors = reportErrors; for (const s of sourceSignatures) { - const related = signatureRelatedTo(s, t, /*erase*/ true, shouldElaborateErrors); + const related = signatureRelatedTo(s, t, /*erase*/ true, shouldElaborateErrors, incompatibleReporter(s, t)); if (related) { result &= related; - errorInfo = saveErrorInfo; + resetErrorInfo(saveErrorInfo); continue outer; } shouldElaborateErrors = false; @@ -14192,12 +14339,26 @@ namespace ts { return result; } + function reportIncompatibleCallSignatureReturn(siga: Signature, sigb: Signature) { + if (siga.parameters.length === 0 && sigb.parameters.length === 0) { + return (source: Type, target: Type) => reportIncompatibleError(Diagnostics.Call_signatures_with_no_arguments_have_incompatible_return_types_0_and_1, typeToString(source), typeToString(target)); + } + return (source: Type, target: Type) => reportIncompatibleError(Diagnostics.Call_signature_return_types_0_and_1_are_incompatible, typeToString(source), typeToString(target)); + } + + function reportIncompatibleConstructSignatureReturn(siga: Signature, sigb: Signature) { + if (siga.parameters.length === 0 && sigb.parameters.length === 0) { + return (source: Type, target: Type) => reportIncompatibleError(Diagnostics.Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1, typeToString(source), typeToString(target)); + } + return (source: Type, target: Type) => reportIncompatibleError(Diagnostics.Construct_signature_return_types_0_and_1_are_incompatible, typeToString(source), typeToString(target)); + } + /** * See signatureAssignableTo, compareSignaturesIdentical */ - function signatureRelatedTo(source: Signature, target: Signature, erase: boolean, reportErrors: boolean): Ternary { + function signatureRelatedTo(source: Signature, target: Signature, erase: boolean, reportErrors: boolean, incompatibleReporter: (source: Type, target: Type) => void): Ternary { return compareSignaturesRelated(erase ? getErasedSignature(source) : source, erase ? getErasedSignature(target) : target, - CallbackCheck.None, /*ignoreReturnTypes*/ false, reportErrors, reportError, isRelatedTo); + CallbackCheck.None, /*ignoreReturnTypes*/ false, reportErrors, reportError, incompatibleReporter, isRelatedTo); } function signaturesIdenticalTo(source: Type, target: Type, kind: SignatureKind): Ternary { @@ -14715,16 +14876,18 @@ namespace ts { if (!ignoreReturnTypes) { const sourceTypePredicate = getTypePredicateOfSignature(source); const targetTypePredicate = getTypePredicateOfSignature(target); - result &= sourceTypePredicate !== undefined || targetTypePredicate !== undefined - ? compareTypePredicatesIdentical(sourceTypePredicate, targetTypePredicate, compareTypes) - // If they're both type predicates their return types will both be `boolean`, so no need to compare those. - : compareTypes(getReturnTypeOfSignature(source), getReturnTypeOfSignature(target)); + result &= sourceTypePredicate || targetTypePredicate ? + compareTypePredicatesIdentical(sourceTypePredicate, targetTypePredicate, compareTypes) : + compareTypes(getReturnTypeOfSignature(source), getReturnTypeOfSignature(target)); } return result; } function compareTypePredicatesIdentical(source: TypePredicate | undefined, target: TypePredicate | undefined, compareTypes: (s: Type, t: Type) => Ternary): Ternary { - return source === undefined || target === undefined || !typePredicateKindsMatch(source, target) ? Ternary.False : compareTypes(source.type, target.type); + return !(source && target && typePredicateKindsMatch(source, target)) ? Ternary.False : + source.type === target.type ? Ternary.True : + source.type && target.type ? compareTypes(source.type, target.type) : + Ternary.False; } function literalTypesWithSameBaseType(types: Type[]): boolean { @@ -15004,9 +15167,9 @@ namespace ts { * Return true if type was inferred from an object literal, written as an object type literal, or is the shape of a module * with no call or construct signatures. */ - function isObjectTypeWithInferableIndex(type: Type) { - return type.symbol && (type.symbol.flags & (SymbolFlags.ObjectLiteral | SymbolFlags.TypeLiteral | SymbolFlags.Enum | SymbolFlags.ValueModule)) !== 0 && - !typeHasCallOrConstructSignatures(type); + function isObjectTypeWithInferableIndex(type: Type): boolean { + return !!(type.symbol && (type.symbol.flags & (SymbolFlags.ObjectLiteral | SymbolFlags.TypeLiteral | SymbolFlags.Enum | SymbolFlags.ValueModule)) !== 0 && + !typeHasCallOrConstructSignatures(type)) || !!(getObjectFlags(type) & ObjectFlags.ReverseMapped && isObjectTypeWithInferableIndex((type as ReverseMappedType).source)); } function createSymbolWithType(source: Symbol, type: Type | undefined) { @@ -15332,8 +15495,7 @@ namespace ts { function applyToReturnTypes(source: Signature, target: Signature, callback: (s: Type, t: Type) => void) { const sourceTypePredicate = getTypePredicateOfSignature(source); const targetTypePredicate = getTypePredicateOfSignature(target); - if (sourceTypePredicate && targetTypePredicate && sourceTypePredicate.kind === targetTypePredicate.kind && - (sourceTypePredicate.kind === TypePredicateKind.This || sourceTypePredicate.parameterIndex === (targetTypePredicate).parameterIndex)) { + if (sourceTypePredicate && targetTypePredicate && typePredicateKindsMatch(sourceTypePredicate, targetTypePredicate) && sourceTypePredicate.type && targetTypePredicate.type) { callback(sourceTypePredicate.type, targetTypePredicate.type); } else { @@ -15408,6 +15570,13 @@ namespace ts { }; } + function cloneInferredPartOfContext(context: InferenceContext): InferenceContext | undefined { + const inferences = filter(context.inferences, hasInferenceCandidates); + return inferences.length ? + createInferenceContextWorker(map(inferences, cloneInferenceInfo), context.signature, context.flags, context.compareTypes) : + undefined; + } + function getMapperFromContext(context: T): TypeMapper | T & undefined { return context && context.mapper; } @@ -16692,12 +16861,6 @@ namespace ts { getInitialTypeOfBindingElement(node); } - function getInitialOrAssignedType(node: VariableDeclaration | BindingElement | Expression, reference: Node) { - return getConstraintForLocation(node.kind === SyntaxKind.VariableDeclaration || node.kind === SyntaxKind.BindingElement ? - getInitialType(node) : - getAssignedType(node), reference); - } - function isEmptyArrayAssignment(node: VariableDeclaration | BindingElement | Expression) { return node.kind === SyntaxKind.VariableDeclaration && (node).initializer && isEmptyArrayLiteral((node).initializer!) || @@ -16948,23 +17111,64 @@ namespace ts { return isLengthPushOrUnshift || isElementAssignment; } - function maybeTypePredicateCall(node: CallExpression) { - const links = getNodeLinks(node); - if (links.maybeTypePredicate === undefined) { - links.maybeTypePredicate = getMaybeTypePredicate(node); - } - return links.maybeTypePredicate; + function isDeclarationWithExplicitTypeAnnotation(declaration: Declaration | undefined) { + return !!(declaration && ( + declaration.kind === SyntaxKind.VariableDeclaration || declaration.kind === SyntaxKind.Parameter || + declaration.kind === SyntaxKind.PropertyDeclaration || declaration.kind === SyntaxKind.PropertySignature) && + getEffectiveTypeAnnotationNode(declaration as VariableDeclaration | ParameterDeclaration | PropertyDeclaration | PropertySignature)); + } + + function getExplicitTypeOfSymbol(symbol: Symbol) { + return symbol.flags & (SymbolFlags.Function | SymbolFlags.Method | SymbolFlags.Class | SymbolFlags.ValueModule) || + symbol.flags & (SymbolFlags.Variable | SymbolFlags.Property) && isDeclarationWithExplicitTypeAnnotation(symbol.valueDeclaration) ? + getTypeOfSymbol(symbol) : undefined; } - function getMaybeTypePredicate(node: CallExpression) { - if (node.expression.kind !== SyntaxKind.SuperKeyword) { - const funcType = checkNonNullExpression(node.expression); - if (funcType !== silentNeverType) { - const apparentType = getApparentType(funcType); - return apparentType !== errorType && some(getSignaturesOfType(apparentType, SignatureKind.Call), signatureHasTypePredicate); + // We require the dotted function name in an assertion expression to be comprised of identifiers + // that reference function, method, class or value module symbols; or variable, property or + // parameter symbols with declarations that have explicit type annotations. Such references are + // resolvable with no possibility of triggering circularities in control flow analysis. + function getTypeOfDottedName(node: Expression): Type | undefined { + if (!(node.flags & NodeFlags.InWithStatement)) { + switch (node.kind) { + case SyntaxKind.Identifier: + const symbol = getResolvedSymbol(node); + return getExplicitTypeOfSymbol(symbol.flags & SymbolFlags.Alias ? resolveAlias(symbol) : symbol); + case SyntaxKind.ThisKeyword: + return getExplicitThisType(node); + case SyntaxKind.PropertyAccessExpression: + const type = getTypeOfDottedName((node).expression); + const prop = type && getPropertyOfType(type, (node).name.escapedText); + return prop && getExplicitTypeOfSymbol(prop); + case SyntaxKind.ParenthesizedExpression: + return getTypeOfDottedName((node).expression); } } - return false; + } + + function getEffectsSignature(node: CallExpression) { + const links = getNodeLinks(node); + let signature = links.effectsSignature; + if (signature === undefined) { + // A call expression parented by an expression statement is a potential assertion. Other call + // expressions are potential type predicate function calls. In order to avoid triggering + // circularities in control flow analysis, we use getTypeOfDottedName when resolving the call + // target expression of an assertion. + const funcType = node.parent.kind === SyntaxKind.ExpressionStatement ? getTypeOfDottedName(node.expression) : + node.expression.kind !== SyntaxKind.SuperKeyword ? checkNonNullExpression(node.expression) : + undefined; + const signatures = getSignaturesOfType(funcType && getApparentType(funcType) || unknownType, SignatureKind.Call); + const candidate = signatures.length === 1 && !signatures[0].typeParameters ? signatures[0] : + some(signatures, hasTypePredicateOrNeverReturnType) ? getResolvedSignature(node) : + undefined; + signature = links.effectsSignature = candidate && hasTypePredicateOrNeverReturnType(candidate) ? candidate : unknownSignature; + } + return signature === unknownSignature ? undefined : signature; + } + + function hasTypePredicateOrNeverReturnType(signature: Signature) { + return !!(getTypePredicateOfSignature(signature) || + signature.declaration && (getReturnTypeFromAnnotation(signature.declaration) || unknownType).flags & TypeFlags.Never); } function reportFlowControlError(node: Node) { @@ -16974,6 +17178,71 @@ namespace ts { diagnostics.add(createFileDiagnostic(sourceFile, span.start, span.length, Diagnostics.The_containing_function_or_module_body_is_too_large_for_control_flow_analysis)); } + function isReachableFlowNode(flow: FlowNode) { + const result = isReachableFlowNodeWorker(flow, /*skipCacheCheck*/ false); + lastFlowNode = flow; + lastFlowNodeReachable = result; + return result; + } + + function isUnlockedReachableFlowNode(flow: FlowNode) { + return !(flow.flags & FlowFlags.PreFinally && (flow).lock.locked) && isReachableFlowNodeWorker(flow, /*skipCacheCheck*/ false); + } + + function isReachableFlowNodeWorker(flow: FlowNode, noCacheCheck: boolean): boolean { + while (true) { + if (flow === lastFlowNode) { + return lastFlowNodeReachable; + } + const flags = flow.flags; + if (flags & FlowFlags.Shared) { + if (!noCacheCheck) { + const id = getFlowNodeId(flow); + const reachable = flowNodeReachable[id]; + return reachable !== undefined ? reachable : (flowNodeReachable[id] = isReachableFlowNodeWorker(flow, /*skipCacheCheck*/ true)); + } + noCacheCheck = false; + } + if (flags & (FlowFlags.Assignment | FlowFlags.Condition | FlowFlags.ArrayMutation | FlowFlags.PreFinally)) { + flow = (flow).antecedent; + } + else if (flags & FlowFlags.Call) { + const signature = getEffectsSignature((flow).node); + if (signature && getReturnTypeOfSignature(signature).flags & TypeFlags.Never) { + return false; + } + flow = (flow).antecedent; + } + else if (flags & FlowFlags.BranchLabel) { + // A branching point is reachable if any branch is reachable. + return some((flow).antecedents, isUnlockedReachableFlowNode); + } + else if (flags & FlowFlags.LoopLabel) { + // A loop is reachable if the control flow path that leads to the top is reachable. + flow = (flow).antecedents![0]; + } + else if (flags & FlowFlags.SwitchClause) { + // The control flow path representing an unmatched value in a switch statement with + // no default clause is unreachable if the switch statement is exhaustive. + if ((flow).clauseStart === (flow).clauseEnd && isExhaustiveSwitchStatement((flow).switchStatement)) { + return false; + } + flow = (flow).antecedent; + } + else if (flags & FlowFlags.AfterFinally) { + // Cache is unreliable once we start locking nodes + lastFlowNode = undefined; + (flow).locked = true; + const result = isReachableFlowNodeWorker((flow).antecedent, /*skipCacheCheck*/ false); + (flow).locked = false; + return result; + } + else { + return !(flags & FlowFlags.Unreachable); + } + } + } + function getFlowTypeOfReference(reference: Node, declaredType: Type, initialType = declaredType, flowContainer?: Node, couldBeUninitialized?: boolean) { let key: string | undefined; let keySet = false; @@ -16984,6 +17253,7 @@ namespace ts { if (!reference.flowNode || !couldBeUninitialized && !(declaredType.flags & TypeFlags.Narrowable)) { return declaredType; } + flowInvocationCount++; const sharedFlowStart = sharedFlowCount; const evolvedType = getTypeFromFlowType(getTypeAtFlowNode(reference.flowNode)); sharedFlowCount = sharedFlowStart; @@ -16992,7 +17262,7 @@ namespace ts { // on empty arrays are possible without implicit any errors and new element types can be inferred without // type mismatch errors. const resultType = getObjectFlags(evolvedType) & ObjectFlags.EvolvingArray && isEvolvingArrayOperationTarget(reference) ? autoArrayType : finalizeEvolvingArrayType(evolvedType); - if (reference.parent && reference.parent.kind === SyntaxKind.NonNullExpression && getTypeWithFacts(resultType, TypeFacts.NEUndefinedOrNull).flags & TypeFlags.Never) { + if (resultType === unreachableNeverType|| reference.parent && reference.parent.kind === SyntaxKind.NonNullExpression && getTypeWithFacts(resultType, TypeFacts.NEUndefinedOrNull).flags & TypeFlags.Never) { return declaredType; } return resultType; @@ -17016,15 +17286,6 @@ namespace ts { flowDepth++; while (true) { const flags = flow.flags; - if (flags & FlowFlags.Cached) { - const key = getOrSetCacheKey(); - if (key) { - const id = getFlowNodeId(flow); - if (flowAssignmentKeys[id] === key) { - return flowAssignmentTypes[id]; - } - } - } if (flags & FlowFlags.Shared) { // We cache results of flow type resolution for shared nodes that were previously visited in // the same getFlowTypeOfReference invocation. A node is considered shared when it is the @@ -17055,14 +17316,12 @@ namespace ts { flow = (flow).antecedent; continue; } - else if (flowLoopCount === flowLoopStart) { // Only cache assignments when not within loop analysis - const key = getOrSetCacheKey(); - if (key && !isIncomplete(type)) { - flow.flags |= FlowFlags.Cached; - const id = getFlowNodeId(flow); - flowAssignmentKeys[id] = key; - flowAssignmentTypes[id] = type; - } + } + else if (flags & FlowFlags.Call) { + type = getTypeAtFlowCall(flow); + if (!type) { + flow = (flow).antecedent; + continue; } } else if (flags & FlowFlags.Condition) { @@ -17089,7 +17348,7 @@ namespace ts { } else if (flags & FlowFlags.Start) { // Check if we should continue with the control flow of the containing function. - const container = (flow).container; + const container = (flow).node; if (container && container !== flowContainer && reference.kind !== SyntaxKind.PropertyAccessExpression && reference.kind !== SyntaxKind.ElementAccessExpression && @@ -17116,11 +17375,35 @@ namespace ts { } } + function getInitialOrAssignedType(flow: FlowAssignment) { + const node = flow.node; + if (flow.flags & FlowFlags.Cached) { + const cached = flowAssignmentTypes[getNodeId(node)]; + if (cached) { + return cached; + } + } + const startInvocationCount = flowInvocationCount; + const type = getConstraintForLocation(node.kind === SyntaxKind.VariableDeclaration || node.kind === SyntaxKind.BindingElement ? + getInitialType(node) : + getAssignedType(node), reference); + // We cache the assigned type when getFlowTypeOfReference was recursively invoked in the + // resolution of the assigned type and we're not within loop analysis. + if (flowInvocationCount !== startInvocationCount && flowLoopCount === flowLoopStart) { + flow.flags |= FlowFlags.Cached; + flowAssignmentTypes[getNodeId(node)] = type; + } + return type; + } + function getTypeAtFlowAssignment(flow: FlowAssignment) { const node = flow.node; // Assignments only narrow the computed type if the declared type is a union type. Thus, we // only need to evaluate the assigned type if the declared type is a union type. if (isMatchingReference(reference, node)) { + if (!isReachableFlowNode(flow)) { + return unreachableNeverType; + } if (getAssignmentTargetKind(node) === AssignmentKind.Compound) { const flowType = getTypeAtFlowNode(flow.antecedent); return createFlowType(getBaseTypeOfLiteralType(getTypeFromFlowType(flowType)), isIncomplete(flowType)); @@ -17129,11 +17412,11 @@ namespace ts { if (isEmptyArrayAssignment(node)) { return getEvolvingArrayType(neverType); } - const assignedType = getBaseTypeOfLiteralType(getInitialOrAssignedType(node, reference)); + const assignedType = getBaseTypeOfLiteralType(getInitialOrAssignedType(flow)); return isTypeAssignableTo(assignedType, declaredType) ? assignedType : anyArrayType; } if (declaredType.flags & TypeFlags.Union) { - return getAssignmentReducedType(declaredType, getInitialOrAssignedType(node, reference)); + return getAssignmentReducedType(declaredType, getInitialOrAssignedType(flow)); } return declaredType; } @@ -17142,6 +17425,9 @@ namespace ts { // reference 'x.y.z', we may be at an assignment to 'x.y' or 'x'. In that case, // return the declared type. if (containsMatchingReference(reference, node)) { + if (!isReachableFlowNode(flow)) { + return unreachableNeverType; + } // A matching dotted name might also be an expando property on a function *expression*, // in which case we continue control flow analysis back to the function's declaration if (isVariableDeclaration(node) && (isInJSFile(node) || isVarConst(node))) { @@ -17160,6 +17446,38 @@ namespace ts { return undefined; } + function narrowTypeByAssertion(type: Type, expr: Expression): Type { + const node = skipParentheses(expr); + if (node.kind === SyntaxKind.BinaryExpression) { + if ((node).operatorToken.kind === SyntaxKind.AmpersandAmpersandToken) { + return narrowTypeByAssertion(narrowTypeByAssertion(type, (node).left), (node).right); + } + if ((node).operatorToken.kind === SyntaxKind.BarBarToken) { + return getUnionType([narrowTypeByAssertion(type, (node).left), narrowTypeByAssertion(type, (node).right)]); + } + } + return narrowType(type, node, /*assumeTrue*/ true); + } + + function getTypeAtFlowCall(flow: FlowCall): FlowType | undefined { + const signature = getEffectsSignature(flow.node); + if (signature) { + const predicate = getTypePredicateOfSignature(signature); + if (predicate && (predicate.kind === TypePredicateKind.AssertsThis || predicate.kind === TypePredicateKind.AssertsIdentifier)) { + const flowType = getTypeAtFlowNode(flow.antecedent); + const type = getTypeFromFlowType(flowType); + const narrowedType = predicate.type ? narrowTypeByTypePredicate(type, predicate, flow.node, /*assumeTrue*/ true) : + predicate.kind === TypePredicateKind.AssertsIdentifier ? narrowTypeByAssertion(type, flow.node.arguments[predicate.parameterIndex]) : + type; + return narrowedType === type ? flowType : createFlowType(narrowedType, isIncomplete(flowType)); + } + if (getReturnTypeOfSignature(signature).flags & TypeFlags.Never) { + return unreachableNeverType; + } + } + return undefined; + } + function getTypeAtFlowArrayMutation(flow: FlowArrayMutation): FlowType | undefined { if (declaredType === autoType || declaredType === autoArrayType) { const node = flow.node; @@ -17206,7 +17524,7 @@ namespace ts { // *only* place a silent never type is ever generated. const assumeTrue = (flow.flags & FlowFlags.TrueCondition) !== 0; const nonEvolvingType = finalizeEvolvingArrayType(type); - const narrowedType = narrowType(nonEvolvingType, flow.expression, assumeTrue); + const narrowedType = narrowType(nonEvolvingType, flow.node, assumeTrue); if (narrowedType === nonEvolvingType) { return flowType; } @@ -17234,6 +17552,9 @@ namespace ts { else if (containsMatchingReferenceDiscriminant(reference, expr)) { type = declaredType; } + else if (flow.clauseStart === flow.clauseEnd && isExhaustiveSwitchStatement(flow.switchStatement)) { + return unreachableNeverType; + } return createFlowType(type, isIncomplete(flowType)); } @@ -17303,24 +17624,31 @@ namespace ts { const antecedentTypes: Type[] = []; let subtypeReduction = false; let firstAntecedentType: FlowType | undefined; - flowLoopNodes[flowLoopCount] = flow; - flowLoopKeys[flowLoopCount] = key; - flowLoopTypes[flowLoopCount] = antecedentTypes; for (const antecedent of flow.antecedents!) { - flowLoopCount++; - const flowType = getTypeAtFlowNode(antecedent); - flowLoopCount--; + let flowType; if (!firstAntecedentType) { - firstAntecedentType = flowType; + // The first antecedent of a loop junction is always the non-looping control + // flow path that leads to the top. + flowType = firstAntecedentType = getTypeAtFlowNode(antecedent); } - const type = getTypeFromFlowType(flowType); - // If we see a value appear in the cache it is a sign that control flow analysis - // was restarted and completed by checkExpressionCached. We can simply pick up - // the resulting type and bail out. - const cached = cache.get(key); - if (cached) { - return cached; + else { + // All but the first antecedent are the looping control flow paths that lead + // back to the loop junction. We track these on the flow loop stack. + flowLoopNodes[flowLoopCount] = flow; + flowLoopKeys[flowLoopCount] = key; + flowLoopTypes[flowLoopCount] = antecedentTypes; + flowLoopCount++; + flowType = getTypeAtFlowNode(antecedent); + flowLoopCount--; + // If we see a value appear in the cache it is a sign that control flow analysis + // was restarted and completed by checkExpressionCached. We can simply pick up + // the resulting type and bail out. + const cached = cache.get(key); + if (cached) { + return cached; + } } + const type = getTypeFromFlowType(flowType); pushIfUnique(antecedentTypes, type); // If an antecedent type is not a subset of the declared type, we need to perform // subtype reduction. This happens when a "foreign" type is injected into the control @@ -17453,7 +17781,7 @@ namespace ts { assumeTrue = !assumeTrue; } const valueType = getTypeOfExpression(value); - if ((type.flags & TypeFlags.Unknown) && (operator === SyntaxKind.EqualsEqualsEqualsToken) && assumeTrue) { + if ((type.flags & TypeFlags.Unknown) && assumeTrue && (operator === SyntaxKind.EqualsEqualsEqualsToken || operator === SyntaxKind.ExclamationEqualsEqualsToken)) { if (valueType.flags & (TypeFlags.Primitive | TypeFlags.NonPrimitive)) { return valueType; } @@ -17743,24 +18071,25 @@ namespace ts { getIntersectionType([type, candidate]); } - function narrowTypeByTypePredicate(type: Type, callExpression: CallExpression, assumeTrue: boolean): Type { - if (!hasMatchingArgument(callExpression, reference) || !maybeTypePredicateCall(callExpression)) { - return type; - } - const signature = getResolvedSignature(callExpression); - const predicate = getTypePredicateOfSignature(signature); - if (!predicate) { - return type; + function narrowTypeByCallExpression(type: Type, callExpression: CallExpression, assumeTrue: boolean): Type { + if (hasMatchingArgument(callExpression, reference)) { + const signature = getEffectsSignature(callExpression); + const predicate = signature && getTypePredicateOfSignature(signature); + if (predicate && (predicate.kind === TypePredicateKind.This || predicate.kind === TypePredicateKind.Identifier)) { + return narrowTypeByTypePredicate(type, predicate, callExpression, assumeTrue); + } } + return type; + } + function narrowTypeByTypePredicate(type: Type, predicate: TypePredicate, callExpression: CallExpression, assumeTrue: boolean): Type { // Don't narrow from 'any' if the predicate type is exactly 'Object' or 'Function' if (isTypeAny(type) && (predicate.type === globalObjectType || predicate.type === globalFunctionType)) { return type; } - - if (isIdentifierTypePredicate(predicate)) { + if (predicate.kind === TypePredicateKind.Identifier || predicate.kind === TypePredicateKind.AssertsIdentifier) { const predicateArgument = callExpression.arguments[predicate.parameterIndex]; - if (predicateArgument) { + if (predicateArgument && predicate.type) { if (isMatchingReference(reference, predicateArgument)) { return getNarrowedType(type, predicate.type, assumeTrue, isTypeSubtypeOf); } @@ -17771,7 +18100,7 @@ namespace ts { } else { const invokedExpression = skipParentheses(callExpression.expression); - if (isAccessExpression(invokedExpression)) { + if (isAccessExpression(invokedExpression) && predicate.type) { const possibleReference = skipParentheses(invokedExpression.expression); if (isMatchingReference(reference, possibleReference)) { return getNarrowedType(type, predicate.type, assumeTrue, isTypeSubtypeOf); @@ -17795,7 +18124,7 @@ namespace ts { case SyntaxKind.ElementAccessExpression: return narrowTypeByTruthiness(type, expr, assumeTrue); case SyntaxKind.CallExpression: - return narrowTypeByTypePredicate(type, expr, assumeTrue); + return narrowTypeByCallExpression(type, expr, assumeTrue); case SyntaxKind.ParenthesizedExpression: return narrowType(type, (expr).expression, assumeTrue); case SyntaxKind.BinaryExpression: @@ -18059,7 +18388,7 @@ namespace ts { // the entire control flow graph from the variable's declaration (i.e. when the flow container and // declaration container are the same). const assumeInitialized = isParameter || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || isBindingElement(declaration) || - type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & TypeFlags.AnyOrUnknown) !== 0 || + type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (TypeFlags.AnyOrUnknown | TypeFlags.Void)) !== 0 || isInTypeQuery(node) || node.parent.kind === SyntaxKind.ExportSpecifier) || node.parent.kind === SyntaxKind.NonNullExpression || declaration.kind === SyntaxKind.VariableDeclaration && (declaration).exclamationToken || @@ -18391,6 +18720,20 @@ namespace ts { } } + function getExplicitThisType(node: Expression) { + const container = getThisContainer(node, /*includeArrowFunctions*/ false); + if (isFunctionLike(container)) { + const signature = getSignatureFromDeclaration(container); + if (signature.thisParameter) { + return getExplicitTypeOfSymbol(signature.thisParameter); + } + } + if (isClassLike(container.parent)) { + const symbol = getSymbolOfNode(container.parent); + return hasModifier(container, ModifierFlags.Static) ? getTypeOfSymbol(symbol) : (getDeclaredTypeOfSymbol(symbol) as InterfaceType).thisType!; + } + } + function getClassNameFromPrototypeMethod(container: Node) { // Check if it's the RHS of a x.prototype.y = function [name]() { .... } if (container.kind === SyntaxKind.FunctionExpression && @@ -19225,7 +19568,7 @@ namespace ts { getContextualTypeForObjectLiteralMethod(node, contextFlags) : getContextualType(node, contextFlags); const instantiatedType = instantiateContextualType(contextualType, node, contextFlags); - if (instantiatedType) { + if (instantiatedType && !(contextFlags && contextFlags & ContextFlags.NoConstraints && instantiatedType.flags & TypeFlags.TypeVariable)) { const apparentType = mapType(instantiatedType, getApparentType, /*noReductions*/ true); if (apparentType.flags & TypeFlags.Union) { if (isObjectLiteralExpression(node)) { @@ -21465,7 +21808,7 @@ namespace ts { const returnContext = createInferenceContext(signature.typeParameters!, signature, context.flags); const returnSourceType = instantiateType(contextualType, outerContext && outerContext.returnMapper); inferTypes(returnContext.inferences, returnSourceType, inferenceTargetType); - context.returnMapper = some(returnContext.inferences, hasInferenceCandidates) ? getMapperFromContext(returnContext) : undefined; + context.returnMapper = some(returnContext.inferences, hasInferenceCandidates) ? getMapperFromContext(cloneInferredPartOfContext(returnContext)) : undefined; } } @@ -23681,9 +24024,11 @@ namespace ts { } function isExhaustiveSwitchStatement(node: SwitchStatement): boolean { - if (!node.possiblyExhaustive) { - return false; - } + const links = getNodeLinks(node); + return links.isExhaustive !== undefined ? links.isExhaustive : (links.isExhaustive = computeExhaustiveSwitchStatement(node)); + } + + function computeExhaustiveSwitchStatement(node: SwitchStatement): boolean { if (node.expression.kind === SyntaxKind.TypeOfExpression) { const operandType = getTypeOfExpression((node.expression as TypeOfExpression).expression); // This cast is safe because the switch is possibly exhaustive and does not contain a default case, so there can be no undefined. @@ -23705,14 +24050,7 @@ namespace ts { } function functionHasImplicitReturn(func: FunctionLikeDeclaration) { - if (!(func.flags & NodeFlags.HasImplicitReturn)) { - return false; - } - - if (some((func.body).statements, statement => statement.kind === SyntaxKind.SwitchStatement && isExhaustiveSwitchStatement(statement))) { - return false; - } - return true; + return func.endFlowNode && isReachableFlowNode(func.endFlowNode); } /** NOTE: Return value of `[]` means a different thing than `undefined`. `[]` means func returns `void`, `undefined` means it returns `never`. */ @@ -25131,8 +25469,8 @@ namespace ts { const constructSignature = getSingleSignature(type, SignatureKind.Construct, /*allowMembers*/ true); const signature = callSignature || constructSignature; if (signature && signature.typeParameters) { - const contextualType = getApparentTypeOfContextualType(node); - if (contextualType && !isMixinConstructorType(contextualType)) { + const contextualType = getApparentTypeOfContextualType(node, ContextFlags.NoConstraints); + if (contextualType) { const contextualSignature = getSingleSignature(getNonNullableType(contextualType), callSignature ? SignatureKind.Call : SignatureKind.Construct, /*allowMembers*/ false); if (contextualSignature && !contextualSignature.typeParameters) { if (checkMode & CheckMode.SkipGenericFunctions) { @@ -25538,7 +25876,7 @@ namespace ts { checkSourceElement(node.type); const { parameterName } = node; - if (isThisTypePredicate(typePredicate)) { + if (typePredicate.kind === TypePredicateKind.This || typePredicate.kind === TypePredicateKind.AssertsThis) { getTypeFromThisTypeNode(parameterName as ThisTypeNode); } else { @@ -25547,12 +25885,14 @@ namespace ts { error(parameterName, Diagnostics.A_type_predicate_cannot_reference_a_rest_parameter); } else { - const leadingError = () => chainDiagnosticMessages(/*details*/ undefined, Diagnostics.A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type); - checkTypeAssignableTo(typePredicate.type, - getTypeOfSymbol(signature.parameters[typePredicate.parameterIndex]), - node.type, - /*headMessage*/ undefined, - leadingError); + if (typePredicate.type) { + const leadingError = () => chainDiagnosticMessages(/*details*/ undefined, Diagnostics.A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type); + checkTypeAssignableTo(typePredicate.type, + getTypeOfSymbol(signature.parameters[typePredicate.parameterIndex]), + node.type, + /*headMessage*/ undefined, + leadingError); + } } } else if (parameterName) { @@ -25705,7 +26045,7 @@ namespace ts { for (const member of node.members) { if (member.kind === SyntaxKind.Constructor) { for (const param of (member as ConstructorDeclaration).parameters) { - if (isParameterPropertyDeclaration(param) && !isBindingPattern(param.name)) { + if (isParameterPropertyDeclaration(param, member) && !isBindingPattern(param.name)) { addName(instanceNames, param.name, param.name.escapedText, DeclarationMeaning.GetOrSetAccessor); } } @@ -27469,7 +27809,7 @@ namespace ts { const parameter = local.valueDeclaration && tryGetRootParameterDeclaration(local.valueDeclaration); const name = local.valueDeclaration && getNameOfDeclaration(local.valueDeclaration); if (parameter && name) { - if (!isParameterPropertyDeclaration(parameter) && !parameterIsThisKeyword(parameter) && !isIdentifierThatStartsWithUnderscore(name)) { + if (!isParameterPropertyDeclaration(parameter, parameter.parent) && !parameterIsThisKeyword(parameter) && !isIdentifierThatStartsWithUnderscore(name)) { addDiagnostic(parameter, UnusedKind.Parameter, createDiagnosticForNode(name, Diagnostics._0_is_declared_but_its_value_is_never_read, symbolName(local))); } } @@ -27966,7 +28306,8 @@ namespace ts { // Grammar checking checkGrammarStatementInAmbientContext(node); - checkTruthinessExpression(node.expression); + const type = checkTruthinessExpression(node.expression); + checkTestingKnownTruthyCallableType(node, type); checkSourceElement(node.thenStatement); if (node.thenStatement.kind === SyntaxKind.EmptyStatement) { @@ -27976,6 +28317,57 @@ namespace ts { checkSourceElement(node.elseStatement); } + function checkTestingKnownTruthyCallableType(ifStatement: IfStatement, type: Type) { + if (!strictNullChecks) { + return; + } + + const testedNode = isIdentifier(ifStatement.expression) + ? ifStatement.expression + : isPropertyAccessExpression(ifStatement.expression) + ? ifStatement.expression.name + : undefined; + + if (!testedNode) { + return; + } + + const possiblyFalsy = getFalsyFlags(type); + if (possiblyFalsy) { + return; + } + + // While it technically should be invalid for any known-truthy value + // to be tested, we de-scope to functions unrefenced in the block as a + // heuristic to identify the most common bugs. There are too many + // false positives for values sourced from type definitions without + // strictNullChecks otherwise. + const callSignatures = getSignaturesOfType(type, SignatureKind.Call); + if (callSignatures.length === 0) { + return; + } + + const testedFunctionSymbol = getSymbolAtLocation(testedNode); + if (!testedFunctionSymbol) { + return; + } + + const functionIsUsedInBody = forEachChild(ifStatement.thenStatement, function check(childNode): boolean | undefined { + if (isIdentifier(childNode)) { + const childSymbol = getSymbolAtLocation(childNode); + if (childSymbol && childSymbol.id === testedFunctionSymbol.id) { + return true; + } + } + + return forEachChild(childNode, check); + }); + + if (!functionIsUsedInBody) { + error(ifStatement.expression, Diagnostics.This_condition_will_always_return_true_since_the_function_is_always_defined_Did_you_mean_to_call_it_instead); + } + } + function checkDoStatement(node: DoStatement) { // Grammar checking checkGrammarStatementInAmbientContext(node); @@ -28740,11 +29132,13 @@ namespace ts { let nextType: Type | undefined; if (methodName !== "throw") { const methodParameterType = methodParameterTypes ? getUnionType(methodParameterTypes) : unknownType; - const resolvedMethodParameterType = resolver.resolveIterationType(methodParameterType, errorNode) || anyType; if (methodName === "next") { - nextType = resolvedMethodParameterType; + // The value of `next(value)` is *not* awaited by async generators + nextType = methodParameterType; } else if (methodName === "return") { + // The value of `return(value)` *is* awaited by async generators + const resolvedMethodParameterType = resolver.resolveIterationType(methodParameterType, errorNode) || anyType; returnTypes = append(returnTypes, resolvedMethodParameterType); } } @@ -29233,11 +29627,10 @@ namespace ts { const constraint = getEffectiveConstraintOfTypeParameter(source); const sourceConstraint = constraint && getTypeFromTypeNode(constraint); const targetConstraint = getConstraintOfTypeParameter(target); - if (sourceConstraint) { - // relax check if later interface augmentation has no constraint - if (!targetConstraint || !isTypeIdenticalTo(sourceConstraint, targetConstraint)) { - return false; - } + // relax check if later interface augmentation has no constraint, it's more broad and is OK to merge with + // a more constrained interface (this could be generalized to a full heirarchy check, but that's maybe overkill) + if (sourceConstraint && targetConstraint && !isTypeIdenticalTo(sourceConstraint, targetConstraint)) { + return false; } // If the type parameter node has a default and it is not identical to the default @@ -30417,6 +30810,9 @@ namespace ts { cancellationToken.throwIfCancellationRequested(); } } + if (kind >= SyntaxKind.FirstStatement && kind <= SyntaxKind.LastStatement && node.flowNode && !isReachableFlowNode(node.flowNode)) { + errorOrSuggestion(compilerOptions.allowUnreachableCode === false, node, Diagnostics.Unreachable_code_detected); + } switch (kind) { case SyntaxKind.TypeParameter: @@ -30718,7 +31114,7 @@ namespace ts { function checkSourceFileWorker(node: SourceFile) { const links = getNodeLinks(node); if (!(links.flags & NodeCheckFlags.TypeChecked)) { - if (skipTypeChecking(node, compilerOptions)) { + if (skipTypeChecking(node, compilerOptions, host)) { return; } @@ -31415,8 +31811,7 @@ namespace ts { const nameType = checkComputedPropertyName(name); return isTypeAssignableToKind(nameType, TypeFlags.ESSymbolLike) ? nameType : stringType; default: - Debug.fail("Unsupported property name."); - return errorType; + return Debug.fail("Unsupported property name."); } } @@ -32985,6 +33380,7 @@ namespace ts { // Modifiers are never allowed on properties except for 'async' on a method declaration if (prop.modifiers) { + // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion for (const mod of prop.modifiers!) { // TODO: GH#19955 if (mod.kind !== SyntaxKind.AsyncKeyword || prop.kind !== SyntaxKind.MethodDeclaration) { grammarErrorOnNode(mod, Diagnostics._0_modifier_cannot_be_used_here, getTextOfNode(mod)); @@ -33716,9 +34112,33 @@ namespace ts { return grammarErrorOnNode(withMinus ? node.parent : node, diagnosticMessage, literal); } } + + // Realism (size) checking + checkNumericLiteralValueSize(node); + return false; } + function checkNumericLiteralValueSize(node: NumericLiteral) { + // Scientific notation (e.g. 2e54 and 1e00000000010) can't be converted to bigint + // Literals with 15 or fewer characters aren't long enough to reach past 2^53 - 1 + // Fractional numbers (e.g. 9000000000000000.001) are inherently imprecise anyway + if (node.numericLiteralFlags & TokenFlags.Scientific || node.text.length <= 15 || node.text.indexOf(".") !== -1) { + return; + } + + // We can't rely on the runtime to accurately store and compare extremely large numeric values + // Even for internal use, we use getTextOfNode: https://github.com/microsoft/TypeScript/issues/33298 + // Thus, if the runtime claims a too-large number is lower than Number.MAX_SAFE_INTEGER, + // it's likely addition operations on it will fail too + const apparentValue = +getTextOfNode(node); + if (apparentValue <= 2 ** 53 - 1 && apparentValue + 1 > apparentValue) { + return; + } + + addErrorOrSuggestion(/*isError*/ false, createDiagnosticForNode(node, Diagnostics.Numeric_literals_with_absolute_values_equal_to_2_53_or_greater_are_too_large_to_be_represented_accurately_as_integers)); + } + function checkGrammarBigIntLiteral(node: BigIntLiteral): boolean { const literalType = isLiteralTypeNode(node.parent) || isPrefixUnaryExpression(node.parent) && isLiteralTypeNode(node.parent.parent); diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 009c04fbb8c5f..fd0d428d54bae 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -772,6 +772,12 @@ namespace ts { category: Diagnostics.Advanced_Options, description: Diagnostics.Disable_size_limitations_on_JavaScript_projects }, + { + name: "disableSourceOfProjectReferenceRedirect", + type: "boolean", + category: Diagnostics.Advanced_Options, + description: Diagnostics.Disable_use_of_source_files_instead_of_declaration_files_from_referenced_projects + }, { name: "noImplicitUseStrict", type: "boolean", diff --git a/src/compiler/core.ts b/src/compiler/core.ts index d930bee47117f..0a3f0ff674918 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -1654,7 +1654,7 @@ namespace ts { */ export function compose(...args: ((t: T) => T)[]): (t: T) => T; export function compose(a: (t: T) => T, b: (t: T) => T, c: (t: T) => T, d: (t: T) => T, e: (t: T) => T): (t: T) => T { - if (e) { + if (!!e) { const args: ((t: T) => T)[] = []; for (let i = 0; i < arguments.length; i++) { args[i] = arguments[i]; diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index b296c224d089d..87052c4e7cdb2 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1035,6 +1035,39 @@ "category": "Error", "code": 1356 }, + "An enum member name must be followed by a ',', '=', or '}'.": { + "category": "Error", + "code": 1357 + }, + + "The types of '{0}' are incompatible between these types.": { + "category": "Error", + "code": 2200 + }, + "The types returned by '{0}' are incompatible between these types.": { + "category": "Error", + "code": 2201 + }, + "Call signature return types '{0}' and '{1}' are incompatible.": { + "category": "Error", + "code": 2202, + "elidedInCompatabilityPyramid": true + }, + "Construct signature return types '{0}' and '{1}' are incompatible.": { + "category": "Error", + "code": 2203, + "elidedInCompatabilityPyramid": true + }, + "Call signatures with no arguments have incompatible return types '{0}' and '{1}'.": { + "category": "Error", + "code": 2204, + "elidedInCompatabilityPyramid": true + }, + "Construct signatures with no arguments have incompatible return types '{0}' and '{1}'.": { + "category": "Error", + "code": 2205, + "elidedInCompatabilityPyramid": true + }, "Duplicate identifier '{0}'.": { "category": "Error", @@ -2689,7 +2722,10 @@ "category": "Error", "code": 2773 }, - + "This condition will always return true since the function is always defined. Did you mean to call it instead?": { + "category": "Error", + "code": 2774 + }, "Import declaration '{0}' is using private name '{1}'.": { "category": "Error", "code": 4000 @@ -4003,6 +4039,10 @@ "category": "Message", "code": 6220 }, + "Disable use of source files instead of declaration files from referenced projects.": { + "category": "Message", + "code": 6221 + }, "Projects to reference": { "category": "Message", @@ -4643,6 +4683,10 @@ "category": "Suggestion", "code": 80007 }, + "Numeric literals with absolute values equal to 2^53 or greater are too large to be represented accurately as integers.": { + "category": "Suggestion", + "code": 80008 + }, "Add missing 'super()' call": { "category": "Message", @@ -5124,6 +5168,18 @@ "category": "Message", "code": 95090 }, + "Convert to a bigint numeric literal": { + "category": "Message", + "code": 95091 + }, + "Convert all to bigint numeric literals": { + "category": "Message", + "code": 95092 + }, + "Convert 'const' to 'let'": { + "category": "Message", + "code": 95093 + }, "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer.": { "category": "Error", diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 98a110751ec3d..2ed08f29e212c 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -20,7 +20,7 @@ namespace ts { export function forEachEmittedFile( host: EmitHost, action: (emitFileNames: EmitFileNames, sourceFileOrBundle: SourceFile | Bundle | undefined) => T, sourceFilesOrTargetSourceFile?: readonly SourceFile[] | SourceFile, - emitOnlyDtsFiles = false, + forceDtsEmit = false, onlyBuildInfo?: boolean, includeBuildInfo?: boolean) { const sourceFiles = isArray(sourceFilesOrTargetSourceFile) ? sourceFilesOrTargetSourceFile : getSourceFilesToEmit(host, sourceFilesOrTargetSourceFile); @@ -29,7 +29,7 @@ namespace ts { const prepends = host.getPrependNodes(); if (sourceFiles.length || prepends.length) { const bundle = createBundle(sourceFiles, prepends); - const result = action(getOutputPathsFor(bundle, host, emitOnlyDtsFiles), bundle); + const result = action(getOutputPathsFor(bundle, host, forceDtsEmit), bundle); if (result) { return result; } @@ -38,21 +38,20 @@ namespace ts { else { if (!onlyBuildInfo) { for (const sourceFile of sourceFiles) { - const result = action(getOutputPathsFor(sourceFile, host, emitOnlyDtsFiles), sourceFile); + const result = action(getOutputPathsFor(sourceFile, host, forceDtsEmit), sourceFile); if (result) { return result; } } } if (includeBuildInfo) { - const buildInfoPath = getOutputPathForBuildInfo(host.getCompilerOptions()); + const buildInfoPath = getTsBuildInfoEmitOutputFilePath(host.getCompilerOptions()); if (buildInfoPath) return action({ buildInfoPath }, /*sourceFileOrBundle*/ undefined); } } } - /*@internal*/ - export function getOutputPathForBuildInfo(options: CompilerOptions) { + export function getTsBuildInfoEmitOutputFilePath(options: CompilerOptions) { const configFile = options.configFilePath; if (!isIncrementalCompilation(options)) return undefined; if (options.tsBuildInfoFile) return options.tsBuildInfoFile; @@ -80,7 +79,7 @@ namespace ts { const sourceMapFilePath = jsFilePath && getSourceMapFilePath(jsFilePath, options); const declarationFilePath = (forceDtsPaths || getEmitDeclarations(options)) ? removeFileExtension(outPath) + Extension.Dts : undefined; const declarationMapPath = declarationFilePath && getAreDeclarationMapsEnabled(options) ? declarationFilePath + ".map" : undefined; - const buildInfoPath = getOutputPathForBuildInfo(options); + const buildInfoPath = getTsBuildInfoEmitOutputFilePath(options); return { jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath, buildInfoPath }; } @@ -170,38 +169,71 @@ namespace ts { undefined; } + function createAddOutput() { + let outputs: string[] | undefined; + return { addOutput, getOutputs }; + function addOutput(path: string | undefined) { + if (path) { + (outputs || (outputs = [])).push(path); + } + } + function getOutputs(): readonly string[] { + return outputs || emptyArray; + } + } + + function getSingleOutputFileNames(configFile: ParsedCommandLine, addOutput: ReturnType["addOutput"]) { + const { jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath, buildInfoPath } = getOutputPathsForBundle(configFile.options, /*forceDtsPaths*/ false); + addOutput(jsFilePath); + addOutput(sourceMapFilePath); + addOutput(declarationFilePath); + addOutput(declarationMapPath); + addOutput(buildInfoPath); + } + + function getOwnOutputFileNames(configFile: ParsedCommandLine, inputFileName: string, ignoreCase: boolean, addOutput: ReturnType["addOutput"]) { + if (fileExtensionIs(inputFileName, Extension.Dts)) return; + const js = getOutputJSFileName(inputFileName, configFile, ignoreCase); + addOutput(js); + if (fileExtensionIs(inputFileName, Extension.Json)) return; + if (js && configFile.options.sourceMap) { + addOutput(`${js}.map`); + } + if (getEmitDeclarations(configFile.options) && hasTSFileExtension(inputFileName)) { + const dts = getOutputDeclarationFileName(inputFileName, configFile, ignoreCase); + addOutput(dts); + if (configFile.options.declarationMap) { + addOutput(`${dts}.map`); + } + } + } + /*@internal*/ export function getAllProjectOutputs(configFile: ParsedCommandLine, ignoreCase: boolean): readonly string[] { - let outputs: string[] | undefined; - const addOutput = (path: string | undefined) => path && (outputs || (outputs = [])).push(path); + const { addOutput, getOutputs } = createAddOutput(); if (configFile.options.outFile || configFile.options.out) { - const { jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath, buildInfoPath } = getOutputPathsForBundle(configFile.options, /*forceDtsPaths*/ false); - addOutput(jsFilePath); - addOutput(sourceMapFilePath); - addOutput(declarationFilePath); - addOutput(declarationMapPath); - addOutput(buildInfoPath); + getSingleOutputFileNames(configFile, addOutput); } else { for (const inputFileName of configFile.fileNames) { - if (fileExtensionIs(inputFileName, Extension.Dts)) continue; - const js = getOutputJSFileName(inputFileName, configFile, ignoreCase); - addOutput(js); - if (fileExtensionIs(inputFileName, Extension.Json)) continue; - if (js && configFile.options.sourceMap) { - addOutput(`${js}.map`); - } - if (getEmitDeclarations(configFile.options) && hasTSFileExtension(inputFileName)) { - const dts = getOutputDeclarationFileName(inputFileName, configFile, ignoreCase); - addOutput(dts); - if (configFile.options.declarationMap) { - addOutput(`${dts}.map`); - } - } + getOwnOutputFileNames(configFile, inputFileName, ignoreCase, addOutput); } - addOutput(getOutputPathForBuildInfo(configFile.options)); + addOutput(getTsBuildInfoEmitOutputFilePath(configFile.options)); } - return outputs || emptyArray; + return getOutputs(); + } + + export function getOutputFileNames(commandLine: ParsedCommandLine, inputFileName: string, ignoreCase: boolean): readonly string[] { + inputFileName = normalizePath(inputFileName); + Debug.assert(contains(commandLine.fileNames, inputFileName), `Expected fileName to be present in command line`); + const { addOutput, getOutputs } = createAddOutput(); + if (commandLine.options.outFile || commandLine.options.out) { + getSingleOutputFileNames(commandLine, addOutput); + } + else { + getOwnOutputFileNames(commandLine, inputFileName, ignoreCase, addOutput); + } + return getOutputs(); } /*@internal*/ @@ -220,14 +252,14 @@ namespace ts { return getOutputDeclarationFileName(inputFileName, configFile, ignoreCase); } } - const buildInfoPath = getOutputPathForBuildInfo(configFile.options); + const buildInfoPath = getTsBuildInfoEmitOutputFilePath(configFile.options); if (buildInfoPath) return buildInfoPath; return Debug.fail(`project ${configFile.options.configFilePath} expected to have at least one output`); } /*@internal*/ // targetSourceFile is when users only want one file in entire project to be emitted. This is used in compileOnSave feature - export function emitFiles(resolver: EmitResolver, host: EmitHost, targetSourceFile: SourceFile | undefined, { scriptTransformers, declarationTransformers }: EmitTransformers, emitOnlyDtsFiles?: boolean, onlyBuildInfo?: boolean): EmitResult { + export function emitFiles(resolver: EmitResolver, host: EmitHost, targetSourceFile: SourceFile | undefined, { scriptTransformers, declarationTransformers }: EmitTransformers, emitOnlyDtsFiles?: boolean, onlyBuildInfo?: boolean, forceDtsEmit?: boolean): EmitResult { const compilerOptions = host.getCompilerOptions(); const sourceMapDataList: SourceMapEmitResult[] | undefined = (compilerOptions.sourceMap || compilerOptions.inlineSourceMap || getAreDeclarationMapsEnabled(compilerOptions)) ? [] : undefined; const emittedFilesList: string[] | undefined = compilerOptions.listEmittedFiles ? [] : undefined; @@ -241,7 +273,14 @@ namespace ts { // Emit each output file enter(); - forEachEmittedFile(host, emitSourceFileOrBundle, getSourceFilesToEmit(host, targetSourceFile), emitOnlyDtsFiles, onlyBuildInfo, !targetSourceFile); + forEachEmittedFile( + host, + emitSourceFileOrBundle, + getSourceFilesToEmit(host, targetSourceFile), + forceDtsEmit, + onlyBuildInfo, + !targetSourceFile + ); exit(); @@ -400,7 +439,7 @@ namespace ts { }); const declBlocked = (!!declarationTransform.diagnostics && !!declarationTransform.diagnostics.length) || !!host.isEmitBlocked(declarationFilePath) || !!compilerOptions.noEmit; emitSkipped = emitSkipped || declBlocked; - if (!declBlocked || emitOnlyDtsFiles) { + if (!declBlocked || forceDtsEmit) { Debug.assert(declarationTransform.transformed.length === 1, "Should only see one output from the decl transform"); printSourceFileOrBundle( declarationFilePath, @@ -415,7 +454,7 @@ namespace ts { // Explicitly do not passthru either `inline` option } ); - if (emitOnlyDtsFiles && declarationTransform.transformed[0].kind === SyntaxKind.SourceFile) { + if (forceDtsEmit && declarationTransform.transformed[0].kind === SyntaxKind.SourceFile) { const sourceFile = declarationTransform.transformed[0]; exportedModulesFromDeclarationEmit = sourceFile.exportedModulesFromDeclarationEmit; } @@ -1907,11 +1946,17 @@ namespace ts { // function emitTypePredicate(node: TypePredicateNode) { + if (node.assertsModifier) { + emit(node.assertsModifier); + writeSpace(); + } emit(node.parameterName); - writeSpace(); - writeKeyword("is"); - writeSpace(); - emit(node.type); + if (node.type) { + writeSpace(); + writeKeyword("is"); + writeSpace(); + emit(node.type); + } } function emitTypeReference(node: TypeReferenceNode) { diff --git a/src/compiler/factory.ts b/src/compiler/factory.ts index 033299cd587f6..bd2dcbee6f188 100644 --- a/src/compiler/factory.ts +++ b/src/compiler/factory.ts @@ -669,16 +669,26 @@ namespace ts { } export function createTypePredicateNode(parameterName: Identifier | ThisTypeNode | string, type: TypeNode) { + return createTypePredicateNodeWithModifier(/*assertsModifier*/ undefined, parameterName, type); + } + + export function createTypePredicateNodeWithModifier(assertsModifier: AssertsToken | undefined, parameterName: Identifier | ThisTypeNode | string, type: TypeNode | undefined) { const node = createSynthesizedNode(SyntaxKind.TypePredicate) as TypePredicateNode; + node.assertsModifier = assertsModifier; node.parameterName = asName(parameterName); node.type = type; return node; } export function updateTypePredicateNode(node: TypePredicateNode, parameterName: Identifier | ThisTypeNode, type: TypeNode) { - return node.parameterName !== parameterName + return updateTypePredicateNodeWithModifier(node, node.assertsModifier, parameterName, type); + } + + export function updateTypePredicateNodeWithModifier(node: TypePredicateNode, assertsModifier: AssertsToken | undefined, parameterName: Identifier | ThisTypeNode, type: TypeNode | undefined) { + return node.assertsModifier !== assertsModifier + || node.parameterName !== parameterName || node.type !== type - ? updateNode(createTypePredicateNode(parameterName, type), node) + ? updateNode(createTypePredicateNodeWithModifier(assertsModifier, parameterName, type), node) : node; } diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 292c72fd160b7..edaa7ebeaebaa 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -165,7 +165,8 @@ namespace ts { return visitNode(cbNode, (node).typeName) || visitNodes(cbNode, cbNodes, (node).typeArguments); case SyntaxKind.TypePredicate: - return visitNode(cbNode, (node).parameterName) || + return visitNode(cbNode, (node).assertsModifier) || + visitNode(cbNode, (node).parameterName) || visitNode(cbNode, (node).type); case SyntaxKind.TypeQuery: return visitNode(cbNode, (node).exprName); @@ -770,7 +771,11 @@ namespace ts { fixupParentReferences(sourceFile); } + sourceFile.nodeCount = nodeCount; + sourceFile.identifierCount = identifierCount; + sourceFile.identifiers = identifiers; sourceFile.parseDiagnostics = parseDiagnostics; + const result = sourceFile as JsonSourceFile; clearState(); return result; @@ -2121,7 +2126,7 @@ namespace ts { // We didn't get a comma, and the list wasn't terminated, explicitly parse // out a comma so we give a good error message. - parseExpected(SyntaxKind.CommaToken); + parseExpected(SyntaxKind.CommaToken, getExpectedCommaDiagnostic(kind)); // If the token was a semicolon, and the caller allows that, then skip it and // continue. This ensures we get back on track and don't result in tons of @@ -2164,6 +2169,10 @@ namespace ts { return result; } + function getExpectedCommaDiagnostic(kind: ParsingContext) { + return kind === ParsingContext.EnumMembers ? Diagnostics.An_enum_member_name_must_be_followed_by_a_or : undefined; + } + interface MissingList extends NodeArray { isMissingList: true; } @@ -3033,6 +3042,8 @@ namespace ts { return parseParenthesizedType(); case SyntaxKind.ImportKeyword: return parseImportType(); + case SyntaxKind.AssertsKeyword: + return lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine) ? parseAssertsTypePredicate() : parseTypeReference(); default: return parseTypeReference(); } @@ -3073,6 +3084,7 @@ namespace ts { case SyntaxKind.DotDotDotToken: case SyntaxKind.InferKeyword: case SyntaxKind.ImportKeyword: + case SyntaxKind.AssertsKeyword: return true; case SyntaxKind.FunctionKeyword: return !inStartOfParameter; @@ -3249,6 +3261,7 @@ namespace ts { const type = parseType(); if (typePredicateVariable) { const node = createNode(SyntaxKind.TypePredicate, typePredicateVariable.pos); + node.assertsModifier = undefined; node.parameterName = typePredicateVariable; node.type = type; return finishNode(node); @@ -3266,6 +3279,14 @@ namespace ts { } } + function parseAssertsTypePredicate(): TypeNode { + const node = createNode(SyntaxKind.TypePredicate); + node.assertsModifier = parseExpectedToken(SyntaxKind.AssertsKeyword); + node.parameterName = token() === SyntaxKind.ThisKeyword ? parseThisTypeNode() : parseIdentifier(); + node.type = parseOptional(SyntaxKind.IsKeyword) ? parseType() : undefined; + return finishNode(node); + } + function parseType(): TypeNode { // The rules about 'yield' only apply to actual code/expression contexts. They don't // apply to 'type' contexts. So we disable these parameters here before moving on. diff --git a/src/compiler/program.ts b/src/compiler/program.ts index ff24b7a9d42fb..04c2c8d2c770b 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -817,6 +817,8 @@ namespace ts { let resolvedProjectReferences: readonly (ResolvedProjectReference | undefined)[] | undefined; let projectReferenceRedirects: Map | undefined; let mapFromFileToProjectReferenceRedirects: Map | undefined; + let mapFromToProjectReferenceRedirectSource: Map | undefined; + const useSourceOfProjectReferenceRedirect = !!host.useSourceOfProjectReferenceRedirect && host.useSourceOfProjectReferenceRedirect(); const shouldCreateNewSourceFile = shouldProgramCreateNewSourceFiles(oldProgram, options); // We set `structuralIsReused` to `undefined` because `tryReuseStructureFromOldProgram` calls `tryReuseStructureFromOldProgram` which checks @@ -831,17 +833,32 @@ namespace ts { if (!resolvedProjectReferences) { resolvedProjectReferences = projectReferences.map(parseProjectReferenceConfigFile); } + if (host.setResolvedProjectReferenceCallbacks) { + host.setResolvedProjectReferenceCallbacks({ + getSourceOfProjectReferenceRedirect, + forEachResolvedProjectReference + }); + } if (rootNames.length) { for (const parsedRef of resolvedProjectReferences) { if (!parsedRef) continue; const out = parsedRef.commandLine.options.outFile || parsedRef.commandLine.options.out; - if (out) { - processSourceFile(changeExtension(out, ".d.ts"), /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false, /*packageId*/ undefined); + if (useSourceOfProjectReferenceRedirect) { + if (out || getEmitModuleKind(parsedRef.commandLine.options) === ModuleKind.None) { + for (const fileName of parsedRef.commandLine.fileNames) { + processSourceFile(fileName, /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false, /*packageId*/ undefined); + } + } } - else if (getEmitModuleKind(parsedRef.commandLine.options) === ModuleKind.None) { - for (const fileName of parsedRef.commandLine.fileNames) { - if (!fileExtensionIs(fileName, Extension.Dts) && hasTSFileExtension(fileName)) { - processSourceFile(getOutputDeclarationFileName(fileName, parsedRef.commandLine, !host.useCaseSensitiveFileNames()), /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false, /*packageId*/ undefined); + else { + if (out) { + processSourceFile(changeExtension(out, ".d.ts"), /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false, /*packageId*/ undefined); + } + else if (getEmitModuleKind(parsedRef.commandLine.options) === ModuleKind.None) { + for (const fileName of parsedRef.commandLine.fileNames) { + if (!fileExtensionIs(fileName, Extension.Dts) && hasTSFileExtension(fileName)) { + processSourceFile(getOutputDeclarationFileName(fileName, parsedRef.commandLine, !host.useCaseSensitiveFileNames()), /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false, /*packageId*/ undefined); + } } } } @@ -955,6 +972,7 @@ namespace ts { getResolvedProjectReferenceToRedirect, getResolvedProjectReferenceByPath, forEachResolvedProjectReference, + isSourceOfProjectReferenceRedirect, emitBuildInfo }; @@ -987,9 +1005,15 @@ namespace ts { return ts.toPath(fileName, currentDirectory, getCanonicalFileName); } + function isValidSourceFileForEmit(file: SourceFile) { + // source file is allowed to be emitted and its not source of project reference redirect + return sourceFileMayBeEmitted(file, options, isSourceFileFromExternalLibrary, getResolvedProjectReferenceToRedirect) && + !isSourceOfProjectReferenceRedirect(file.fileName); + } + function getCommonSourceDirectory() { if (commonSourceDirectory === undefined) { - const emittedFiles = filter(files, file => sourceFileMayBeEmitted(file, options, isSourceFileFromExternalLibrary, getResolvedProjectReferenceToRedirect)); + const emittedFiles = filter(files, file => isValidSourceFileForEmit(file)); if (options.rootDir && checkSourceFilesBelongToPath(emittedFiles, options.rootDir)) { // If a rootDir is specified use it as the commonSourceDirectory commonSourceDirectory = getNormalizedAbsolutePath(options.rootDir, currentDirectory); @@ -1220,6 +1244,12 @@ namespace ts { } if (projectReferences) { resolvedProjectReferences = projectReferences.map(parseProjectReferenceConfigFile); + if (host.setResolvedProjectReferenceCallbacks) { + host.setResolvedProjectReferenceCallbacks({ + getSourceOfProjectReferenceRedirect, + forEachResolvedProjectReference + }); + } } // check if program source files has changed in the way that can affect structure of the program @@ -1359,18 +1389,16 @@ namespace ts { // try to verify results of module resolution for (const { oldFile: oldSourceFile, newFile: newSourceFile } of modifiedSourceFiles) { const newSourceFilePath = getNormalizedAbsolutePath(newSourceFile.originalFileName, currentDirectory); - if (resolveModuleNamesWorker) { - const moduleNames = getModuleNames(newSourceFile); - const resolutions = resolveModuleNamesReusingOldState(moduleNames, newSourceFilePath, newSourceFile); - // ensure that module resolution results are still correct - const resolutionsChanged = hasChangesInResolutions(moduleNames, resolutions, oldSourceFile.resolvedModules, moduleResolutionIsEqualTo); - if (resolutionsChanged) { - oldProgram.structureIsReused = StructureIsReused.SafeModules; - newSourceFile.resolvedModules = zipToMap(moduleNames, resolutions); - } - else { - newSourceFile.resolvedModules = oldSourceFile.resolvedModules; - } + const moduleNames = getModuleNames(newSourceFile); + const resolutions = resolveModuleNamesReusingOldState(moduleNames, newSourceFilePath, newSourceFile); + // ensure that module resolution results are still correct + const resolutionsChanged = hasChangesInResolutions(moduleNames, resolutions, oldSourceFile.resolvedModules, moduleResolutionIsEqualTo); + if (resolutionsChanged) { + oldProgram.structureIsReused = StructureIsReused.SafeModules; + newSourceFile.resolvedModules = zipToMap(moduleNames, resolutions); + } + else { + newSourceFile.resolvedModules = oldSourceFile.resolvedModules; } if (resolveTypeReferenceDirectiveNamesWorker) { // We lower-case all type references because npm automatically lowercases all packages. See GH#9824. @@ -1403,6 +1431,13 @@ namespace ts { for (const newSourceFile of newSourceFiles) { const filePath = newSourceFile.path; addFileToFilesByName(newSourceFile, filePath, newSourceFile.resolvedPath); + if (useSourceOfProjectReferenceRedirect) { + const redirectProject = getProjectReferenceRedirectProject(newSourceFile.fileName); + if (redirectProject && !(redirectProject.commandLine.options.outFile || redirectProject.commandLine.options.out)) { + const redirect = getProjectReferenceOutputName(redirectProject, newSourceFile.fileName); + addFileToFilesByName(newSourceFile, toPath(redirect), /*redirectedPath*/ undefined); + } + } // Set the file as found during node modules search if it was found that way in old progra, if (oldProgram.isSourceFileFromExternalLibrary(oldProgram.getSourceFileByPath(newSourceFile.resolvedPath)!)) { sourceFilesFoundSearchingNodeModules.set(filePath, true); @@ -1530,18 +1565,18 @@ namespace ts { return noDiagnosticsTypeChecker || (noDiagnosticsTypeChecker = createTypeChecker(program, /*produceDiagnostics:*/ false)); } - function emit(sourceFile?: SourceFile, writeFileCallback?: WriteFileCallback, cancellationToken?: CancellationToken, emitOnlyDtsFiles?: boolean, transformers?: CustomTransformers): EmitResult { - return runWithCancellationToken(() => emitWorker(program, sourceFile, writeFileCallback, cancellationToken, emitOnlyDtsFiles, transformers)); + function emit(sourceFile?: SourceFile, writeFileCallback?: WriteFileCallback, cancellationToken?: CancellationToken, emitOnlyDtsFiles?: boolean, transformers?: CustomTransformers, forceDtsEmit?: boolean): EmitResult { + return runWithCancellationToken(() => emitWorker(program, sourceFile, writeFileCallback, cancellationToken, emitOnlyDtsFiles, transformers, forceDtsEmit)); } function isEmitBlocked(emitFileName: string): boolean { return hasEmitBlockingDiagnostics.has(toPath(emitFileName)); } - function emitWorker(program: Program, sourceFile: SourceFile | undefined, writeFileCallback: WriteFileCallback | undefined, cancellationToken: CancellationToken | undefined, emitOnlyDtsFiles?: boolean, customTransformers?: CustomTransformers): EmitResult { + function emitWorker(program: Program, sourceFile: SourceFile | undefined, writeFileCallback: WriteFileCallback | undefined, cancellationToken: CancellationToken | undefined, emitOnlyDtsFiles?: boolean, customTransformers?: CustomTransformers, forceDtsEmit?: boolean): EmitResult { let declarationDiagnostics: readonly Diagnostic[] = []; - if (!emitOnlyDtsFiles) { + if (!forceDtsEmit) { if (options.noEmit) { return { diagnostics: declarationDiagnostics, sourceMaps: undefined, emittedFiles: undefined, emitSkipped: true }; } @@ -1590,6 +1625,8 @@ namespace ts { sourceFile, getTransformers(options, customTransformers, emitOnlyDtsFiles), emitOnlyDtsFiles, + /*onlyBuildInfo*/ false, + forceDtsEmit ); performance.mark("afterEmit"); @@ -1680,7 +1717,7 @@ namespace ts { function getSemanticDiagnosticsForFileNoCache(sourceFile: SourceFile, cancellationToken: CancellationToken): Diagnostic[] | undefined { return runWithCancellationToken(() => { - if (skipTypeChecking(sourceFile, options)) { + if (skipTypeChecking(sourceFile, options, program)) { return emptyArray; } @@ -1757,13 +1794,12 @@ namespace ts { switch (parent.kind) { case SyntaxKind.Parameter: case SyntaxKind.PropertyDeclaration: - if ((parent).questionToken === node) { + case SyntaxKind.MethodDeclaration: + if ((parent).questionToken === node) { diagnostics.push(createDiagnosticForNode(node, Diagnostics._0_can_only_be_used_in_a_ts_file, "?")); return; } - // falls through - - case SyntaxKind.MethodDeclaration: + // falls through case SyntaxKind.MethodSignature: case SyntaxKind.Constructor: case SyntaxKind.GetAccessor: @@ -1833,7 +1869,6 @@ namespace ts { case SyntaxKind.ClassDeclaration: case SyntaxKind.ClassExpression: case SyntaxKind.MethodDeclaration: - case SyntaxKind.MethodSignature: case SyntaxKind.Constructor: case SyntaxKind.GetAccessor: case SyntaxKind.SetAccessor: @@ -1841,7 +1876,7 @@ namespace ts { case SyntaxKind.FunctionDeclaration: case SyntaxKind.ArrowFunction: // Check type parameters - if (nodes === (parent).typeParameters) { + if (nodes === (parent).typeParameters) { diagnostics.push(createDiagnosticForNodeArray(nodes, Diagnostics.type_parameter_declarations_can_only_be_used_in_a_ts_file)); return; } @@ -1849,8 +1884,8 @@ namespace ts { case SyntaxKind.VariableStatement: // Check modifiers - if (nodes === (parent).modifiers) { - return checkModifiers(>nodes, parent.kind === SyntaxKind.VariableStatement); + if (nodes === parent.modifiers) { + return checkModifiers(parent.modifiers, parent.kind === SyntaxKind.VariableStatement); } break; case SyntaxKind.PropertyDeclaration: @@ -1876,8 +1911,9 @@ namespace ts { case SyntaxKind.ExpressionWithTypeArguments: case SyntaxKind.JsxSelfClosingElement: case SyntaxKind.JsxOpeningElement: + case SyntaxKind.TaggedTemplateExpression: // Check type arguments - if (nodes === (parent).typeArguments) { + if (nodes === (parent).typeArguments) { diagnostics.push(createDiagnosticForNodeArray(nodes, Diagnostics.type_arguments_can_only_be_used_in_a_ts_file)); return; } @@ -2233,6 +2269,16 @@ namespace ts { // Get source file from normalized fileName function findSourceFile(fileName: string, path: Path, isDefaultLib: boolean, ignoreNoDefaultLib: boolean, refFile: RefFile | undefined, packageId: PackageId | undefined): SourceFile | undefined { + if (useSourceOfProjectReferenceRedirect) { + const source = getSourceOfProjectReferenceRedirect(fileName); + if (source) { + const file = isString(source) ? + findSourceFile(source, toPath(source), isDefaultLib, ignoreNoDefaultLib, refFile, packageId) : + undefined; + if (file) addFileToFilesByName(file, path, /*redirectedPath*/ undefined); + return file; + } + } const originalFileName = fileName; if (filesByName.has(path)) { const file = filesByName.get(path); @@ -2281,7 +2327,7 @@ namespace ts { } let redirectedPath: Path | undefined; - if (refFile) { + if (refFile && !useSourceOfProjectReferenceRedirect) { const redirectProject = getProjectReferenceRedirectProject(fileName); if (redirectProject) { if (redirectProject.commandLine.options.outFile || redirectProject.commandLine.options.out) { @@ -2450,6 +2496,36 @@ namespace ts { }); } + function getSourceOfProjectReferenceRedirect(file: string) { + if (!isDeclarationFileName(file)) return undefined; + if (mapFromToProjectReferenceRedirectSource === undefined) { + mapFromToProjectReferenceRedirectSource = createMap(); + forEachResolvedProjectReference(resolvedRef => { + if (resolvedRef) { + const out = resolvedRef.commandLine.options.outFile || resolvedRef.commandLine.options.out; + if (out) { + // Dont know which source file it means so return true? + const outputDts = changeExtension(out, Extension.Dts); + mapFromToProjectReferenceRedirectSource!.set(toPath(outputDts), true); + } + else { + forEach(resolvedRef.commandLine.fileNames, fileName => { + if (!fileExtensionIs(fileName, Extension.Dts) && hasTSFileExtension(fileName)) { + const outputDts = getOutputDeclarationFileName(fileName, resolvedRef.commandLine, host.useCaseSensitiveFileNames()); + mapFromToProjectReferenceRedirectSource!.set(toPath(outputDts), fileName); + } + }); + } + } + }); + } + return mapFromToProjectReferenceRedirectSource.get(toPath(file)); + } + + function isSourceOfProjectReferenceRedirect(fileName: string) { + return useSourceOfProjectReferenceRedirect && !!getResolvedProjectReferenceToRedirect(fileName); + } + function forEachProjectReference( projectReferences: readonly ProjectReference[] | undefined, resolvedProjectReferences: readonly (ResolvedProjectReference | undefined)[] | undefined, @@ -2806,10 +2882,6 @@ namespace ts { } if (options.isolatedModules) { - if (getEmitDeclarations(options)) { - createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, getEmitDeclarationOptionName(options), "isolatedModules"); - } - if (options.out) { createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedModules"); } @@ -2861,8 +2933,7 @@ namespace ts { const rootPaths = arrayToSet(rootNames, toPath); for (const file of files) { // Ignore file that is not emitted - if (!sourceFileMayBeEmitted(file, options, isSourceFileFromExternalLibrary, getResolvedProjectReferenceToRedirect)) continue; - if (!rootPaths.has(file.path)) { + if (isValidSourceFileForEmit(file) && !rootPaths.has(file.path)) { addProgramDiagnosticAtRefPath( file, rootPaths, @@ -3107,7 +3178,7 @@ namespace ts { } function verifyProjectReferences() { - const buildInfoPath = !options.noEmit && !options.suppressOutputPathCheck ? getOutputPathForBuildInfo(options) : undefined; + const buildInfoPath = !options.noEmit && !options.suppressOutputPathCheck ? getTsBuildInfoEmitOutputFilePath(options) : undefined; forEachProjectReference(projectReferences, resolvedProjectReferences, (resolvedRef, index, parent) => { const ref = (parent ? parent.commandLine.projectReferences : projectReferences)![index]; const parentFile = parent && parent.sourceFile as JsonSourceFile; @@ -3134,7 +3205,7 @@ namespace ts { createDiagnosticForReference(parentFile, index, Diagnostics.Cannot_prepend_project_0_because_it_does_not_have_outFile_set, ref.path); } } - if (!parent && buildInfoPath && buildInfoPath === getOutputPathForBuildInfo(options)) { + if (!parent && buildInfoPath && buildInfoPath === getTsBuildInfoEmitOutputFilePath(options)) { createDiagnosticForReference(parentFile, index, Diagnostics.Cannot_write_file_0_because_it_will_overwrite_tsbuildinfo_file_generated_by_referenced_project_1, buildInfoPath, ref.path); hasEmitBlockingDiagnostics.set(toPath(buildInfoPath), true); } diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index ad60d29866db6..1de4327d2b4df 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -66,6 +66,7 @@ namespace ts { abstract: SyntaxKind.AbstractKeyword, any: SyntaxKind.AnyKeyword, as: SyntaxKind.AsKeyword, + asserts: SyntaxKind.AssertsKeyword, bigint: SyntaxKind.BigIntKeyword, boolean: SyntaxKind.BooleanKeyword, break: SyntaxKind.BreakKeyword, diff --git a/src/compiler/sys.ts b/src/compiler/sys.ts index 2d6286a379e01..6a3f4ed86bdd7 100644 --- a/src/compiler/sys.ts +++ b/src/compiler/sys.ts @@ -522,6 +522,33 @@ namespace ts { } } + function recursiveCreateDirectory(directoryPath: string, sys: System) { + const basePath = getDirectoryPath(directoryPath); + const shouldCreateParent = basePath !== "" && directoryPath !== basePath && !sys.directoryExists(basePath); + if (shouldCreateParent) { + recursiveCreateDirectory(basePath, sys); + } + if (shouldCreateParent || !sys.directoryExists(directoryPath)) { + sys.createDirectory(directoryPath); + } + } + + /** + * patch writefile to create folder before writing the file + */ + /*@internal*/ + export function patchWriteFileEnsuringDirectory(sys: System) { + // patch writefile to create folder before writing the file + const originalWriteFile = sys.writeFile; + sys.writeFile = (path, data, writeBom) => { + const directoryPath = getDirectoryPath(normalizeSlashes(path)); + if (directoryPath && !sys.directoryExists(directoryPath)) { + recursiveCreateDirectory(directoryPath, sys); + } + originalWriteFile.call(sys, path, data, writeBom); + }; + } + /*@internal*/ export type BufferEncoding = "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "latin1" | "binary" | "hex"; @@ -651,6 +678,8 @@ namespace ts { base64decode?(input: string): string; base64encode?(input: string): string; /*@internal*/ bufferFrom?(input: string, encoding?: string): Buffer; + // For testing + /*@internal*/ now?(): Date; } export interface FileWatcher { @@ -1365,17 +1394,6 @@ namespace ts { }; } - function recursiveCreateDirectory(directoryPath: string, sys: System) { - const basePath = getDirectoryPath(directoryPath); - const shouldCreateParent = basePath !== "" && directoryPath !== basePath && !sys.directoryExists(basePath); - if (shouldCreateParent) { - recursiveCreateDirectory(basePath, sys); - } - if (shouldCreateParent || !sys.directoryExists(directoryPath)) { - sys.createDirectory(directoryPath); - } - } - let sys: System | undefined; if (typeof ChakraHost !== "undefined") { sys = getChakraSystem(); @@ -1387,14 +1405,7 @@ namespace ts { } if (sys) { // patch writefile to create folder before writing the file - const originalWriteFile = sys.writeFile; - sys.writeFile = (path, data, writeBom) => { - const directoryPath = getDirectoryPath(normalizeSlashes(path)); - if (directoryPath && !sys!.directoryExists(directoryPath)) { - recursiveCreateDirectory(directoryPath, sys!); - } - originalWriteFile.call(sys, path, data, writeBom); - }; + patchWriteFileEnsuringDirectory(sys); } return sys!; })(); diff --git a/src/compiler/transformers/classFields.ts b/src/compiler/transformers/classFields.ts index 4efe4ad7b3849..37473d9bb20ec 100644 --- a/src/compiler/transformers/classFields.ts +++ b/src/compiler/transformers/classFields.ts @@ -337,7 +337,7 @@ namespace ts { if (constructor && constructor.body) { let parameterPropertyDeclarationCount = 0; for (let i = indexOfFirstStatement; i < constructor.body.statements.length; i++) { - if (isParameterPropertyDeclaration(getOriginalNode(constructor.body.statements[i]))) { + if (isParameterPropertyDeclaration(getOriginalNode(constructor.body.statements[i]), constructor)) { parameterPropertyDeclarationCount++; } else { diff --git a/src/compiler/transformers/declarations/diagnostics.ts b/src/compiler/transformers/declarations/diagnostics.ts index 61d4dd30a6726..91c960ea9427d 100644 --- a/src/compiler/transformers/declarations/diagnostics.ts +++ b/src/compiler/transformers/declarations/diagnostics.ts @@ -135,7 +135,7 @@ namespace ts { return getReturnTypeVisibilityError; } else if (isParameter(node)) { - if (isParameterPropertyDeclaration(node) && hasModifier(node.parent, ModifierFlags.Private)) { + if (isParameterPropertyDeclaration(node, node.parent) && hasModifier(node.parent, ModifierFlags.Private)) { return getVariableDeclarationTypeVisibilityError; } return getParameterDeclarationTypeVisibilityError; diff --git a/src/compiler/transformers/generators.ts b/src/compiler/transformers/generators.ts index 3b1a8379e07d7..cc16aef60093f 100644 --- a/src/compiler/transformers/generators.ts +++ b/src/compiler/transformers/generators.ts @@ -2871,7 +2871,7 @@ namespace ts { function tryEnterOrLeaveBlock(operationIndex: number): void { if (blocks) { for (; blockIndex < blockActions!.length && blockOffsets![blockIndex] <= operationIndex; blockIndex++) { - const block = blocks[blockIndex]; + const block: CodeBlock = blocks[blockIndex]; const blockAction = blockActions![blockIndex]; switch (block.kind) { case CodeBlockKind.Exception: diff --git a/src/compiler/transformers/ts.ts b/src/compiler/transformers/ts.ts index 4cbc8e565dfcb..06b3fb53ec180 100644 --- a/src/compiler/transformers/ts.ts +++ b/src/compiler/transformers/ts.ts @@ -895,7 +895,7 @@ namespace ts { const members: ClassElement[] = []; const constructor = getFirstConstructorWithBody(node); const parametersWithPropertyAssignments = constructor && - filter(constructor.parameters, isParameterPropertyDeclaration); + filter(constructor.parameters, p => isParameterPropertyDeclaration(p, constructor)); if (parametersWithPropertyAssignments) { for (const parameter of parametersWithPropertyAssignments) { @@ -1907,7 +1907,7 @@ namespace ts { function transformConstructorBody(body: Block, constructor: ConstructorDeclaration) { const parametersWithPropertyAssignments = constructor && - filter(constructor.parameters, isParameterPropertyDeclaration); + filter(constructor.parameters, p => isParameterPropertyDeclaration(p, constructor)); if (!some(parametersWithPropertyAssignments)) { return visitFunctionBody(body, visitor, context); } diff --git a/src/compiler/tsbuild.ts b/src/compiler/tsbuild.ts index 6811b1394ac77..2f152d294a769 100644 --- a/src/compiler/tsbuild.ts +++ b/src/compiler/tsbuild.ts @@ -308,6 +308,7 @@ namespace ts { /*@internal*/ getUpToDateStatusOfProject(project: string): UpToDateStatus; /*@internal*/ invalidateProject(configFilePath: ResolvedConfigFilePath, reloadLevel?: ConfigFileProgramReloadLevel): void; /*@internal*/ buildNextInvalidatedProject(): void; + /*@internal*/ getAllParsedConfigs(): readonly ParsedCommandLine[]; } /** @@ -315,7 +316,7 @@ namespace ts { */ export function createBuilderStatusReporter(system: System, pretty?: boolean): DiagnosticReporter { return diagnostic => { - let output = pretty ? `[${formatColorAndReset(new Date().toLocaleTimeString(), ForegroundColorEscapeSequences.Grey)}] ` : `${new Date().toLocaleTimeString()} - `; + let output = pretty ? `[${formatColorAndReset(getLocaleTimeString(system), ForegroundColorEscapeSequences.Grey)}] ` : `${getLocaleTimeString(system)} - `; output += `${flattenDiagnosticMessageText(diagnostic.messageText, system.newLine)}${system.newLine + system.newLine}`; system.write(output); }; @@ -1620,7 +1621,7 @@ namespace ts { if (!state.buildInfoChecked.has(resolvedPath)) { state.buildInfoChecked.set(resolvedPath, true); - const buildInfoPath = getOutputPathForBuildInfo(project.options); + const buildInfoPath = getTsBuildInfoEmitOutputFilePath(project.options); if (buildInfoPath) { const value = state.readFileWithCache(buildInfoPath); const buildInfo = value && getBuildInfo(value); @@ -2047,6 +2048,10 @@ namespace ts { }, invalidateProject: (configFilePath, reloadLevel) => invalidateProject(state, configFilePath, reloadLevel || ConfigFileProgramReloadLevel.None), buildNextInvalidatedProject: () => buildNextInvalidatedProject(state), + getAllParsedConfigs: () => arrayFrom(mapDefinedIterator( + state.configFileCache.values(), + config => isParsedCommandLine(config) ? config : undefined + )), }; } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 0fbbda52a71b0..def1074ee101d 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -32,6 +32,7 @@ namespace ts { | SyntaxKind.AbstractKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsKeyword + | SyntaxKind.AssertsKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.BreakKeyword @@ -250,6 +251,7 @@ namespace ts { // Contextual keywords AbstractKeyword, AsKeyword, + AssertsKeyword, AnyKeyword, AsyncKeyword, AwaitKeyword, @@ -361,8 +363,8 @@ namespace ts { SemicolonClassElement, // Element Block, - VariableStatement, EmptyStatement, + VariableStatement, ExpressionStatement, IfStatement, DoStatement, @@ -512,6 +514,8 @@ namespace ts { LastTemplateToken = TemplateTail, FirstBinaryOperator = LessThanToken, LastBinaryOperator = CaretEqualsToken, + FirstStatement = VariableStatement, + LastStatement = DebuggerStatement, FirstNode = QualifiedName, FirstJSDocNode = JSDocTypeExpression, LastJSDocNode = JSDocPropertyTag, @@ -614,9 +618,13 @@ namespace ts { /* @internal */ export const enum RelationComparisonResult { - Succeeded = 1, // Should be truthy - Failed = 2, - FailedAndReported = 3 + Succeeded = 1 << 0, // Should be truthy + Failed = 1 << 1, + Reported = 1 << 2, + + ReportsUnmeasurable = 1 << 3, + ReportsUnreliable = 1 << 4, + ReportsMask = ReportsUnmeasurable | ReportsUnreliable } export interface Node extends TextRange { @@ -736,6 +744,7 @@ namespace ts { export type AwaitKeywordToken = Token; export type PlusToken = Token; export type MinusToken = Token; + export type AssertsToken = Token; export type Modifier = Token @@ -1037,6 +1046,7 @@ namespace ts { questionToken?: QuestionToken; exclamationToken?: ExclamationToken; body?: Block | Expression; + /* @internal */ endFlowNode?: FlowNode; } export type FunctionLikeDeclaration = @@ -1180,8 +1190,9 @@ namespace ts { export interface TypePredicateNode extends TypeNode { kind: SyntaxKind.TypePredicate; parent: SignatureDeclaration | JSDocTypeExpression; + assertsModifier?: AssertsToken; parameterName: Identifier | ThisTypeNode; - type: TypeNode; + type?: TypeNode; } export interface TypeQueryNode extends TypeNode { @@ -2570,16 +2581,33 @@ namespace ts { FalseCondition = 1 << 6, // Condition known to be false SwitchClause = 1 << 7, // Switch statement clause ArrayMutation = 1 << 8, // Potential array mutation - Referenced = 1 << 9, // Referenced as antecedent once - Shared = 1 << 10, // Referenced as antecedent more than once - PreFinally = 1 << 11, // Injected edge that links pre-finally label and pre-try flow - AfterFinally = 1 << 12, // Injected edge that links post-finally flow with the rest of the graph + Call = 1 << 9, // Potential assertion call + Referenced = 1 << 10, // Referenced as antecedent once + Shared = 1 << 11, // Referenced as antecedent more than once + PreFinally = 1 << 12, // Injected edge that links pre-finally label and pre-try flow + AfterFinally = 1 << 13, // Injected edge that links post-finally flow with the rest of the graph /** @internal */ - Cached = 1 << 13, // Indicates that at least one cross-call cache entry exists for this node, even if not a loop participant + Cached = 1 << 14, // Indicates that at least one cross-call cache entry exists for this node, even if not a loop participant Label = BranchLabel | LoopLabel, Condition = TrueCondition | FalseCondition } + export type FlowNode = + | AfterFinallyFlow + | PreFinallyFlow + | FlowStart + | FlowLabel + | FlowAssignment + | FlowCall + | FlowCondition + | FlowSwitchClause + | FlowArrayMutation; + + export interface FlowNodeBase { + flags: FlowFlags; + id?: number; // Node id used by flow type cache in checker + } + export interface FlowLock { locked?: boolean; } @@ -2593,18 +2621,11 @@ namespace ts { lock: FlowLock; } - export type FlowNode = - | AfterFinallyFlow | PreFinallyFlow | FlowStart | FlowLabel | FlowAssignment | FlowCondition | FlowSwitchClause | FlowArrayMutation; - export interface FlowNodeBase { - flags: FlowFlags; - id?: number; // Node id used by flow type cache in checker - } - // FlowStart represents the start of a control flow. For a function expression or arrow - // function, the container property references the function (which in turn has a flowNode + // function, the node property references the function (which in turn has a flowNode // property for the containing control flow). export interface FlowStart extends FlowNodeBase { - container?: FunctionExpression | ArrowFunction | MethodDeclaration; + node?: FunctionExpression | ArrowFunction | MethodDeclaration; } // FlowLabel represents a junction with multiple possible preceding control flows. @@ -2619,10 +2640,15 @@ namespace ts { antecedent: FlowNode; } + export interface FlowCall extends FlowNodeBase { + node: CallExpression; + antecedent: FlowNode; + } + // FlowCondition represents a condition that is known to be true or false at the // node's location in the control flow. export interface FlowCondition extends FlowNodeBase { - expression: Expression; + node: Expression; antecedent: FlowNode; } @@ -2981,6 +3007,8 @@ namespace ts { * will be invoked when writing the JavaScript and declaration files. */ emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback, cancellationToken?: CancellationToken, emitOnlyDtsFiles?: boolean, customTransformers?: CustomTransformers): EmitResult; + /*@internal*/ + emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback, cancellationToken?: CancellationToken, emitOnlyDtsFiles?: boolean, customTransformers?: CustomTransformers, forceDtsEmit?: boolean): EmitResult; // eslint-disable-line @typescript-eslint/unified-signatures getOptionsDiagnostics(cancellationToken?: CancellationToken): readonly Diagnostic[]; getGlobalDiagnostics(cancellationToken?: CancellationToken): readonly Diagnostic[]; @@ -3005,11 +3033,11 @@ namespace ts { /* @internal */ getClassifiableNames(): UnderscoreEscapedMap; - /* @internal */ getNodeCount(): number; - /* @internal */ getIdentifierCount(): number; - /* @internal */ getSymbolCount(): number; - /* @internal */ getTypeCount(): number; - /* @internal */ getRelationCacheSizes(): { assignable: number, identity: number, subtype: number }; + getNodeCount(): number; + getIdentifierCount(): number; + getSymbolCount(): number; + getTypeCount(): number; + getRelationCacheSizes(): { assignable: number, identity: number, subtype: number }; /* @internal */ getFileProcessingDiagnostics(): DiagnosticCollection; /* @internal */ getResolvedTypeReferenceDirectives(): Map; @@ -3037,6 +3065,7 @@ namespace ts { /*@internal*/ getResolvedProjectReferenceToRedirect(fileName: string): ResolvedProjectReference | undefined; /*@internal*/ forEachResolvedProjectReference(cb: (resolvedProjectReference: ResolvedProjectReference | undefined, resolvedProjectReferencePath: Path) => T | undefined): T | undefined; /*@internal*/ getResolvedProjectReferenceByPath(projectReferencePath: Path): ResolvedProjectReference | undefined; + /*@internal*/ isSourceOfProjectReferenceRedirect(fileName: string): boolean; /*@internal*/ getProgramBuildInfo?(): ProgramBuildInfo | undefined; /*@internal*/ emitBuildInfo(writeFile?: WriteFileCallback, cancellationToken?: CancellationToken): EmitResult; } @@ -3137,6 +3166,7 @@ namespace ts { getSourceFile(fileName: string): SourceFile | undefined; getResolvedTypeReferenceDirectives(): ReadonlyMap; getProjectReferenceRedirect(fileName: string): string | undefined; + isSourceOfProjectReferenceRedirect(fileName: string): boolean; readonly redirectTargetsMap: RedirectTargetsMap; } @@ -3287,6 +3317,7 @@ namespace ts { /* @internal */ getElementTypeOfArrayType(arrayType: Type): Type | undefined; /* @internal */ createPromiseType(type: Type): Type; + /* @internal */ isTypeAssignableTo(source: Type, target: Type): boolean; /* @internal */ createAnonymousType(symbol: Symbol, members: SymbolTable, callSignatures: Signature[], constructSignatures: Signature[], stringIndexInfo: IndexInfo | undefined, numberIndexInfo: IndexInfo | undefined): Type; /* @internal */ createSignature( declaration: SignatureDeclaration, @@ -3525,25 +3556,45 @@ namespace ts { export const enum TypePredicateKind { This, - Identifier + Identifier, + AssertsThis, + AssertsIdentifier } export interface TypePredicateBase { kind: TypePredicateKind; - type: Type; + type: Type | undefined; } export interface ThisTypePredicate extends TypePredicateBase { kind: TypePredicateKind.This; + parameterName: undefined; + parameterIndex: undefined; + type: Type; } export interface IdentifierTypePredicate extends TypePredicateBase { kind: TypePredicateKind.Identifier; parameterName: string; parameterIndex: number; + type: Type; + } + + export interface AssertsThisTypePredicate extends TypePredicateBase { + kind: TypePredicateKind.AssertsThis; + parameterName: undefined; + parameterIndex: undefined; + type: Type | undefined; + } + + export interface AssertsIdentifierTypePredicate extends TypePredicateBase { + kind: TypePredicateKind.AssertsIdentifier; + parameterName: string; + parameterIndex: number; + type: Type | undefined; } - export type TypePredicate = IdentifierTypePredicate | ThisTypePredicate; + export type TypePredicate = ThisTypePredicate | IdentifierTypePredicate | AssertsThisTypePredicate | AssertsIdentifierTypePredicate; /* @internal */ export type AnyImportSyntax = ImportDeclaration | ImportEqualsDeclaration; @@ -3961,7 +4012,7 @@ namespace ts { resolvedSignature?: Signature; // Cached signature of signature node or call expression resolvedSymbol?: Symbol; // Cached name resolution result resolvedIndexInfo?: IndexInfo; // Cached indexing info resolution result - maybeTypePredicate?: boolean; // Cached check whether call expression might reference a type predicate + effectsSignature?: Signature; // Signature with possible control flow effects enumMemberValue?: string | number; // Constant value of enum member isVisible?: boolean; // Is this node visible containsArgumentsReference?: boolean; // Whether a function-like declaration contains an 'arguments' reference @@ -3976,6 +4027,7 @@ namespace ts { contextFreeType?: Type; // Cached context-free type used by the first pass of inference; used when a function's return is partially contextually sensitive deferredNodes?: Map; // Set of nodes whose checking has been deferred capturedBlockScopeBindings?: Symbol[]; // Block-scoped bindings captured beneath this part of an IterationStatement + isExhaustive?: boolean; // Is node an exhaustive switch statement } export const enum TypeFlags { @@ -4200,7 +4252,7 @@ namespace ts { } // Object type or intersection of object types - export type BaseType = ObjectType | IntersectionType; + export type BaseType = ObjectType | IntersectionType | TypeVariable; // Also `any` and `object` export interface InterfaceTypeWithDeclaredMembers extends InterfaceType { declaredProperties: Symbol[]; // Declared members @@ -4629,6 +4681,8 @@ namespace ts { code: number; message: string; reportsUnnecessary?: {}; + /* @internal */ + elidedInCompatabilityPyramid?: boolean; } /** @@ -4723,6 +4777,7 @@ namespace ts { /* @internal */ diagnostics?: boolean; /* @internal */ extendedDiagnostics?: boolean; disableSizeLimit?: boolean; + disableSourceOfProjectReferenceRedirect?: boolean; downlevelIteration?: boolean; emitBOM?: boolean; emitDecoratorMetadata?: boolean; @@ -5251,11 +5306,23 @@ namespace ts { /* @internal */ hasChangedAutomaticTypeDirectiveNames?: boolean; createHash?(data: string): string; getParsedCommandLine?(fileName: string): ParsedCommandLine | undefined; + /* @internal */ setResolvedProjectReferenceCallbacks?(callbacks: ResolvedProjectReferenceCallbacks): void; + /* @internal */ useSourceOfProjectReferenceRedirect?(): boolean; // TODO: later handle this in better way in builder host instead once the api for tsbuild finalizes and doesn't use compilerHost as base /*@internal*/createDirectory?(directory: string): void; } + /** true if --out otherwise source file name */ + /*@internal*/ + export type SourceOfProjectReferenceRedirect = string | true; + + /*@internal*/ + export interface ResolvedProjectReferenceCallbacks { + getSourceOfProjectReferenceRedirect(fileName: string): SourceOfProjectReferenceRedirect | undefined; + forEachResolvedProjectReference(cb: (resolvedProjectReference: ResolvedProjectReference | undefined, resolvedProjectReferencePath: Path) => T | undefined): T | undefined; + } + /* @internal */ export const enum TransformFlags { None = 0, diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index b338d3ba657cd..6b48cb80625ee 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -975,6 +975,8 @@ namespace ts { return getSpanOfTokenAtPosition(sourceFile, node.pos); } + Debug.assert(!isJSDoc(errorNode)); + const isMissing = nodeIsMissing(errorNode); const pos = isMissing || isJsxText(node) ? errorNode.pos @@ -1007,7 +1009,7 @@ namespace ts { } export function isDeclarationReadonly(declaration: Declaration): boolean { - return !!(getCombinedModifierFlags(declaration) & ModifierFlags.Readonly && !isParameterPropertyDeclaration(declaration)); + return !!(getCombinedModifierFlags(declaration) & ModifierFlags.Readonly && !isParameterPropertyDeclaration(declaration, declaration.parent)); } export function isVarConst(node: VariableDeclaration | VariableDeclarationList): boolean { @@ -4981,8 +4983,8 @@ namespace ts { } export type ParameterPropertyDeclaration = ParameterDeclaration & { parent: ConstructorDeclaration, name: Identifier }; - export function isParameterPropertyDeclaration(node: Node): node is ParameterPropertyDeclaration { - return hasModifier(node, ModifierFlags.ParameterPropertyModifier) && node.parent.kind === SyntaxKind.Constructor; + export function isParameterPropertyDeclaration(node: Node, parent: Node): node is ParameterPropertyDeclaration { + return hasModifier(node, ModifierFlags.ParameterPropertyModifier) && parent.kind === SyntaxKind.Constructor; } export function isEmptyBindingPattern(node: BindingName): node is BindingPattern { @@ -8711,11 +8713,16 @@ namespace ts { return { pos: typeParameters.pos - 1, end: typeParameters.end + 1 }; } - export function skipTypeChecking(sourceFile: SourceFile, options: CompilerOptions) { + export interface HostWithIsSourceOfProjectReferenceRedirect { + isSourceOfProjectReferenceRedirect(fileName: string): boolean; + } + export function skipTypeChecking(sourceFile: SourceFile, options: CompilerOptions, host: HostWithIsSourceOfProjectReferenceRedirect) { // If skipLibCheck is enabled, skip reporting errors if file is a declaration file. // If skipDefaultLibCheck is enabled, skip reporting errors if file contains a // '/// ' directive. - return options.skipLibCheck && sourceFile.isDeclarationFile || options.skipDefaultLibCheck && sourceFile.hasNoDefaultLib; + return (options.skipLibCheck && sourceFile.isDeclarationFile || + options.skipDefaultLibCheck && sourceFile.hasNoDefaultLib) || + host.isSourceOfProjectReferenceRedirect(sourceFile.fileName); } export function isJsonEqual(a: unknown, b: unknown): boolean { diff --git a/src/compiler/visitor.ts b/src/compiler/visitor.ts index 8b7805e6905d1..3ef382cd10fd8 100644 --- a/src/compiler/visitor.ts +++ b/src/compiler/visitor.ts @@ -333,7 +333,8 @@ namespace ts { // Types case SyntaxKind.TypePredicate: - return updateTypePredicateNode(node, + return updateTypePredicateNodeWithModifier(node, + visitNode((node).assertsModifier, visitor), visitNode((node).parameterName, visitor), visitNode((node).type, visitor, isTypeNode)); diff --git a/src/compiler/watch.ts b/src/compiler/watch.ts index b3b4739a2c62f..06871fc9cacdb 100644 --- a/src/compiler/watch.ts +++ b/src/compiler/watch.ts @@ -54,6 +54,15 @@ namespace ts { : newLine; } + /** + * Get locale specific time based on whether we are in test mode + */ + export function getLocaleTimeString(system: System) { + return !system.now ? + new Date().toLocaleTimeString() : + system.now().toLocaleTimeString("en-US", { timeZone: "UTC" }); + } + /** * Create a function that reports watch status by writing to the system and handles the formating of the diagnostic */ @@ -61,7 +70,7 @@ namespace ts { return pretty ? (diagnostic, newLine, options) => { clearScreenIfNotWatchingForFileChanges(system, diagnostic, options); - let output = `[${formatColorAndReset(new Date().toLocaleTimeString(), ForegroundColorEscapeSequences.Grey)}] `; + let output = `[${formatColorAndReset(getLocaleTimeString(system), ForegroundColorEscapeSequences.Grey)}] `; output += `${flattenDiagnosticMessageText(diagnostic.messageText, system.newLine)}${newLine + newLine}`; system.write(output); } : @@ -72,7 +81,7 @@ namespace ts { output += newLine; } - output += `${new Date().toLocaleTimeString()} - `; + output += `${getLocaleTimeString(system)} - `; output += `${flattenDiagnosticMessageText(diagnostic.messageText, system.newLine)}${getPlainDiagnosticFollowingNewLines(diagnostic, newLine)}`; system.write(output); @@ -447,7 +456,7 @@ namespace ts { } export function readBuilderProgram(compilerOptions: CompilerOptions, host: ReadBuildProgramHost) { if (compilerOptions.out || compilerOptions.outFile) return undefined; - const buildInfoPath = getOutputPathForBuildInfo(compilerOptions); + const buildInfoPath = getTsBuildInfoEmitOutputFilePath(compilerOptions); if (!buildInfoPath) return undefined; const content = host.readFile(buildInfoPath); if (!content) return undefined; diff --git a/src/harness/fakes.ts b/src/harness/fakes.ts index 63426bddb4839..adcaef55471ca 100644 --- a/src/harness/fakes.ts +++ b/src/harness/fakes.ts @@ -140,7 +140,7 @@ namespace fakes { } public createHash(data: string): string { - return data; + return `${ts.generateDjb2Hash(data)}-${data}`; } public realpath(path: string) { @@ -164,6 +164,10 @@ namespace fakes { return undefined; } } + + now() { + return new Date(this.vfs.time()); + } } /** @@ -520,39 +524,51 @@ ${indentText}${text}`; export const version = "FakeTSVersion"; - export class SolutionBuilderHost extends CompilerHost implements ts.SolutionBuilderHost { - createProgram: ts.CreateProgram; - - constructor(sys: System | vfs.FileSystem, options?: ts.CompilerOptions, setParentNodes?: boolean, createProgram?: ts.CreateProgram) { - super(sys, options, setParentNodes); - this.createProgram = createProgram || ts.createEmitAndSemanticDiagnosticsBuilderProgram; - } - - readFile(path: string) { - const value = super.readFile(path); + export function patchSolutionBuilderHost(host: ts.SolutionBuilderHost, sys: System) { + const originalReadFile = host.readFile; + host.readFile = (path, encoding) => { + const value = originalReadFile.call(host, path, encoding); if (!value || !ts.isBuildInfoFile(path)) return value; const buildInfo = ts.getBuildInfo(value); ts.Debug.assert(buildInfo.version === version); buildInfo.version = ts.version; return ts.getBuildInfoText(buildInfo); + }; + + if (host.writeFile) { + const originalWriteFile = host.writeFile; + host.writeFile = (fileName, content, writeByteOrderMark) => { + if (!ts.isBuildInfoFile(fileName)) return originalWriteFile.call(host, fileName, content, writeByteOrderMark); + const buildInfo = ts.getBuildInfo(content); + sanitizeBuildInfoProgram(buildInfo); + buildInfo.version = version; + originalWriteFile.call(host, fileName, ts.getBuildInfoText(buildInfo), writeByteOrderMark); + }; + } + + ts.Debug.assert(host.now === undefined); + host.now = () => new Date(sys.vfs.time()); + ts.Debug.assertDefined(host.createHash); + } + + export class SolutionBuilderHost extends CompilerHost implements ts.SolutionBuilderHost { + createProgram: ts.CreateProgram; + + private constructor(sys: System | vfs.FileSystem, options?: ts.CompilerOptions, setParentNodes?: boolean, createProgram?: ts.CreateProgram) { + super(sys, options, setParentNodes); + this.createProgram = createProgram || ts.createEmitAndSemanticDiagnosticsBuilderProgram; } - public writeFile(fileName: string, content: string, writeByteOrderMark: boolean) { - if (!ts.isBuildInfoFile(fileName)) return super.writeFile(fileName, content, writeByteOrderMark); - const buildInfo = ts.getBuildInfo(content); - sanitizeBuildInfoProgram(buildInfo); - buildInfo.version = version; - super.writeFile(fileName, ts.getBuildInfoText(buildInfo), writeByteOrderMark); + static create(sys: System | vfs.FileSystem, options?: ts.CompilerOptions, setParentNodes?: boolean, createProgram?: ts.CreateProgram) { + const host = new SolutionBuilderHost(sys, options, setParentNodes, createProgram); + patchSolutionBuilderHost(host, host.sys); + return host; } createHash(data: string) { return `${ts.generateDjb2Hash(data)}-${data}`; } - now() { - return new Date(this.sys.vfs.time()); - } - diagnostics: SolutionBuilderDiagnostic[] = []; reportDiagnostic(diagnostic: ts.Diagnostic) { diff --git a/src/harness/vfs.ts b/src/harness/vfs.ts index cf0ba1984103e..76475b00360b2 100644 --- a/src/harness/vfs.ts +++ b/src/harness/vfs.ts @@ -32,6 +32,10 @@ namespace vfs { let devCount = 0; // A monotonically increasing count of device ids let inoCount = 0; // A monotonically increasing count of inodes + export interface DiffOptions { + includeChangedFileWithSameContent?: boolean; + } + /** * Represents a virtual POSIX-like file system. */ @@ -693,21 +697,25 @@ namespace vfs { * Generates a `FileSet` patch containing all the entries in this `FileSystem` that are not in `base`. * @param base The base file system. If not provided, this file system's `shadowRoot` is used (if present). */ - public diff(base = this.shadowRoot) { + public diff(base = this.shadowRoot, options: DiffOptions = {}) { const differences: FileSet = {}; - const hasDifferences = base ? FileSystem.rootDiff(differences, this, base) : FileSystem.trackCreatedInodes(differences, this, this._getRootLinks()); + const hasDifferences = base ? + FileSystem.rootDiff(differences, this, base, options) : + FileSystem.trackCreatedInodes(differences, this, this._getRootLinks()); return hasDifferences ? differences : undefined; } /** - * Generates a `FileSet` patch containing all the entries in `chagned` that are not in `base`. + * Generates a `FileSet` patch containing all the entries in `changed` that are not in `base`. */ - public static diff(changed: FileSystem, base: FileSystem) { + public static diff(changed: FileSystem, base: FileSystem, options: DiffOptions = {}) { const differences: FileSet = {}; - return FileSystem.rootDiff(differences, changed, base) ? differences : undefined; + return FileSystem.rootDiff(differences, changed, base, options) ? + differences : + undefined; } - private static diffWorker(container: FileSet, changed: FileSystem, changedLinks: ReadonlyMap | undefined, base: FileSystem, baseLinks: ReadonlyMap | undefined) { + private static diffWorker(container: FileSet, changed: FileSystem, changedLinks: ReadonlyMap | undefined, base: FileSystem, baseLinks: ReadonlyMap | undefined, options: DiffOptions) { if (changedLinks && !baseLinks) return FileSystem.trackCreatedInodes(container, changed, changedLinks); if (baseLinks && !changedLinks) return FileSystem.trackDeletedInodes(container, baseLinks); if (changedLinks && baseLinks) { @@ -724,10 +732,10 @@ namespace vfs { const baseNode = baseLinks.get(basename); if (baseNode) { if (isDirectory(changedNode) && isDirectory(baseNode)) { - return hasChanges = FileSystem.directoryDiff(container, basename, changed, changedNode, base, baseNode) || hasChanges; + return hasChanges = FileSystem.directoryDiff(container, basename, changed, changedNode, base, baseNode, options) || hasChanges; } if (isFile(changedNode) && isFile(baseNode)) { - return hasChanges = FileSystem.fileDiff(container, basename, changed, changedNode, base, baseNode) || hasChanges; + return hasChanges = FileSystem.fileDiff(container, basename, changed, changedNode, base, baseNode, options) || hasChanges; } if (isSymlink(changedNode) && isSymlink(baseNode)) { return hasChanges = FileSystem.symlinkDiff(container, basename, changedNode, baseNode) || hasChanges; @@ -740,7 +748,7 @@ namespace vfs { return false; } - private static rootDiff(container: FileSet, changed: FileSystem, base: FileSystem) { + private static rootDiff(container: FileSet, changed: FileSystem, base: FileSystem, options: DiffOptions) { while (!changed._lazy.links && changed._shadowRoot) changed = changed._shadowRoot; while (!base._lazy.links && base._shadowRoot) base = base._shadowRoot; @@ -750,10 +758,10 @@ namespace vfs { // no difference if the root links are empty and unshadowed if (!changed._lazy.links && !changed._shadowRoot && !base._lazy.links && !base._shadowRoot) return false; - return FileSystem.diffWorker(container, changed, changed._getRootLinks(), base, base._getRootLinks()); + return FileSystem.diffWorker(container, changed, changed._getRootLinks(), base, base._getRootLinks(), options); } - private static directoryDiff(container: FileSet, basename: string, changed: FileSystem, changedNode: DirectoryInode, base: FileSystem, baseNode: DirectoryInode) { + private static directoryDiff(container: FileSet, basename: string, changed: FileSystem, changedNode: DirectoryInode, base: FileSystem, baseNode: DirectoryInode, options: DiffOptions) { while (!changedNode.links && changedNode.shadowRoot) changedNode = changedNode.shadowRoot; while (!baseNode.links && baseNode.shadowRoot) baseNode = baseNode.shadowRoot; @@ -770,7 +778,7 @@ namespace vfs { // no difference if both nodes have identical children const children: FileSet = {}; - if (!FileSystem.diffWorker(children, changed, changed._getLinks(changedNode), base, base._getLinks(baseNode))) { + if (!FileSystem.diffWorker(children, changed, changed._getLinks(changedNode), base, base._getLinks(baseNode), options)) { return false; } @@ -778,7 +786,7 @@ namespace vfs { return true; } - private static fileDiff(container: FileSet, basename: string, changed: FileSystem, changedNode: FileInode, base: FileSystem, baseNode: FileInode) { + private static fileDiff(container: FileSet, basename: string, changed: FileSystem, changedNode: FileInode, base: FileSystem, baseNode: FileInode, options: DiffOptions) { while (!changedNode.buffer && changedNode.shadowRoot) changedNode = changedNode.shadowRoot; while (!baseNode.buffer && baseNode.shadowRoot) baseNode = baseNode.shadowRoot; @@ -800,7 +808,11 @@ namespace vfs { if (changedBuffer === baseBuffer) return false; // no difference if both buffers are identical - if (Buffer.compare(changedBuffer, baseBuffer) === 0) return false; + if (Buffer.compare(changedBuffer, baseBuffer) === 0) { + if (!options.includeChangedFileWithSameContent) return false; + container[basename] = new SameFileContentFile(changedBuffer); + return true; + } container[basename] = new File(changedBuffer); return true; @@ -1361,6 +1373,12 @@ namespace vfs { } } + export class SameFileContentFile extends File { + constructor(data: Buffer | string, metaAndEncoding?: { encoding?: string, meta?: Record }) { + super(data, metaAndEncoding); + } + } + /** Extended options for a hard link in a `FileSet` */ export class Link { public readonly path: string; @@ -1549,6 +1567,9 @@ namespace vfs { else if (entry instanceof Directory) { text += formatPatchWorker(file, entry.files); } + else if (entry instanceof SameFileContentFile) { + text += `//// [${file}] file written with same contents\r\n`; + } else if (entry instanceof File) { const content = typeof entry.data === "string" ? entry.data : entry.data.toString("utf8"); text += `//// [${file}]\r\n${content}\r\n\r\n`; diff --git a/src/harness/virtualFileSystemWithWatch.ts b/src/harness/virtualFileSystemWithWatch.ts index 1a2fd5f4cc88d..0417ad55c99a6 100644 --- a/src/harness/virtualFileSystemWithWatch.ts +++ b/src/harness/virtualFileSystemWithWatch.ts @@ -44,7 +44,10 @@ interface Array { length: number; [n: number]: T; }` } export function createServerHost(fileOrFolderList: readonly FileOrFolderOrSymLink[], params?: TestServerHostCreationParameters): TestServerHost { - return new TestServerHost(/*withSafelist*/ true, fileOrFolderList, params); + const host = new TestServerHost(/*withSafelist*/ true, fileOrFolderList, params); + // Just like sys, patch the host to use writeFile + patchWriteFileEnsuringDirectory(host); + return host; } export interface File { @@ -174,8 +177,8 @@ interface Array { length: number; [n: number]: T; }` } } - export function checkWatchedFiles(host: TestServerHost, expectedFiles: string[]) { - checkMapKeys("watchedFiles", host.watchedFiles, expectedFiles); + export function checkWatchedFiles(host: TestServerHost, expectedFiles: string[], additionalInfo?: string) { + checkMapKeys(`watchedFiles:: ${additionalInfo || ""}::`, host.watchedFiles, expectedFiles); } export function checkWatchedFilesDetailed(host: TestServerHost, expectedFiles: ReadonlyMap): void; @@ -1016,6 +1019,19 @@ interface Array { length: number; [n: number]: T; }` } } + export type TestServerHostTrackingWrittenFiles = TestServerHost & { writtenFiles: Map; }; + + export function changeToHostTrackingWrittenFiles(inputHost: TestServerHost) { + const host = inputHost as TestServerHostTrackingWrittenFiles; + const originalWriteFile = host.writeFile; + host.writtenFiles = createMap(); + host.writeFile = (fileName, content) => { + originalWriteFile.call(host, fileName, content); + const path = host.toFullPath(fileName); + host.writtenFiles.set(path, true); + }; + return host; + } export const tsbuildProjectsLocation = "/user/username/projects"; export function getTsBuildProjectFilePath(project: string, file: string) { return `${tsbuildProjectsLocation}/${project}/${file}`; diff --git a/src/lib/es2015.promise.d.ts b/src/lib/es2015.promise.d.ts index 83776137c33c1..45b0fa5dc59d9 100644 --- a/src/lib/es2015.promise.d.ts +++ b/src/lib/es2015.promise.d.ts @@ -18,7 +18,7 @@ interface PromiseConstructor { * @param values An array of Promises. * @returns A new Promise. */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike, T10 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>; + all(values: readonly [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike, T10 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>; /** * Creates a Promise that is resolved with an array of results when all of the provided Promises @@ -26,7 +26,7 @@ interface PromiseConstructor { * @param values An array of Promises. * @returns A new Promise. */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; + all(values: readonly [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; /** * Creates a Promise that is resolved with an array of results when all of the provided Promises @@ -34,7 +34,7 @@ interface PromiseConstructor { * @param values An array of Promises. * @returns A new Promise. */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>; + all(values: readonly [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>; /** * Creates a Promise that is resolved with an array of results when all of the provided Promises @@ -42,7 +42,7 @@ interface PromiseConstructor { * @param values An array of Promises. * @returns A new Promise. */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; + all(values: readonly [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; /** * Creates a Promise that is resolved with an array of results when all of the provided Promises @@ -50,7 +50,7 @@ interface PromiseConstructor { * @param values An array of Promises. * @returns A new Promise. */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6]>; + all(values: readonly [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6]>; /** * Creates a Promise that is resolved with an array of results when all of the provided Promises @@ -58,7 +58,7 @@ interface PromiseConstructor { * @param values An array of Promises. * @returns A new Promise. */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike]): Promise<[T1, T2, T3, T4, T5]>; + all(values: readonly [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike]): Promise<[T1, T2, T3, T4, T5]>; /** * Creates a Promise that is resolved with an array of results when all of the provided Promises @@ -66,7 +66,7 @@ interface PromiseConstructor { * @param values An array of Promises. * @returns A new Promise. */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike ]): Promise<[T1, T2, T3, T4]>; + all(values: readonly [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike ]): Promise<[T1, T2, T3, T4]>; /** * Creates a Promise that is resolved with an array of results when all of the provided Promises @@ -74,7 +74,7 @@ interface PromiseConstructor { * @param values An array of Promises. * @returns A new Promise. */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise<[T1, T2, T3]>; + all(values: readonly [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise<[T1, T2, T3]>; /** * Creates a Promise that is resolved with an array of results when all of the provided Promises @@ -82,7 +82,7 @@ interface PromiseConstructor { * @param values An array of Promises. * @returns A new Promise. */ - all(values: [T1 | PromiseLike, T2 | PromiseLike]): Promise<[T1, T2]>; + all(values: readonly [T1 | PromiseLike, T2 | PromiseLike]): Promise<[T1, T2]>; /** * Creates a Promise that is resolved with an array of results when all of the provided Promises @@ -90,7 +90,7 @@ interface PromiseConstructor { * @param values An array of Promises. * @returns A new Promise. */ - all(values: (T | PromiseLike)[]): Promise; + all(values: readonly (T | PromiseLike)[]): Promise; /** * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved @@ -98,7 +98,7 @@ interface PromiseConstructor { * @param values An array of Promises. * @returns A new Promise. */ - race(values: T[]): Promise ? U : T>; + race(values: readonly T[]): Promise ? U : T>; /** * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved diff --git a/src/lib/es2018.asyncgenerator.d.ts b/src/lib/es2018.asyncgenerator.d.ts index 76275c92575c0..f6966264c8be4 100644 --- a/src/lib/es2018.asyncgenerator.d.ts +++ b/src/lib/es2018.asyncgenerator.d.ts @@ -2,7 +2,7 @@ interface AsyncGenerator extends AsyncIterator { // NOTE: 'next' is defined using a tuple to ensure we report the correct assignability errors in all places. - next(...args: [] | [TNext | PromiseLike]): Promise>; + next(...args: [] | [TNext]): Promise>; return(value: TReturn | PromiseLike): Promise>; throw(e: any): Promise>; [Symbol.asyncIterator](): AsyncGenerator; diff --git a/src/lib/es2018.asynciterable.d.ts b/src/lib/es2018.asynciterable.d.ts index d5d83f31893bb..19a31c72ca4a9 100644 --- a/src/lib/es2018.asynciterable.d.ts +++ b/src/lib/es2018.asynciterable.d.ts @@ -11,7 +11,7 @@ interface SymbolConstructor { interface AsyncIterator { // NOTE: 'next' is defined using a tuple to ensure we report the correct assignability errors in all places. - next(...args: [] | [TNext | PromiseLike]): Promise>; + next(...args: [] | [TNext]): Promise>; return?(value?: TReturn | PromiseLike): Promise>; throw?(e?: any): Promise>; } diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index 37b4ddc47a54c..759eec5d54f34 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -1777,6 +1777,12 @@ namespace ts.server { configFileErrors.push(...parsedCommandLine.errors); } + this.logger.info(`Config: ${configFilename} : ${JSON.stringify({ + rootNames: parsedCommandLine.fileNames, + options: parsedCommandLine.options, + projectReferences: parsedCommandLine.projectReferences + }, /*replacer*/ undefined, " ")}`); + Debug.assert(!!parsedCommandLine.fileNames); const compilerOptions = parsedCommandLine.options; @@ -1818,7 +1824,7 @@ namespace ts.server { let scriptInfo: ScriptInfo | NormalizedPath; let path: Path; // Use the project's fileExists so that it can use caching instead of reaching to disk for the query - if (!isDynamic && !project.fileExists(newRootFile)) { + if (!isDynamic && !project.fileExistsWithCache(newRootFile)) { path = normalizedPathToPath(normalizedPath, this.currentDirectory, this.toCanonicalFileName); const existingValue = projectRootFilesMap.get(path)!; if (isScriptInfo(existingValue)) { @@ -1851,7 +1857,7 @@ namespace ts.server { projectRootFilesMap.forEach((value, path) => { if (!newRootScriptInfoMap.has(path)) { if (isScriptInfo(value)) { - project.removeFile(value, project.fileExists(path), /*detachFromProject*/ true); + project.removeFile(value, project.fileExistsWithCache(path), /*detachFromProject*/ true); } else { projectRootFilesMap.delete(path); @@ -2584,7 +2590,9 @@ namespace ts.server { /*@internal*/ getOriginalLocationEnsuringConfiguredProject(project: Project, location: DocumentPosition): DocumentPosition | undefined { - const originalLocation = project.getSourceMapper().tryGetSourcePosition(location); + const originalLocation = project.isSourceOfProjectReferenceRedirect(location.fileName) ? + location : + project.getSourceMapper().tryGetSourcePosition(location); if (!originalLocation) return undefined; const { fileName } = originalLocation; @@ -2595,7 +2603,8 @@ namespace ts.server { if (!configFileName) return undefined; const configuredProject = this.findConfiguredProjectByProjectName(configFileName) || - this.createAndLoadConfiguredProject(configFileName, `Creating project for original file: ${originalFileInfo.fileName} for location: ${location.fileName}`); + this.createAndLoadConfiguredProject(configFileName, `Creating project for original file: ${originalFileInfo.fileName}${location !== originalLocation ? " for location: " + location.fileName : ""}`); + if (configuredProject === project) return originalLocation; updateProjectIfDirty(configuredProject); // Keep this configured project as referenced from project addOriginalConfiguredProject(configuredProject); diff --git a/src/server/project.ts b/src/server/project.ts index 4b38a099b2b3d..418532bdc45d4 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -196,6 +196,11 @@ namespace ts.server { /*@internal*/ originalConfiguredProjects: Map | undefined; + /*@internal*/ + getResolvedProjectReferenceToRedirect(_fileName: string): ResolvedProjectReference | undefined { + return undefined; + } + private readonly cancellationToken: ThrottledCancellationToken; public isNonTsProject() { @@ -391,6 +396,11 @@ namespace ts.server { } fileExists(file: string): boolean { + return this.fileExistsWithCache(file); + } + + /* @internal */ + fileExistsWithCache(file: string): boolean { // As an optimization, don't hit the disks for files we already know don't exist // (because we're watching for their creation). const path = this.toPath(file); @@ -527,8 +537,11 @@ namespace ts.server { return this.projectService.getSourceFileLike(fileName, this); } - private shouldEmitFile(scriptInfo: ScriptInfo) { - return scriptInfo && !scriptInfo.isDynamicOrHasMixedContent(); + /*@internal*/ + shouldEmitFile(scriptInfo: ScriptInfo | undefined) { + return scriptInfo && + !scriptInfo.isDynamicOrHasMixedContent() && + !this.program!.isSourceOfProjectReferenceRedirect(scriptInfo.path); } getCompileOnSaveAffectedFileList(scriptInfo: ScriptInfo): string[] { @@ -538,7 +551,7 @@ namespace ts.server { updateProjectIfDirty(this); this.builderState = BuilderState.create(this.program!, this.projectService.toCanonicalFileName, this.builderState); return mapDefined(BuilderState.getFilesAffectedBy(this.builderState, this.program!, scriptInfo.path, this.cancellationToken, data => this.projectService.host.createHash!(data)), // TODO: GH#18217 - sourceFile => this.shouldEmitFile(this.projectService.getScriptInfoForPath(sourceFile.path)!) ? sourceFile.fileName : undefined); + sourceFile => this.shouldEmitFile(this.projectService.getScriptInfoForPath(sourceFile.path)) ? sourceFile.fileName : undefined); } /** @@ -1223,6 +1236,11 @@ namespace ts.server { this.rootFilesMap.delete(info.path); } + /*@internal*/ + isSourceOfProjectReferenceRedirect(fileName: string) { + return !!this.program && this.program.isSourceOfProjectReferenceRedirect(fileName); + } + protected enableGlobalPlugins(options: CompilerOptions, pluginConfigOverrides: Map | undefined) { const host = this.projectService.host; @@ -1475,6 +1493,8 @@ namespace ts.server { configFileWatcher: FileWatcher | undefined; private directoriesWatchedForWildcards: Map | undefined; readonly canonicalConfigFilePath: NormalizedPath; + private projectReferenceCallbacks: ResolvedProjectReferenceCallbacks | undefined; + private mapOfDeclarationDirectories: Map | undefined; /* @internal */ pendingReload: ConfigFileProgramReloadLevel | undefined; @@ -1520,6 +1540,63 @@ namespace ts.server { this.canonicalConfigFilePath = asNormalizedPath(projectService.toCanonicalFileName(configFileName)); } + /* @internal */ + setResolvedProjectReferenceCallbacks(projectReferenceCallbacks: ResolvedProjectReferenceCallbacks) { + this.projectReferenceCallbacks = projectReferenceCallbacks; + } + + /* @internal */ + useSourceOfProjectReferenceRedirect = () => !!this.languageServiceEnabled && + !this.getCompilerOptions().disableSourceOfProjectReferenceRedirect; + + /** + * This implementation of fileExists checks if the file being requested is + * .d.ts file for the referenced Project. + * If it is it returns true irrespective of whether that file exists on host + */ + fileExists(file: string): boolean { + // Project references go to source file instead of .d.ts file + if (this.useSourceOfProjectReferenceRedirect() && this.projectReferenceCallbacks) { + const source = this.projectReferenceCallbacks.getSourceOfProjectReferenceRedirect(file); + if (source) return isString(source) ? super.fileExists(source) : true; + } + return super.fileExists(file); + } + + /** + * This implementation of directoryExists checks if the directory being requested is + * directory of .d.ts file for the referenced Project. + * If it is it returns true irrespective of whether that directory exists on host + */ + directoryExists(path: string): boolean { + if (super.directoryExists(path)) return true; + if (!this.useSourceOfProjectReferenceRedirect() || !this.projectReferenceCallbacks) return false; + + if (!this.mapOfDeclarationDirectories) { + this.mapOfDeclarationDirectories = createMap(); + this.projectReferenceCallbacks.forEachResolvedProjectReference(ref => { + if (!ref) return; + const out = ref.commandLine.options.outFile || ref.commandLine.options.outDir; + if (out) { + this.mapOfDeclarationDirectories!.set(getDirectoryPath(this.toPath(out)), true); + } + else { + // Set declaration's in different locations only, if they are next to source the directory present doesnt change + const declarationDir = ref.commandLine.options.declarationDir || ref.commandLine.options.outDir; + if (declarationDir) { + this.mapOfDeclarationDirectories!.set(this.toPath(declarationDir), true); + } + } + }); + } + const dirPath = this.toPath(path); + const dirPathWithTrailingDirectorySeparator = `${dirPath}${directorySeparator}`; + return !!forEachKey( + this.mapOfDeclarationDirectories, + declDirPath => dirPath === declDirPath || startsWith(declDirPath, dirPathWithTrailingDirectorySeparator) + ); + } + /** * If the project has reload from disk pending, it reloads (and then updates graph as part of that) instead of just updating the graph * @returns: true if set of files in the project stays the same and false - otherwise. @@ -1528,6 +1605,8 @@ namespace ts.server { this.isInitialLoadPending = returnFalse; const reloadLevel = this.pendingReload; this.pendingReload = ConfigFileProgramReloadLevel.None; + this.projectReferenceCallbacks = undefined; + this.mapOfDeclarationDirectories = undefined; let result: boolean; switch (reloadLevel) { case ConfigFileProgramReloadLevel.Partial: @@ -1570,6 +1649,12 @@ namespace ts.server { return program && program.forEachResolvedProjectReference(cb); } + /*@internal*/ + getResolvedProjectReferenceToRedirect(fileName: string): ResolvedProjectReference | undefined { + const program = this.getCurrentProgram(); + return program && program.getResolvedProjectReferenceToRedirect(fileName); + } + /*@internal*/ enablePluginsWithOptions(options: CompilerOptions, pluginConfigOverrides: Map | undefined) { const host = this.projectService.host; @@ -1652,6 +1737,8 @@ namespace ts.server { this.stopWatchingWildCards(); this.projectErrors = undefined; this.configFileSpecs = undefined; + this.projectReferenceCallbacks = undefined; + this.mapOfDeclarationDirectories = undefined; super.close(); } diff --git a/src/server/scriptInfo.ts b/src/server/scriptInfo.ts index e441ca54d378f..cbd006dd9d259 100644 --- a/src/server/scriptInfo.ts +++ b/src/server/scriptInfo.ts @@ -495,15 +495,17 @@ namespace ts.server { // the default project; if no configured projects, the first external project should // be the default project; otherwise the first inferred project should be the default. let firstExternalProject; + let firstConfiguredProject; for (const project of this.containingProjects) { if (project.projectKind === ProjectKind.Configured) { - return project; + if (!project.isSourceOfProjectReferenceRedirect(this.fileName)) return project; + if (!firstConfiguredProject) firstConfiguredProject = project; } else if (project.projectKind === ProjectKind.External && !firstExternalProject) { firstExternalProject = project; } } - return firstExternalProject || this.containingProjects[0]; + return firstConfiguredProject || firstExternalProject || this.containingProjects[0]; } } diff --git a/src/server/session.ts b/src/server/session.ts index f2996b98dd847..6fe392c722b0d 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -448,7 +448,9 @@ namespace ts.server { function getDefinitionInProject(definition: DocumentPosition | undefined, definingProject: Project, project: Project): DocumentPosition | undefined { if (!definition || project.containsFile(toNormalizedPath(definition.fileName))) return definition; - const mappedDefinition = definingProject.getLanguageService().getSourceMapper().tryGetGeneratedPosition(definition); + const mappedDefinition = definingProject.isSourceOfProjectReferenceRedirect(definition.fileName) ? + definition : + definingProject.getLanguageService().getSourceMapper().tryGetGeneratedPosition(definition); return mappedDefinition && project.containsFile(toNormalizedPath(mappedDefinition.fileName)) ? mappedDefinition : undefined; } @@ -477,7 +479,7 @@ namespace ts.server { for (const symlinkedProject of symlinkedProjects) addToTodo({ project: symlinkedProject, location: originalLocation as TLocation }, toDo!, seenProjects); }); } - return originalLocation; + return originalLocation === location ? undefined : originalLocation; }); return toDo; } @@ -1037,7 +1039,9 @@ namespace ts.server { private getEmitOutput(args: protocol.FileRequestArgs): EmitOutput { const { file, project } = this.getFileAndProject(args); - return project.getLanguageService().getEmitOutput(file); + return project.shouldEmitFile(project.getScriptInfo(file)) ? + project.getLanguageService().getEmitOutput(file) : + { emitSkipped: true, outputFiles: [] }; } private mapDefinitionInfo(definitions: readonly DefinitionInfo[], project: Project): readonly protocol.FileSpanWithContext[] { @@ -1672,10 +1676,10 @@ namespace ts.server { } } - private createCheckList(fileNames: string[], defaultProject?: Project): PendingErrorCheck[] { + private createCheckList(fileNames: string[]): PendingErrorCheck[] { return mapDefined(fileNames, uncheckedFileName => { const fileName = toNormalizedPath(uncheckedFileName); - const project = defaultProject || this.projectService.tryGetDefaultProjectForFile(fileName); + const project = this.projectService.tryGetDefaultProjectForFile(fileName); return project && { fileName, project }; }); } diff --git a/src/services/codefixes/convertConstToLet.ts b/src/services/codefixes/convertConstToLet.ts new file mode 100644 index 0000000000000..610aaf5daa4e2 --- /dev/null +++ b/src/services/codefixes/convertConstToLet.ts @@ -0,0 +1,32 @@ +/* @internal */ +namespace ts.codefix { + const fixId = "fixConvertConstToLet"; + const errorCodes = [Diagnostics.Cannot_assign_to_0_because_it_is_a_constant.code]; + + registerCodeFix({ + errorCodes, + getCodeActions: context => { + const { sourceFile, span, program } = context; + const variableStatement = getVariableStatement(sourceFile, span.start, program); + const changes = textChanges.ChangeTracker.with(context, t => doChange(t, sourceFile, variableStatement)); + return [createCodeFixAction(fixId, changes, Diagnostics.Convert_const_to_let, fixId, Diagnostics.Convert_const_to_let)]; + }, + fixIds: [fixId] + }); + + function getVariableStatement(sourceFile: SourceFile, pos: number, program: Program) { + const token = getTokenAtPosition(sourceFile, pos); + const checker = program.getTypeChecker(); + const symbol = checker.getSymbolAtLocation(token); + if (symbol) { + return symbol.valueDeclaration.parent.parent as VariableStatement; + } + } + function doChange(changes: textChanges.ChangeTracker, sourceFile: SourceFile, variableStatement?: VariableStatement) { + if (!variableStatement) { + return; + } + const start = variableStatement.getStart(); + changes.replaceRangeWithText(sourceFile, { pos: start, end: start + 5 }, "let"); + } +} diff --git a/src/services/codefixes/fixAwaitInSyncFunction.ts b/src/services/codefixes/fixAwaitInSyncFunction.ts index e5b3a24dbea18..55dd4bd05567f 100644 --- a/src/services/codefixes/fixAwaitInSyncFunction.ts +++ b/src/services/codefixes/fixAwaitInSyncFunction.ts @@ -15,11 +15,14 @@ namespace ts.codefix { return [createCodeFixAction(fixId, changes, Diagnostics.Add_async_modifier_to_containing_function, fixId, Diagnostics.Add_all_missing_async_modifiers)]; }, fixIds: [fixId], - getAllCodeActions: context => codeFixAll(context, errorCodes, (changes, diag) => { - const nodes = getNodes(diag.file, diag.start); - if (!nodes) return; - doChange(changes, context.sourceFile, nodes); - }), + getAllCodeActions: context => { + const seen = createMap(); + return codeFixAll(context, errorCodes, (changes, diag) => { + const nodes = getNodes(diag.file, diag.start); + if (!nodes || !addToSeen(seen, getNodeId(nodes.insertBefore))) return; + doChange(changes, context.sourceFile, nodes); + }); + }, }); function getReturnType(expr: FunctionDeclaration | MethodDeclaration | FunctionExpression | ArrowFunction) { diff --git a/src/services/codefixes/inferFromUsage.ts b/src/services/codefixes/inferFromUsage.ts index 60cd06101dc1f..5dd3478288517 100644 --- a/src/services/codefixes/inferFromUsage.ts +++ b/src/services/codefixes/inferFromUsage.ts @@ -393,6 +393,19 @@ namespace ts.codefix { function inferTypeFromReferences(program: Program, references: readonly Identifier[], cancellationToken: CancellationToken) { const checker = program.getTypeChecker(); + const builtinConstructors: { [s: string]: (t: Type) => Type } = { + string: () => checker.getStringType(), + number: () => checker.getNumberType(), + Array: t => checker.createArrayType(t), + Promise: t => checker.createPromiseType(t), + }; + const builtins = [ + checker.getStringType(), + checker.getNumberType(), + checker.createArrayType(checker.getAnyType()), + checker.createPromiseType(checker.getAnyType()), + ]; + return { single, parameters, @@ -401,26 +414,74 @@ namespace ts.codefix { interface CallUsage { argumentTypes: Type[]; - returnType: Usage; + return_: Usage; } interface Usage { - isNumber?: boolean; - isString?: boolean; + isNumber: boolean | undefined; + isString: boolean | undefined; /** Used ambiguously, eg x + ___ or object[___]; results in string | number if no other evidence exists */ - isNumberOrString?: boolean; + isNumberOrString: boolean | undefined; + + candidateTypes: Type[] | undefined; + properties: UnderscoreEscapedMap | undefined; + calls: CallUsage[] | undefined; + constructs: CallUsage[] | undefined; + numberIndex: Usage | undefined; + stringIndex: Usage | undefined; + candidateThisTypes: Type[] | undefined; + inferredTypes: Type[] | undefined; + } - candidateTypes?: Type[]; - properties?: UnderscoreEscapedMap; - calls?: CallUsage[]; - constructs?: CallUsage[]; - numberIndex?: Usage; - stringIndex?: Usage; - candidateThisTypes?: Type[]; + function createEmptyUsage(): Usage { + return { + isNumber: undefined, + isString: undefined, + isNumberOrString: undefined, + candidateTypes: undefined, + properties: undefined, + calls: undefined, + constructs: undefined, + numberIndex: undefined, + stringIndex: undefined, + candidateThisTypes: undefined, + inferredTypes: undefined, + }; + } + + function combineUsages(usages: Usage[]): Usage { + const combinedProperties = createUnderscoreEscapedMap(); + for (const u of usages) { + if (u.properties) { + u.properties.forEach((p, name) => { + if (!combinedProperties.has(name)) { + combinedProperties.set(name, []); + } + combinedProperties.get(name)!.push(p); + }); + } + } + const properties = createUnderscoreEscapedMap(); + combinedProperties.forEach((ps, name) => { + properties.set(name, combineUsages(ps)); + }); + return { + isNumber: usages.some(u => u.isNumber), + isString: usages.some(u => u.isString), + isNumberOrString: usages.some(u => u.isNumberOrString), + candidateTypes: flatMap(usages, u => u.candidateTypes) as Type[], + properties, + calls: flatMap(usages, u => u.calls) as CallUsage[], + constructs: flatMap(usages, u => u.constructs) as CallUsage[], + numberIndex: forEach(usages, u => u.numberIndex), + stringIndex: forEach(usages, u => u.stringIndex), + candidateThisTypes: flatMap(usages, u => u.candidateThisTypes) as Type[], + inferredTypes: undefined, // clear type cache + }; } function single(): Type { - return unifyFromUsage(inferTypesFromReferencesSingle(references)); + return combineTypes(inferTypesFromReferencesSingle(references)); } function parameters(declaration: FunctionLike): ParameterInference[] | undefined { @@ -428,7 +489,7 @@ namespace ts.codefix { return undefined; } - const usage: Usage = {}; + const usage = createEmptyUsage(); for (const reference of references) { cancellationToken.throwIfCancellationRequested(); calculateUsageOfNode(reference, usage); @@ -456,7 +517,7 @@ namespace ts.codefix { const inferred = inferTypesFromReferencesSingle(getReferences(parameter.name, program, cancellationToken)); types.push(...(isRest ? mapDefined(inferred, checker.getElementTypeOfArrayType) : inferred)); } - const type = unifyFromUsage(types); + const type = combineTypes(types); return { type: isRest ? checker.createArrayType(type) : type, isOptional: isOptional && !isRest, @@ -466,22 +527,22 @@ namespace ts.codefix { } function thisParameter() { - const usage: Usage = {}; + const usage = createEmptyUsage(); for (const reference of references) { cancellationToken.throwIfCancellationRequested(); calculateUsageOfNode(reference, usage); } - return unifyFromUsage(usage.candidateThisTypes || emptyArray); + return combineTypes(usage.candidateThisTypes || emptyArray); } function inferTypesFromReferencesSingle(references: readonly Identifier[]): Type[] { - const usage: Usage = {}; + const usage: Usage = createEmptyUsage(); for (const reference of references) { cancellationToken.throwIfCancellationRequested(); calculateUsageOfNode(reference, usage); } - return inferFromUsage(usage); + return inferTypes(usage); } function calculateUsageOfNode(node: Expression, usage: Usage): void { @@ -490,6 +551,9 @@ namespace ts.codefix { } switch (node.parent.kind) { + case SyntaxKind.ExpressionStatement: + addCandidateType(usage, checker.getVoidType()); + break; case SyntaxKind.PostfixUnaryExpression: usage.isNumber = true; break; @@ -632,6 +696,9 @@ namespace ts.codefix { else if (otherOperandType.flags & TypeFlags.StringLike) { usage.isString = true; } + else if (otherOperandType.flags & TypeFlags.Any) { + // do nothing, maybe we'll learn something elsewhere + } else { usage.isNumberOrString = true; } @@ -677,7 +744,7 @@ namespace ts.codefix { function inferTypeFromCallExpression(parent: CallExpression | NewExpression, usage: Usage): void { const call: CallUsage = { argumentTypes: [], - returnType: {} + return_: createEmptyUsage() }; if (parent.arguments) { @@ -686,7 +753,7 @@ namespace ts.codefix { } } - calculateUsageOfNode(parent, call.returnType); + calculateUsageOfNode(parent, call.return_); if (parent.kind === SyntaxKind.CallExpression) { (usage.calls || (usage.calls = [])).push(call); } @@ -700,7 +767,7 @@ namespace ts.codefix { if (!usage.properties) { usage.properties = createUnderscoreEscapedMap(); } - const propertyUsage = usage.properties.get(name) || { }; + const propertyUsage = usage.properties.get(name) || createEmptyUsage(); calculateUsageOfNode(parent, propertyUsage); usage.properties.set(name, propertyUsage); } @@ -712,7 +779,7 @@ namespace ts.codefix { } else { const indexType = checker.getTypeAtLocation(parent.argumentExpression); - const indexUsage = {}; + const indexUsage = createEmptyUsage(); calculateUsageOfNode(parent, indexUsage); if (indexType.flags & TypeFlags.NumberLike) { usage.numberIndex = indexUsage; @@ -752,8 +819,12 @@ namespace ts.codefix { return inferences.filter(i => toRemove.every(f => !f(i))); } - function unifyFromUsage(inferences: readonly Type[], fallback = checker.getAnyType()): Type { - if (!inferences.length) return fallback; + function combineFromUsage(usage: Usage) { + return combineTypes(inferTypes(usage)); + } + + function combineTypes(inferences: readonly Type[]): Type { + if (!inferences.length) return checker.getAnyType(); // 1. string or number individually override string | number // 2. non-any, non-void overrides any or void @@ -776,12 +847,12 @@ namespace ts.codefix { const anons = good.filter(i => checker.getObjectFlags(i) & ObjectFlags.Anonymous) as AnonymousType[]; if (anons.length) { good = good.filter(i => !(checker.getObjectFlags(i) & ObjectFlags.Anonymous)); - good.push(unifyAnonymousTypes(anons)); + good.push(combineAnonymousTypes(anons)); } - return checker.getWidenedType(checker.getUnionType(good)); + return checker.getWidenedType(checker.getUnionType(good.map(checker.getBaseTypeOfLiteralType), UnionReduction.Subtype)); } - function unifyAnonymousTypes(anons: AnonymousType[]) { + function combineAnonymousTypes(anons: AnonymousType[]) { if (anons.length === 1) { return anons[0]; } @@ -822,7 +893,7 @@ namespace ts.codefix { numberIndices.length ? checker.createIndexInfo(checker.getUnionType(numberIndices), numberIndexReadonly) : undefined); } - function inferFromUsage(usage: Usage) { + function inferTypes(usage: Usage): Type[] { const types = []; if (usage.isNumber) { @@ -834,92 +905,155 @@ namespace ts.codefix { if (usage.isNumberOrString) { types.push(checker.getUnionType([checker.getStringType(), checker.getNumberType()])); } + if (usage.numberIndex) { + types.push(checker.createArrayType(combineFromUsage(usage.numberIndex))); + } + if (usage.properties && usage.properties.size + || usage.calls && usage.calls.length + || usage.constructs && usage.constructs.length + || usage.stringIndex) { + types.push(inferStructuralType(usage)); + } types.push(...(usage.candidateTypes || []).map(t => checker.getBaseTypeOfLiteralType(t))); + types.push(...inferNamedTypesFromProperties(usage)); - if (usage.properties && hasCalls(usage.properties.get("then" as __String))) { - const paramType = getParameterTypeFromCalls(0, usage.properties.get("then" as __String)!.calls!, /*isRestParameter*/ false)!; // TODO: GH#18217 - const types = paramType.getCallSignatures().map(sig => sig.getReturnType()); - types.push(checker.createPromiseType(types.length ? checker.getUnionType(types, UnionReduction.Subtype) : checker.getAnyType())); - } - else if (usage.properties && hasCalls(usage.properties.get("push" as __String))) { - types.push(checker.createArrayType(getParameterTypeFromCalls(0, usage.properties.get("push" as __String)!.calls!, /*isRestParameter*/ false)!)); + return types; + } + + function inferStructuralType(usage: Usage) { + const members = createUnderscoreEscapedMap(); + if (usage.properties) { + usage.properties.forEach((u, name) => { + const symbol = checker.createSymbol(SymbolFlags.Property, name); + symbol.type = combineFromUsage(u); + members.set(name, symbol); + }); } + const callSignatures: Signature[] = usage.calls ? [getSignatureFromCalls(usage.calls)] : []; + const constructSignatures: Signature[] = usage.constructs ? [getSignatureFromCalls(usage.constructs)] : []; + const stringIndexInfo = usage.stringIndex && checker.createIndexInfo(combineFromUsage(usage.stringIndex), /*isReadonly*/ false); + return checker.createAnonymousType(/*symbol*/ undefined!, members, callSignatures, constructSignatures, stringIndexInfo, /*numberIndexInfo*/ undefined); // TODO: GH#18217 + } - if (usage.numberIndex) { - types.push(checker.createArrayType(recur(usage.numberIndex))); - } - else if (usage.properties || usage.calls || usage.constructs || usage.stringIndex) { - const members = createUnderscoreEscapedMap(); - const callSignatures: Signature[] = []; - const constructSignatures: Signature[] = []; - let stringIndexInfo: IndexInfo | undefined; - - if (usage.properties) { - usage.properties.forEach((u, name) => { - const symbol = checker.createSymbol(SymbolFlags.Property, name); - symbol.type = recur(u); - members.set(name, symbol); - }); - } + function inferNamedTypesFromProperties(usage: Usage): Type[] { + if (!usage.properties || !usage.properties.size) return []; + const types = builtins.filter(t => allPropertiesAreAssignableToUsage(t, usage)); + if (0 < types.length && types.length < 3) { + return types.map(t => inferInstantiationFromUsage(t, usage)); + } + return []; + } - if (usage.calls) { - for (const call of usage.calls) { - callSignatures.push(getSignatureFromCall(call)); - } + function allPropertiesAreAssignableToUsage(type: Type, usage: Usage) { + if (!usage.properties) return false; + return !forEachEntry(usage.properties, (propUsage, name) => { + const source = checker.getTypeOfPropertyOfType(type, name as string); + if (!source) { + return true; } - - if (usage.constructs) { - for (const construct of usage.constructs) { - constructSignatures.push(getSignatureFromCall(construct)); - } + if (propUsage.calls) { + const sigs = checker.getSignaturesOfType(source, SignatureKind.Call); + return !sigs.length || !checker.isTypeAssignableTo(source, getFunctionFromCalls(propUsage.calls)); } - - if (usage.stringIndex) { - stringIndexInfo = checker.createIndexInfo(recur(usage.stringIndex), /*isReadonly*/ false); + else { + return !checker.isTypeAssignableTo(source, combineFromUsage(propUsage)); } + }); + } - types.push(checker.createAnonymousType(/*symbol*/ undefined!, members, callSignatures, constructSignatures, stringIndexInfo, /*numberIndexInfo*/ undefined)); // TODO: GH#18217 - } - return types; - - function recur(innerUsage: Usage): Type { - return unifyFromUsage(inferFromUsage(innerUsage)); + /** + * inference is limited to + * 1. generic types with a single parameter + * 2. inference to/from calls with a single signature + */ + function inferInstantiationFromUsage(type: Type, usage: Usage) { + if (!(getObjectFlags(type) & ObjectFlags.Reference) || !usage.properties) { + return type; } + const generic = (type as TypeReference).target; + const singleTypeParameter = singleOrUndefined(generic.typeParameters); + if (!singleTypeParameter) return type; + + const types: Type[] = []; + usage.properties.forEach((propUsage, name) => { + const genericPropertyType = checker.getTypeOfPropertyOfType(generic, name as string); + Debug.assert(!!genericPropertyType, "generic should have all the properties of its reference."); + types.push(...inferTypeParameters(genericPropertyType!, combineFromUsage(propUsage), singleTypeParameter)); + }); + return builtinConstructors[type.symbol.escapedName as string](combineTypes(types)); } - function getParameterTypeFromCalls(parameterIndex: number, calls: CallUsage[], isRestParameter: boolean) { - let types: Type[] = []; - if (calls) { - for (const call of calls) { - if (call.argumentTypes.length > parameterIndex) { - if (isRestParameter) { - types = concatenate(types, map(call.argumentTypes.slice(parameterIndex), a => checker.getBaseTypeOfLiteralType(a))); - } - else { - types.push(checker.getBaseTypeOfLiteralType(call.argumentTypes[parameterIndex])); + function inferTypeParameters(genericType: Type, usageType: Type, typeParameter: Type): readonly Type[] { + if (genericType === typeParameter) { + return [usageType]; + } + else if (genericType.flags & TypeFlags.UnionOrIntersection) { + return flatMap((genericType as UnionOrIntersectionType).types, t => inferTypeParameters(t, usageType, typeParameter)); + } + else if (getObjectFlags(genericType) & ObjectFlags.Reference && getObjectFlags(usageType) & ObjectFlags.Reference) { + // this is wrong because we need a reference to the targetType to, so we can check that it's also a reference + const genericArgs = (genericType as TypeReference).typeArguments; + const usageArgs = (usageType as TypeReference).typeArguments; + const types = []; + if (genericArgs && usageArgs) { + for (let i = 0; i < genericArgs.length; i++) { + if (usageArgs[i]) { + types.push(...inferTypeParameters(genericArgs[i], usageArgs[i], typeParameter)); } } } + return types; + } + const genericSigs = checker.getSignaturesOfType(genericType, SignatureKind.Call); + const usageSigs = checker.getSignaturesOfType(usageType, SignatureKind.Call); + if (genericSigs.length === 1 && usageSigs.length === 1) { + return inferFromSignatures(genericSigs[0], usageSigs[0], typeParameter); } + return []; + } - if (types.length) { - const type = checker.getWidenedType(checker.getUnionType(types, UnionReduction.Subtype)); - return isRestParameter ? checker.createArrayType(type) : type; + function inferFromSignatures(genericSig: Signature, usageSig: Signature, typeParameter: Type) { + const types = []; + for (let i = 0; i < genericSig.parameters.length; i++) { + const genericParam = genericSig.parameters[i]; + const usageParam = usageSig.parameters[i]; + const isRest = genericSig.declaration && isRestParameter(genericSig.declaration.parameters[i]); + if (!usageParam) { + break; + } + let genericParamType = checker.getTypeOfSymbolAtLocation(genericParam, genericParam.valueDeclaration); + const elementType = isRest && checker.getElementTypeOfArrayType(genericParamType); + if (elementType) { + genericParamType = elementType; + } + const targetType = (usageParam as SymbolLinks).type || checker.getTypeOfSymbolAtLocation(usageParam, usageParam.valueDeclaration); + types.push(...inferTypeParameters(genericParamType, targetType, typeParameter)); } - return undefined; + const genericReturn = checker.getReturnTypeOfSignature(genericSig); + const usageReturn = checker.getReturnTypeOfSignature(usageSig); + types.push(...inferTypeParameters(genericReturn, usageReturn, typeParameter)); + return types; + } + + function getFunctionFromCalls(calls: CallUsage[]) { + return checker.createAnonymousType(undefined!, createSymbolTable(), [getSignatureFromCalls(calls)], emptyArray, /*stringIndexInfo*/ undefined, /*numberIndexInfo*/ undefined); } - function getSignatureFromCall(call: CallUsage): Signature { + function getSignatureFromCalls(calls: CallUsage[]): Signature { const parameters: Symbol[] = []; - for (let i = 0; i < call.argumentTypes.length; i++) { + const length = Math.max(...calls.map(c => c.argumentTypes.length)); + for (let i = 0; i < length; i++) { const symbol = checker.createSymbol(SymbolFlags.FunctionScopedVariable, escapeLeadingUnderscores(`arg${i}`)); - symbol.type = checker.getWidenedType(checker.getBaseTypeOfLiteralType(call.argumentTypes[i])); + symbol.type = combineTypes(calls.map(call => call.argumentTypes[i] || checker.getUndefinedType())); + if (calls.some(call => call.argumentTypes[i] === undefined)) { + symbol.flags |= SymbolFlags.Optional; + } parameters.push(symbol); } - const returnType = unifyFromUsage(inferFromUsage(call.returnType), checker.getVoidType()); + const returnType = combineFromUsage(combineUsages(calls.map(call => call.return_))); // TODO: GH#18217 - return checker.createSignature(/*declaration*/ undefined!, /*typeParameters*/ undefined, /*thisParameter*/ undefined, parameters, returnType, /*typePredicate*/ undefined, call.argumentTypes.length, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false); + return checker.createSignature(/*declaration*/ undefined!, /*typeParameters*/ undefined, /*thisParameter*/ undefined, parameters, returnType, /*typePredicate*/ undefined, length, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false); } function addCandidateType(usage: Usage, type: Type | undefined) { @@ -933,9 +1067,5 @@ namespace ts.codefix { (usage.candidateThisTypes || (usage.candidateThisTypes = [])).push(type); } } - - function hasCalls(usage: Usage | undefined): boolean { - return !!usage && !!usage.calls; - } } } diff --git a/src/services/codefixes/useBigintLiteral.ts b/src/services/codefixes/useBigintLiteral.ts new file mode 100644 index 0000000000000..0749cc1a677b6 --- /dev/null +++ b/src/services/codefixes/useBigintLiteral.ts @@ -0,0 +1,33 @@ +/* @internal */ +namespace ts.codefix { + const fixId = "useBigintLiteral"; + const errorCodes = [ + Diagnostics.Numeric_literals_with_absolute_values_equal_to_2_53_or_greater_are_too_large_to_be_represented_accurately_as_integers.code, + ]; + + registerCodeFix({ + errorCodes, + getCodeActions: context => { + const changes = textChanges.ChangeTracker.with(context, t => makeChange(t, context.sourceFile, context.span)); + if (changes.length > 0) { + return [createCodeFixAction(fixId, changes, Diagnostics.Convert_to_a_bigint_numeric_literal, fixId, Diagnostics.Convert_all_to_bigint_numeric_literals)]; + } + }, + fixIds: [fixId], + getAllCodeActions: context => { + return codeFixAll(context, errorCodes, (changes, diag) => makeChange(changes, diag.file, diag)); + }, + }); + + function makeChange(changeTracker: textChanges.ChangeTracker, sourceFile: SourceFile, span: TextSpan) { + const numericLiteral = tryCast(getTokenAtPosition(sourceFile, span.start), isNumericLiteral); + if (!numericLiteral) { + return; + } + + // We use .getText to overcome parser inaccuracies: https://github.com/microsoft/TypeScript/issues/33298 + const newText = numericLiteral.getText(sourceFile) + "n"; + + changeTracker.replaceNode(sourceFile, numericLiteral, createBigIntLiteral(newText)); + } +} diff --git a/src/services/findAllReferences.ts b/src/services/findAllReferences.ts index 5d667ee55a472..f98fb2f75b8d8 100644 --- a/src/services/findAllReferences.ts +++ b/src/services/findAllReferences.ts @@ -1145,7 +1145,7 @@ namespace ts.FindAllReferences.Core { } export function eachSymbolReferenceInFile(definition: Identifier, checker: TypeChecker, sourceFile: SourceFile, cb: (token: Identifier) => T): T | undefined { - const symbol = isParameterPropertyDeclaration(definition.parent) + const symbol = isParameterPropertyDeclaration(definition.parent, definition.parent.parent) ? first(checker.getSymbolsOfParameterPropertyDeclaration(definition.parent, definition.text)) : checker.getSymbolAtLocation(definition); if (!symbol) return undefined; @@ -1886,7 +1886,7 @@ namespace ts.FindAllReferences.Core { const res = fromRoot(symbol); if (res) return res; - if (symbol.valueDeclaration && isParameterPropertyDeclaration(symbol.valueDeclaration)) { + if (symbol.valueDeclaration && isParameterPropertyDeclaration(symbol.valueDeclaration, symbol.valueDeclaration.parent)) { // For a parameter property, now try on the other symbol (property if this was a parameter, parameter if this was a property). const paramProps = checker.getSymbolsOfParameterPropertyDeclaration(cast(symbol.valueDeclaration, isParameter), symbol.name); Debug.assert(paramProps.length === 2 && !!(paramProps[0].flags & SymbolFlags.FunctionScopedVariable) && !!(paramProps[1].flags & SymbolFlags.Property)); // is [parameter, property] diff --git a/src/services/navigationBar.ts b/src/services/navigationBar.ts index fb0a1503214b2..dd3bdcffd3248 100644 --- a/src/services/navigationBar.ts +++ b/src/services/navigationBar.ts @@ -56,7 +56,7 @@ namespace ts.NavigationBar { curCancellationToken = cancellationToken; curSourceFile = sourceFile; try { - return map(topLevelItems(rootNavigationBarNode(sourceFile)), convertToTopLevelItem); + return map(primaryNavBarMenuItems(rootNavigationBarNode(sourceFile)), convertToPrimaryNavBarMenuItem); } finally { reset(); @@ -111,8 +111,8 @@ namespace ts.NavigationBar { return root; } - function addLeafNode(node: Node): void { - pushChild(parent, emptyNavigationBarNode(node)); + function addLeafNode(node: Node, name?: DeclarationName): void { + pushChild(parent, emptyNavigationBarNode(node, name)); } function emptyNavigationBarNode(node: Node, name?: DeclarationName): NavigationBarNode { @@ -197,7 +197,7 @@ namespace ts.NavigationBar { // Parameter properties are children of the class, not the constructor. for (const param of ctr.parameters) { - if (isParameterPropertyDeclaration(param)) { + if (isParameterPropertyDeclaration(param, ctr)) { addLeafNode(param); } } @@ -243,23 +243,26 @@ namespace ts.NavigationBar { } break; + case SyntaxKind.ShorthandPropertyAssignment: + addNodeWithRecursiveChild(node, (node).name); + break; + case SyntaxKind.SpreadAssignment: + const { expression } = node; + // Use the expression as the name of the SpreadAssignment, otherwise show as . + isIdentifier(expression) ? addLeafNode(node, expression) : addLeafNode(node); + break; case SyntaxKind.BindingElement: + case SyntaxKind.PropertyAssignment: case SyntaxKind.VariableDeclaration: - const { name, initializer } = node; + const { name, initializer } = node; if (isBindingPattern(name)) { addChildrenRecursively(name); } else if (initializer && isFunctionOrClassExpression(initializer)) { - if (initializer.name) { - // Don't add a node for the VariableDeclaration, just for the initializer. - addChildrenRecursively(initializer); - } - else { - // Add a node for the VariableDeclaration, but not for the initializer. - startNode(node); - forEachChild(initializer, addChildrenRecursively); - endNode(); - } + // Add a node for the VariableDeclaration, but not for the initializer. + startNode(node); + forEachChild(initializer, addChildrenRecursively); + endNode(); } else { addNodeWithRecursiveChild(node, initializer); @@ -699,12 +702,15 @@ namespace ts.NavigationBar { } } - /** Flattens the NavNode tree to a list, keeping only the top-level items. */ - function topLevelItems(root: NavigationBarNode): NavigationBarNode[] { - const topLevel: NavigationBarNode[] = []; + /** Flattens the NavNode tree to a list of items to appear in the primary navbar menu. */ + function primaryNavBarMenuItems(root: NavigationBarNode): NavigationBarNode[] { + // The primary (middle) navbar menu displays the general code navigation hierarchy, similar to the navtree. + // The secondary (right) navbar menu displays the child items of whichever primary item is selected. + // Some less interesting items without their own child navigation items (e.g. a local variable declaration) only show up in the secondary menu. + const primaryNavBarMenuItems: NavigationBarNode[] = []; function recur(item: NavigationBarNode) { - if (isTopLevel(item)) { - topLevel.push(item); + if (shouldAppearInPrimaryNavBarMenu(item)) { + primaryNavBarMenuItems.push(item); if (item.children) { for (const child of item.children) { recur(child); @@ -713,9 +719,16 @@ namespace ts.NavigationBar { } } recur(root); - return topLevel; + return primaryNavBarMenuItems; - function isTopLevel(item: NavigationBarNode): boolean { + /** Determines if a node should appear in the primary navbar menu. */ + function shouldAppearInPrimaryNavBarMenu(item: NavigationBarNode): boolean { + // Items with children should always appear in the primary navbar menu. + if (item.children) { + return true; + } + + // Some nodes are otherwise important enough to always include in the primary navigation menu. switch (navigationBarNodeKind(item)) { case SyntaxKind.ClassDeclaration: case SyntaxKind.ClassExpression: @@ -728,13 +741,6 @@ namespace ts.NavigationBar { case SyntaxKind.JSDocCallbackTag: return true; - case SyntaxKind.Constructor: - case SyntaxKind.MethodDeclaration: - case SyntaxKind.GetAccessor: - case SyntaxKind.SetAccessor: - case SyntaxKind.VariableDeclaration: - return hasSomeImportantChild(item); - case SyntaxKind.ArrowFunction: case SyntaxKind.FunctionDeclaration: case SyntaxKind.FunctionExpression: @@ -755,15 +761,9 @@ namespace ts.NavigationBar { case SyntaxKind.Constructor: return true; default: - return hasSomeImportantChild(item); + return false; } } - function hasSomeImportantChild(item: NavigationBarNode): boolean { - return some(item.children, child => { - const childKind = navigationBarNodeKind(child); - return childKind !== SyntaxKind.VariableDeclaration && childKind !== SyntaxKind.BindingElement; - }); - } } } @@ -778,19 +778,19 @@ namespace ts.NavigationBar { }; } - function convertToTopLevelItem(n: NavigationBarNode): NavigationBarItem { + function convertToPrimaryNavBarMenuItem(n: NavigationBarNode): NavigationBarItem { return { text: getItemName(n.node, n.name), kind: getNodeKind(n.node), kindModifiers: getModifiers(n.node), spans: getSpans(n), - childItems: map(n.children, convertToChildItem) || emptyChildItemArray, + childItems: map(n.children, convertToSecondaryNavBarMenuItem) || emptyChildItemArray, indent: n.indent, bolded: false, grayed: false }; - function convertToChildItem(n: NavigationBarNode): NavigationBarItem { + function convertToSecondaryNavBarMenuItem(n: NavigationBarNode): NavigationBarItem { return { text: getItemName(n.node, n.name), kind: getNodeKind(n.node), diff --git a/src/services/refactors/extractSymbol.ts b/src/services/refactors/extractSymbol.ts index 950bb078e0670..e7f57a57351c4 100644 --- a/src/services/refactors/extractSymbol.ts +++ b/src/services/refactors/extractSymbol.ts @@ -116,6 +116,7 @@ namespace ts.refactor.extractSymbol { export const cannotExtractRange: DiagnosticMessage = createMessage("Cannot extract range."); export const cannotExtractImport: DiagnosticMessage = createMessage("Cannot extract import statement."); export const cannotExtractSuper: DiagnosticMessage = createMessage("Cannot extract super call."); + export const cannotExtractJSDoc: DiagnosticMessage = createMessage("Cannot extract JSDoc."); export const cannotExtractEmpty: DiagnosticMessage = createMessage("Cannot extract empty range."); export const expressionExpected: DiagnosticMessage = createMessage("expression expected."); export const uselessConstantType: DiagnosticMessage = createMessage("No reason to extract constant of type."); @@ -246,6 +247,10 @@ namespace ts.refactor.extractSymbol { return { targetRange: { range: statements, facts: rangeFacts, declarations } }; } + if (isJSDoc(start)) { + return { errors: [createFileDiagnostic(sourceFile, span.start, length, Messages.cannotExtractJSDoc)] }; + } + if (isReturnStatement(start) && !start.expression) { // Makes no sense to extract an expression-less return statement. return { errors: [createFileDiagnostic(sourceFile, span.start, length, Messages.cannotExtractRange)] }; @@ -1006,11 +1011,14 @@ namespace ts.refactor.extractSymbol { const localNameText = getUniqueName(isClassLike(scope) ? "newProperty" : "newLocal", file); const isJS = isInJSFile(scope); - const variableType = isJS || !checker.isContextSensitive(node) + let variableType = isJS || !checker.isContextSensitive(node) ? undefined : checker.typeToTypeNode(checker.getContextualType(node)!, scope, NodeBuilderFlags.NoTruncation); // TODO: GH#18217 - const initializer = transformConstantInitializer(node, substitutions); + let initializer = transformConstantInitializer(node, substitutions); + + ({ variableType, initializer } = transformFunctionInitializerAndType(variableType, initializer)); + suppressLeadingAndTrailingTrivia(initializer); const changeTracker = textChanges.ChangeTracker.fromContext(context); @@ -1102,6 +1110,73 @@ namespace ts.refactor.extractSymbol { const renameFilename = node.getSourceFile().fileName; const renameLocation = getRenameLocation(edits, renameFilename, localNameText, /*isDeclaredBeforeUse*/ true); return { renameFilename, renameLocation, edits }; + + function transformFunctionInitializerAndType(variableType: TypeNode | undefined, initializer: Expression): { variableType: TypeNode | undefined, initializer: Expression } { + // If no contextual type exists there is nothing to transfer to the function signature + if (variableType === undefined) return { variableType, initializer }; + // Only do this for function expressions and arrow functions that are not generic + if (!isFunctionExpression(initializer) && !isArrowFunction(initializer) || !!initializer.typeParameters) return { variableType, initializer }; + const functionType = checker.getTypeAtLocation(node); + const functionSignature = singleOrUndefined(checker.getSignaturesOfType(functionType, SignatureKind.Call)); + + // If no function signature, maybe there was an error, do nothing + if (!functionSignature) return { variableType, initializer }; + // If the function signature has generic type parameters we don't attempt to move the parameters + if (!!functionSignature.getTypeParameters()) return { variableType, initializer }; + + // We add parameter types if needed + const parameters: ParameterDeclaration[] = []; + let hasAny = false; + for (const p of initializer.parameters) { + if (p.type) { + parameters.push(p); + } + else { + const paramType = checker.getTypeAtLocation(p); + if (paramType === checker.getAnyType()) hasAny = true; + + parameters.push(updateParameter(p, + p.decorators, p.modifiers, p.dotDotDotToken, + p.name, p.questionToken, p.type || checker.typeToTypeNode(paramType, scope, NodeBuilderFlags.NoTruncation), p.initializer)); + } + } + // If a parameter was inferred as any we skip adding function parameters at all. + // Turning an implicit any (which under common settings is a error) to an explicit + // is probably actually a worse refactor outcome. + if (hasAny) return { variableType, initializer }; + variableType = undefined; + if (isArrowFunction(initializer)) { + initializer = updateArrowFunction(initializer, node.modifiers, initializer.typeParameters, + parameters, + initializer.type || checker.typeToTypeNode(functionSignature.getReturnType(), scope, NodeBuilderFlags.NoTruncation), + initializer.equalsGreaterThanToken, + initializer.body); + } + else { + if (functionSignature && !!functionSignature.thisParameter) { + const firstParameter = firstOrUndefined(parameters); + // If the function signature has a this parameter and if the first defined parameter is not the this parameter, we must add it + // Note: If this parameter was already there, it would have been previously updated with the type if not type was present + if ((!firstParameter || (isIdentifier(firstParameter.name) && firstParameter.name.escapedText !== "this"))) { + const thisType = checker.getTypeOfSymbolAtLocation(functionSignature.thisParameter, node); + parameters.splice(0, 0, createParameter( + /* decorators */ undefined, + /* modifiers */ undefined, + /* dotDotDotToken */ undefined, + "this", + /* questionToken */ undefined, + checker.typeToTypeNode(thisType, scope, NodeBuilderFlags.NoTruncation) + )); + } + } + initializer = updateFunctionExpression(initializer, node.modifiers, initializer.asteriskToken, + initializer.name, initializer.typeParameters, + parameters, + initializer.type || checker.typeToTypeNode(functionSignature.getReturnType(), scope, NodeBuilderFlags.NoTruncation), + initializer.body); + } + return { variableType, initializer }; + } } function getContainingVariableDeclarationIfInList(node: Node, scope: Scope) { diff --git a/src/services/refactors/generateGetAccessorAndSetAccessor.ts b/src/services/refactors/generateGetAccessorAndSetAccessor.ts index 7e4ca1a66457d..a1bd32b37fc29 100644 --- a/src/services/refactors/generateGetAccessorAndSetAccessor.ts +++ b/src/services/refactors/generateGetAccessorAndSetAccessor.ts @@ -92,7 +92,7 @@ namespace ts.refactor.generateGetAccessorAndSetAccessor { } function isAcceptedDeclaration(node: Node): node is AcceptedDeclaration { - return isParameterPropertyDeclaration(node) || isPropertyDeclaration(node) || isPropertyAssignment(node); + return isParameterPropertyDeclaration(node, node.parent) || isPropertyDeclaration(node) || isPropertyAssignment(node); } function createPropertyName (name: string, originalName: AcceptedNameType) { @@ -214,7 +214,7 @@ namespace ts.refactor.generateGetAccessorAndSetAccessor { } function insertAccessor(changeTracker: textChanges.ChangeTracker, file: SourceFile, accessor: AccessorDeclaration, declaration: AcceptedDeclaration, container: ContainerDeclaration) { - isParameterPropertyDeclaration(declaration) ? changeTracker.insertNodeAtClassStart(file, container, accessor) : + isParameterPropertyDeclaration(declaration, declaration.parent) ? changeTracker.insertNodeAtClassStart(file, container, accessor) : isPropertyAssignment(declaration) ? changeTracker.insertNodeAfterComma(file, declaration, accessor) : changeTracker.insertNodeAfter(file, declaration, accessor); } diff --git a/src/services/services.ts b/src/services/services.ts index 644629ce2af4f..fb5c35d8f5d48 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -1149,10 +1149,10 @@ namespace ts { useCaseSensitiveFileNames: () => useCaseSensitiveFileNames, getCurrentDirectory: () => currentDirectory, getProgram, - fileExists: host.fileExists && (f => host.fileExists!(f)), - readFile: host.readFile && ((f, encoding) => host.readFile!(f, encoding)), - getDocumentPositionMapper: host.getDocumentPositionMapper && ((generatedFileName, sourceFileName) => host.getDocumentPositionMapper!(generatedFileName, sourceFileName)), - getSourceFileLike: host.getSourceFileLike && (f => host.getSourceFileLike!(f)), + fileExists: maybeBind(host, host.fileExists), + readFile: maybeBind(host, host.readFile), + getDocumentPositionMapper: maybeBind(host, host.getDocumentPositionMapper), + getSourceFileLike: maybeBind(host, host.getSourceFileLike), log }); @@ -1250,6 +1250,12 @@ namespace ts { if (host.resolveTypeReferenceDirectives) { compilerHost.resolveTypeReferenceDirectives = (...args) => host.resolveTypeReferenceDirectives!(...args); } + if (host.setResolvedProjectReferenceCallbacks) { + compilerHost.setResolvedProjectReferenceCallbacks = callbacks => host.setResolvedProjectReferenceCallbacks!(callbacks); + } + if (host.useSourceOfProjectReferenceRedirect) { + compilerHost.useSourceOfProjectReferenceRedirect = () => host.useSourceOfProjectReferenceRedirect!(); + } const documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings); const options: CreateProgramOptions = { diff --git a/src/services/sourcemaps.ts b/src/services/sourcemaps.ts index d07c21a9f432c..6ab656b4236ee 100644 --- a/src/services/sourcemaps.ts +++ b/src/services/sourcemaps.ts @@ -70,6 +70,11 @@ namespace ts { if (!sourceFile) return undefined; const program = host.getProgram()!; + // If this is source file of project reference source (instead of redirect) there is no generated position + if (program.isSourceOfProjectReferenceRedirect(sourceFile.fileName)) { + return undefined; + } + const options = program.getCompilerOptions(); const outPath = options.outFile || options.out; diff --git a/src/services/tsconfig.json b/src/services/tsconfig.json index 6b52393422c98..b90607b0a85a3 100644 --- a/src/services/tsconfig.json +++ b/src/services/tsconfig.json @@ -79,9 +79,11 @@ "codefixes/fixStrictClassInitialization.ts", "codefixes/requireInTs.ts", "codefixes/useDefaultImport.ts", + "codefixes/useBigintLiteral.ts", "codefixes/fixAddModuleReferTypeMissingTypeof.ts", "codefixes/convertToMappedObjectType.ts", "codefixes/removeUnnecessaryAwait.ts", + "codefixes/convertConstToLet.ts", "refactors/convertExport.ts", "refactors/convertImport.ts", "refactors/extractSymbol.ts", diff --git a/src/services/types.ts b/src/services/types.ts index c44370febe399..d77007f045df0 100644 --- a/src/services/types.ts +++ b/src/services/types.ts @@ -234,6 +234,10 @@ namespace ts { getDocumentPositionMapper?(generatedFileName: string, sourceFileName?: string): DocumentPositionMapper | undefined; /* @internal */ getSourceFileLike?(fileName: string): SourceFileLike | undefined; + /* @internal */ + setResolvedProjectReferenceCallbacks?(callbacks: ResolvedProjectReferenceCallbacks): void; + /* @internal */ + useSourceOfProjectReferenceRedirect?(): boolean; } /* @internal */ diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 95d501de1105d..91b0a7a19914b 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -353,8 +353,13 @@ namespace ts { case SyntaxKind.MethodDeclaration: case SyntaxKind.MethodSignature: return ScriptElementKind.memberFunctionElement; + case SyntaxKind.PropertyAssignment: + const {initializer} = node as PropertyAssignment; + return isFunctionLike(initializer) ? ScriptElementKind.memberFunctionElement : ScriptElementKind.memberVariableElement; case SyntaxKind.PropertyDeclaration: case SyntaxKind.PropertySignature: + case SyntaxKind.ShorthandPropertyAssignment: + case SyntaxKind.SpreadAssignment: return ScriptElementKind.memberVariableElement; case SyntaxKind.IndexSignature: return ScriptElementKind.indexSignatureElement; case SyntaxKind.ConstructSignature: return ScriptElementKind.constructSignatureElement; diff --git a/src/testRunner/externalCompileRunner.ts b/src/testRunner/externalCompileRunner.ts index c9e800713c3ba..7698fc3f086af 100644 --- a/src/testRunner/externalCompileRunner.ts +++ b/src/testRunner/externalCompileRunner.ts @@ -10,6 +10,7 @@ interface ExecResult { interface UserConfig { types: string[]; + cloneUrl: string; path?: string; } @@ -49,13 +50,17 @@ abstract class ExternalCompileRunnerBase extends RunnerBase { const stdio = isWorker ? "pipe" : "inherit"; let types: string[] | undefined; if (fs.existsSync(path.join(cwd, "test.json"))) { + const config = JSON.parse(fs.readFileSync(path.join(cwd, "test.json"), { encoding: "utf8" })) as UserConfig; + ts.Debug.assert(!!config.types, "Bad format from test.json: Types field must be present."); + ts.Debug.assert(!!config.cloneUrl, "Bad format from test.json: cloneUrl field must be present."); const submoduleDir = path.join(cwd, directoryName); + if (!fs.existsSync(submoduleDir)) { + exec("git", ["clone", config.cloneUrl, directoryName], { cwd }); + } exec("git", ["reset", "HEAD", "--hard"], { cwd: submoduleDir }); exec("git", ["clean", "-f"], { cwd: submoduleDir }); - exec("git", ["submodule", "update", "--init", "--remote", "."], { cwd: originalCwd }); + exec("git", ["pull", "-f"], { cwd: submoduleDir }); - const config = JSON.parse(fs.readFileSync(path.join(cwd, "test.json"), { encoding: "utf8" })) as UserConfig; - ts.Debug.assert(!!config.types, "Bad format from test.json: Types field must be present."); types = config.types; cwd = config.path ? path.join(cwd, config.path) : submoduleDir; diff --git a/src/testRunner/tsconfig.json b/src/testRunner/tsconfig.json index db9e96e1ad2fc..14544ce0bc171 100644 --- a/src/testRunner/tsconfig.json +++ b/src/testRunner/tsconfig.json @@ -38,6 +38,7 @@ "unittests/services/extract/helpers.ts", "unittests/tsbuild/helpers.ts", + "unittests/tsc/helpers.ts", "unittests/tscWatch/helpers.ts", "unittests/tsserver/helpers.ts", @@ -145,6 +146,8 @@ "unittests/tsserver/occurences.ts", "unittests/tsserver/openFile.ts", "unittests/tsserver/projectErrors.ts", + "unittests/tsserver/projectReferenceCompileOnSave.ts", + "unittests/tsserver/projectReferenceErrors.ts", "unittests/tsserver/projectReferences.ts", "unittests/tsserver/projects.ts", "unittests/tsserver/refactors.ts", diff --git a/src/testRunner/unittests/programApi.ts b/src/testRunner/unittests/programApi.ts index 51e1b8ffa502c..5f5251afaf253 100644 --- a/src/testRunner/unittests/programApi.ts +++ b/src/testRunner/unittests/programApi.ts @@ -160,4 +160,22 @@ namespace ts { } } }); + + describe("unittests:: Program.getNodeCount / Program.getIdentifierCount", () => { + it("works on projects that have .json files", () => { + const main = new documents.TextDocument("/main.ts", 'export { version } from "./package.json";'); + const pkg = new documents.TextDocument("/package.json", '{"version": "1.0.0"}'); + + const fs = vfs.createFromFileSystem(Harness.IO, /*ignoreCase*/ false, { documents: [main, pkg], cwd: "/" }); + const program = createProgram(["/main.ts"], { resolveJsonModule: true }, new fakes.CompilerHost(fs, { newLine: NewLineKind.LineFeed })); + + const json = program.getSourceFile("/package.json")!; + assert.equal(json.scriptKind, ScriptKind.JSON); + assert.isNumber(json.nodeCount); + assert.isNumber(json.identifierCount); + + assert.isNotNaN(program.getNodeCount()); + assert.isNotNaN(program.getIdentifierCount()); + }); + }); } diff --git a/src/testRunner/unittests/services/extract/ranges.ts b/src/testRunner/unittests/services/extract/ranges.ts index d2ac6a0a88347..ab205288b330c 100644 --- a/src/testRunner/unittests/services/extract/ranges.ts +++ b/src/testRunner/unittests/services/extract/ranges.ts @@ -380,6 +380,10 @@ switch (x) { `[#|{ 1;|] }`, [refactor.extractSymbol.Messages.cannotExtractRange.message]); + testExtractRangeFailed("extractRangeFailed19", + `[#|/** @type {number} */|] const foo = 1;`, + [refactor.extractSymbol.Messages.cannotExtractJSDoc.message]); + testExtractRangeFailed("extract-method-not-for-token-expression-statement", `[#|a|]`, [refactor.extractSymbol.Messages.cannotExtractIdentifier.message]); }); } diff --git a/src/testRunner/unittests/transform.ts b/src/testRunner/unittests/transform.ts index 5203e69e813a7..ffd5ba7609f27 100644 --- a/src/testRunner/unittests/transform.ts +++ b/src/testRunner/unittests/transform.ts @@ -300,6 +300,34 @@ namespace ts { }); }); + // https://github.com/microsoft/TypeScript/issues/33295 + testBaseline("transformParameterProperty", () => { + return transpileModule("", { + transformers: { + before: [transformAddParameterProperty], + }, + compilerOptions: { + target: ScriptTarget.ES5, + newLine: NewLineKind.CarriageReturnLineFeed, + } + }).outputText; + + function transformAddParameterProperty(_context: TransformationContext) { + return (sourceFile: SourceFile): SourceFile => { + return visitNode(sourceFile); + }; + function visitNode(sf: SourceFile) { + // produce `class Foo { constructor(@Dec private x) {} }`; + // The decorator is required to trigger ts.ts transformations. + const classDecl = createClassDeclaration([], [], "Foo", /*typeParameters*/ undefined, /*heritageClauses*/ undefined, [ + createConstructor(/*decorators*/ undefined, /*modifiers*/ undefined, [ + createParameter(/*decorators*/ [createDecorator(createIdentifier("Dec"))], /*modifiers*/ [createModifier(SyntaxKind.PrivateKeyword)], /*dotDotDotToken*/ undefined, "x")], createBlock([])) + ]); + return updateSourceFileNode(sf, [classDecl]); + } + } + }); + function baselineDeclarationTransform(text: string, opts: TranspileOptions) { const fs = vfs.createFromFileSystem(Harness.IO, /*caseSensitive*/ true, { documents: [new documents.TextDocument("/.src/index.ts", text)] }); const host = new fakes.CompilerHost(fs, opts.compilerOptions); @@ -389,7 +417,7 @@ class Clazz { } `, { transformers: { - before: [addSyntheticComment(n => isPropertyDeclaration(n) || isParameterPropertyDeclaration(n) || isClassDeclaration(n) || isConstructorDeclaration(n))], + before: [addSyntheticComment(n => isPropertyDeclaration(n) || isParameterPropertyDeclaration(n, n.parent) || isClassDeclaration(n) || isConstructorDeclaration(n))], }, compilerOptions: { target: ScriptTarget.ES2015, diff --git a/src/testRunner/unittests/tsbuild/amdModulesWithOut.ts b/src/testRunner/unittests/tsbuild/amdModulesWithOut.ts index 79f5605d235c1..fdcf748cf2cf5 100644 --- a/src/testRunner/unittests/tsbuild/amdModulesWithOut.ts +++ b/src/testRunner/unittests/tsbuild/amdModulesWithOut.ts @@ -1,27 +1,8 @@ namespace ts { describe("unittests:: tsbuild:: outFile:: on amd modules with --out", () => { let outFileFs: vfs.FileSystem; - const { time, tick } = getTime(); - const enum ext { js, jsmap, dts, dtsmap, buildinfo } const enum project { lib, app } - type OutputFile = [string, string, string, string, string]; function relName(path: string) { return path.slice(1); } - const outputFiles: [OutputFile, OutputFile] = [ - [ - "/src/lib/module.js", - "/src/lib/module.js.map", - "/src/lib/module.d.ts", - "/src/lib/module.d.ts.map", - "/src/lib/module.tsbuildinfo" - ], - [ - "/src/app/module.js", - "/src/app/module.js.map", - "/src/app/module.d.ts", - "/src/app/module.d.ts.map", - "/src/app/module.tsbuildinfo" - ] - ]; type Sources = [string, readonly string[]]; const enum source { config, ts } const sources: [Sources, Sources] = [ @@ -43,68 +24,52 @@ namespace ts { ] ]; before(() => { - outFileFs = loadProjectFromDisk("tests/projects/amdModulesWithOut", time); + outFileFs = loadProjectFromDisk("tests/projects/amdModulesWithOut"); }); after(() => { outFileFs = undefined!; }); interface VerifyOutFileScenarioInput { - scenario: string; - modifyFs: (fs: vfs.FileSystem) => void; + subScenario: string; + modifyFs?: (fs: vfs.FileSystem) => void; modifyAgainFs?: (fs: vfs.FileSystem) => void; } function verifyOutFileScenario({ - scenario, + subScenario, modifyFs, modifyAgainFs }: VerifyOutFileScenarioInput) { - verifyTsbuildOutput({ - scenario, - projFs: () => outFileFs, - time, - tick, - proj: "amdModulesWithOut", - rootNames: ["/src/app"], - expectedMapFileNames: [ - outputFiles[project.lib][ext.jsmap], - outputFiles[project.lib][ext.dtsmap], - outputFiles[project.app][ext.jsmap], - outputFiles[project.app][ext.dtsmap], - ], - expectedBuildInfoFilesForSectionBaselines: [ - [outputFiles[project.lib][ext.buildinfo], outputFiles[project.lib][ext.js], outputFiles[project.lib][ext.dts]], - [outputFiles[project.app][ext.buildinfo], outputFiles[project.app][ext.js], outputFiles[project.app][ext.dts]] - ], - lastProjectOutput: outputFiles[project.app][ext.js], - initialBuild: { - modifyFs - }, - incrementalDtsUnchangedBuild: { - modifyFs: fs => appendText(fs, relName(sources[project.lib][source.ts][1]), "console.log(x);") - }, - incrementalHeaderChangedBuild: modifyAgainFs ? { - modifyFs: modifyAgainFs - } : undefined, - outputFiles: [ - ...outputFiles[project.lib], - ...outputFiles[project.app] - ], - baselineOnly: true + verifyTscIncrementalEdits({ + scenario: "amdModulesWithOut", + subScenario, + fs: () => outFileFs, + commandLineArgs: ["--b", "/src/app", "--verbose"], + baselineSourceMap: true, + modifyFs, + incrementalScenarios: [ + { + buildKind: BuildKind.IncrementalDtsUnchanged, + modifyFs: fs => appendText(fs, relName(sources[project.lib][source.ts][1]), "console.log(x);") + }, + ...(modifyAgainFs ? [{ + buildKind: BuildKind.IncrementalHeadersChange, + modifyFs: modifyAgainFs + }] : emptyArray), + ] }); } describe("Prepend output with .tsbuildinfo", () => { verifyOutFileScenario({ - scenario: "modules and globals mixed in amd", - modifyFs: noop + subScenario: "modules and globals mixed in amd", }); // Prologues describe("Prologues", () => { verifyOutFileScenario({ - scenario: "multiple prologues in all projects", + subScenario: "multiple prologues in all projects", modifyFs: fs => { enableStrict(fs, sources[project.lib][source.config]); addTestPrologue(fs, sources[project.lib][source.ts][0], `"myPrologue"`); @@ -122,7 +87,7 @@ namespace ts { describe("Shebang", () => { // changes declaration because its emitted in .d.ts file verifyOutFileScenario({ - scenario: "shebang in all projects", + subScenario: "shebang in all projects", modifyFs: fs => { addShebang(fs, "lib", "file0"); addShebang(fs, "lib", "file1"); @@ -134,7 +99,7 @@ namespace ts { // emitHelpers describe("emitHelpers", () => { verifyOutFileScenario({ - scenario: "multiple emitHelpers in all projects", + subScenario: "multiple emitHelpers in all projects", modifyFs: fs => { addSpread(fs, "lib", "file0"); addRest(fs, "lib", "file1"); @@ -149,7 +114,7 @@ namespace ts { describe("triple slash refs", () => { // changes declaration because its emitted in .d.ts file verifyOutFileScenario({ - scenario: "triple slash refs in all projects", + subScenario: "triple slash refs in all projects", modifyFs: fs => { addTripleSlashRef(fs, "lib", "file0"); addTripleSlashRef(fs, "app", "file4"); @@ -193,7 +158,7 @@ ${internal} export enum internalEnum { a, b, c }`); // Verify initial + incremental edits verifyOutFileScenario({ - scenario: "stripInternal", + subScenario: "stripInternal", modifyFs: stripInternalScenario, modifyAgainFs: fs => replaceText(fs, sources[project.lib][source.ts][1], `export const`, `/*@internal*/ export const`), }); @@ -207,47 +172,13 @@ ${internal} export enum internalEnum { a, b, c }`); replaceText(fs, sources[project.app][source.ts][0], "file1", "lib/file1"); } - const libOutputFile: OutputFile = [ - "/src/lib/module.js", - "/src/lib/module.js.map", - "/src/lib/module.d.ts", - "/src/lib/module.d.ts.map", - "/src/lib/module.tsbuildinfo" - ]; - verifyTsbuildOutput({ - scenario: "when the module resolution finds original source file", - projFs: () => outFileFs, - time, - tick, - proj: "amdModulesWithOut", - rootNames: ["/src/app"], - expectedMapFileNames: [ - libOutputFile[ext.jsmap], - libOutputFile[ext.dtsmap], - outputFiles[project.app][ext.jsmap], - outputFiles[project.app][ext.dtsmap], - ], - expectedBuildInfoFilesForSectionBaselines: [ - [libOutputFile[ext.buildinfo], libOutputFile[ext.js], libOutputFile[ext.dts]], - [outputFiles[project.app][ext.buildinfo], outputFiles[project.app][ext.js], outputFiles[project.app][ext.dts]] - ], - lastProjectOutput: outputFiles[project.app][ext.js], - initialBuild: { - modifyFs, - expectedDiagnostics: [ - getExpectedDiagnosticForProjectsInBuild("src/lib/tsconfig.json", "src/app/tsconfig.json"), - [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/lib/tsconfig.json", "src/module.js"], - [Diagnostics.Building_project_0, sources[project.lib][source.config]], - [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/app/tsconfig.json", "src/app/module.js"], - [Diagnostics.Building_project_0, sources[project.app][source.config]], - ] - }, - outputFiles: [ - ...libOutputFile, - ...outputFiles[project.app] - ], - baselineOnly: true, - verifyDiagnostics: true + verifyTsc({ + scenario: "amdModulesWithOut", + subScenario: "when the module resolution finds original source file", + fs: () => outFileFs, + commandLineArgs: ["-b", "/src/app", "--verbose"], + modifyFs, + baselineSourceMap: true, }); }); }); diff --git a/src/testRunner/unittests/tsbuild/containerOnlyReferenced.ts b/src/testRunner/unittests/tsbuild/containerOnlyReferenced.ts index 425dbf2e20f2e..f621d956621c3 100644 --- a/src/testRunner/unittests/tsbuild/containerOnlyReferenced.ts +++ b/src/testRunner/unittests/tsbuild/containerOnlyReferenced.ts @@ -19,7 +19,7 @@ namespace ts { it("verify that subsequent builds after initial build doesnt build anything", () => { const fs = projFs.shadow(); - const host = new fakes.SolutionBuilderHost(fs); + const host = fakes.SolutionBuilderHost.create(fs); createSolutionBuilder(host, ["/src"], { verbose: true }).build(); host.assertDiagnosticMessages( getExpectedDiagnosticForProjectsInBuild("src/src/folder/tsconfig.json", "src/src/folder2/tsconfig.json", "src/src/tsconfig.json", "src/tests/tsconfig.json", "src/tsconfig.json"), diff --git a/src/testRunner/unittests/tsbuild/demo.ts b/src/testRunner/unittests/tsbuild/demo.ts index c345ad1e372db..c8a597368ffc0 100644 --- a/src/testRunner/unittests/tsbuild/demo.ts +++ b/src/testRunner/unittests/tsbuild/demo.ts @@ -1,10 +1,8 @@ namespace ts { describe("unittests:: tsbuild:: on demo project", () => { let projFs: vfs.FileSystem; - const { time } = getTime(); - before(() => { - projFs = loadProjectFromDisk("tests/projects/demo", time); + projFs = loadProjectFromDisk("tests/projects/demo"); }); after(() => { @@ -49,7 +47,7 @@ namespace ts { function verifyBuild({ modifyDiskLayout, expectedExitStatus, expectedDiagnostics, expectedOutputs, notExpectedOutputs }: VerifyBuild) { const fs = projFs.shadow(); - const host = new fakes.SolutionBuilderHost(fs); + const host = fakes.SolutionBuilderHost.create(fs); modifyDiskLayout(fs); const builder = createSolutionBuilder(host, ["/src/tsconfig.json"], { verbose: true }); const exitStatus = builder.build(); diff --git a/src/testRunner/unittests/tsbuild/emitDeclarationOnly.ts b/src/testRunner/unittests/tsbuild/emitDeclarationOnly.ts index 1999737a50fb8..e7dff56ab9fa9 100644 --- a/src/testRunner/unittests/tsbuild/emitDeclarationOnly.ts +++ b/src/testRunner/unittests/tsbuild/emitDeclarationOnly.ts @@ -1,109 +1,53 @@ namespace ts { describe("unittests:: tsbuild:: on project with emitDeclarationOnly set to true", () => { let projFs: vfs.FileSystem; - const { time, tick } = getTime(); before(() => { - projFs = loadProjectFromDisk("tests/projects/emitDeclarationOnly", time); + projFs = loadProjectFromDisk("tests/projects/emitDeclarationOnly"); }); after(() => { projFs = undefined!; }); function verifyEmitDeclarationOnly(disableMap?: true) { - verifyTsbuildOutput({ - scenario: `only dts output in circular import project with emitDeclarationOnly${disableMap ? "" : " and declarationMap"}`, - projFs: () => projFs, - time, - tick, - proj: "emitDeclarationOnly", - rootNames: ["/src"], - lastProjectOutput: `/src/lib/index.d.ts`, - outputFiles: [ - "/src/lib/a.d.ts", - "/src/lib/b.d.ts", - "/src/lib/c.d.ts", - "/src/lib/index.d.ts", - "/src/tsconfig.tsbuildinfo", - ...(disableMap ? emptyArray : [ - "/src/lib/a.d.ts.map", - "/src/lib/b.d.ts.map", - "/src/lib/c.d.ts.map", - "/src/lib/index.d.ts.map" - ]) - ], - initialBuild: { - modifyFs: disableMap ? - (fs => replaceText(fs, "/src/tsconfig.json", `"declarationMap": true,`, "")) : - noop, - expectedDiagnostics: [ - getExpectedDiagnosticForProjectsInBuild("src/tsconfig.json"), - [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/tsconfig.json", "src/lib/a.d.ts"], - [Diagnostics.Building_project_0, "/src/tsconfig.json"] - ] - }, - incrementalDtsChangedBuild: { + verifyTscIncrementalEdits({ + subScenario: `only dts output in circular import project with emitDeclarationOnly${disableMap ? "" : " and declarationMap"}`, + fs: () => projFs, + scenario: "emitDeclarationOnly", + commandLineArgs: ["--b", "/src", "--verbose"], + modifyFs: disableMap ? + (fs => replaceText(fs, "/src/tsconfig.json", `"declarationMap": true,`, "")) : + undefined, + incrementalScenarios: [{ + buildKind: BuildKind.IncrementalDtsChange, modifyFs: fs => replaceText(fs, "/src/src/a.ts", "b: B;", "b: B; foo: any;"), - expectedDiagnostics: [ - getExpectedDiagnosticForProjectsInBuild("src/tsconfig.json"), - [Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2, "src/tsconfig.json", "src/lib/a.d.ts", "src/src/a.ts"], - [Diagnostics.Building_project_0, "/src/tsconfig.json"] - ] - }, - baselineOnly: true, - verifyDiagnostics: true + }], }); } verifyEmitDeclarationOnly(); verifyEmitDeclarationOnly(/*disableMap*/ true); - verifyTsbuildOutput({ - scenario: `only dts output in non circular imports project with emitDeclarationOnly`, - projFs: () => projFs, - time, - tick, - proj: "emitDeclarationOnly", - rootNames: ["/src"], - lastProjectOutput: `/src/lib/a.d.ts`, - outputFiles: [ - "/src/lib/a.d.ts", - "/src/lib/b.d.ts", - "/src/lib/c.d.ts", - "/src/tsconfig.tsbuildinfo", - "/src/lib/a.d.ts.map", - "/src/lib/b.d.ts.map", - "/src/lib/c.d.ts.map", - ], - initialBuild: { - modifyFs: fs => { - fs.rimrafSync("/src/src/index.ts"); - replaceText(fs, "/src/src/a.ts", `import { B } from "./b";`, `export class B { prop = "hello"; }`); - }, - expectedDiagnostics: [ - getExpectedDiagnosticForProjectsInBuild("src/tsconfig.json"), - [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/tsconfig.json", "src/lib/a.d.ts"], - [Diagnostics.Building_project_0, "/src/tsconfig.json"] - ] - }, - incrementalDtsChangedBuild: { - modifyFs: fs => replaceText(fs, "/src/src/a.ts", "b: B;", "b: B; foo: any;"), - expectedDiagnostics: [ - getExpectedDiagnosticForProjectsInBuild("src/tsconfig.json"), - [Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2, "src/tsconfig.json", "src/lib/a.d.ts", "src/src/a.ts"], - [Diagnostics.Building_project_0, "/src/tsconfig.json"] - ] + verifyTscIncrementalEdits({ + subScenario: `only dts output in non circular imports project with emitDeclarationOnly`, + fs: () => projFs, + scenario: "emitDeclarationOnly", + commandLineArgs: ["--b", "/src", "--verbose"], + modifyFs: fs => { + fs.rimrafSync("/src/src/index.ts"); + replaceText(fs, "/src/src/a.ts", `import { B } from "./b";`, `export class B { prop = "hello"; }`); }, - incrementalDtsUnchangedBuild: { - modifyFs: fs => replaceText(fs, "/src/src/a.ts", "export interface A {", `class C { } + incrementalScenarios: [ + { + buildKind: BuildKind.IncrementalDtsChange, + modifyFs: fs => replaceText(fs, "/src/src/a.ts", "b: B;", "b: B; foo: any;"), + + }, + { + buildKind: BuildKind.IncrementalDtsUnchanged, + modifyFs: fs => replaceText(fs, "/src/src/a.ts", "export interface A {", `class C { } export interface A {`), - expectedDiagnostics: [ - getExpectedDiagnosticForProjectsInBuild("src/tsconfig.json"), - [Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2, "src/tsconfig.json", "src/lib/a.d.ts", "src/src/a.ts"], - [Diagnostics.Building_project_0, "/src/tsconfig.json"], - [Diagnostics.Updating_unchanged_output_timestamps_of_project_0, "/src/tsconfig.json"] - ] - }, - baselineOnly: true, - verifyDiagnostics: true + + }, + ], }); }); } diff --git a/src/testRunner/unittests/tsbuild/emptyFiles.ts b/src/testRunner/unittests/tsbuild/emptyFiles.ts index a2e7aedf29058..6e09b5871f936 100644 --- a/src/testRunner/unittests/tsbuild/emptyFiles.ts +++ b/src/testRunner/unittests/tsbuild/emptyFiles.ts @@ -10,7 +10,7 @@ namespace ts { describe("unittests:: tsbuild - empty files option in tsconfig", () => { it("has empty files diagnostic when files is empty and no references are provided", () => { const fs = projFs.shadow(); - const host = new fakes.SolutionBuilderHost(fs); + const host = fakes.SolutionBuilderHost.create(fs); const builder = createSolutionBuilder(host, ["/src/no-references"], { dry: false, force: false, verbose: false }); host.clearDiagnostics(); @@ -26,7 +26,7 @@ namespace ts { it("does not have empty files diagnostic when files is empty and references are provided", () => { const fs = projFs.shadow(); - const host = new fakes.SolutionBuilderHost(fs); + const host = fakes.SolutionBuilderHost.create(fs); const builder = createSolutionBuilder(host, ["/src/with-references"], { dry: false, force: false, verbose: false }); host.clearDiagnostics(); diff --git a/src/testRunner/unittests/tsbuild/graphOrdering.ts b/src/testRunner/unittests/tsbuild/graphOrdering.ts index d2fa94abd0392..79ddd80d67bde 100644 --- a/src/testRunner/unittests/tsbuild/graphOrdering.ts +++ b/src/testRunner/unittests/tsbuild/graphOrdering.ts @@ -17,7 +17,7 @@ namespace ts { before(() => { const fs = new vfs.FileSystem(false); - host = new fakes.SolutionBuilderHost(fs); + host = fakes.SolutionBuilderHost.create(fs); writeProjects(fs, ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J"], deps); }); diff --git a/src/testRunner/unittests/tsbuild/helpers.ts b/src/testRunner/unittests/tsbuild/helpers.ts index 2d25ec5c871fb..b21c60a861709 100644 --- a/src/testRunner/unittests/tsbuild/helpers.ts +++ b/src/testRunner/unittests/tsbuild/helpers.ts @@ -113,9 +113,11 @@ interface Symbol { } `; + /** + * Load project from disk into /src folder + */ export function loadProjectFromDisk( root: string, - time?: vfs.FileSystemOptions["time"], libContentToAppend?: string ): vfs.FileSystem { const resolver = vfs.createResolver(Harness.IO); @@ -125,22 +127,22 @@ interface Symbol { }, cwd: "/", meta: { defaultLibLocation: "/lib" }, - time }); addLibAndMakeReadonly(fs, libContentToAppend); return fs; } + /** + * All the files must be in /src + */ export function loadProjectFromFiles( files: vfs.FileSet, - time?: vfs.FileSystemOptions["time"], libContentToAppend?: string ): vfs.FileSystem { const fs = new vfs.FileSystem(/*ignoreCase*/ true, { files, cwd: "/", meta: { defaultLibLocation: "/lib" }, - time }); addLibAndMakeReadonly(fs, libContentToAppend); return fs; @@ -152,6 +154,26 @@ interface Symbol { fs.makeReadonly(); } + /** + * Gets the FS mountuing existing fs's /src and /lib folder + */ + export function getFsWithTime(baseFs: vfs.FileSystem) { + const { time, tick } = getTime(); + const host = new fakes.System(baseFs) as any as vfs.FileSystemResolverHost; + host.getWorkspaceRoot = notImplemented; + const resolver = vfs.createResolver(host); + const fs = new vfs.FileSystem(/*ignoreCase*/ true, { + files: { + ["/src"]: new vfs.Mount("/src", resolver), + ["/lib"]: new vfs.Mount("/lib", resolver) + }, + cwd: "/", + meta: { defaultLibLocation: "/lib" }, + time + }); + return { fs, time, tick }; + } + export function verifyOutputsPresent(fs: vfs.FileSystem, outputs: readonly string[]) { for (const output of outputs) { assert(fs.existsSync(output), `Expect file ${output} to exist`); @@ -164,9 +186,10 @@ interface Symbol { } } - function generateSourceMapBaselineFiles(fs: vfs.FileSystem, mapFileNames: readonly string[]) { - for (const mapFile of mapFileNames) { - if (!fs.existsSync(mapFile)) continue; + export function generateSourceMapBaselineFiles(fs: vfs.FileSystem, mapFileNames: Iterator) { + while (true) { + const { value: mapFile, done } = mapFileNames.next(); + if (done) break; const text = Harness.SourceMapRecorder.getSourceMapRecordWithVFS(fs, mapFile); fs.writeFileSync(`${mapFile}.baseline.txt`, text); } @@ -229,234 +252,117 @@ interface Symbol { } } - interface BuildInput { - fs: vfs.FileSystem; - tick: () => void; - rootNames: readonly string[]; - expectedMapFileNames?: readonly string[]; - expectedBuildInfoFilesForSectionBaselines?: readonly BuildInfoSectionBaselineFiles[]; - modifyFs: (fs: vfs.FileSystem) => void; - } - - function build({ fs, tick, rootNames, expectedMapFileNames, expectedBuildInfoFilesForSectionBaselines, modifyFs }: BuildInput) { - const actualReadFileMap = createMap(); - modifyFs(fs); - tick(); - - const host = new fakes.SolutionBuilderHost(fs); - const builder = createSolutionBuilder(host, rootNames, { dry: false, force: false, verbose: true }); - host.clearDiagnostics(); - const originalReadFile = host.readFile; - host.readFile = path => { - // Dont record libs - if (path.startsWith("/src/")) { - actualReadFileMap.set(path, (actualReadFileMap.get(path) || 0) + 1); + export function baselineBuildInfo( + configs: readonly ParsedCommandLine[], + fs: vfs.FileSystem, + writtenFiles: Map + ) { + let expectedBuildInfoFiles: BuildInfoSectionBaselineFiles[] | undefined; + for (const { options } of configs) { + const out = options.outFile || options.out; + if (out) { + const { jsFilePath, declarationFilePath, buildInfoPath } = getOutputPathsForBundle(options, /*forceDts*/ false); + if (buildInfoPath && writtenFiles.has(buildInfoPath)) { + (expectedBuildInfoFiles || (expectedBuildInfoFiles = [])).push( + [buildInfoPath, jsFilePath, declarationFilePath] + ); + } } - return originalReadFile.call(host, path); - }; - builder.build(); - if (expectedMapFileNames) generateSourceMapBaselineFiles(fs, expectedMapFileNames); - generateBuildInfoSectionBaselineFiles(fs, expectedBuildInfoFilesForSectionBaselines || emptyArray); - fs.makeReadonly(); - return { fs, actualReadFileMap, host, builder }; - } - - function generateBaseline(fs: vfs.FileSystem, proj: string, scenario: string, subScenario: string, baseFs: vfs.FileSystem) { - const patch = fs.diff(baseFs); - // eslint-disable-next-line no-null/no-null - Harness.Baseline.runBaseline(`tsbuild/${proj}/${subScenario.split(" ").join("-")}/${scenario.split(" ").join("-")}.js`, patch ? vfs.formatPatch(patch) : null); - } - - function verifyReadFileCalls(actualReadFileMap: Map, expectedReadFiles: ReadonlyMap) { - TestFSWithWatch.verifyMapSize("readFileCalls", actualReadFileMap, arrayFrom(expectedReadFiles.keys())); - expectedReadFiles.forEach((expected, expectedFile) => { - const actual = actualReadFileMap.get(expectedFile); - assert.equal(actual, expected, `Mismatch in read file call number for: ${expectedFile} -Not in Actual: ${JSON.stringify(arrayFrom(mapDefinedIterator(expectedReadFiles.keys(), f => actualReadFileMap.has(f) ? undefined : f)))} -Mismatch Actual(path, actual, expected): ${JSON.stringify(arrayFrom(mapDefinedIterator(actualReadFileMap.entries(), ([p, v]) => expectedReadFiles.get(p) !== v ? [p, v, expectedReadFiles.get(p) || 0] : undefined)))}`); - }); - } - - export function getReadFilesMap(filesReadOnce: readonly string[], ...filesWithTwoReadCalls: string[]) { - const map = arrayToMap(filesReadOnce, identity, () => 1); - for (const fileWithTwoReadCalls of filesWithTwoReadCalls) { - map.set(fileWithTwoReadCalls, 2); } - return map; + if (expectedBuildInfoFiles) generateBuildInfoSectionBaselineFiles(fs, expectedBuildInfoFiles); } - export interface ExpectedBuildOutput { - expectedDiagnostics?: readonly fakes.ExpectedDiagnostic[]; - expectedReadFiles?: ReadonlyMap; + export interface TscIncremental { + buildKind: BuildKind; + modifyFs: (fs: vfs.FileSystem) => void; + subScenario?: string; } - export interface BuildState extends ExpectedBuildOutput { - modifyFs: (fs: vfs.FileSystem) => void; + export interface VerifyTsBuildInput extends TscCompile { + incrementalScenarios: TscIncremental[]; } - export interface VerifyTsBuildInput { - scenario: string; - projFs: () => vfs.FileSystem; - time: () => number; - tick: () => void; - proj: string; - rootNames: readonly string[]; - /** map file names to generate baseline of */ - expectedMapFileNames?: readonly string[]; - expectedBuildInfoFilesForSectionBaselines?: readonly BuildInfoSectionBaselineFiles[]; - lastProjectOutput: string; - initialBuild: BuildState; - outputFiles?: readonly string[]; - incrementalDtsChangedBuild?: BuildState; - incrementalDtsUnchangedBuild?: BuildState; - incrementalHeaderChangedBuild?: BuildState; - baselineOnly?: true; - verifyDiagnostics?: true; - } - - export function verifyTsbuildOutput({ - scenario, projFs, time, tick, proj, rootNames, outputFiles, baselineOnly, verifyDiagnostics, - expectedMapFileNames, expectedBuildInfoFilesForSectionBaselines, lastProjectOutput, - initialBuild, incrementalDtsChangedBuild, incrementalDtsUnchangedBuild, incrementalHeaderChangedBuild + export function verifyTscIncrementalEdits({ + subScenario, fs, scenario, commandLineArgs, + baselineSourceMap, modifyFs, baselineReadFileCalls, + incrementalScenarios }: VerifyTsBuildInput) { - describe(`tsc --b ${proj}:: ${scenario}`, () => { - let fs: vfs.FileSystem; - let actualReadFileMap: Map; - let firstBuildTime: number; - let host: fakes.SolutionBuilderHost; + describe(`tsc --b ${scenario}:: ${subScenario}`, () => { + let tick: () => void; + let sys: TscCompileSystem; before(() => { - const result = build({ - fs: projFs().shadow(), - tick, - rootNames, - expectedMapFileNames, - expectedBuildInfoFilesForSectionBaselines, - modifyFs: initialBuild.modifyFs, + let baseFs: vfs.FileSystem; + ({ fs: baseFs, tick } = getFsWithTime(fs())); + sys = tscCompile({ + scenario, + subScenario, + fs: () => baseFs.makeReadonly(), + commandLineArgs, + modifyFs: fs => { + if (modifyFs) modifyFs(fs); + tick(); + }, + baselineSourceMap, + baselineReadFileCalls }); - ({ fs, actualReadFileMap, host } = result); - firstBuildTime = time(); + Debug.assert(!!incrementalScenarios.length, `${scenario}/${subScenario}:: No incremental scenarios, you probably want to use verifyTsc instead.`); }); after(() => { - fs = undefined!; - actualReadFileMap = undefined!; - host = undefined!; + sys = undefined!; + tick = undefined!; }); describe("initialBuild", () => { - if (!baselineOnly || verifyDiagnostics) { - it(`verify diagnostics`, () => { - host.assertDiagnosticMessages(...(initialBuild.expectedDiagnostics || emptyArray)); - }); - } - it(`Generates files matching the baseline`, () => { - generateBaseline(fs, proj, scenario, "initial Build", projFs()); - }); - if (!baselineOnly) { - it("verify readFile calls", () => { - verifyReadFileCalls(actualReadFileMap, Debug.assertDefined(initialBuild.expectedReadFiles)); - }); - } + verifyTscBaseline(() => sys); }); - function incrementalBuild(subScenario: string, incrementalModifyFs: (fs: vfs.FileSystem) => void, incrementalExpectedDiagnostics: readonly fakes.ExpectedDiagnostic[] | undefined, incrementalExpectedReadFiles: ReadonlyMap | undefined) { - describe(subScenario, () => { - let newFs: vfs.FileSystem; - let actualReadFileMap: Map; - let host: fakes.SolutionBuilderHost; - let beforeBuildTime: number; - let afterBuildTime: number; + for (const { buildKind, modifyFs, subScenario: incrementalSubScenario } of incrementalScenarios) { + describe(incrementalSubScenario || buildKind, () => { + let newSys: TscCompileSystem; before(() => { - beforeBuildTime = fs.statSync(lastProjectOutput).mtimeMs; - tick(); - newFs = fs.shadow(); + Debug.assert(buildKind !== BuildKind.Initial, "Incremental edit cannot be initial compilation"); tick(); - ({ actualReadFileMap, host } = build({ - fs: newFs, - tick, - rootNames, - expectedMapFileNames, - expectedBuildInfoFilesForSectionBaselines, - modifyFs: incrementalModifyFs, - })); - afterBuildTime = newFs.statSync(lastProjectOutput).mtimeMs; + newSys = tscCompile({ + scenario, + subScenario: incrementalSubScenario || subScenario, + buildKind, + fs: () => sys.vfs, + commandLineArgs, + modifyFs: fs => { + tick(); + modifyFs(fs); + tick(); + }, + baselineSourceMap, + baselineReadFileCalls + }); }); after(() => { - newFs = undefined!; - actualReadFileMap = undefined!; - host = undefined!; - }); - it("verify build output times", () => { - assert.equal(beforeBuildTime, firstBuildTime, "First build timestamp is correct"); - assert.equal(afterBuildTime, time(), "Second build timestamp is correct"); - }); - if (!baselineOnly || verifyDiagnostics) { - it(`verify diagnostics`, () => { - host.assertDiagnosticMessages(...(incrementalExpectedDiagnostics || emptyArray)); - }); - } - else { - // Build should pass without errors if not verifying diagnostics - it(`verify no errors`, () => { - host.assertErrors(/*empty*/); - }); - } - it(`Generates files matching the baseline`, () => { - generateBaseline(newFs, proj, scenario, subScenario, fs); + newSys = undefined!; }); - if (!baselineOnly) { - it("verify readFile calls", () => { - verifyReadFileCalls(actualReadFileMap, Debug.assertDefined(incrementalExpectedReadFiles)); - }); - } + verifyTscBaseline(() => newSys); it(`Verify emit output file text is same when built clean`, () => { - const expectedOutputFiles = Debug.assertDefined(outputFiles); - const { fs } = build({ - fs: newFs.shadow(), - tick, - rootNames, + const sys = tscCompile({ + scenario, + subScenario, + fs: () => newSys.vfs, + commandLineArgs, modifyFs: fs => { + tick(); // Delete output files - for (const outputFile of expectedOutputFiles) { - if (fs.existsSync(outputFile)) { - fs.rimrafSync(outputFile); - } - } + const host = fakes.SolutionBuilderHost.create(fs); + const builder = createSolutionBuilder(host, commandLineArgs, { clean: true }); + builder.clean(); }, }); - for (const outputFile of expectedOutputFiles) { - const expectedText = fs.existsSync(outputFile) ? fs.readFileSync(outputFile, "utf8") : undefined; - const actualText = newFs.existsSync(outputFile) ? newFs.readFileSync(outputFile, "utf8") : undefined; + for (const outputFile of arrayFrom(sys.writtenFiles.keys())) { + const expectedText = sys.readFile(outputFile); + const actualText = newSys.readFile(outputFile); assert.equal(actualText, expectedText, `File: ${outputFile}`); } }); }); } - if (incrementalDtsChangedBuild) { - incrementalBuild( - "incremental declaration changes", - incrementalDtsChangedBuild.modifyFs, - incrementalDtsChangedBuild.expectedDiagnostics, - incrementalDtsChangedBuild.expectedReadFiles, - ); - } - - if (incrementalDtsUnchangedBuild) { - incrementalBuild( - "incremental declaration doesnt change", - incrementalDtsUnchangedBuild.modifyFs, - incrementalDtsUnchangedBuild.expectedDiagnostics, - incrementalDtsUnchangedBuild.expectedReadFiles - ); - } - - if (incrementalHeaderChangedBuild) { - incrementalBuild( - "incremental headers change without dts changes", - incrementalHeaderChangedBuild.modifyFs, - incrementalHeaderChangedBuild.expectedDiagnostics, - incrementalHeaderChangedBuild.expectedReadFiles - ); - } }); } diff --git a/src/testRunner/unittests/tsbuild/inferredTypeFromTransitiveModule.ts b/src/testRunner/unittests/tsbuild/inferredTypeFromTransitiveModule.ts index 301f9894fde51..eb3658d14ccaa 100644 --- a/src/testRunner/unittests/tsbuild/inferredTypeFromTransitiveModule.ts +++ b/src/testRunner/unittests/tsbuild/inferredTypeFromTransitiveModule.ts @@ -1,48 +1,59 @@ namespace ts { describe("unittests:: tsbuild:: inferredTypeFromTransitiveModule::", () => { let projFs: vfs.FileSystem; - const { time, tick } = getTime(); before(() => { - projFs = loadProjectFromDisk("tests/projects/inferredTypeFromTransitiveModule", time); + projFs = loadProjectFromDisk("tests/projects/inferredTypeFromTransitiveModule"); }); after(() => { projFs = undefined!; }); - verifyTsbuildOutput({ - scenario: "inferred type from transitive module", - projFs: () => projFs, - time, - tick, - proj: "inferredTypeFromTransitiveModule", - rootNames: ["/src"], - lastProjectOutput: `/src/obj/index.js`, - outputFiles: [ - "/src/obj/bar.js", "/src/obj/bar.d.ts", - "/src/obj/bundling.js", "/src/obj/bundling.d.ts", - "/src/obj/lazyIndex.js", "/src/obj/lazyIndex.d.ts", - "/src/obj/index.js", "/src/obj/index.d.ts", - "/src/obj/tsconfig.tsbuildinfo" - ], - initialBuild: { - modifyFs: noop, - expectedDiagnostics: [ - getExpectedDiagnosticForProjectsInBuild("src/tsconfig.json"), - [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/tsconfig.json", "src/obj/bar.js"], - [Diagnostics.Building_project_0, "/src/tsconfig.json"] - ] - }, - incrementalDtsChangedBuild: { - modifyFs: fs => replaceText(fs, "/src/bar.ts", "param: string", ""), - expectedDiagnostics: [ - getExpectedDiagnosticForProjectsInBuild("src/tsconfig.json"), - [Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2, "src/tsconfig.json", "src/obj/bar.js", "src/bar.ts"], - [Diagnostics.Building_project_0, "/src/tsconfig.json"], - [Diagnostics.Updating_unchanged_output_timestamps_of_project_0, "/src/tsconfig.json"] - ] + verifyTscIncrementalEdits({ + scenario: "inferredTypeFromTransitiveModule", + subScenario: "inferred type from transitive module", + fs: () => projFs, + commandLineArgs: ["--b", "/src", "--verbose"], + incrementalScenarios: [{ + buildKind: BuildKind.IncrementalDtsChange, + modifyFs: changeBarParam, + }], + }); + + verifyTscIncrementalEdits({ + subScenario: "inferred type from transitive module with isolatedModules", + fs: () => projFs, + scenario: "inferredTypeFromTransitiveModule", + commandLineArgs: ["--b", "/src", "--verbose"], + modifyFs: changeToIsolatedModules, + incrementalScenarios: [{ + buildKind: BuildKind.IncrementalDtsChange, + modifyFs: changeBarParam + }] + }); + + verifyTscIncrementalEdits({ + scenario: "inferredTypeFromTransitiveModule", + subScenario: "reports errors in files affected by change in signature with isolatedModules", + fs: () => projFs, + commandLineArgs: ["--b", "/src", "--verbose"], + modifyFs: fs => { + changeToIsolatedModules(fs); + appendText(fs, "/src/lazyIndex.ts", ` +import { default as bar } from './bar'; +bar("hello");`); }, - baselineOnly: true, - verifyDiagnostics: true + incrementalScenarios: [{ + buildKind: BuildKind.IncrementalDtsChange, + modifyFs: changeBarParam + }] }); }); + + function changeToIsolatedModules(fs: vfs.FileSystem) { + replaceText(fs, "/src/tsconfig.json", `"incremental": true`, `"incremental": true, "isolatedModules": true`); + } + + function changeBarParam(fs: vfs.FileSystem) { + replaceText(fs, "/src/bar.ts", "param: string", ""); + } } diff --git a/src/testRunner/unittests/tsbuild/lateBoundSymbol.ts b/src/testRunner/unittests/tsbuild/lateBoundSymbol.ts index 781dd6938b9f1..f2cbfca320ebc 100644 --- a/src/testRunner/unittests/tsbuild/lateBoundSymbol.ts +++ b/src/testRunner/unittests/tsbuild/lateBoundSymbol.ts @@ -1,46 +1,22 @@ namespace ts { describe("unittests:: tsbuild:: lateBoundSymbol:: interface is merged and contains late bound member", () => { let projFs: vfs.FileSystem; - const { time, tick } = getTime(); before(() => { - projFs = loadProjectFromDisk("tests/projects/lateBoundSymbol", time); + projFs = loadProjectFromDisk("tests/projects/lateBoundSymbol"); }); after(() => { projFs = undefined!; // Release the contents }); - verifyTsbuildOutput({ - scenario: "interface is merged and contains late bound member", - projFs: () => projFs, - time, - tick, - proj: "lateBoundSymbol", - rootNames: ["/src/tsconfig.json"], - lastProjectOutput: "/src/src/main.js", - outputFiles: [ - "/src/src/hkt.js", - "/src/src/main.js", - "/src/tsconfig.tsbuildinfo", - ], - initialBuild: { - modifyFs: noop, - expectedDiagnostics: [ - getExpectedDiagnosticForProjectsInBuild("src/tsconfig.json"), - [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/tsconfig.json", "src/src/hkt.js"], - [Diagnostics.Building_project_0, "/src/tsconfig.json"] - ] - }, - incrementalDtsUnchangedBuild: { + verifyTscIncrementalEdits({ + subScenario: "interface is merged and contains late bound member", + fs: () => projFs, + scenario: "lateBoundSymbol", + commandLineArgs: ["--b", "/src/tsconfig.json", "--verbose"], + incrementalScenarios: [{ + buildKind: BuildKind.IncrementalDtsUnchanged, modifyFs: fs => replaceText(fs, "/src/src/main.ts", "const x = 10;", ""), - expectedDiagnostics: [ - getExpectedDiagnosticForProjectsInBuild("src/tsconfig.json"), - [Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2, "src/tsconfig.json", "src/src/hkt.js", "src/src/main.ts"], - [Diagnostics.Building_project_0, "/src/tsconfig.json"], - [Diagnostics.Updating_unchanged_output_timestamps_of_project_0, "/src/tsconfig.json"] - ] - }, - baselineOnly: true, - verifyDiagnostics: true + }] }); }); } diff --git a/src/testRunner/unittests/tsbuild/missingExtendedFile.ts b/src/testRunner/unittests/tsbuild/missingExtendedFile.ts index 907ed9202fa07..7fa3352da268b 100644 --- a/src/testRunner/unittests/tsbuild/missingExtendedFile.ts +++ b/src/testRunner/unittests/tsbuild/missingExtendedFile.ts @@ -3,7 +3,7 @@ namespace ts { it("unittests:: tsbuild - when tsconfig extends the missing file", () => { const projFs = loadProjectFromDisk("tests/projects/missingExtendedConfig"); const fs = projFs.shadow(); - const host = new fakes.SolutionBuilderHost(fs); + const host = fakes.SolutionBuilderHost.create(fs); const builder = createSolutionBuilder(host, ["/src/tsconfig.json"], {}); builder.build(); host.assertDiagnosticMessages( diff --git a/src/testRunner/unittests/tsbuild/moduleSpecifiers.ts b/src/testRunner/unittests/tsbuild/moduleSpecifiers.ts index c6737b9d2f7ec..81d8e170e5d71 100644 --- a/src/testRunner/unittests/tsbuild/moduleSpecifiers.ts +++ b/src/testRunner/unittests/tsbuild/moduleSpecifiers.ts @@ -1,16 +1,16 @@ namespace ts { // https://github.com/microsoft/TypeScript/issues/31696 describe("unittests:: tsbuild:: moduleSpecifiers:: synthesized module specifiers to referenced projects resolve correctly", () => { - let projFs: vfs.FileSystem; - const { time, tick } = getTime(); - before(() => { - projFs = loadProjectFromFiles({ - "/src/common/nominal.ts": utils.dedent` + verifyTsc({ + scenario: "moduleSpecifiers", + subScenario: `synthesized module specifiers resolve correctly`, + fs: () => loadProjectFromFiles({ + "/src/solution/common/nominal.ts": utils.dedent` export declare type Nominal = T & { [Symbol.species]: Name; }; `, - "/src/common/tsconfig.json": utils.dedent` + "/src/solution/common/tsconfig.json": utils.dedent` { "extends": "../../tsconfig.base.json", "compilerOptions": { @@ -18,12 +18,12 @@ namespace ts { }, "include": ["nominal.ts"] }`, - "/src/sub-project/index.ts": utils.dedent` + "/src/solution/sub-project/index.ts": utils.dedent` import { Nominal } from '../common/nominal'; export type MyNominal = Nominal; `, - "/src/sub-project/tsconfig.json": utils.dedent` + "/src/solution/sub-project/tsconfig.json": utils.dedent` { "extends": "../../tsconfig.base.json", "compilerOptions": { @@ -34,7 +34,7 @@ namespace ts { ], "include": ["./index.ts"] }`, - "/src/sub-project-2/index.ts": utils.dedent` + "/src/solution/sub-project-2/index.ts": utils.dedent` import { MyNominal } from '../sub-project/index'; const variable = { @@ -45,7 +45,7 @@ namespace ts { return 'key'; } `, - "/src/sub-project-2/tsconfig.json": utils.dedent` + "/src/solution/sub-project-2/tsconfig.json": utils.dedent` { "extends": "../../tsconfig.base.json", "compilerOptions": { @@ -56,7 +56,7 @@ namespace ts { ], "include": ["./index.ts"] }`, - "/src/tsconfig.json": utils.dedent` + "/src/solution/tsconfig.json": utils.dedent` { "compilerOptions": { "composite": true @@ -67,7 +67,7 @@ namespace ts { ], "include": [] }`, - "/tsconfig.base.json": utils.dedent` + "/src/tsconfig.base.json": utils.dedent` { "compilerOptions": { "skipLibCheck": true, @@ -75,32 +75,17 @@ namespace ts { "outDir": "lib", } }`, - "/tsconfig.json": utils.dedent`{ + "/src/tsconfig.json": utils.dedent`{ "compilerOptions": { "composite": true }, "references": [ - { "path": "./src" } + { "path": "./solution" } ], "include": [] }` - }, time, symbolLibContent); - }); - after(() => { - projFs = undefined!; - }); - verifyTsbuildOutput({ - scenario: `synthesized module specifiers resolve correctly`, - projFs: () => projFs, - time, - tick, - proj: "moduleSpecifiers", - rootNames: ["/"], - lastProjectOutput: `/src/lib/index.d.ts`, - initialBuild: { - modifyFs: noop, - }, - baselineOnly: true + }, symbolLibContent), + commandLineArgs: ["-b", "/src", "--verbose"] }); }); } diff --git a/src/testRunner/unittests/tsbuild/outFile.ts b/src/testRunner/unittests/tsbuild/outFile.ts index f9aafee0e4db4..20cbe05a3c1cb 100644 --- a/src/testRunner/unittests/tsbuild/outFile.ts +++ b/src/testRunner/unittests/tsbuild/outFile.ts @@ -55,21 +55,7 @@ namespace ts { ] ] ]; - const expectedMapFileNames = [ - outputFiles[project.first][ext.jsmap], - outputFiles[project.first][ext.dtsmap], - outputFiles[project.second][ext.jsmap], - outputFiles[project.second][ext.dtsmap], - outputFiles[project.third][ext.jsmap], - outputFiles[project.third][ext.dtsmap] - ]; - const expectedTsbuildInfoFileNames: readonly BuildInfoSectionBaselineFiles[] = [ - [outputFiles[project.first][ext.buildinfo], outputFiles[project.first][ext.js], outputFiles[project.first][ext.dts]], - [outputFiles[project.second][ext.buildinfo], outputFiles[project.second][ext.js], outputFiles[project.second][ext.dts]], - [outputFiles[project.third][ext.buildinfo], outputFiles[project.third][ext.js], outputFiles[project.third][ext.dts]] - ]; const relSources = sources.map(([config, sources]) => [relName(config), sources.map(relName)]) as any as [Sources, Sources, Sources]; - const { time, tick } = getTime(); let expectedOutputFiles = [ ...outputFiles[project.first], ...outputFiles[project.second], @@ -84,247 +70,78 @@ namespace ts { [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, relSources[project.third][source.config], relOutputFiles[project.third][ext.js]], [Diagnostics.Building_project_0, sources[project.third][source.config]] ]; - let initialExpectedReadFiles: ReadonlyMap = getReadFilesMap( - [ - // Configs - sources[project.first][source.config], - sources[project.second][source.config], - sources[project.third][source.config], - - // Source files - ...sources[project.first][source.ts], - ...sources[project.second][source.ts], - ...sources[project.third][source.ts], - - // outputs - ...outputFiles[project.first], - ...outputFiles[project.second], - ] - ); - - let dtsChangedExpectedDiagnostics: readonly fakes.ExpectedDiagnostic[] = [ - getExpectedDiagnosticForProjectsInBuild(relSources[project.first][source.config], relSources[project.second][source.config], relSources[project.third][source.config]), - [Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2, relSources[project.first][source.config], relOutputFiles[project.first][ext.js], relSources[project.first][source.ts][part.one]], - [Diagnostics.Building_project_0, sources[project.first][source.config]], - [Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, relSources[project.second][source.config], relSources[project.second][source.ts][part.one], relOutputFiles[project.second][ext.js]], - [Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2, relSources[project.third][source.config], relOutputFiles[project.third][ext.js], "src/first"], - [Diagnostics.Building_project_0, sources[project.third][source.config]] - ]; - let dtsChangedExpectedReadFiles: ReadonlyMap = getReadFilesMap( - [ - // Configs - sources[project.first][source.config], - sources[project.second][source.config], - sources[project.third][source.config], - - // Source files - ...sources[project.first][source.ts], - ...sources[project.third][source.ts], - - // outputs - ...outputFiles[project.first], - ...outputFiles[project.second], - outputFiles[project.third][ext.dts], - ], - outputFiles[project.first][ext.dts], // dts changes so once read old content, and once new (to emit third) - ); - - let dtsChangedExpectedDiagnosticsDependOrdered: readonly fakes.ExpectedDiagnostic[] = [ - getExpectedDiagnosticForProjectsInBuild(relSources[project.first][source.config], relSources[project.second][source.config], relSources[project.third][source.config]), - [Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2, relSources[project.first][source.config], relOutputFiles[project.first][ext.js], relSources[project.first][source.ts][part.one]], - [Diagnostics.Building_project_0, sources[project.first][source.config]], - [Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2, relSources[project.second][source.config], relOutputFiles[project.second][ext.js], "src/first"], - [Diagnostics.Building_project_0, sources[project.second][source.config]], - [Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2, relSources[project.third][source.config], relOutputFiles[project.third][ext.js], "src/second"], - [Diagnostics.Building_project_0, sources[project.third][source.config]] - ]; - let dtsChangedExpectedReadFilesDependOrdered: ReadonlyMap = getDtsChangedReadFilesDependOrdered(); - - let dtsUnchangedExpectedDiagnostics: readonly fakes.ExpectedDiagnostic[] = [ - getExpectedDiagnosticForProjectsInBuild(relSources[project.first][source.config], relSources[project.second][source.config], relSources[project.third][source.config]), - [Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2, relSources[project.first][source.config], relOutputFiles[project.first][ext.js], relSources[project.first][source.ts][part.one]], - [Diagnostics.Building_project_0, sources[project.first][source.config]], - [Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, relSources[project.second][source.config], relSources[project.second][source.ts][part.one], relOutputFiles[project.second][ext.js]], - [Diagnostics.Project_0_is_out_of_date_because_output_of_its_dependency_1_has_changed, relSources[project.third][source.config], "src/first"], - [Diagnostics.Updating_output_of_project_0, sources[project.third][source.config]], - [Diagnostics.Updating_unchanged_output_timestamps_of_project_0, sources[project.third][source.config]], - ]; - let dtsUnchangedExpectedReadFiles: ReadonlyMap = getReadFilesMap( - [ - // Configs - sources[project.first][source.config], - sources[project.second][source.config], - sources[project.third][source.config], - - // Source files - ...sources[project.first][source.ts], - - // outputs to prepend - ...outputFiles[project.first], - ...outputFiles[project.second], - ...outputFiles[project.third], - ] - ); - - let dtsUnchangedExpectedDiagnosticsDependOrdered: readonly fakes.ExpectedDiagnostic[] = [ - getExpectedDiagnosticForProjectsInBuild(relSources[project.first][source.config], relSources[project.second][source.config], relSources[project.third][source.config]), - [Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2, relSources[project.first][source.config], relOutputFiles[project.first][ext.js], relSources[project.first][source.ts][part.one]], - [Diagnostics.Building_project_0, sources[project.first][source.config]], - [Diagnostics.Project_0_is_out_of_date_because_output_of_its_dependency_1_has_changed, relSources[project.second][source.config], "src/first"], - [Diagnostics.Updating_output_of_project_0, sources[project.second][source.config]], - [Diagnostics.Updating_unchanged_output_timestamps_of_project_0, sources[project.second][source.config]], - [Diagnostics.Project_0_is_out_of_date_because_output_of_its_dependency_1_has_changed, relSources[project.third][source.config], "src/second"], - [Diagnostics.Updating_output_of_project_0, sources[project.third][source.config]], - [Diagnostics.Updating_unchanged_output_timestamps_of_project_0, sources[project.third][source.config]], - ]; - let dtsUnchangedExpectedReadFilesDependOrdered: ReadonlyMap = getDtsUnchangedExpectedReadFilesDependOrdered(); - before(() => { - outFileFs = loadProjectFromDisk("tests/projects/outfile-concat", time); + outFileFs = loadProjectFromDisk("tests/projects/outfile-concat"); }); after(() => { outFileFs = undefined!; expectedOutputFiles = undefined!; initialExpectedDiagnostics = undefined!; - initialExpectedReadFiles = undefined!; - dtsChangedExpectedDiagnostics = undefined!; - dtsChangedExpectedReadFiles = undefined!; - dtsChangedExpectedDiagnosticsDependOrdered = undefined!; - dtsChangedExpectedReadFilesDependOrdered = undefined!; - dtsUnchangedExpectedDiagnostics = undefined!; - dtsUnchangedExpectedReadFiles = undefined!; - dtsUnchangedExpectedDiagnosticsDependOrdered = undefined!; - dtsUnchangedExpectedReadFilesDependOrdered = undefined!; }); function createSolutionBuilder(host: fakes.SolutionBuilderHost, baseOptions?: BuildOptions) { return ts.createSolutionBuilder(host, ["/src/third"], { dry: false, force: false, verbose: true, ...(baseOptions || {}) }); } - function getInitialExpectedReadFiles(additionalSourceFiles?: readonly string[]) { - if (!additionalSourceFiles) return initialExpectedReadFiles; - const expectedReadFiles = cloneMap(initialExpectedReadFiles); - for (const path of additionalSourceFiles) { - expectedReadFiles.set(path, 1); - } - return expectedReadFiles; - } - - function getDtsChangedReadFilesDependOrdered() { - const value = cloneMap(dtsChangedExpectedReadFiles); - for (const path of sources[project.second][source.ts]) { - value.set(path, 1); - } - value.set(outputFiles[project.second][ext.dts], 2); // dts changes so once read old content, and once new (to emit third) - return value; - } - - function getDtsChangedReadFiles(dependOrdered?: boolean, additionalSourceFiles?: readonly string[]) { - const value = dependOrdered ? dtsChangedExpectedReadFilesDependOrdered : dtsChangedExpectedReadFiles; - if (!additionalSourceFiles) return value; - const expectedReadFiles = cloneMap(value); - for (const path of additionalSourceFiles) { - expectedReadFiles.set(path, 1); - } - return expectedReadFiles; - } - - function getDtsUnchangedExpectedReadFilesDependOrdered() { - const value = cloneMap(dtsUnchangedExpectedReadFiles); - // Since this changes too - for (const path of outputFiles[project.second]) { - value.set(path, 2); - } - return value; - } - - function getDtsUnchangedReadFiles(dependOrdered?: boolean, additionalSourceFiles?: readonly string[]) { - const value = dependOrdered ? dtsUnchangedExpectedReadFilesDependOrdered : dtsUnchangedExpectedReadFiles; - if (!additionalSourceFiles || additionalSourceFiles.length !== 3) return value; - const expectedReadFiles = cloneMap(value); - // Additional source Files - expectedReadFiles.set(additionalSourceFiles[project.first], 1); - return expectedReadFiles; - } - interface VerifyOutFileScenarioInput { - scenario: string; - modifyFs: (fs: vfs.FileSystem) => void; + subScenario: string; + modifyFs?: (fs: vfs.FileSystem) => void; modifyAgainFs?: (fs: vfs.FileSystem) => void; - additionalSourceFiles?: readonly string[]; - expectedBuildInfoFilesForSectionBaselines?: readonly BuildInfoSectionBaselineFiles[]; - dependOrdered?: true; ignoreDtsChanged?: true; ignoreDtsUnchanged?: true; baselineOnly?: true; } function verifyOutFileScenario({ - scenario, + subScenario, modifyFs, modifyAgainFs, - additionalSourceFiles, - expectedBuildInfoFilesForSectionBaselines, - dependOrdered, ignoreDtsChanged, ignoreDtsUnchanged, baselineOnly }: VerifyOutFileScenarioInput) { - const initialExpectedReadFiles = !baselineOnly ? getInitialExpectedReadFiles(additionalSourceFiles) : undefined; - const dtsChangedReadFiles = !baselineOnly && !ignoreDtsChanged ? getDtsChangedReadFiles(dependOrdered, additionalSourceFiles) : undefined; - const dtsUnchanged: ExpectedBuildOutput | undefined = !baselineOnly && (!ignoreDtsUnchanged || !modifyAgainFs) ? { - expectedDiagnostics: dependOrdered ? - dtsUnchangedExpectedDiagnosticsDependOrdered : - dtsUnchangedExpectedDiagnostics, - expectedReadFiles: getDtsUnchangedReadFiles(dependOrdered, additionalSourceFiles) - } : undefined; - - verifyTsbuildOutput({ - scenario, - projFs: () => outFileFs, - time, - tick, - proj: "outfile-concat", - rootNames: ["/src/third"], - expectedMapFileNames, - expectedBuildInfoFilesForSectionBaselines: expectedBuildInfoFilesForSectionBaselines || expectedTsbuildInfoFileNames, - lastProjectOutput: outputFiles[project.third][ext.js], - initialBuild: { - modifyFs, - expectedDiagnostics: initialExpectedDiagnostics, - expectedReadFiles: initialExpectedReadFiles - }, - incrementalDtsChangedBuild: !ignoreDtsChanged ? { + const incrementalScenarios: TscIncremental[] = []; + if (!ignoreDtsChanged) { + incrementalScenarios.push({ + buildKind: BuildKind.IncrementalDtsChange, modifyFs: fs => replaceText(fs, relSources[project.first][source.ts][part.one], "Hello", "Hola"), - expectedDiagnostics: dependOrdered ? - dtsChangedExpectedDiagnosticsDependOrdered : - dtsChangedExpectedDiagnostics, - expectedReadFiles: dtsChangedReadFiles - } : undefined, - incrementalDtsUnchangedBuild: !ignoreDtsUnchanged ? { + }); + } + if (!ignoreDtsUnchanged) { + incrementalScenarios.push({ + buildKind: BuildKind.IncrementalDtsUnchanged, modifyFs: fs => appendText(fs, relSources[project.first][source.ts][part.one], "console.log(s);"), - expectedDiagnostics: dtsUnchanged && dtsUnchanged.expectedDiagnostics, - expectedReadFiles: dtsUnchanged && dtsUnchanged.expectedReadFiles - } : undefined, - incrementalHeaderChangedBuild: modifyAgainFs ? { - modifyFs: modifyAgainFs, - expectedDiagnostics: dtsUnchanged && dtsUnchanged.expectedDiagnostics, - expectedReadFiles: dtsUnchanged && dtsUnchanged.expectedReadFiles - } : undefined, - outputFiles: expectedOutputFiles, - baselineOnly - }); + }); + } + if (modifyAgainFs) { + incrementalScenarios.push({ + buildKind: BuildKind.IncrementalHeadersChange, + modifyFs: modifyAgainFs + }); + } + const input: VerifyTsBuildInput = { + subScenario, + fs: () => outFileFs, + scenario: "outfile-concat", + commandLineArgs: ["--b", "/src/third", "--verbose"], + baselineSourceMap: true, + modifyFs, + baselineReadFileCalls: !baselineOnly, + incrementalScenarios, + }; + return incrementalScenarios.length ? + verifyTscIncrementalEdits(input) : + verifyTsc(input); } // Verify initial + incremental edits verifyOutFileScenario({ - scenario: "baseline sectioned sourcemaps", - modifyFs: noop + subScenario: "baseline sectioned sourcemaps", }); // Verify baseline with build info + dts unChanged verifyOutFileScenario({ - scenario: "when final project is not composite but uses project references", + subScenario: "when final project is not composite but uses project references", modifyFs: fs => replaceText(fs, sources[project.third][source.config], `"composite": true,`, ""), ignoreDtsChanged: true, baselineOnly: true @@ -332,7 +149,7 @@ namespace ts { // Verify baseline with build info verifyOutFileScenario({ - scenario: "when final project is not composite but incremental", + subScenario: "when final project is not composite but incremental", modifyFs: fs => replaceText(fs, sources[project.third][source.config], `"composite": true,`, `"incremental": true,`), ignoreDtsChanged: true, ignoreDtsUnchanged: true, @@ -341,14 +158,9 @@ namespace ts { // Verify baseline with build info verifyOutFileScenario({ - scenario: "when final project specifies tsBuildInfoFile", + subScenario: "when final project specifies tsBuildInfoFile", modifyFs: fs => replaceText(fs, sources[project.third][source.config], `"composite": true,`, `"composite": true, "tsBuildInfoFile": "./thirdjs/output/third.tsbuildinfo",`), - expectedBuildInfoFilesForSectionBaselines: [ - expectedTsbuildInfoFileNames[0], - expectedTsbuildInfoFileNames[1], - ["/src/third/thirdjs/output/third.tsbuildinfo", expectedTsbuildInfoFileNames[2][1], expectedTsbuildInfoFileNames[2][2]] - ], ignoreDtsChanged: true, ignoreDtsUnchanged: true, baselineOnly: true @@ -361,7 +173,7 @@ namespace ts { ...outputFiles[project.second], ...outputFiles[project.third] ]; - const host = new fakes.SolutionBuilderHost(fs); + const host = fakes.SolutionBuilderHost.create(fs); const builder = createSolutionBuilder(host); builder.build(); host.assertDiagnosticMessages(...initialExpectedDiagnostics); @@ -377,13 +189,13 @@ namespace ts { }); it("verify buildInfo absence results in new build", () => { - const fs = outFileFs.shadow(); + const { fs, tick } = getFsWithTime(outFileFs); const expectedOutputs = [ ...outputFiles[project.first], ...outputFiles[project.second], ...outputFiles[project.third] ]; - const host = new fakes.SolutionBuilderHost(fs); + const host = fakes.SolutionBuilderHost.create(fs); let builder = createSolutionBuilder(host); builder.build(); host.assertDiagnosticMessages(...initialExpectedDiagnostics); @@ -391,7 +203,11 @@ namespace ts { verifyOutputsPresent(fs, expectedOutputs); // Delete bundle info host.clearDiagnostics(); + + tick(); host.deleteFile(outputFiles[project.first][ext.buildinfo]); + tick(); + builder = createSolutionBuilder(host); builder.build(); host.assertDiagnosticMessages( @@ -407,7 +223,7 @@ namespace ts { it("verify that if incremental is set to false, tsbuildinfo is not generated", () => { const fs = outFileFs.shadow(); - const host = new fakes.SolutionBuilderHost(fs); + const host = fakes.SolutionBuilderHost.create(fs); replaceText(fs, sources[project.third][source.config], `"composite": true,`, ""); const builder = createSolutionBuilder(host); builder.build(); @@ -418,14 +234,16 @@ namespace ts { }); it("rebuilds completely when version in tsbuildinfo doesnt match ts version", () => { - const fs = outFileFs.shadow(); - const host = new fakes.SolutionBuilderHost(fs); + const { fs, tick } = getFsWithTime(outFileFs); + const host = fakes.SolutionBuilderHost.create(fs); let builder = createSolutionBuilder(host); builder.build(); host.assertDiagnosticMessages(...initialExpectedDiagnostics); host.clearDiagnostics(); + tick(); builder = createSolutionBuilder(host); changeCompilerVersion(host); + tick(); builder.build(); host.assertDiagnosticMessages( getExpectedDiagnosticForProjectsInBuild(relSources[project.first][source.config], relSources[project.second][source.config], relSources[project.third][source.config]), @@ -439,12 +257,12 @@ namespace ts { }); it("rebuilds completely when command line incremental flag changes between non dts changes", () => { - const fs = outFileFs.shadow(); + const { fs, tick } = getFsWithTime(outFileFs); // Make non composite third project replaceText(fs, sources[project.third][source.config], `"composite": true,`, ""); // Build with command line incremental - const host = new fakes.SolutionBuilderHost(fs); + const host = fakes.SolutionBuilderHost.create(fs); let builder = createSolutionBuilder(host, { incremental: true }); builder.build(); host.assertDiagnosticMessages(...initialExpectedDiagnostics); @@ -483,7 +301,7 @@ namespace ts { it("builds till project specified", () => { const fs = outFileFs.shadow(); - const host = new fakes.SolutionBuilderHost(fs); + const host = fakes.SolutionBuilderHost.create(fs); const builder = createSolutionBuilder(host, { verbose: false }); const result = builder.build(sources[project.second][source.config]); host.assertDiagnosticMessages(/*empty*/); @@ -496,7 +314,7 @@ namespace ts { it("cleans till project specified", () => { const fs = outFileFs.shadow(); - const host = new fakes.SolutionBuilderHost(fs); + const host = fakes.SolutionBuilderHost.create(fs); const builder = createSolutionBuilder(host, { verbose: false }); builder.build(); const result = builder.clean(sources[project.second][source.config]); @@ -513,7 +331,7 @@ namespace ts { describe("Prologues", () => { // Verify initial + incremental edits verifyOutFileScenario({ - scenario: "strict in all projects", + subScenario: "strict in all projects", modifyFs: fs => { enableStrict(fs, sources[project.first][source.config]); enableStrict(fs, sources[project.second][source.config]); @@ -524,7 +342,7 @@ namespace ts { // Verify ignore dtsChanged verifyOutFileScenario({ - scenario: "strict in one dependency", + subScenario: "strict in one dependency", modifyFs: fs => enableStrict(fs, sources[project.second][source.config]), modifyAgainFs: fs => addTestPrologue(fs, "src/first/first_PART1.ts", `"myPrologue"`), ignoreDtsChanged: true, @@ -533,7 +351,7 @@ namespace ts { // Verify initial + incremental edits - sourcemap verification verifyOutFileScenario({ - scenario: "multiple prologues in all projects", + subScenario: "multiple prologues in all projects", modifyFs: fs => { enableStrict(fs, sources[project.first][source.config]); addTestPrologue(fs, sources[project.first][source.ts][part.one], `"myPrologue"`); @@ -549,7 +367,7 @@ namespace ts { // Verify ignore dtsChanged verifyOutFileScenario({ - scenario: "multiple prologues in different projects", + subScenario: "multiple prologues in different projects", modifyFs: fs => { enableStrict(fs, sources[project.first][source.config]); addTestPrologue(fs, sources[project.second][source.ts][part.one], `"myPrologue"`); @@ -567,7 +385,7 @@ namespace ts { // changes declaration because its emitted in .d.ts file // Verify initial + incremental edits verifyOutFileScenario({ - scenario: "shebang in all projects", + subScenario: "shebang in all projects", modifyFs: fs => { addShebang(fs, "first", "first_PART1"); addShebang(fs, "first", "first_part2"); @@ -578,7 +396,7 @@ namespace ts { // Verify ignore dtsChanged verifyOutFileScenario({ - scenario: "shebang in only one dependency project", + subScenario: "shebang in only one dependency project", modifyFs: fs => addShebang(fs, "second", "second_part1"), ignoreDtsChanged: true, baselineOnly: true @@ -589,7 +407,7 @@ namespace ts { describe("emitHelpers", () => { // Verify initial + incremental edits verifyOutFileScenario({ - scenario: "emitHelpers in all projects", + subScenario: "emitHelpers in all projects", modifyFs: fs => { addRest(fs, "first", "first_PART1"); addRest(fs, "second", "second_part1"); @@ -600,7 +418,7 @@ namespace ts { // Verify ignore dtsChanged verifyOutFileScenario({ - scenario: "emitHelpers in only one dependency project", + subScenario: "emitHelpers in only one dependency project", modifyFs: fs => { addStubFoo(fs, "first", "first_PART1"); addRest(fs, "second", "second_part1"); @@ -612,7 +430,7 @@ namespace ts { // Verify ignore dtsChanged verifyOutFileScenario({ - scenario: "multiple emitHelpers in all projects", + subScenario: "multiple emitHelpers in all projects", modifyFs: fs => { addRest(fs, "first", "first_PART1"); addSpread(fs, "first", "first_part3"); @@ -628,7 +446,7 @@ namespace ts { // Verify ignore dtsChanged verifyOutFileScenario({ - scenario: "multiple emitHelpers in different projects", + subScenario: "multiple emitHelpers in different projects", modifyFs: fs => { addRest(fs, "first", "first_PART1"); addSpread(fs, "second", "second_part1"); @@ -645,24 +463,18 @@ namespace ts { // changes declaration because its emitted in .d.ts file // Verify initial + incremental edits verifyOutFileScenario({ - scenario: "triple slash refs in all projects", + subScenario: "triple slash refs in all projects", modifyFs: fs => { addTripleSlashRef(fs, "first", "first_part2"); addTripleSlashRef(fs, "second", "second_part1"); addTripleSlashRef(fs, "third", "third_part1"); - }, - additionalSourceFiles: [ - getTripleSlashRef("first"), getTripleSlashRef("second"), getTripleSlashRef("third") - ] + } }); // Verify ignore dtsChanged verifyOutFileScenario({ - scenario: "triple slash refs in one project", + subScenario: "triple slash refs in one project", modifyFs: fs => addTripleSlashRef(fs, "second", "second_part1"), - additionalSourceFiles: [ - getTripleSlashRef("second") - ], ignoreDtsChanged: true, baselineOnly: true }); @@ -721,14 +533,14 @@ ${internal} enum internalEnum { a, b, c }`); // Verify initial + incremental edits verifyOutFileScenario({ - scenario: "stripInternal", + subScenario: "stripInternal", modifyFs: stripInternalScenario, modifyAgainFs: fs => replaceText(fs, sources[project.first][source.ts][part.one], `/*@internal*/ interface`, "interface"), }); // Verify ignore dtsChanged verifyOutFileScenario({ - scenario: "stripInternal with comments emit enabled", + subScenario: "stripInternal with comments emit enabled", modifyFs: fs => stripInternalScenario(fs, /*removeCommentsDisabled*/ true), modifyAgainFs: fs => replaceText(fs, sources[project.first][source.ts][part.one], `/*@internal*/ interface`, "interface"), ignoreDtsChanged: true, @@ -737,7 +549,7 @@ ${internal} enum internalEnum { a, b, c }`); // Verify ignore dtsChanged verifyOutFileScenario({ - scenario: "stripInternal jsdoc style comment", + subScenario: "stripInternal jsdoc style comment", modifyFs: fs => stripInternalScenario(fs, /*removeCommentsDisabled*/ false, /*jsDocStyle*/ true), modifyAgainFs: fs => replaceText(fs, sources[project.first][source.ts][part.one], `/**@internal*/ interface`, "interface"), ignoreDtsChanged: true, @@ -746,7 +558,7 @@ ${internal} enum internalEnum { a, b, c }`); // Verify ignore dtsChanged verifyOutFileScenario({ - scenario: "stripInternal jsdoc style with comments emit enabled", + subScenario: "stripInternal jsdoc style with comments emit enabled", modifyFs: fs => stripInternalScenario(fs, /*removeCommentsDisabled*/ true, /*jsDocStyle*/ true), ignoreDtsChanged: true, baselineOnly: true @@ -766,37 +578,33 @@ ${internal} enum internalEnum { a, b, c }`); // Verify initial + incremental edits verifyOutFileScenario({ - scenario: "stripInternal when one-two-three are prepended in order", + subScenario: "stripInternal when one-two-three are prepended in order", modifyFs: stripInternalWithDependentOrder, modifyAgainFs: fs => replaceText(fs, sources[project.first][source.ts][part.one], `/*@internal*/ interface`, "interface"), - dependOrdered: true, }); // Verify ignore dtsChanged verifyOutFileScenario({ - scenario: "stripInternal with comments emit enabled when one-two-three are prepended in order", + subScenario: "stripInternal with comments emit enabled when one-two-three are prepended in order", modifyFs: fs => stripInternalWithDependentOrder(fs, /*removeCommentsDisabled*/ true), modifyAgainFs: fs => replaceText(fs, sources[project.first][source.ts][part.one], `/*@internal*/ interface`, "interface"), - dependOrdered: true, ignoreDtsChanged: true, baselineOnly: true }); // Verify ignore dtsChanged verifyOutFileScenario({ - scenario: "stripInternal jsdoc style comment when one-two-three are prepended in order", + subScenario: "stripInternal jsdoc style comment when one-two-three are prepended in order", modifyFs: fs => stripInternalWithDependentOrder(fs, /*removeCommentsDisabled*/ false, /*jsDocStyle*/ true), modifyAgainFs: fs => replaceText(fs, sources[project.first][source.ts][part.one], `/**@internal*/ interface`, "interface"), - dependOrdered: true, ignoreDtsChanged: true, baselineOnly: true }); // Verify ignore dtsChanged verifyOutFileScenario({ - scenario: "stripInternal jsdoc style with comments emit enabled when one-two-three are prepended in order", + subScenario: "stripInternal jsdoc style with comments emit enabled when one-two-three are prepended in order", modifyFs: fs => stripInternalWithDependentOrder(fs, /*removeCommentsDisabled*/ true, /*jsDocStyle*/ true), - dependOrdered: true, ignoreDtsChanged: true, baselineOnly: true }); @@ -804,7 +612,7 @@ ${internal} enum internalEnum { a, b, c }`); // only baseline verifyOutFileScenario({ - scenario: "stripInternal baseline when internal is inside another internal", + subScenario: "stripInternal baseline when internal is inside another internal", modifyFs: fs => { stripInternalOfThird(fs); prependText(fs, sources[project.first][source.ts][part.one], `namespace ts { @@ -843,7 +651,7 @@ ${internal} enum internalEnum { a, b, c }`); // only baseline verifyOutFileScenario({ - scenario: "stripInternal when few members of enum are internal", + subScenario: "stripInternal when few members of enum are internal", modifyFs: fs => { stripInternalOfThird(fs); prependText(fs, sources[project.first][source.ts][part.one], `enum TokenFlags { @@ -883,7 +691,7 @@ ${internal} enum internalEnum { a, b, c }`); // Verify ignore dtsChanged verifyOutFileScenario({ - scenario: "when source files are empty in the own file", + subScenario: "when source files are empty in the own file", modifyFs: makeThirdEmptySourceFile, ignoreDtsChanged: true, baselineOnly: true @@ -891,7 +699,7 @@ ${internal} enum internalEnum { a, b, c }`); // only baseline verifyOutFileScenario({ - scenario: "declarationMap and sourceMap disabled", + subScenario: "declarationMap and sourceMap disabled", modifyFs: fs => { makeThirdEmptySourceFile(fs); replaceText(fs, sources[project.third][source.config], `"composite": true,`, ""); @@ -921,7 +729,7 @@ ${internal} enum internalEnum { a, b, c }`); replaceText(fs, sources[project.second][source.config], `"outFile": "../2/second-output.js",`, ""); replaceText(fs, sources[project.third][source.config], `"outFile": "./thirdjs/output/third-output.js",`, ""); - const host = new fakes.SolutionBuilderHost(fs); + const host = fakes.SolutionBuilderHost.create(fs); const builder = createSolutionBuilder(host); builder.build(); host.assertDiagnosticMessages( diff --git a/src/testRunner/unittests/tsbuild/referencesWithRootDirInParent.ts b/src/testRunner/unittests/tsbuild/referencesWithRootDirInParent.ts index 79cc34ce01628..d81e5f3f947d6 100644 --- a/src/testRunner/unittests/tsbuild/referencesWithRootDirInParent.ts +++ b/src/testRunner/unittests/tsbuild/referencesWithRootDirInParent.ts @@ -16,7 +16,7 @@ namespace ts { "/src/dist/main/b.js", "/src/dist/main/b.d.ts" ]; const fs = projFs.shadow(); - const host = new fakes.SolutionBuilderHost(fs); + const host = fakes.SolutionBuilderHost.create(fs); const builder = createSolutionBuilder(host, ["/src/src/main", "/src/src/other"], {}); builder.build(); host.assertDiagnosticMessages(/*empty*/); @@ -34,7 +34,7 @@ namespace ts { ]; const fs = projFs.shadow(); replaceText(fs, "/src/tsconfig.base.json", `"rootDir": "./src/",`, ""); - const host = new fakes.SolutionBuilderHost(fs); + const host = fakes.SolutionBuilderHost.create(fs); const builder = createSolutionBuilder(host, ["/src/src/main"], { verbose: true }); builder.build(); host.assertDiagnosticMessages( @@ -69,7 +69,7 @@ namespace ts { fs.writeFileSync("/src/src/other/tsconfig.json", JSON.stringify({ compilerOptions: { composite: true, outDir: "../../dist/" }, })); - const host = new fakes.SolutionBuilderHost(fs); + const host = fakes.SolutionBuilderHost.create(fs); const builder = createSolutionBuilder(host, ["/src/src/main"], { verbose: true }); builder.build(); host.assertDiagnosticMessages( @@ -105,7 +105,7 @@ namespace ts { fs.writeFileSync("/src/src/other/tsconfig.other.json", JSON.stringify({ compilerOptions: { composite: true, outDir: "../../dist/" }, })); - const host = new fakes.SolutionBuilderHost(fs); + const host = fakes.SolutionBuilderHost.create(fs); const builder = createSolutionBuilder(host, ["/src/src/main/tsconfig.main.json"], { verbose: true }); builder.build(); host.assertDiagnosticMessages( diff --git a/src/testRunner/unittests/tsbuild/resolveJsonModule.ts b/src/testRunner/unittests/tsbuild/resolveJsonModule.ts index f1ea08324f6eb..71ae0d4c86e80 100644 --- a/src/testRunner/unittests/tsbuild/resolveJsonModule.ts +++ b/src/testRunner/unittests/tsbuild/resolveJsonModule.ts @@ -1,10 +1,9 @@ namespace ts { describe("unittests:: tsbuild:: with resolveJsonModule option on project resolveJsonModuleAndComposite", () => { let projFs: vfs.FileSystem; - const { time, tick } = getTime(); const allExpectedOutputs = ["/src/dist/src/index.js", "/src/dist/src/index.d.ts", "/src/dist/src/hello.json"]; before(() => { - projFs = loadProjectFromDisk("tests/projects/resolveJsonModuleAndComposite", time); + projFs = loadProjectFromDisk("tests/projects/resolveJsonModuleAndComposite"); }); after(() => { @@ -17,7 +16,7 @@ namespace ts { } function verifyProjectWithResolveJsonModuleWithFs(fs: vfs.FileSystem, configFile: string, allExpectedOutputs: readonly string[], ...expectedDiagnosticMessages: fakes.ExpectedDiagnostic[]) { - const host = new fakes.SolutionBuilderHost(fs); + const host = fakes.SolutionBuilderHost.create(fs); const builder = createSolutionBuilder(host, [configFile], { dry: false, force: false, verbose: false }); builder.build(); host.assertDiagnosticMessages(...expectedDiagnosticMessages); @@ -65,10 +64,10 @@ export default hello.hello`); }); it("with resolveJsonModule and sourceMap", () => { - const fs = projFs.shadow(); + const { fs, tick } = getFsWithTime(projFs); const configFile = "src/tsconfig_withFiles.json"; replaceText(fs, configFile, `"composite": true,`, `"composite": true, "sourceMap": true,`); - const host = new fakes.SolutionBuilderHost(fs); + const host = fakes.SolutionBuilderHost.create(fs); let builder = createSolutionBuilder(host, [configFile], { verbose: true }); builder.build(); host.assertDiagnosticMessages( @@ -88,10 +87,10 @@ export default hello.hello`); }); it("with resolveJsonModule and without outDir", () => { - const fs = projFs.shadow(); + const { fs, tick } = getFsWithTime(projFs); const configFile = "src/tsconfig_withFiles.json"; replaceText(fs, configFile, `"outDir": "dist",`, ""); - const host = new fakes.SolutionBuilderHost(fs); + const host = fakes.SolutionBuilderHost.create(fs); let builder = createSolutionBuilder(host, [configFile], { verbose: true }); builder.build(); host.assertDiagnosticMessages( @@ -112,10 +111,9 @@ export default hello.hello`); }); describe("unittests:: tsbuild:: with resolveJsonModule option on project importJsonFromProjectReference", () => { - const { time, tick } = getTime(); let projFs: vfs.FileSystem; before(() => { - projFs = loadProjectFromDisk("tests/projects/importJsonFromProjectReference", time); + projFs = loadProjectFromDisk("tests/projects/importJsonFromProjectReference"); }); after(() => { @@ -124,11 +122,11 @@ export default hello.hello`); it("when importing json module from project reference", () => { const expectedOutput = "/src/main/index.js"; - const fs = projFs.shadow(); + const { fs, tick } = getFsWithTime(projFs); const configFile = "src/tsconfig.json"; const stringsConfigFile = "src/strings/tsconfig.json"; const mainConfigFile = "src/main/tsconfig.json"; - const host = new fakes.SolutionBuilderHost(fs); + const host = fakes.SolutionBuilderHost.create(fs); let builder = createSolutionBuilder(host, [configFile], { verbose: true }); builder.build(); host.assertDiagnosticMessages( diff --git a/src/testRunner/unittests/tsbuild/sample.ts b/src/testRunner/unittests/tsbuild/sample.ts index 91574c3a920b0..1a27a624197e0 100644 --- a/src/testRunner/unittests/tsbuild/sample.ts +++ b/src/testRunner/unittests/tsbuild/sample.ts @@ -1,14 +1,13 @@ namespace ts { describe("unittests:: tsbuild:: on 'sample1' project", () => { let projFs: vfs.FileSystem; - const { time, tick } = getTime(); const testsOutputs = ["/src/tests/index.js", "/src/tests/index.d.ts", "/src/tests/tsconfig.tsbuildinfo"]; const logicOutputs = ["/src/logic/index.js", "/src/logic/index.js.map", "/src/logic/index.d.ts", "/src/logic/tsconfig.tsbuildinfo"]; const coreOutputs = ["/src/core/index.js", "/src/core/index.d.ts", "/src/core/index.d.ts.map", "/src/core/tsconfig.tsbuildinfo"]; const allExpectedOutputs = [...testsOutputs, ...logicOutputs, ...coreOutputs]; before(() => { - projFs = loadProjectFromDisk("tests/projects/sample1", time); + projFs = loadProjectFromDisk("tests/projects/sample1"); }); after(() => { @@ -18,7 +17,7 @@ namespace ts { describe("sanity check of clean build of 'sample1' project", () => { it("can build the sample project 'sample1' without error", () => { const fs = projFs.shadow(); - const host = new fakes.SolutionBuilderHost(fs); + const host = fakes.SolutionBuilderHost.create(fs); const builder = createSolutionBuilder(host, ["/src/tests"], { dry: false, force: false, verbose: false }); host.clearDiagnostics(); @@ -36,7 +35,7 @@ namespace ts { references: [{ path: "../core" }] })); - const host = new fakes.SolutionBuilderHost(fs); + const host = fakes.SolutionBuilderHost.create(fs); const builder = createSolutionBuilder(host, ["/src/tests"], {}); builder.build(); host.assertDiagnosticMessages(/*empty*/); @@ -52,7 +51,7 @@ namespace ts { references: [{ path: "../core" }] })); - const host = new fakes.SolutionBuilderHost(fs); + const host = fakes.SolutionBuilderHost.create(fs); const builder = createSolutionBuilder(host, ["/src/tests"], {}); builder.build(); host.assertDiagnosticMessages(/*empty*/); @@ -64,7 +63,7 @@ namespace ts { it("builds correctly when project is not composite or doesnt have any references", () => { const fs = projFs.shadow(); replaceText(fs, "/src/core/tsconfig.json", `"composite": true,`, ""); - const host = new fakes.SolutionBuilderHost(fs); + const host = fakes.SolutionBuilderHost.create(fs); const builder = createSolutionBuilder(host, ["/src/core"], { verbose: true }); builder.build(); host.assertDiagnosticMessages( @@ -79,7 +78,7 @@ namespace ts { describe("dry builds", () => { it("doesn't write any files in a dry build", () => { const fs = projFs.shadow(); - const host = new fakes.SolutionBuilderHost(fs); + const host = fakes.SolutionBuilderHost.create(fs); const builder = createSolutionBuilder(host, ["/src/tests"], { dry: true, force: false, verbose: false }); builder.build(); host.assertDiagnosticMessages( @@ -93,8 +92,8 @@ namespace ts { }); it("indicates that it would skip builds during a dry build", () => { - const fs = projFs.shadow(); - const host = new fakes.SolutionBuilderHost(fs); + const { fs, tick } = getFsWithTime(projFs); + const host = fakes.SolutionBuilderHost.create(fs); let builder = createSolutionBuilder(host, ["/src/tests"], { dry: false, force: false, verbose: false }); builder.build(); @@ -114,7 +113,7 @@ namespace ts { describe("clean builds", () => { it("removes all files it built", () => { const fs = projFs.shadow(); - const host = new fakes.SolutionBuilderHost(fs); + const host = fakes.SolutionBuilderHost.create(fs); const builder = createSolutionBuilder(host, ["/src/tests"], { dry: false, force: false, verbose: false }); builder.build(); @@ -136,7 +135,7 @@ namespace ts { it("cleans till project specified", () => { const fs = projFs.shadow(); - const host = new fakes.SolutionBuilderHost(fs); + const host = fakes.SolutionBuilderHost.create(fs); const builder = createSolutionBuilder(host, ["/src/tests"], {}); builder.build(); const result = builder.clean("/src/logic"); @@ -148,7 +147,7 @@ namespace ts { it("cleaning project in not build order doesnt throw error", () => { const fs = projFs.shadow(); - const host = new fakes.SolutionBuilderHost(fs); + const host = fakes.SolutionBuilderHost.create(fs); const builder = createSolutionBuilder(host, ["/src/tests"], {}); builder.build(); const result = builder.clean("/src/logic2"); @@ -160,8 +159,8 @@ namespace ts { describe("force builds", () => { it("always builds under --force", () => { - const fs = projFs.shadow(); - const host = new fakes.SolutionBuilderHost(fs); + const { fs, time, tick } = getFsWithTime(projFs); + const host = fakes.SolutionBuilderHost.create(fs); let builder = createSolutionBuilder(host, ["/src/tests"], { dry: false, force: true, verbose: false }); builder.build(); @@ -187,8 +186,8 @@ namespace ts { describe("can detect when and what to rebuild", () => { function initializeWithBuild(opts?: BuildOptions) { - const fs = projFs.shadow(); - const host = new fakes.SolutionBuilderHost(fs); + const { fs, tick } = getFsWithTime(projFs); + const host = fakes.SolutionBuilderHost.create(fs); let builder = createSolutionBuilder(host, ["/src/tests"], { verbose: true }); builder.build(); host.clearDiagnostics(); @@ -199,7 +198,7 @@ namespace ts { it("Builds the project", () => { const fs = projFs.shadow(); - const host = new fakes.SolutionBuilderHost(fs); + const host = fakes.SolutionBuilderHost.create(fs); const builder = createSolutionBuilder(host, ["/src/tests"], { verbose: true }); builder.build(); host.assertDiagnosticMessages( @@ -273,8 +272,8 @@ namespace ts { }); it("does not rebuild if there is no program and bundle in the ts build info event if version doesnt match ts version", () => { - const fs = projFs.shadow(); - const host = new fakes.SolutionBuilderHost(fs, /*options*/ undefined, /*setParentNodes*/ undefined, createAbstractBuilder); + const { fs, tick } = getFsWithTime(projFs); + const host = fakes.SolutionBuilderHost.create(fs, /*options*/ undefined, /*setParentNodes*/ undefined, createAbstractBuilder); let builder = createSolutionBuilder(host, ["/src/tests"], { verbose: true }); builder.build(); host.assertDiagnosticMessages( @@ -329,10 +328,10 @@ namespace ts { }); it("rebuilds when extended config file changes", () => { - const fs = projFs.shadow(); + const { fs, tick } = getFsWithTime(projFs); fs.writeFileSync("/src/tests/tsconfig.base.json", JSON.stringify({ compilerOptions: { target: "es3" } })); replaceText(fs, "/src/tests/tsconfig.json", `"references": [`, `"extends": "./tsconfig.base.json", "references": [`); - const host = new fakes.SolutionBuilderHost(fs); + const host = fakes.SolutionBuilderHost.create(fs); let builder = createSolutionBuilder(host, ["/src/tests"], { verbose: true }); builder.build(); host.assertDiagnosticMessages( @@ -360,7 +359,7 @@ namespace ts { it("builds till project specified", () => { const fs = projFs.shadow(); - const host = new fakes.SolutionBuilderHost(fs); + const host = fakes.SolutionBuilderHost.create(fs); const builder = createSolutionBuilder(host, ["/src/tests"], {}); const result = builder.build("/src/logic"); host.assertDiagnosticMessages(/*empty*/); @@ -371,7 +370,7 @@ namespace ts { it("building project in not build order doesnt throw error", () => { const fs = projFs.shadow(); - const host = new fakes.SolutionBuilderHost(fs); + const host = fakes.SolutionBuilderHost.create(fs); const builder = createSolutionBuilder(host, ["/src/tests"], {}); const result = builder.build("/src/logic2"); host.assertDiagnosticMessages(/*empty*/); @@ -386,7 +385,7 @@ namespace ts { } const fs = projFs.shadow(); - const host = new fakes.SolutionBuilderHost(fs); + const host = fakes.SolutionBuilderHost.create(fs); const builder = createSolutionBuilder(host, ["/src/tests"], {}); verifyBuildNextResult({ project: "/src/core/tsconfig.json" as ResolvedConfigFileName, @@ -420,7 +419,7 @@ namespace ts { it("building using buildReferencedProject", () => { const fs = projFs.shadow(); - const host = new fakes.SolutionBuilderHost(fs); + const host = fakes.SolutionBuilderHost.create(fs); const builder = createSolutionBuilder(host, ["/src/tests"], { verbose: true }); builder.buildReferences("/src/tests"); host.assertDiagnosticMessages( @@ -438,7 +437,7 @@ namespace ts { describe("downstream-blocked compilations", () => { it("won't build downstream projects if upstream projects have errors", () => { const fs = projFs.shadow(); - const host = new fakes.SolutionBuilderHost(fs); + const host = fakes.SolutionBuilderHost.create(fs); const builder = createSolutionBuilder(host, ["/src/tests"], { dry: false, force: false, verbose: true }); // Induce an error in the middle project @@ -462,8 +461,8 @@ namespace ts { describe("project invalidation", () => { it("invalidates projects correctly", () => { - const fs = projFs.shadow(); - const host = new fakes.SolutionBuilderHost(fs); + const { fs, time, tick } = getFsWithTime(projFs); + const host = fakes.SolutionBuilderHost.create(fs); const builder = createSolutionBuilder(host, ["/src/tests"], { dry: false, force: false, verbose: false }); builder.build(); @@ -518,7 +517,7 @@ export class cNew {}`); describe("lists files", () => { it("listFiles", () => { const fs = projFs.shadow(); - const host = new fakes.SolutionBuilderHost(fs); + const host = fakes.SolutionBuilderHost.create(fs); const builder = createSolutionBuilder(host, ["/src/tests"], { listFiles: true }); builder.build(); assert.deepEqual(host.traces, [ @@ -545,7 +544,7 @@ export class cNew {}`); it("listEmittedFiles", () => { const fs = projFs.shadow(); - const host = new fakes.SolutionBuilderHost(fs); + const host = fakes.SolutionBuilderHost.create(fs); const builder = createSolutionBuilder(host, ["/src/tests"], { listEmittedFiles: true }); builder.build(); assert.deepEqual(host.traces, [ @@ -568,338 +567,73 @@ export class cNew {}`); }); describe("emit output", () => { - const initialBuild: BuildState = { - modifyFs: noop, - expectedDiagnostics: [ - getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json", "src/logic/tsconfig.json", "src/tests/tsconfig.json"), - [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/core/tsconfig.json", "src/core/anotherModule.js"], - [Diagnostics.Building_project_0, "/src/core/tsconfig.json"], - [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/logic/tsconfig.json", "src/logic/index.js"], - [Diagnostics.Building_project_0, "/src/logic/tsconfig.json"], - [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/tests/tsconfig.json", "src/tests/index.js"], - [Diagnostics.Building_project_0, "/src/tests/tsconfig.json"] - ], - expectedReadFiles: getReadFilesMap( - [ - // Configs - "/src/core/tsconfig.json", - "/src/logic/tsconfig.json", - "/src/tests/tsconfig.json", - - // Source files - "/src/core/anotherModule.ts", - "/src/core/index.ts", - "/src/core/some_decl.d.ts", - "/src/logic/index.ts", - "/src/tests/index.ts", - - // Modules of generated files - "/src/core/anotherModule.d.ts", - "/src/core/index.d.ts", - "/src/logic/index.d.ts", - - // build info - "/src/core/tsconfig.tsbuildinfo", - "/src/logic/tsconfig.tsbuildinfo", - "/src/tests/tsconfig.tsbuildinfo" - ] - ) - }; - verifyTsbuildOutput({ - scenario: "sample", - projFs: () => projFs, - time, - tick, - proj: "sample1", - rootNames: ["/src/tests"], - expectedMapFileNames: [ - "/src/core/anotherModule.d.ts.map", - "/src/core/index.d.ts.map", - "/src/logic/index.js.map" - ], - lastProjectOutput: "/src/tests/index.js", - initialBuild, - incrementalDtsChangedBuild: { - modifyFs: fs => appendText(fs, "/src/core/index.ts", ` + verifyTscIncrementalEdits({ + subScenario: "sample", + fs: () => projFs, + scenario: "sample1", + commandLineArgs: ["--b", "/src/tests", "--verbose"], + baselineSourceMap: true, + baselineReadFileCalls: true, + incrementalScenarios: [ + { + buildKind: BuildKind.IncrementalDtsChange, + modifyFs: fs => appendText(fs, "/src/core/index.ts", ` export class someClass { }`), - expectedDiagnostics: [ - // Emits only partial core instead of all outputs - getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json", "src/logic/tsconfig.json", "src/tests/tsconfig.json"), - [Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2, "src/core/tsconfig.json", "src/core/anotherModule.js", "src/core/index.ts"], - [Diagnostics.Building_project_0, "/src/core/tsconfig.json"], - [Diagnostics.Updating_unchanged_output_timestamps_of_project_0, "/src/core/tsconfig.json"], - [Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2, "src/logic/tsconfig.json", "src/logic/index.js", "src/core"], - [Diagnostics.Building_project_0, "/src/logic/tsconfig.json"], - [Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2, "src/tests/tsconfig.json", "src/tests/index.js", "src/core"], - [Diagnostics.Building_project_0, "/src/tests/tsconfig.json"], - ], - expectedReadFiles: getReadFilesMap( - [ - // Configs - "/src/core/tsconfig.json", - "/src/logic/tsconfig.json", - "/src/tests/tsconfig.json", - - // Source files - "/src/core/anotherModule.ts", - "/src/core/index.ts", - "/src/core/some_decl.d.ts", - "/src/logic/index.ts", - "/src/tests/index.ts", - - // Modules of generated files - "/src/core/anotherModule.d.ts", - "/src/core/index.d.ts", - "/src/logic/index.d.ts", - - // build info - "/src/core/tsconfig.tsbuildinfo", - "/src/logic/tsconfig.tsbuildinfo", - "/src/tests/tsconfig.tsbuildinfo", - - "/src/tests/index.d.ts", // to check if d.ts has changed - ], - "/src/core/index.d.ts", // to check if changed, and to build other projects after change - ), - }, - incrementalDtsUnchangedBuild: { - modifyFs: fs => appendText(fs, "/src/core/index.ts", ` + }, + { + buildKind: BuildKind.IncrementalDtsUnchanged, + modifyFs: fs => appendText(fs, "/src/core/index.ts", ` class someClass { }`), - expectedDiagnostics: [ - getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json", "src/logic/tsconfig.json", "src/tests/tsconfig.json"), - [Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2, "src/core/tsconfig.json", "src/core/anotherModule.js", "src/core/index.ts"], - [Diagnostics.Building_project_0, "/src/core/tsconfig.json"], - [Diagnostics.Updating_unchanged_output_timestamps_of_project_0, "/src/core/tsconfig.json"], - [Diagnostics.Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies, "src/logic/tsconfig.json"], - [Diagnostics.Updating_output_timestamps_of_project_0, "/src/logic/tsconfig.json"], - [Diagnostics.Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies, "src/tests/tsconfig.json"], - [Diagnostics.Updating_output_timestamps_of_project_0, "/src/tests/tsconfig.json"] - ], - expectedReadFiles: getReadFilesMap( - [ - // Configs - "/src/core/tsconfig.json", - "/src/logic/tsconfig.json", - "/src/tests/tsconfig.json", - - // Source files - "/src/core/anotherModule.ts", - "/src/core/index.ts", - "/src/core/some_decl.d.ts", - - // to check if changed - "/src/core/index.d.ts", - - // build info - "/src/core/tsconfig.tsbuildinfo", - "/src/logic/tsconfig.tsbuildinfo", - "/src/tests/tsconfig.tsbuildinfo", - ], - ) - }, - outputFiles: [ - "/src/core/anotherModule.js", - "/src/core/anotherModule.d.ts", - "/src/core/anotherModule.d.ts.map", - "/src/core/index.js", - "/src/core/index.d.ts", - "/src/core/index.d.ts.map", - "/src/core/tsconfig.tsbuildinfo", - "/src/logic/index.js", - "/src/logic/index.js.map", - "/src/logic/index.d.ts", - "/src/logic/tsconfig.tsbuildinfo", - "/src/tests/index.js", - "/src/tests/index.d.ts", - "/src/tests/tsconfig.tsbuildinfo", - ] - }); - - verifyTsbuildOutput({ - scenario: "when logic config changes declaration dir", - projFs: () => projFs, - time, - tick, - proj: "sample1", - rootNames: ["/src/tests"], - expectedMapFileNames: [ - "/src/core/anotherModule.d.ts.map", - "/src/core/index.d.ts.map", - "/src/logic/index.js.map" - ], - lastProjectOutput: "/src/tests/index.js", - initialBuild, - incrementalDtsChangedBuild: { - modifyFs: fs => replaceText(fs, "/src/logic/tsconfig.json", `"declaration": true,`, `"declaration": true, + }, + { + subScenario: "when logic config changes declaration dir", + buildKind: BuildKind.IncrementalDtsChange, + modifyFs: fs => replaceText(fs, "/src/logic/tsconfig.json", `"declaration": true,`, `"declaration": true, "declarationDir": "decls",`), - expectedDiagnostics: [ - getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json", "src/logic/tsconfig.json", "src/tests/tsconfig.json"), - [Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, "src/core/tsconfig.json", "src/core/anotherModule.ts", "src/core/anotherModule.js"], - [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/logic/tsconfig.json", "src/logic/decls/index.d.ts"], - [Diagnostics.Building_project_0, "/src/logic/tsconfig.json"], - [Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2, "src/tests/tsconfig.json", "src/tests/index.js", "src/logic"], - [Diagnostics.Building_project_0, "/src/tests/tsconfig.json"], - ], - expectedReadFiles: getReadFilesMap( - [ - // Configs - "/src/core/tsconfig.json", - "/src/logic/tsconfig.json", - "/src/tests/tsconfig.json", - - // Source files - "/src/logic/index.ts", - "/src/tests/index.ts", - - // Modules of generated files - "/src/core/anotherModule.d.ts", - "/src/core/index.d.ts", - "/src/logic/decls/index.d.ts", - - // build info - "/src/core/tsconfig.tsbuildinfo", - "/src/logic/tsconfig.tsbuildinfo", - "/src/tests/tsconfig.tsbuildinfo", - - "/src/tests/index.d.ts", // to check if d.ts has changed - ] - ) - }, - outputFiles: [ - "/src/core/anotherModule.js", - "/src/core/anotherModule.d.ts", - "/src/core/anotherModule.d.ts.map", - "/src/core/index.js", - "/src/core/index.d.ts", - "/src/core/index.d.ts.map", - "/src/core/tsconfig.tsbuildinfo", - "/src/logic/index.js", - "/src/logic/index.js.map", - "/src/logic/decls/index.d.ts", - "/src/logic/tsconfig.tsbuildinfo", - "/src/tests/index.js", - "/src/tests/index.d.ts", - "/src/tests/tsconfig.tsbuildinfo", + } ], }); - verifyTsbuildOutput({ - scenario: "when logic specifies tsBuildInfoFile", - projFs: () => projFs, - time, - tick, - proj: "sample1", - rootNames: ["/src/tests"], - expectedMapFileNames: [ - "/src/core/anotherModule.d.ts.map", - "/src/core/index.d.ts.map", - "/src/logic/index.js.map" - ], - lastProjectOutput: "/src/tests/index.js", - initialBuild: { - modifyFs: fs => replaceText(fs, "/src/logic/tsconfig.json", `"composite": true,`, `"composite": true, + verifyTsc({ + scenario: "sample1", + subScenario: "when logic specifies tsBuildInfoFile", + fs: () => projFs, + modifyFs: fs => replaceText(fs, "/src/logic/tsconfig.json", `"composite": true,`, `"composite": true, "tsBuildInfoFile": "ownFile.tsbuildinfo",`), - expectedDiagnostics: initialBuild.expectedDiagnostics, - expectedReadFiles: getReadFilesMap( - [ - // Configs - "/src/core/tsconfig.json", - "/src/logic/tsconfig.json", - "/src/tests/tsconfig.json", - - // Source files - "/src/core/anotherModule.ts", - "/src/core/index.ts", - "/src/core/some_decl.d.ts", - "/src/logic/index.ts", - "/src/tests/index.ts", - - // Modules of generated files - "/src/core/anotherModule.d.ts", - "/src/core/index.d.ts", - "/src/logic/index.d.ts", - - // build info - "/src/core/tsconfig.tsbuildinfo", - "/src/logic/ownFile.tsbuildinfo", - "/src/tests/tsconfig.tsbuildinfo" - ] - ) - }, - outputFiles: [ - "/src/core/anotherModule.js", - "/src/core/anotherModule.d.ts", - "/src/core/anotherModule.d.ts.map", - "/src/core/index.js", - "/src/core/index.d.ts", - "/src/core/index.d.ts.map", - "/src/core/tsconfig.tsbuildinfo", - "/src/logic/index.js", - "/src/logic/index.js.map", - "/src/logic/index.d.ts", - "/src/logic/ownFile.tsbuildinfo", - "/src/tests/index.js", - "/src/tests/index.d.ts", - "/src/tests/tsconfig.tsbuildinfo", - ] - }); - - verifyTsbuildOutput({ - scenario: "when declaration option changes", - projFs: () => projFs, - time, - tick, - proj: "sample1", - rootNames: ["/src/core"], - lastProjectOutput: "/src/core/index.js", - initialBuild: { - modifyFs: fs => fs.writeFileSync("/src/core/tsconfig.json", `{ + commandLineArgs: ["--b", "/src/tests", "--verbose"], + baselineSourceMap: true, + baselineReadFileCalls: true + }); + + verifyTscIncrementalEdits({ + subScenario: "when declaration option changes", + fs: () => projFs, + scenario: "sample1", + commandLineArgs: ["--b", "/src/core", "--verbose"], + modifyFs: fs => fs.writeFileSync("/src/core/tsconfig.json", `{ "compilerOptions": { "incremental": true, "skipDefaultLibCheck": true } }`), - expectedDiagnostics: [ - getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json"), - [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/core/tsconfig.json", "src/core/anotherModule.js"], - [Diagnostics.Building_project_0, "/src/core/tsconfig.json"], - ] - }, - incrementalDtsChangedBuild: { + incrementalScenarios: [{ + buildKind: BuildKind.IncrementalDtsChange, modifyFs: fs => replaceText(fs, "/src/core/tsconfig.json", `"incremental": true,`, `"incremental": true, "declaration": true,`), - expectedDiagnostics: [ - getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json"), - [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/core/tsconfig.json", "src/core/anotherModule.d.ts"], - [Diagnostics.Building_project_0, "/src/core/tsconfig.json"] - ] - }, - outputFiles: [ - "/src/core/anotherModule.js", - "/src/core/anotherModule.d.ts", - "/src/core/index.js", - "/src/core/index.d.ts", - "/src/core/tsconfig.tsbuildinfo", - ], - baselineOnly: true, - verifyDiagnostics: true - }); - - verifyTsbuildOutput({ - scenario: "when target option changes", - projFs: () => projFs, - time, - tick, - proj: "sample1", - rootNames: ["/src/core"], - lastProjectOutput: "/src/core/index.js", - initialBuild: { - modifyFs: fs => { - fs.writeFileSync("/lib/lib.esnext.full.d.ts", `/// + }], + }); + + verifyTscIncrementalEdits({ + subScenario: "when target option changes", + fs: () => projFs, + scenario: "sample1", + commandLineArgs: ["--b", "/src/core", "--verbose"], + modifyFs: fs => { + fs.writeFileSync("/lib/lib.esnext.full.d.ts", `/// /// `); - fs.writeFileSync("/lib/lib.esnext.d.ts", libContent); - fs.writeFileSync("/lib/lib.d.ts", `/// + fs.writeFileSync("/lib/lib.esnext.d.ts", libContent); + fs.writeFileSync("/lib/lib.d.ts", `/// /// `); - fs.writeFileSync("/src/core/tsconfig.json", `{ + fs.writeFileSync("/src/core/tsconfig.json", `{ "compilerOptions": { "incremental": true, "listFiles": true, @@ -907,80 +641,36 @@ class someClass { }`), "target": "esnext", } }`); - }, - expectedDiagnostics: [ - getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json"), - [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/core/tsconfig.json", "src/core/anotherModule.js"], - [Diagnostics.Building_project_0, "/src/core/tsconfig.json"], - ] }, - incrementalDtsChangedBuild: { + incrementalScenarios: [{ + buildKind: BuildKind.IncrementalDtsChange, modifyFs: fs => replaceText(fs, "/src/core/tsconfig.json", "esnext", "es5"), - expectedDiagnostics: [ - getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json"), - [Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2, "src/core/tsconfig.json", "src/core/anotherModule.js", "src/core/tsconfig.json"], - [Diagnostics.Building_project_0, "/src/core/tsconfig.json"] - ] - }, - outputFiles: [ - "/src/core/anotherModule.js", - "/src/core/anotherModule.d.ts", - "/src/core/index.js", - "/src/core/index.d.ts", - "/src/core/tsconfig.tsbuildinfo", - ], - baselineOnly: true, - verifyDiagnostics: true - }); - - verifyTsbuildOutput({ - scenario: "when module option changes", - projFs: () => projFs, - time, - tick, - proj: "sample1", - rootNames: ["/src/core"], - lastProjectOutput: "/src/core/index.js", - initialBuild: { - modifyFs: fs => fs.writeFileSync("/src/core/tsconfig.json", `{ + }], + }); + + verifyTscIncrementalEdits({ + subScenario: "when module option changes", + fs: () => projFs, + scenario: "sample1", + commandLineArgs: ["--b", "/src/core", "--verbose"], + modifyFs: fs => fs.writeFileSync("/src/core/tsconfig.json", `{ "compilerOptions": { "incremental": true, "module": "commonjs" } }`), - expectedDiagnostics: [ - getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json"), - [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/core/tsconfig.json", "src/core/anotherModule.js"], - [Diagnostics.Building_project_0, "/src/core/tsconfig.json"], - ] - }, - incrementalDtsChangedBuild: { + incrementalScenarios: [{ + buildKind: BuildKind.IncrementalDtsChange, modifyFs: fs => replaceText(fs, "/src/core/tsconfig.json", `"module": "commonjs"`, `"module": "amd"`), - expectedDiagnostics: [ - getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json"), - [Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2, "src/core/tsconfig.json", "src/core/anotherModule.js", "src/core/tsconfig.json"], - [Diagnostics.Building_project_0, "/src/core/tsconfig.json"] - ] - }, - outputFiles: [ - "/src/core/anotherModule.js", - "/src/core/index.js", - "/src/core/tsconfig.tsbuildinfo", - ], - baselineOnly: true, - verifyDiagnostics: true - }); - - verifyTsbuildOutput({ - scenario: "when esModuleInterop option changes", - projFs: () => projFs, - time, - tick, - proj: "sample1", - rootNames: ["/src/tests"], - lastProjectOutput: "/src/tests/index.js", - initialBuild: { - modifyFs: fs => fs.writeFileSync("/src/tests/tsconfig.json", `{ + }], + }); + + verifyTscIncrementalEdits({ + subScenario: "when esModuleInterop option changes", + fs: () => projFs, + scenario: "sample1", + commandLineArgs: ["--b", "/src/tests", "--verbose"], + modifyFs: fs => fs.writeFileSync("/src/tests/tsconfig.json", `{ "references": [ { "path": "../core" }, { "path": "../logic" } @@ -994,29 +684,10 @@ class someClass { }`), "esModuleInterop": false } }`), - expectedDiagnostics: [ - getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json", "src/logic/tsconfig.json", "src/tests/tsconfig.json"), - [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/core/tsconfig.json", "src/core/anotherModule.js"], - [Diagnostics.Building_project_0, "/src/core/tsconfig.json"], - [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/logic/tsconfig.json", "src/logic/index.js"], - [Diagnostics.Building_project_0, "/src/logic/tsconfig.json"], - [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/tests/tsconfig.json", "src/tests/index.js"], - [Diagnostics.Building_project_0, "/src/tests/tsconfig.json"] - ] - }, - incrementalDtsChangedBuild: { + incrementalScenarios: [{ + buildKind: BuildKind.IncrementalDtsChange, modifyFs: fs => replaceText(fs, "/src/tests/tsconfig.json", `"esModuleInterop": false`, `"esModuleInterop": true`), - expectedDiagnostics: [ - getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json", "src/logic/tsconfig.json", "src/tests/tsconfig.json"), - [Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, "src/core/tsconfig.json", "src/core/anotherModule.ts", "src/core/anotherModule.js"], - [Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, "src/logic/tsconfig.json", "src/logic/index.ts", "src/logic/index.js"], - [Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2, "src/tests/tsconfig.json", "src/tests/index.js", "src/tests/tsconfig.json"], - [Diagnostics.Building_project_0, "/src/tests/tsconfig.json"] - ] - }, - outputFiles: [], - baselineOnly: true, - verifyDiagnostics: true + }], }); }); }); diff --git a/src/testRunner/unittests/tsbuild/transitiveReferences.ts b/src/testRunner/unittests/tsbuild/transitiveReferences.ts index d661ba0c7980e..99fcd75d087e1 100644 --- a/src/testRunner/unittests/tsbuild/transitiveReferences.ts +++ b/src/testRunner/unittests/tsbuild/transitiveReferences.ts @@ -27,7 +27,7 @@ namespace ts { function verifyBuild(modifyDiskLayout: (fs: vfs.FileSystem) => void, allExpectedOutputs: readonly string[], expectedFileTraces: readonly string[], ...expectedDiagnostics: fakes.ExpectedDiagnostic[]) { const fs = projFs.shadow(); - const host = new fakes.SolutionBuilderHost(fs); + const host = fakes.SolutionBuilderHost.create(fs); modifyDiskLayout(fs); const builder = createSolutionBuilder(host, ["/src/tsconfig.c.json"], { listFiles: true }); builder.build(); diff --git a/src/testRunner/unittests/tsbuild/watchMode.ts b/src/testRunner/unittests/tsbuild/watchMode.ts index bc5cd79f7efca..b2f2eac158257 100644 --- a/src/testRunner/unittests/tsbuild/watchMode.ts +++ b/src/testRunner/unittests/tsbuild/watchMode.ts @@ -2,18 +2,12 @@ namespace ts.tscWatch { import projectsLocation = TestFSWithWatch.tsbuildProjectsLocation; import getFilePathInProject = TestFSWithWatch.getTsBuildProjectFilePath; import getFileFromProject = TestFSWithWatch.getTsBuildProjectFile; - type TsBuildWatchSystem = WatchedSystem & { writtenFiles: Map; }; + type TsBuildWatchSystem = TestFSWithWatch.TestServerHostTrackingWrittenFiles; function createTsBuildWatchSystem(fileOrFolderList: readonly TestFSWithWatch.FileOrFolderOrSymLink[], params?: TestFSWithWatch.TestServerHostCreationParameters) { - const host = createWatchedSystem(fileOrFolderList, params) as TsBuildWatchSystem; - const originalWriteFile = host.writeFile; - host.writtenFiles = createMap(); - host.writeFile = (fileName, content) => { - originalWriteFile.call(host, fileName, content); - const path = host.toFullPath(fileName); - host.writtenFiles.set(path, true); - }; - return host; + return TestFSWithWatch.changeToHostTrackingWrittenFiles( + createWatchedSystem(fileOrFolderList, params) + ); } export function createSolutionBuilder(system: WatchedSystem, rootNames: readonly string[], defaultOptions?: BuildOptions) { @@ -710,8 +704,8 @@ let x: string = 10;`); const coreIndexDts = projectFileName(SubProject.core, "index.d.ts"); const coreAnotherModuleDts = projectFileName(SubProject.core, "anotherModule.d.ts"); const logicIndexDts = projectFileName(SubProject.logic, "index.d.ts"); - const expectedWatchedFiles = () => [core[0], logic[0], ...tests, libFile].map(f => f.path).concat([coreIndexDts, coreAnotherModuleDts, logicIndexDts].map(f => f.toLowerCase())); const expectedWatchedDirectoriesRecursive = projectSystem.getTypeRootsFromLocation(projectPath(SubProject.tests)); + const expectedProjectFiles = () => [libFile, ...tests, ...logic.slice(1), ...core.slice(1, core.length - 1)].map(f => f.path); const expectedProgramFiles = () => [tests[1].path, libFile.path, coreIndexDts, coreAnotherModuleDts, logicIndexDts]; function createSolutionAndWatchMode() { @@ -723,12 +717,19 @@ let x: string = 10;`); } function verifyWatches(host: TsBuildWatchSystem, withTsserver?: boolean) { - verifyWatchesOfProject(host, withTsserver ? expectedWatchedFiles().filter(f => f !== tests[1].path.toLowerCase()) : expectedWatchedFiles(), expectedWatchedDirectoriesRecursive); + verifyWatchesOfProject( + host, + withTsserver ? + [...core.slice(0, core.length - 1), ...logic, tests[0], libFile].map(f => f.path.toLowerCase()) : + [core[0], logic[0], ...tests, libFile].map(f => f.path).concat([coreIndexDts, coreAnotherModuleDts, logicIndexDts].map(f => f.toLowerCase())), + expectedWatchedDirectoriesRecursive + ); } function verifyScenario( edit: (host: TsBuildWatchSystem, solutionBuilder: SolutionBuilder) => void, - expectedFilesAfterEdit: () => readonly string[] + expectedProgramFilesAfterEdit: () => readonly string[], + expectedProjectFilesAfterEdit: () => readonly string[] ) { it("with tsc-watch", () => { const { host, solutionBuilder, watch } = createSolutionAndWatchMode(); @@ -737,7 +738,7 @@ let x: string = 10;`); host.checkTimeoutQueueLengthAndRun(1); checkOutputErrorsIncremental(host, emptyArray); - checkProgramActualFiles(watch(), expectedFilesAfterEdit()); + checkProgramActualFiles(watch(), expectedProgramFilesAfterEdit()); }); @@ -747,7 +748,7 @@ let x: string = 10;`); edit(host, solutionBuilder); host.checkTimeoutQueueLengthAndRun(2); - checkProjectActualFiles(service, tests[0].path, [tests[0].path, ...expectedFilesAfterEdit()]); + checkProjectActualFiles(service, tests[0].path, expectedProjectFilesAfterEdit()); }); } @@ -777,7 +778,7 @@ function foo() { // not ideal, but currently because of d.ts but no new file is written // There will be timeout queued even though file contents are same - }, expectedProgramFiles); + }, expectedProgramFiles, expectedProjectFiles); }); describe("non local edit in ts file, rebuilds in watch compilation", () => { @@ -787,7 +788,7 @@ export function gfoo() { }`); solutionBuilder.invalidateProject(logic[0].path.toLowerCase() as ResolvedConfigFilePath); solutionBuilder.buildNextInvalidatedProject(); - }, expectedProgramFiles); + }, expectedProgramFiles, expectedProjectFiles); }); describe("change in project reference config file builds correctly", () => { @@ -798,7 +799,7 @@ export function gfoo() { })); solutionBuilder.invalidateProject(logic[0].path.toLowerCase() as ResolvedConfigFilePath, ConfigFileProgramReloadLevel.Full); solutionBuilder.buildNextInvalidatedProject(); - }, () => [tests[1].path, libFile.path, coreIndexDts, coreAnotherModuleDts, projectFilePath(SubProject.logic, "decls/index.d.ts")]); + }, () => [tests[1].path, libFile.path, coreIndexDts, coreAnotherModuleDts, projectFilePath(SubProject.logic, "decls/index.d.ts")], expectedProjectFiles); }); }); @@ -888,7 +889,9 @@ export function gfoo() { const aDts = dtsFile(multiFolder ? "a/index" : "a"), bDts = dtsFile(multiFolder ? "b/index" : "b"); const expectedFiles = [jsFile(multiFolder ? "a/index" : "a"), aDts, jsFile(multiFolder ? "b/index" : "b"), bDts, jsFile(multiFolder ? "c/index" : "c")]; const expectedProgramFiles = [cTs.path, libFile.path, aDts, refs.path, bDts]; + const expectedProjectFiles = [cTs.path, libFile.path, aTs.path, refs.path, bTs.path]; const expectedWatchedFiles = expectedProgramFiles.concat(cTsconfig.path, bTsconfig.path, aTsconfig.path).map(s => s.toLowerCase()); + const expectedProjectWatchedFiles = expectedProjectFiles.concat(cTsconfig.path, bTsconfig.path, aTsconfig.path).map(s => s.toLowerCase()); const expectedWatchedDirectories = multiFolder ? [ getProjectPath(project).toLowerCase() // watches for directories created for resolution of b ] : emptyArray; @@ -926,22 +929,29 @@ export function gfoo() { } function verifyProject(host: TsBuildWatchSystem, service: projectSystem.TestProjectService, orphanInfos?: readonly string[]) { - verifyServerState(host, service, expectedProgramFiles, expectedWatchedFiles, expectedWatchedDirectoriesRecursive, orphanInfos); + verifyServerState({ host, service, expectedProjectFiles, expectedProjectWatchedFiles, expectedWatchedDirectoriesRecursive, orphanInfos }); } - function verifyServerState( - host: TsBuildWatchSystem, - service: projectSystem.TestProjectService, - expectedProgramFiles: readonly string[], - expectedWatchedFiles: readonly string[], - expectedWatchedDirectoriesRecursive: readonly string[], - orphanInfos?: readonly string[]) { - checkProjectActualFiles(service, cTsconfig.path, expectedProgramFiles.concat(cTsconfig.path)); - const watchedFiles = expectedWatchedFiles.filter(f => f !== cTs.path.toLowerCase()); - if (orphanInfos) { + interface VerifyServerState { + host: TsBuildWatchSystem; + service: projectSystem.TestProjectService; + expectedProjectFiles: readonly string[]; + expectedProjectWatchedFiles: readonly string[]; + expectedWatchedDirectoriesRecursive: readonly string[]; + orphanInfos?: readonly string[]; + } + function verifyServerState({ host, service, expectedProjectFiles, expectedProjectWatchedFiles, expectedWatchedDirectoriesRecursive, orphanInfos }: VerifyServerState) { + checkProjectActualFiles(service, cTsconfig.path, expectedProjectFiles.concat(cTsconfig.path)); + const watchedFiles = expectedProjectWatchedFiles.filter(f => f !== cTs.path.toLowerCase()); + const actualOrphan = arrayFrom(mapDefinedIterator( + service.filenameToScriptInfo.values(), + v => v.containingProjects.length === 0 ? v.fileName : undefined + )); + assert.equal(actualOrphan.length, orphanInfos ? orphanInfos.length : 0, `Orphans found: ${JSON.stringify(actualOrphan, /*replacer*/ undefined, " ")}`); + if (orphanInfos && orphanInfos.length) { for (const orphan of orphanInfos) { const info = service.getScriptInfoForPath(orphan as Path); - assert.isDefined(info); + assert.isDefined(info, `${orphan} expected to be present. Actual: ${JSON.stringify(actualOrphan, /*replacer*/ undefined, " ")}`); assert.equal(info!.containingProjects.length, 0); watchedFiles.push(orphan); } @@ -949,16 +959,20 @@ export function gfoo() { verifyWatchesOfProject(host, watchedFiles, expectedWatchedDirectoriesRecursive, expectedWatchedDirectories); } - function verifyScenario( - edit: (host: TsBuildWatchSystem, solutionBuilder: SolutionBuilder) => void, - expectedEditErrors: readonly string[], - expectedProgramFiles: readonly string[], - expectedWatchedFiles: readonly string[], - expectedWatchedDirectoriesRecursive: readonly string[], - dependencies: readonly [string, readonly string[]][], - revert?: (host: TsBuildWatchSystem) => void, - orphanInfosAfterEdit?: readonly string[], - orphanInfosAfterRevert?: readonly string[]) { + interface VerifyScenario { + edit: (host: TsBuildWatchSystem, solutionBuilder: SolutionBuilder) => void; + expectedEditErrors: readonly string[]; + expectedProgramFiles: readonly string[]; + expectedProjectFiles: readonly string[]; + expectedWatchedFiles: readonly string[]; + expectedProjectWatchedFiles: readonly string[]; + expectedWatchedDirectoriesRecursive: readonly string[]; + dependencies: readonly [string, readonly string[]][]; + revert?: (host: TsBuildWatchSystem) => void; + orphanInfosAfterEdit?: readonly string[]; + orphanInfosAfterRevert?: readonly string[]; + } + function verifyScenario({ edit, expectedEditErrors, expectedProgramFiles, expectedProjectFiles, expectedWatchedFiles, expectedProjectWatchedFiles, expectedWatchedDirectoriesRecursive, dependencies, revert, orphanInfosAfterEdit, orphanInfosAfterRevert }: VerifyScenario) { it("with tsc-watch", () => { const { host, solutionBuilder, watch } = createSolutionAndWatchMode(); @@ -985,7 +999,7 @@ export function gfoo() { edit(host, solutionBuilder); host.checkTimeoutQueueLengthAndRun(2); - verifyServerState(host, service, expectedProgramFiles, expectedWatchedFiles, expectedWatchedDirectoriesRecursive, orphanInfosAfterEdit); + verifyServerState({ host, service, expectedProjectFiles, expectedProjectWatchedFiles, expectedWatchedDirectoriesRecursive, orphanInfos: orphanInfosAfterEdit }); if (revert) { revert(host); @@ -1010,20 +1024,21 @@ export function gfoo() { }); describe("non local edit updates the program and watch correctly", () => { - verifyScenario( - (host, solutionBuilder) => { + verifyScenario({ + edit: (host, solutionBuilder) => { // edit - host.writeFile(bTs.path, `${bTs.content} -export function gfoo() { -}`); - solutionBuilder.invalidateProject(bTsconfig.path.toLowerCase() as ResolvedConfigFilePath); + host.writeFile(bTs.path, `${bTs.content}\nexport function gfoo() {\n}`); + solutionBuilder.invalidateProject((bTsconfig.path.toLowerCase() as ResolvedConfigFilePath)); solutionBuilder.buildNextInvalidatedProject(); }, - emptyArray, + expectedEditErrors: emptyArray, expectedProgramFiles, + expectedProjectFiles, expectedWatchedFiles, + expectedProjectWatchedFiles, expectedWatchedDirectoriesRecursive, - defaultDependencies); + dependencies: defaultDependencies + }); }); describe("edit on config file", () => { @@ -1032,30 +1047,32 @@ export function gfoo() { path: getFilePathInProject(project, "nrefs/a.d.ts"), content: refs.content }; - verifyScenario( - host => { + verifyScenario({ + edit: host => { const cTsConfigJson = JSON.parse(cTsconfig.content); host.ensureFileOrFolder(nrefs); cTsConfigJson.compilerOptions.paths = { "@ref/*": nrefsPath }; host.writeFile(cTsconfig.path, JSON.stringify(cTsConfigJson)); }, - emptyArray, - expectedProgramFiles.map(nrefReplacer), - expectedWatchedFiles.map(nrefReplacer), - expectedWatchedDirectoriesRecursive.map(nrefReplacer), - [ + expectedEditErrors: emptyArray, + expectedProgramFiles: expectedProgramFiles.map(nrefReplacer), + expectedProjectFiles: expectedProjectFiles.map(nrefReplacer), + expectedWatchedFiles: expectedWatchedFiles.map(nrefReplacer), + expectedProjectWatchedFiles: expectedProjectWatchedFiles.map(nrefReplacer), + expectedWatchedDirectoriesRecursive: expectedWatchedDirectoriesRecursive.map(nrefReplacer), + dependencies: [ [aDts, [aDts]], [bDts, [bDts, aDts]], [nrefs.path, [nrefs.path]], [cTs.path, [cTs.path, nrefs.path, bDts]] ], // revert the update - host => host.writeFile(cTsconfig.path, cTsconfig.content), + revert: host => host.writeFile(cTsconfig.path, cTsconfig.content), // AfterEdit:: Extra watched files on server since the script infos arent deleted till next file open - [refs.path.toLowerCase()], + orphanInfosAfterEdit: [refs.path.toLowerCase()], // AfterRevert:: Extra watched files on server since the script infos arent deleted till next file open - [nrefs.path.toLowerCase()] - ); + orphanInfosAfterRevert: [nrefs.path.toLowerCase()] + }); }); describe("edit in referenced config file", () => { @@ -1064,82 +1081,84 @@ export function gfoo() { content: "export declare class A {}" }; const expectedProgramFiles = [cTs.path, bDts, nrefs.path, refs.path, libFile.path]; + const expectedProjectFiles = [cTs.path, bTs.path, nrefs.path, refs.path, libFile.path]; const [, ...expectedWatchedDirectoriesRecursiveWithoutA] = expectedWatchedDirectoriesRecursive; // Not looking in a folder for resolution in multi folder scenario - verifyScenario( - host => { + verifyScenario({ + edit: host => { const bTsConfigJson = JSON.parse(bTsconfig.content); host.ensureFileOrFolder(nrefs); bTsConfigJson.compilerOptions.paths = { "@ref/*": nrefsPath }; host.writeFile(bTsconfig.path, JSON.stringify(bTsConfigJson)); }, - emptyArray, + expectedEditErrors: emptyArray, expectedProgramFiles, - expectedProgramFiles.concat(cTsconfig.path, bTsconfig.path, aTsconfig.path).map(s => s.toLowerCase()), - (multiFolder ? expectedWatchedDirectoriesRecursiveWithoutA : expectedWatchedDirectoriesRecursive).concat(getFilePathInProject(project, "nrefs").toLowerCase()), - [ + expectedProjectFiles, + expectedWatchedFiles: expectedProgramFiles.concat(cTsconfig.path, bTsconfig.path, aTsconfig.path).map(s => s.toLowerCase()), + expectedProjectWatchedFiles: expectedProjectFiles.concat(cTsconfig.path, bTsconfig.path, aTsconfig.path).map(s => s.toLowerCase()), + expectedWatchedDirectoriesRecursive: (multiFolder ? expectedWatchedDirectoriesRecursiveWithoutA : expectedWatchedDirectoriesRecursive).concat(getFilePathInProject(project, "nrefs").toLowerCase()), + dependencies: [ [nrefs.path, [nrefs.path]], [bDts, [bDts, nrefs.path]], [refs.path, [refs.path]], [cTs.path, [cTs.path, refs.path, bDts]], ], // revert the update - host => host.writeFile(bTsconfig.path, bTsconfig.content), + revert: host => host.writeFile(bTsconfig.path, bTsconfig.content), // AfterEdit:: Extra watched files on server since the script infos arent deleted till next file open - [aDts.toLowerCase()], + orphanInfosAfterEdit: [aTs.path.toLowerCase()], // AfterRevert:: Extra watched files on server since the script infos arent deleted till next file open - [nrefs.path.toLowerCase()] - ); + orphanInfosAfterRevert: [nrefs.path.toLowerCase()] + }); }); describe("deleting referenced config file", () => { const expectedProgramFiles = [cTs.path, bTs.path, refs.path, libFile.path]; + const expectedWatchedFiles = expectedProgramFiles.concat(cTsconfig.path, bTsconfig.path).map(s => s.toLowerCase()); const [, ...expectedWatchedDirectoriesRecursiveWithoutA] = expectedWatchedDirectoriesRecursive; // Not looking in a folder for resolution in multi folder scenario // Resolutions should change now // Should map to b.ts instead with options from our own config - verifyScenario( - host => host.deleteFile(bTsconfig.path), - [ + verifyScenario({ + edit: host => host.deleteFile(bTsconfig.path), + expectedEditErrors: [ `${multiFolder ? "c/tsconfig.json" : "tsconfig.c.json"}(9,21): error TS6053: File '/user/username/projects/transitiveReferences/${multiFolder ? "b" : "tsconfig.b.json"}' not found.\n` ], expectedProgramFiles, - expectedProgramFiles.concat(cTsconfig.path, bTsconfig.path).map(s => s.toLowerCase()), - multiFolder ? expectedWatchedDirectoriesRecursiveWithoutA : expectedWatchedDirectoriesRecursive, - [ + expectedProjectFiles: expectedProgramFiles, + expectedWatchedFiles, + expectedProjectWatchedFiles: expectedWatchedFiles, + expectedWatchedDirectoriesRecursive: multiFolder ? expectedWatchedDirectoriesRecursiveWithoutA : expectedWatchedDirectoriesRecursive, + dependencies: [ [bTs.path, [bTs.path, refs.path]], [refs.path, [refs.path]], [cTs.path, [cTs.path, refs.path, bTs.path]], ], // revert the update - host => host.writeFile(bTsconfig.path, bTsconfig.content), + revert: host => host.writeFile(bTsconfig.path, bTsconfig.content), // AfterEdit:: Extra watched files on server since the script infos arent deleted till next file open - [bDts.toLowerCase(), aDts.toLowerCase(), aTsconfig.path.toLowerCase()], - // AfterRevert:: Extra watched files on server since the script infos arent deleted till next file open - [bTs.path.toLowerCase()] - ); + orphanInfosAfterEdit: [aTs.path.toLowerCase(), aTsconfig.path.toLowerCase()], + }); }); describe("deleting transitively referenced config file", () => { - verifyScenario( - host => host.deleteFile(aTsconfig.path), - [ + verifyScenario({ + edit: host => host.deleteFile(aTsconfig.path), + expectedEditErrors: [ `${multiFolder ? "b/tsconfig.json" : "tsconfig.b.json"}(10,21): error TS6053: File '/user/username/projects/transitiveReferences/${multiFolder ? "a" : "tsconfig.a.json"}' not found.\n` ], - expectedProgramFiles.map(s => s.replace(aDts, aTs.path)), - expectedWatchedFiles.map(s => s.replace(aDts.toLowerCase(), aTs.path.toLocaleLowerCase())), + expectedProgramFiles: expectedProgramFiles.map(s => s.replace(aDts, aTs.path)), + expectedProjectFiles, + expectedWatchedFiles: expectedWatchedFiles.map(s => s.replace(aDts.toLowerCase(), aTs.path.toLocaleLowerCase())), + expectedProjectWatchedFiles, expectedWatchedDirectoriesRecursive, - [ + dependencies: [ [aTs.path, [aTs.path]], [bDts, [bDts, aTs.path]], [refs.path, [refs.path]], [cTs.path, [cTs.path, refs.path, bDts]], ], // revert the update - host => host.writeFile(aTsconfig.path, aTsconfig.content), - // AfterEdit:: Extra watched files on server since the script infos arent deleted till next file open - [aDts.toLowerCase()], - // AfterRevert:: Extra watched files on server since the script infos arent deleted till next file open - [aTs.path.toLowerCase()] - ); + revert: host => host.writeFile(aTsconfig.path, aTsconfig.content), + }); }); } diff --git a/src/testRunner/unittests/tsc/helpers.ts b/src/testRunner/unittests/tsc/helpers.ts new file mode 100644 index 0000000000000..ad1d64ac2853b --- /dev/null +++ b/src/testRunner/unittests/tsc/helpers.ts @@ -0,0 +1,243 @@ +namespace ts { + export type TscCompileSystem = fakes.System & { + writtenFiles: Map; + baseLine(): void; + }; + function executeCommandLine(sys: TscCompileSystem, commandLineArgs: readonly string[]) { + if (isBuild(commandLineArgs)) { + return performBuild(sys, commandLineArgs.slice(1)); + } + + const reportDiagnostic = createDiagnosticReporter(sys); + const commandLine = parseCommandLine(commandLineArgs, path => sys.readFile(path)); + if (commandLine.options.build) { + reportDiagnostic(createCompilerDiagnostic(Diagnostics.Option_build_must_be_the_first_command_line_argument)); + return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped); + } + + if (commandLine.errors.length > 0) { + commandLine.errors.forEach(reportDiagnostic); + return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped); + } + + let configFileName: string | undefined; + if (commandLine.options.project) { + if (commandLine.fileNames.length !== 0) { + reportDiagnostic(createCompilerDiagnostic(Diagnostics.Option_project_cannot_be_mixed_with_source_files_on_a_command_line)); + return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped); + } + + const fileOrDirectory = normalizePath(commandLine.options.project); + if (!fileOrDirectory /* current directory "." */ || sys.directoryExists(fileOrDirectory)) { + configFileName = combinePaths(fileOrDirectory, "tsconfig.json"); + if (!sys.fileExists(configFileName)) { + reportDiagnostic(createCompilerDiagnostic(Diagnostics.Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0, commandLine.options.project)); + return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped); + } + } + else { + configFileName = fileOrDirectory; + if (!sys.fileExists(configFileName)) { + reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_specified_path_does_not_exist_Colon_0, commandLine.options.project)); + return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped); + } + } + } + else if (commandLine.fileNames.length === 0) { + const searchPath = normalizePath(sys.getCurrentDirectory()); + configFileName = findConfigFile(searchPath, sys.fileExists); + } + + Debug.assert(commandLine.fileNames.length !== 0 || !!configFileName); + + if (configFileName) { + const configParseResult = Debug.assertDefined(parseConfigFileWithSystem(configFileName, commandLine.options, sys, reportDiagnostic)); + if (isIncrementalCompilation(configParseResult.options)) { + performIncrementalCompilation(sys, configParseResult); + } + else { + performCompilation(sys, configParseResult); + } + } + else { + if (isIncrementalCompilation(commandLine.options)) { + performIncrementalCompilation(sys, commandLine); + } + else { + performCompilation(sys, commandLine); + } + } + } + + function createReportErrorSummary(sys: TscCompileSystem, options: CompilerOptions): ReportEmitErrorSummary | undefined { + return options.pretty ? + errorCount => sys.write(getErrorSummaryText(errorCount, sys.newLine)) : + undefined; + } + + function performCompilation(sys: TscCompileSystem, config: ParsedCommandLine) { + const { fileNames, options, projectReferences } = config; + const reportDiagnostic = createDiagnosticReporter(sys, options.pretty); + const host = createCompilerHostWorker(options, /*setParentPos*/ undefined, sys); + const currentDirectory = host.getCurrentDirectory(); + const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames()); + changeCompilerHostLikeToUseCache(host, fileName => toPath(fileName, currentDirectory, getCanonicalFileName)); + const program = createProgram({ + rootNames: fileNames, + options, + projectReferences, + host, + configFileParsingDiagnostics: getConfigFileParsingDiagnostics(config) + }); + const exitStatus = emitFilesAndReportErrorsAndGetExitStatus( + program, + reportDiagnostic, + s => sys.write(s + sys.newLine), + createReportErrorSummary(sys, options) + ); + baselineBuildInfo([config], sys.vfs, sys.writtenFiles); + return sys.exit(exitStatus); + } + + function performIncrementalCompilation(sys: TscCompileSystem, config: ParsedCommandLine) { + const reportDiagnostic = createDiagnosticReporter(sys, config.options.pretty); + const { options, fileNames, projectReferences } = config; + const exitCode = ts.performIncrementalCompilation({ + system: sys, + rootNames: fileNames, + options, + configFileParsingDiagnostics: getConfigFileParsingDiagnostics(config), + projectReferences, + reportDiagnostic, + reportErrorSummary: createReportErrorSummary(sys, options), + }); + baselineBuildInfo([config], sys.vfs, sys.writtenFiles); + return sys.exit(exitCode); + } + + function performBuild(sys: TscCompileSystem, args: string[]) { + const { buildOptions, projects, errors } = parseBuildCommand(args); + const reportDiagnostic = createDiagnosticReporter(sys, buildOptions.pretty); + + if (errors.length > 0) { + errors.forEach(reportDiagnostic); + return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped); + } + + Debug.assert(projects.length !== 0); + + const buildHost = createSolutionBuilderHost( + sys, + /*createProgram*/ undefined, + reportDiagnostic, + createBuilderStatusReporter(sys, buildOptions.pretty), + createReportErrorSummary(sys, buildOptions) + ); + fakes.patchSolutionBuilderHost(buildHost, sys); + const builder = createSolutionBuilder(buildHost, projects, buildOptions); + const exitCode = buildOptions.clean ? builder.clean() : builder.build(); + baselineBuildInfo(builder.getAllParsedConfigs(), sys.vfs, sys.writtenFiles); + return sys.exit(exitCode); + } + + function isBuild(commandLineArgs: readonly string[]) { + if (commandLineArgs.length > 0 && commandLineArgs[0].charCodeAt(0) === CharacterCodes.minus) { + const firstOption = commandLineArgs[0].slice(commandLineArgs[0].charCodeAt(1) === CharacterCodes.minus ? 2 : 1).toLowerCase(); + return firstOption === "build" || firstOption === "b"; + } + return false; + } + + export enum BuildKind { + Initial = "initial-build", + IncrementalDtsChange = "incremental-declaration-changes", + IncrementalDtsUnchanged = "incremental-declaration-doesnt-change", + IncrementalHeadersChange = "incremental-headers-change-without-dts-changes" + } + + export interface TscCompile { + scenario: string; + subScenario: string; + buildKind?: BuildKind; // Should be defined for tsc --b + fs: () => vfs.FileSystem; + commandLineArgs: readonly string[]; + + modifyFs?: (fs: vfs.FileSystem) => void; + baselineSourceMap?: boolean; + baselineReadFileCalls?: boolean; + } + + export function tscCompile(input: TscCompile) { + const baseFs = input.fs(); + const fs = baseFs.shadow(); + const { + scenario, subScenario, buildKind, + commandLineArgs, modifyFs, + baselineSourceMap, baselineReadFileCalls + } = input; + if (modifyFs) modifyFs(fs); + + // Create system + const sys = new fakes.System(fs, { executingFilePath: "/lib/tsc" }) as TscCompileSystem; + const writtenFiles = sys.writtenFiles = createMap(); + const originalWriteFile = sys.writeFile; + sys.writeFile = (fileName, content, writeByteOrderMark) => { + assert.isFalse(writtenFiles.has(fileName)); + writtenFiles.set(fileName, true); + return originalWriteFile.call(sys, fileName, content, writeByteOrderMark); + }; + const actualReadFileMap: MapLike = {}; + const originalReadFile = sys.readFile; + sys.readFile = path => { + // Dont record libs + if (path.startsWith("/src/")) { + actualReadFileMap[path] = (getProperty(actualReadFileMap, path) || 0) + 1; + } + return originalReadFile.call(sys, path); + }; + + sys.write(`${sys.getExecutingFilePath()} ${commandLineArgs.join(" ")}\n`); + sys.exit = exitCode => sys.exitCode = exitCode; + executeCommandLine(sys, commandLineArgs); + sys.write(`exitCode:: ${sys.exitCode}\n`); + if (baselineReadFileCalls) { + sys.write(`readFiles:: ${JSON.stringify(actualReadFileMap, /*replacer*/ undefined, " ")} `); + } + if (baselineSourceMap) generateSourceMapBaselineFiles(fs, mapDefinedIterator(writtenFiles.keys(), f => f.endsWith(".map") ? f : undefined)); + + // Baseline the errors + fs.writeFileSync(`/lib/${buildKind || BuildKind.Initial}Output.txt`, sys.output.join("")); + fs.makeReadonly(); + + sys.baseLine = () => { + const patch = fs.diff(baseFs, { includeChangedFileWithSameContent: true }); + // eslint-disable-next-line no-null/no-null + Harness.Baseline.runBaseline(`${isBuild(commandLineArgs) ? "tsbuild" : "tsc"}/${scenario}/${buildKind || BuildKind.Initial}/${subScenario.split(" ").join("-")}.js`, patch ? vfs.formatPatch(patch) : null); + }; + return sys; + } + + export function verifyTscBaseline(sys: () => TscCompileSystem) { + it(`Generates files matching the baseline`, () => { + sys().baseLine(); + }); + } + + export function verifyTsc(input: TscCompile) { + describe(input.scenario, () => { + describe(input.subScenario, () => { + let sys: TscCompileSystem; + before(() => { + sys = tscCompile({ + ...input, + fs: () => getFsWithTime(input.fs()).fs.makeReadonly() + }); + }); + after(() => { + sys = undefined!; + }); + verifyTscBaseline(() => sys); + }); + }); + } +} diff --git a/src/testRunner/unittests/tscWatch/emitAndErrorUpdates.ts b/src/testRunner/unittests/tscWatch/emitAndErrorUpdates.ts index f41b07b157d8d..908c609e703b6 100644 --- a/src/testRunner/unittests/tscWatch/emitAndErrorUpdates.ts +++ b/src/testRunner/unittests/tscWatch/emitAndErrorUpdates.ts @@ -12,7 +12,8 @@ namespace ts.tscWatch { file, fileStamp: host.getModifiedTime(file.path.replace(".ts", ".js")), errors: builderProgram.getSemanticDiagnostics(watch().getSourceFileByPath(file.path as Path)), - errorsFromOldState: !!state.semanticDiagnosticsFromOldState && state.semanticDiagnosticsFromOldState.has(file.path) + errorsFromOldState: !!state.semanticDiagnosticsFromOldState && state.semanticDiagnosticsFromOldState.has(file.path), + dtsStamp: host.getModifiedTime(file.path.replace(".ts", ".d.ts")) }; } @@ -24,21 +25,36 @@ namespace ts.tscWatch { return find(stampsAndErrors, info => info.file === file)!; } - function verifyOutputFileStampsAndErrors( - file: File, - emitExpected: boolean, - errorRefershExpected: boolean, - beforeChangeFileStampsAndErrors: readonly ReturnType[], - afterChangeFileStampsAndErrors: readonly ReturnType[] - ) { + interface VerifyOutputFileStampAndErrors { + file: File; + jsEmitExpected: boolean; + dtsEmitExpected: boolean; + errorRefershExpected: boolean; + beforeChangeFileStampsAndErrors: readonly ReturnType[]; + afterChangeFileStampsAndErrors: readonly ReturnType[]; + } + function verifyOutputFileStampsAndErrors({ + file, + jsEmitExpected, + dtsEmitExpected, + errorRefershExpected, + beforeChangeFileStampsAndErrors, + afterChangeFileStampsAndErrors + }: VerifyOutputFileStampAndErrors) { const beforeChange = findStampAndErrors(beforeChangeFileStampsAndErrors, file); const afterChange = findStampAndErrors(afterChangeFileStampsAndErrors, file); - if (emitExpected) { + if (jsEmitExpected) { assert.notStrictEqual(afterChange.fileStamp, beforeChange.fileStamp, `Expected emit for file ${file.path}`); } else { assert.strictEqual(afterChange.fileStamp, beforeChange.fileStamp, `Did not expect new emit for file ${file.path}`); } + if (dtsEmitExpected) { + assert.notStrictEqual(afterChange.dtsStamp, beforeChange.dtsStamp, `Expected emit for file ${file.path}`); + } + else { + assert.strictEqual(afterChange.dtsStamp, beforeChange.dtsStamp, `Did not expect new emit for file ${file.path}`); + } if (errorRefershExpected) { if (afterChange.errors !== emptyArray || beforeChange.errors !== emptyArray) { assert.notStrictEqual(afterChange.errors, beforeChange.errors, `Expected new errors for file ${file.path}`); @@ -51,19 +67,22 @@ namespace ts.tscWatch { } } - interface VerifyEmitAndErrorUpdates { - change: (host: WatchedSystem) => void; - getInitialErrors: (watch: Watch) => readonly Diagnostic[] | readonly string[]; - getIncrementalErrors: (watch: Watch) => readonly Diagnostic[] | readonly string[]; - filesWithNewEmit: readonly File[]; - filesWithOnlyErrorRefresh: readonly File[]; - filesNotTouched: readonly File[]; - configFile?: File; + interface VerifyEmitAndErrorUpdatesWorker extends VerifyEmitAndErrorUpdates { + configFile: File; } - - function verifyEmitAndErrorUpdates({ filesWithNewEmit, filesWithOnlyErrorRefresh, filesNotTouched, configFile = config, change, getInitialErrors, getIncrementalErrors }: VerifyEmitAndErrorUpdates) { + function verifyEmitAndErrorUpdatesWorker({ + fileWithChange, + filesWithNewEmit, + filesWithOnlyErrorRefresh, + filesNotTouched, + configFile, + change, + getInitialErrors, + getIncrementalErrors + }: VerifyEmitAndErrorUpdatesWorker) { const nonLibFiles = [...filesWithNewEmit, ...filesWithOnlyErrorRefresh, ...filesNotTouched]; const files = [...nonLibFiles, configFile, libFile]; + const compilerOptions = (JSON.parse(configFile.content).compilerOptions || {}) as CompilerOptions; const host = createWatchedSystem(files, { currentDirectory }); const watch = createWatchOfConfigFile("tsconfig.json", host); checkProgramActualFiles(watch(), [...nonLibFiles.map(f => f.path), libFile.path]); @@ -73,9 +92,77 @@ namespace ts.tscWatch { host.runQueuedTimeoutCallbacks(); checkOutputErrorsIncremental(host, getIncrementalErrors(watch)); const afterChange = getOutputFileStampsAndErrors(host, watch, nonLibFiles); - filesWithNewEmit.forEach(file => verifyOutputFileStampsAndErrors(file, /*emitExpected*/ true, /*errorRefershExpected*/ true, beforeChange, afterChange)); - filesWithOnlyErrorRefresh.forEach(file => verifyOutputFileStampsAndErrors(file, /*emitExpected*/ false, /*errorRefershExpected*/ true, beforeChange, afterChange)); - filesNotTouched.forEach(file => verifyOutputFileStampsAndErrors(file, /*emitExpected*/ false, /*errorRefershExpected*/ false, beforeChange, afterChange)); + filesWithNewEmit.forEach(file => verifyOutputFileStampsAndErrors({ + file, + jsEmitExpected: !compilerOptions.isolatedModules || fileWithChange === file, + dtsEmitExpected: getEmitDeclarations(compilerOptions), + errorRefershExpected: true, + beforeChangeFileStampsAndErrors: beforeChange, + afterChangeFileStampsAndErrors: afterChange + })); + filesWithOnlyErrorRefresh.forEach(file => verifyOutputFileStampsAndErrors({ + file, + jsEmitExpected: false, + dtsEmitExpected: getEmitDeclarations(compilerOptions) && !file.path.endsWith(".d.ts"), + errorRefershExpected: true, + beforeChangeFileStampsAndErrors: beforeChange, + afterChangeFileStampsAndErrors: afterChange + })); + filesNotTouched.forEach(file => verifyOutputFileStampsAndErrors({ + file, + jsEmitExpected: false, + dtsEmitExpected: false, + errorRefershExpected: false, + beforeChangeFileStampsAndErrors: beforeChange, + afterChangeFileStampsAndErrors: afterChange + })); + } + + function changeCompilerOptions(input: VerifyEmitAndErrorUpdates, additionalOptions: CompilerOptions): File { + const configFile = input.configFile || config; + const content = JSON.parse(configFile.content); + content.compilerOptions = { ...content.compilerOptions, ...additionalOptions }; + return { path: configFile.path, content: JSON.stringify(content) }; + } + + interface VerifyEmitAndErrorUpdates { + change: (host: WatchedSystem) => void; + getInitialErrors: (watch: Watch) => readonly Diagnostic[] | readonly string[]; + getIncrementalErrors: (watch: Watch) => readonly Diagnostic[] | readonly string[]; + fileWithChange: File; + filesWithNewEmit: readonly File[]; + filesWithOnlyErrorRefresh: readonly File[]; + filesNotTouched: readonly File[]; + configFile?: File; + } + function verifyEmitAndErrorUpdates(input: VerifyEmitAndErrorUpdates) { + it("with default config", () => { + verifyEmitAndErrorUpdatesWorker({ + ...input, + configFile: input.configFile || config + }); + }); + + it("with default config and --declaration", () => { + verifyEmitAndErrorUpdatesWorker({ + ...input, + configFile: changeCompilerOptions(input, { declaration: true }) + }); + }); + + it("config with --isolatedModules", () => { + verifyEmitAndErrorUpdatesWorker({ + ...input, + configFile: changeCompilerOptions(input, { isolatedModules: true }) + }); + }); + + it("config with --isolatedModules and --declaration", () => { + verifyEmitAndErrorUpdatesWorker({ + ...input, + configFile: changeCompilerOptions(input, { isolatedModules: true, declaration: true }) + }); + }); } describe("deep import changes", () => { @@ -93,6 +180,7 @@ console.log(b.c.d);` addImportedModule(bFile); addImportedModule(cFile); verifyEmitAndErrorUpdates({ + fileWithChange: cFile, filesWithNewEmit, filesWithOnlyErrorRefresh, filesNotTouched: emptyArray, @@ -113,7 +201,7 @@ console.log(b.c.d);` } } - it("updates errors when deep import file changes", () => { + describe("updates errors when deep import file changes", () => { const bFile: File = { path: `${currentDirectory}/b.ts`, content: `import {C} from './c'; @@ -132,7 +220,7 @@ export class B verifyDeepImportChange(bFile, cFile); }); - it("updates errors when deep import through declaration file changes", () => { + describe("updates errors when deep import through declaration file changes", () => { const bFile: File = { path: `${currentDirectory}/b.d.ts`, content: `import {C} from './c'; @@ -152,7 +240,7 @@ export class B }); }); - it("updates errors in file not exporting a deep multilevel import that changes", () => { + describe("updates errors in file not exporting a deep multilevel import that changes", () => { const aFile: File = { path: `${currentDirectory}/a.ts`, content: `export interface Point { @@ -193,6 +281,7 @@ getPoint().c.x;` content: `import "./d";` }; verifyEmitAndErrorUpdates({ + fileWithChange: aFile, filesWithNewEmit: [aFile, bFile], filesWithOnlyErrorRefresh: [cFile, dFile], filesNotTouched: [eFile], @@ -265,6 +354,7 @@ export class Data { filesWithOnlyErrorRefresh.push(lib2Data2); } verifyEmitAndErrorUpdates({ + fileWithChange: lib1ToolsInterface, filesWithNewEmit, filesWithOnlyErrorRefresh, filesNotTouched: emptyArray, @@ -276,11 +366,11 @@ export class Data { ] }); } - it("when there are no circular import and exports", () => { + describe("when there are no circular import and exports", () => { verifyTransitiveExports(lib2Data); }); - it("when there are circular import and exports", () => { + describe("when there are circular import and exports", () => { const lib2Data: File = { path: `${currentDirectory}/lib2/data.ts`, content: `import { ITest } from "lib1/public"; import { Data2 } from "./data2"; diff --git a/src/testRunner/unittests/tsserver/declarationFileMaps.ts b/src/testRunner/unittests/tsserver/declarationFileMaps.ts index d1c64fe46cec6..a6f217385d904 100644 --- a/src/testRunner/unittests/tsserver/declarationFileMaps.ts +++ b/src/testRunner/unittests/tsserver/declarationFileMaps.ts @@ -179,7 +179,7 @@ namespace ts.projectSystem { } function verifyUserTsConfigProject(session: TestSession) { - checkProjectActualFiles(session.getProjectService().configuredProjects.get(userTsconfig.path)!, [userTs.path, aDts.path, userTsconfig.path]); + checkProjectActualFiles(session.getProjectService().configuredProjects.get(userTsconfig.path)!, [userTs.path, aTs.path, userTsconfig.path]); } it("goToDefinition", () => { @@ -450,6 +450,13 @@ namespace ts.projectSystem { name: "function f(): void", }, references: [ + makeReferenceEntry({ + file: aTs, + text: "f", + options: { index: 1 }, + contextText: "function f() {}", + isDefinition: true + }), { fileName: bTs.path, isDefinition: false, @@ -457,13 +464,6 @@ namespace ts.projectSystem { isWriteAccess: false, textSpan: { start: 0, length: 1 }, }, - makeReferenceEntry({ - file: aTs, - text: "f", - options: { index: 1 }, - contextText: "function f() {}", - isDefinition: true - }) ], } ]); diff --git a/src/testRunner/unittests/tsserver/events/projectLoading.ts b/src/testRunner/unittests/tsserver/events/projectLoading.ts index cb22f41ff25ce..5f4bf1a52c9ca 100644 --- a/src/testRunner/unittests/tsserver/events/projectLoading.ts +++ b/src/testRunner/unittests/tsserver/events/projectLoading.ts @@ -73,44 +73,64 @@ namespace ts.projectSystem { verifyEvent(project, `Change in config file detected`); }); - it("when opening original location project", () => { - const aDTs: File = { - path: `${projectRoot}/a/a.d.ts`, - content: `export declare class A { + describe("when opening original location project", () => { + it("with project references", () => { + verify(); + }); + + it("when disableSourceOfProjectReferenceRedirect is true", () => { + verify(/*disableSourceOfProjectReferenceRedirect*/ true); + }); + + function verify(disableSourceOfProjectReferenceRedirect?: true) { + const aDTs: File = { + path: `${projectRoot}/a/a.d.ts`, + content: `export declare class A { } //# sourceMappingURL=a.d.ts.map ` - }; - const aDTsMap: File = { - path: `${projectRoot}/a/a.d.ts.map`, - content: `{"version":3,"file":"a.d.ts","sourceRoot":"","sources":["./a.ts"],"names":[],"mappings":"AAAA,qBAAa,CAAC;CAAI"}` - }; - const bTs: File = { - path: bTsPath, - content: `import {A} from "../a/a"; new A();` - }; - const configB: File = { - path: configBPath, - content: JSON.stringify({ - references: [{ path: "../a" }] - }) - }; - - const { service, session, verifyEventWithOpenTs, verifyEvent } = createSessionToVerifyEvent(files.concat(aDTs, aDTsMap, bTs, configB)); - verifyEventWithOpenTs(bTs, configB.path, 1); - - session.executeCommandSeq({ - command: protocol.CommandTypes.References, - arguments: { - file: bTs.path, - ...protocolLocationFromSubstring(bTs.content, "A()") - } - }); + }; + const aDTsMap: File = { + path: `${projectRoot}/a/a.d.ts.map`, + content: `{"version":3,"file":"a.d.ts","sourceRoot":"","sources":["./a.ts"],"names":[],"mappings":"AAAA,qBAAa,CAAC;CAAI"}` + }; + const bTs: File = { + path: bTsPath, + content: `import {A} from "../a/a"; new A();` + }; + const configB: File = { + path: configBPath, + content: JSON.stringify({ + ...(disableSourceOfProjectReferenceRedirect && { + compilerOptions: { + disableSourceOfProjectReferenceRedirect + } + }), + references: [{ path: "../a" }] + }) + }; + + const { service, session, verifyEventWithOpenTs, verifyEvent } = createSessionToVerifyEvent(files.concat(aDTs, aDTsMap, bTs, configB)); + verifyEventWithOpenTs(bTs, configB.path, 1); + + session.executeCommandSeq({ + command: protocol.CommandTypes.References, + arguments: { + file: bTs.path, + ...protocolLocationFromSubstring(bTs.content, "A()") + } + }); - checkNumberOfProjects(service, { configuredProjects: 2 }); - const project = service.configuredProjects.get(configA.path)!; - assert.isDefined(project); - verifyEvent(project, `Creating project for original file: ${aTs.path} for location: ${aDTs.path}`); + checkNumberOfProjects(service, { configuredProjects: 2 }); + const project = service.configuredProjects.get(configA.path)!; + assert.isDefined(project); + verifyEvent( + project, + disableSourceOfProjectReferenceRedirect ? + `Creating project for original file: ${aTs.path} for location: ${aDTs.path}` : + `Creating project for original file: ${aTs.path}` + ); + } }); describe("with external projects and config files ", () => { diff --git a/src/testRunner/unittests/tsserver/helpers.ts b/src/testRunner/unittests/tsserver/helpers.ts index 1fb3593590604..a8c79d0b60347 100644 --- a/src/testRunner/unittests/tsserver/helpers.ts +++ b/src/testRunner/unittests/tsserver/helpers.ts @@ -491,8 +491,8 @@ namespace ts.projectSystem { checkArray("Open files", arrayFrom(projectService.openFiles.keys(), path => projectService.getScriptInfoForPath(path as Path)!.fileName), expectedFiles.map(file => file.path)); } - export function checkScriptInfos(projectService: server.ProjectService, expectedFiles: readonly string[]) { - checkArray("ScriptInfos files", arrayFrom(projectService.filenameToScriptInfo.values(), info => info.fileName), expectedFiles); + export function checkScriptInfos(projectService: server.ProjectService, expectedFiles: readonly string[], additionInfo?: string) { + checkArray(`ScriptInfos files: ${additionInfo || ""}`, arrayFrom(projectService.filenameToScriptInfo.values(), info => info.fileName), expectedFiles); } export function protocolLocationFromSubstring(str: string, substring: string): protocol.Location { @@ -501,7 +501,7 @@ namespace ts.projectSystem { return protocolToLocation(str)(start); } - function protocolToLocation(text: string): (pos: number) => protocol.Location { + export function protocolToLocation(text: string): (pos: number) => protocol.Location { const lineStarts = computeLineStarts(text); return pos => { const x = computeLineAndCharacterOfPosition(lineStarts, pos); diff --git a/src/testRunner/unittests/tsserver/projectReferenceCompileOnSave.ts b/src/testRunner/unittests/tsserver/projectReferenceCompileOnSave.ts new file mode 100644 index 0000000000000..9602ef6360eec --- /dev/null +++ b/src/testRunner/unittests/tsserver/projectReferenceCompileOnSave.ts @@ -0,0 +1,410 @@ +namespace ts.projectSystem { + describe("unittests:: tsserver:: with project references and compile on save", () => { + const projectLocation = "/user/username/projects/myproject"; + const dependecyLocation = `${projectLocation}/dependency`; + const usageLocation = `${projectLocation}/usage`; + const dependencyTs: File = { + path: `${dependecyLocation}/fns.ts`, + content: `export function fn1() { } +export function fn2() { } +` + }; + const dependencyConfig: File = { + path: `${dependecyLocation}/tsconfig.json`, + content: JSON.stringify({ + compilerOptions: { composite: true, declarationDir: "../decls" }, + compileOnSave: true + }) + }; + const usageTs: File = { + path: `${usageLocation}/usage.ts`, + content: `import { + fn1, + fn2, +} from '../decls/fns' +fn1(); +fn2(); +` + }; + const usageConfig: File = { + path: `${usageLocation}/tsconfig.json`, + content: JSON.stringify({ + compileOnSave: true, + references: [{ path: "../dependency" }] + }) + }; + + interface VerifySingleScenarioWorker extends VerifySingleScenario { + withProject: boolean; + } + function verifySingleScenarioWorker({ + withProject, scenario, openFiles, requestArgs, change, expectedResult + }: VerifySingleScenarioWorker) { + it(scenario, () => { + const host = TestFSWithWatch.changeToHostTrackingWrittenFiles( + createServerHost([dependencyTs, dependencyConfig, usageTs, usageConfig, libFile]) + ); + const session = createSession(host); + openFilesForSession(openFiles(), session); + const reqArgs = requestArgs(); + const { + expectedAffected, + expectedEmit: { expectedEmitSuccess, expectedFiles }, + expectedEmitOutput + } = expectedResult(withProject); + + if (change) { + session.executeCommandSeq({ + command: protocol.CommandTypes.CompileOnSaveAffectedFileList, + arguments: { file: dependencyTs.path } + }); + const { file, insertString } = change(); + if (session.getProjectService().openFiles.has(file.path)) { + const toLocation = protocolToLocation(file.content); + const location = toLocation(file.content.length); + session.executeCommandSeq({ + command: protocol.CommandTypes.Change, + arguments: { + file: file.path, + ...location, + endLine: location.line, + endOffset: location.offset, + insertString + } + }); + } + else { + host.writeFile(file.path, `${file.content}${insertString}`); + } + host.writtenFiles.clear(); + } + + const args = withProject ? reqArgs : { file: reqArgs.file }; + // Verify CompileOnSaveAffectedFileList + const actualAffectedFiles = session.executeCommandSeq({ + command: protocol.CommandTypes.CompileOnSaveAffectedFileList, + arguments: args + }).response as protocol.CompileOnSaveAffectedFileListSingleProject[]; + assert.deepEqual(actualAffectedFiles, expectedAffected, "Affected files"); + + // Verify CompileOnSaveEmit + const actualEmit = session.executeCommandSeq({ + command: protocol.CommandTypes.CompileOnSaveEmitFile, + arguments: args + }).response; + assert.deepEqual(actualEmit, expectedEmitSuccess, "Emit files"); + assert.equal(host.writtenFiles.size, expectedFiles.length); + for (const file of expectedFiles) { + assert.equal(host.readFile(file.path), file.content, `Expected to write ${file.path}`); + assert.isTrue(host.writtenFiles.has(file.path), `${file.path} is newly written`); + } + + // Verify EmitOutput + const { exportedModulesFromDeclarationEmit: _1, ...actualEmitOutput } = session.executeCommandSeq({ + command: protocol.CommandTypes.EmitOutput, + arguments: args + }).response as EmitOutput; + assert.deepEqual(actualEmitOutput, expectedEmitOutput, "Emit output"); + }); + } + + interface VerifySingleScenario { + scenario: string; + openFiles: () => readonly File[]; + requestArgs: () => protocol.FileRequestArgs; + skipWithoutProject?: boolean; + change?: () => SingleScenarioChange; + expectedResult: GetSingleScenarioResult; + } + function verifySingleScenario(scenario: VerifySingleScenario) { + if (!scenario.skipWithoutProject) { + describe("without specifying project file", () => { + verifySingleScenarioWorker({ + withProject: false, + ...scenario + }); + }); + } + describe("with specifying project file", () => { + verifySingleScenarioWorker({ + withProject: true, + ...scenario + }); + }); + } + + interface SingleScenarioExpectedEmit { + expectedEmitSuccess: boolean; + expectedFiles: readonly File[]; + } + interface SingleScenarioResult { + expectedAffected: protocol.CompileOnSaveAffectedFileListSingleProject[]; + expectedEmit: SingleScenarioExpectedEmit; + expectedEmitOutput: EmitOutput; + } + type GetSingleScenarioResult = (withProject: boolean) => SingleScenarioResult; + interface SingleScenarioChange { + file: File; + insertString: string; + } + interface ScenarioDetails { + scenarioName: string; + requestArgs: () => protocol.FileRequestArgs; + skipWithoutProject?: boolean; + initial: GetSingleScenarioResult; + localChangeToDependency: GetSingleScenarioResult; + localChangeToUsage: GetSingleScenarioResult; + changeToDependency: GetSingleScenarioResult; + changeToUsage: GetSingleScenarioResult; + } + interface VerifyScenario { + openFiles: () => readonly File[]; + scenarios: readonly ScenarioDetails[]; + } + + const localChange = "function fn3() { }"; + const change = `export ${localChange}`; + const changeJs = `function fn3() { } +exports.fn3 = fn3;`; + const changeDts = "export declare function fn3(): void;"; + function verifyScenario({ openFiles, scenarios }: VerifyScenario) { + for (const { + scenarioName, requestArgs, skipWithoutProject, initial, + localChangeToDependency, localChangeToUsage, + changeToDependency, changeToUsage + } of scenarios) { + describe(scenarioName, () => { + verifySingleScenario({ + scenario: "with initial file open", + openFiles, + requestArgs, + skipWithoutProject, + expectedResult: initial + }); + + verifySingleScenario({ + scenario: "with local change to dependency", + openFiles, + requestArgs, + skipWithoutProject, + change: () => ({ file: dependencyTs, insertString: localChange }), + expectedResult: localChangeToDependency + }); + + verifySingleScenario({ + scenario: "with local change to usage", + openFiles, + requestArgs, + skipWithoutProject, + change: () => ({ file: usageTs, insertString: localChange }), + expectedResult: localChangeToUsage + }); + + verifySingleScenario({ + scenario: "with change to dependency", + openFiles, + requestArgs, + skipWithoutProject, + change: () => ({ file: dependencyTs, insertString: change }), + expectedResult: changeToDependency + }); + + verifySingleScenario({ + scenario: "with change to usage", + openFiles, + requestArgs, + skipWithoutProject, + change: () => ({ file: usageTs, insertString: change }), + expectedResult: changeToUsage + }); + }); + } + } + + function expectedAffectedFiles(config: File, fileNames: File[]): protocol.CompileOnSaveAffectedFileListSingleProject { + return { + projectFileName: config.path, + fileNames: fileNames.map(f => f.path), + projectUsesOutFile: false + }; + } + + function expectedUsageEmit(appendJsText?: string): SingleScenarioExpectedEmit { + const appendJs = appendJsText ? `${appendJsText} +` : ""; + return { + expectedEmitSuccess: true, + expectedFiles: [{ + path: `${usageLocation}/usage.js`, + content: `"use strict"; +exports.__esModule = true; +var fns_1 = require("../decls/fns"); +fns_1.fn1(); +fns_1.fn2(); +${appendJs}` + }] + }; + } + + function expectedEmitOutput({ expectedFiles }: SingleScenarioExpectedEmit): EmitOutput { + return { + outputFiles: expectedFiles.map(({ path, content }) => ({ + name: path, + text: content, + writeByteOrderMark: false + })), + emitSkipped: false + }; + } + + function expectedUsageEmitOutput(appendJsText?: string): EmitOutput { + return expectedEmitOutput(expectedUsageEmit(appendJsText)); + } + + function noEmit(): SingleScenarioExpectedEmit { + return { + expectedEmitSuccess: false, + expectedFiles: emptyArray + }; + } + + function noEmitOutput(): EmitOutput { + return { + emitSkipped: true, + outputFiles: [] + }; + } + + function expectedDependencyEmit(appendJsText?: string, appendDtsText?: string): SingleScenarioExpectedEmit { + const appendJs = appendJsText ? `${appendJsText} +` : ""; + const appendDts = appendDtsText ? `${appendDtsText} +` : ""; + return { + expectedEmitSuccess: true, + expectedFiles: [ + { + path: `${dependecyLocation}/fns.js`, + content: `"use strict"; +exports.__esModule = true; +function fn1() { } +exports.fn1 = fn1; +function fn2() { } +exports.fn2 = fn2; +${appendJs}` + }, + { + path: `${projectLocation}/decls/fns.d.ts`, + content: `export declare function fn1(): void; +export declare function fn2(): void; +${appendDts}` + } + ] + }; + } + + function expectedDependencyEmitOutput(appendJsText?: string, appendDtsText?: string): EmitOutput { + return expectedEmitOutput(expectedDependencyEmit(appendJsText, appendDtsText)); + } + + function scenarioDetailsOfUsage(isDependencyOpen?: boolean): ScenarioDetails[] { + return [ + { + scenarioName: "Of usageTs", + requestArgs: () => ({ file: usageTs.path, projectFileName: usageConfig.path }), + initial: () => initialUsageTs(), + // no change to usage so same as initial only usage file + localChangeToDependency: () => initialUsageTs(), + localChangeToUsage: () => initialUsageTs(localChange), + changeToDependency: () => initialUsageTs(), + changeToUsage: () => initialUsageTs(changeJs) + }, + { + scenarioName: "Of dependencyTs in usage project", + requestArgs: () => ({ file: dependencyTs.path, projectFileName: usageConfig.path }), + skipWithoutProject: !!isDependencyOpen, + initial: () => initialDependencyTs(), + localChangeToDependency: () => initialDependencyTs(/*noUsageFiles*/ true), + localChangeToUsage: () => initialDependencyTs(/*noUsageFiles*/ true), + changeToDependency: () => initialDependencyTs(), + changeToUsage: () => initialDependencyTs(/*noUsageFiles*/ true) + } + ]; + + function initialUsageTs(jsText?: string) { + return { + expectedAffected: [ + expectedAffectedFiles(usageConfig, [usageTs]) + ], + expectedEmit: expectedUsageEmit(jsText), + expectedEmitOutput: expectedUsageEmitOutput(jsText) + }; + } + + function initialDependencyTs(noUsageFiles?: true) { + return { + expectedAffected: [ + expectedAffectedFiles(usageConfig, noUsageFiles ? [] : [usageTs]) + ], + expectedEmit: noEmit(), + expectedEmitOutput: noEmitOutput() + }; + } + } + + function scenarioDetailsOfDependencyWhenOpen(): ScenarioDetails { + return { + scenarioName: "Of dependencyTs", + requestArgs: () => ({ file: dependencyTs.path, projectFileName: dependencyConfig.path }), + initial, + localChangeToDependency: withProject => ({ + expectedAffected: withProject ? + [ + expectedAffectedFiles(dependencyConfig, [dependencyTs]) + ] : + [ + expectedAffectedFiles(usageConfig, []), + expectedAffectedFiles(dependencyConfig, [dependencyTs]) + ], + expectedEmit: expectedDependencyEmit(localChange), + expectedEmitOutput: expectedDependencyEmitOutput(localChange) + }), + localChangeToUsage: withProject => initial(withProject, /*noUsageFiles*/ true), + changeToDependency: withProject => initial(withProject, /*noUsageFiles*/ undefined, changeJs, changeDts), + changeToUsage: withProject => initial(withProject, /*noUsageFiles*/ true) + }; + + function initial(withProject: boolean, noUsageFiles?: true, appendJs?: string, appendDts?: string): SingleScenarioResult { + return { + expectedAffected: withProject ? + [ + expectedAffectedFiles(dependencyConfig, [dependencyTs]) + ] : + [ + expectedAffectedFiles(usageConfig, noUsageFiles ? [] : [usageTs]), + expectedAffectedFiles(dependencyConfig, [dependencyTs]) + ], + expectedEmit: expectedDependencyEmit(appendJs, appendDts), + expectedEmitOutput: expectedDependencyEmitOutput(appendJs, appendDts) + }; + } + } + + describe("when dependency project is not open", () => { + verifyScenario({ + openFiles: () => [usageTs], + scenarios: scenarioDetailsOfUsage() + }); + }); + + describe("when the depedency file is open", () => { + verifyScenario({ + openFiles: () => [usageTs, dependencyTs], + scenarios: [ + ...scenarioDetailsOfUsage(/*isDependencyOpen*/ true), + scenarioDetailsOfDependencyWhenOpen(), + ] + }); + }); + }); +} diff --git a/src/testRunner/unittests/tsserver/projectReferenceErrors.ts b/src/testRunner/unittests/tsserver/projectReferenceErrors.ts new file mode 100644 index 0000000000000..a3ec48486157b --- /dev/null +++ b/src/testRunner/unittests/tsserver/projectReferenceErrors.ts @@ -0,0 +1,430 @@ +namespace ts.projectSystem { + describe("unittests:: tsserver:: with project references and error reporting", () => { + const projectLocation = "/user/username/projects/myproject"; + const dependecyLocation = `${projectLocation}/dependency`; + const usageLocation = `${projectLocation}/usage`; + + interface CheckErrorsInFile { + session: TestSession; + host: TestServerHost; + expected: GetErrDiagnostics; + expectedSequenceId?: number; + } + function checkErrorsInFile({ session, host, expected: { file, syntax, semantic, suggestion }, expectedSequenceId }: CheckErrorsInFile) { + host.checkTimeoutQueueLengthAndRun(1); + checkErrorMessage(session, "syntaxDiag", { file: file.path, diagnostics: syntax }); + session.clearMessages(); + + host.runQueuedImmediateCallbacks(1); + checkErrorMessage(session, "semanticDiag", { file: file.path, diagnostics: semantic }); + session.clearMessages(); + + host.runQueuedImmediateCallbacks(1); + checkErrorMessage(session, "suggestionDiag", { file: file.path, diagnostics: suggestion }); + if (expectedSequenceId !== undefined) { + checkCompleteEvent(session, 2, expectedSequenceId); + } + session.clearMessages(); + } + + interface CheckAllErrors { + session: TestSession; + host: TestServerHost; + expected: readonly GetErrDiagnostics[]; + expectedSequenceId: number; + } + function checkAllErrors({ session, host, expected, expectedSequenceId }: CheckAllErrors) { + for (let i = 0; i < expected.length; i++) { + checkErrorsInFile({ + session, + host, + expected: expected[i], + expectedSequenceId: i === expected.length - 1 ? expectedSequenceId : undefined + }); + } + } + + function verifyErrorsUsingGeterr({ allFiles, openFiles, expectedGetErr }: VerifyScenario) { + it("verifies the errors in open file", () => { + const host = createServerHost([...allFiles(), libFile]); + const session = createSession(host, { canUseEvents: true, }); + openFilesForSession(openFiles(), session); + + session.clearMessages(); + const expectedSequenceId = session.getNextSeq(); + const expected = expectedGetErr(); + session.executeCommandSeq({ + command: protocol.CommandTypes.Geterr, + arguments: { + delay: 0, + files: expected.map(f => f.file.path) + } + }); + + checkAllErrors({ session, host, expected, expectedSequenceId }); + }); + } + + function verifyErrorsUsingGeterrForProject({ allFiles, openFiles, expectedGetErrForProject }: VerifyScenario) { + it("verifies the errors in projects", () => { + const host = createServerHost([...allFiles(), libFile]); + const session = createSession(host, { canUseEvents: true, }); + openFilesForSession(openFiles(), session); + + session.clearMessages(); + for (const expected of expectedGetErrForProject()) { + const expectedSequenceId = session.getNextSeq(); + session.executeCommandSeq({ + command: protocol.CommandTypes.GeterrForProject, + arguments: { + delay: 0, + file: expected.project + } + }); + + checkAllErrors({ session, host, expected: expected.errors, expectedSequenceId }); + } + }); + } + + function verifyErrorsUsingSyncMethods({ allFiles, openFiles, expectedSyncDiagnostics }: VerifyScenario) { + it("verifies the errors using sync commands", () => { + const host = createServerHost([...allFiles(), libFile]); + const session = createSession(host); + openFilesForSession(openFiles(), session); + for (const { file, project, syntax, semantic, suggestion } of expectedSyncDiagnostics()) { + const actualSyntax = session.executeCommandSeq({ + command: protocol.CommandTypes.SyntacticDiagnosticsSync, + arguments: { + file: file.path, + projectFileName: project + } + }).response as protocol.Diagnostic[]; + assert.deepEqual(actualSyntax, syntax, `Syntax diagnostics for file: ${file.path}, project: ${project}`); + const actualSemantic = session.executeCommandSeq({ + command: protocol.CommandTypes.SemanticDiagnosticsSync, + arguments: { + file: file.path, + projectFileName: project + } + }).response as protocol.Diagnostic[]; + assert.deepEqual(actualSemantic, semantic, `Semantic diagnostics for file: ${file.path}, project: ${project}`); + const actualSuggestion = session.executeCommandSeq({ + command: protocol.CommandTypes.SuggestionDiagnosticsSync, + arguments: { + file: file.path, + projectFileName: project + } + }).response as protocol.Diagnostic[]; + assert.deepEqual(actualSuggestion, suggestion, `Suggestion diagnostics for file: ${file.path}, project: ${project}`); + } + }); + } + + function verifyConfigFileErrors({ allFiles, openFiles, expectedConfigFileDiagEvents }: VerifyScenario) { + it("verify config file errors", () => { + const host = createServerHost([...allFiles(), libFile]); + const { session, events } = createSessionWithEventTracking(host, server.ConfigFileDiagEvent); + + for (const file of openFiles()) { + session.executeCommandSeq({ + command: protocol.CommandTypes.Open, + arguments: { file: file.path } + }); + } + + assert.deepEqual(events, expectedConfigFileDiagEvents().map(data => ({ + eventName: server.ConfigFileDiagEvent, + data + }))); + }); + } + + interface GetErrDiagnostics { + file: File; + syntax: protocol.Diagnostic[]; + semantic: protocol.Diagnostic[]; + suggestion: protocol.Diagnostic[]; + } + interface GetErrForProjectDiagnostics { + project: string; + errors: readonly GetErrDiagnostics[]; + } + interface SyncDiagnostics extends GetErrDiagnostics { + project?: string; + } + interface VerifyScenario { + allFiles: () => readonly File[]; + openFiles: () => readonly File[]; + expectedGetErr: () => readonly GetErrDiagnostics[]; + expectedGetErrForProject: () => readonly GetErrForProjectDiagnostics[]; + expectedSyncDiagnostics: () => readonly SyncDiagnostics[]; + expectedConfigFileDiagEvents: () => readonly server.ConfigFileDiagEvent["data"][]; + } + function verifyScenario(scenario: VerifyScenario) { + verifyErrorsUsingGeterr(scenario); + verifyErrorsUsingGeterrForProject(scenario); + verifyErrorsUsingSyncMethods(scenario); + verifyConfigFileErrors(scenario); + } + + function emptyDiagnostics(file: File): GetErrDiagnostics { + return { + file, + syntax: emptyArray, + semantic: emptyArray, + suggestion: emptyArray + }; + } + + function syncDiagnostics(diagnostics: GetErrDiagnostics, project: string): SyncDiagnostics { + return { project, ...diagnostics }; + } + + interface VerifyUsageAndDependency { + allFiles: readonly [File, File, File, File]; // dependencyTs, dependencyConfig, usageTs, usageConfig + usageDiagnostics(): GetErrDiagnostics; + dependencyDiagnostics(): GetErrDiagnostics; + + } + function verifyUsageAndDependency({ allFiles, usageDiagnostics, dependencyDiagnostics }: VerifyUsageAndDependency) { + const [dependencyTs, dependencyConfig, usageTs, usageConfig] = allFiles; + function usageProjectDiagnostics(): GetErrForProjectDiagnostics { + return { + project: usageTs.path, + errors: [ + usageDiagnostics(), + emptyDiagnostics(dependencyTs) + ] + }; + } + + function dependencyProjectDiagnostics(): GetErrForProjectDiagnostics { + return { + project: dependencyTs.path, + errors: [ + dependencyDiagnostics() + ] + }; + } + + function usageConfigDiag(): server.ConfigFileDiagEvent["data"] { + return { + triggerFile: usageTs.path, + configFileName: usageConfig.path, + diagnostics: emptyArray + }; + } + + function dependencyConfigDiag(): server.ConfigFileDiagEvent["data"] { + return { + triggerFile: dependencyTs.path, + configFileName: dependencyConfig.path, + diagnostics: emptyArray + }; + } + + describe("when dependency project is not open", () => { + verifyScenario({ + allFiles: () => allFiles, + openFiles: () => [usageTs], + expectedGetErr: () => [ + usageDiagnostics() + ], + expectedGetErrForProject: () => [ + usageProjectDiagnostics(), + { + project: dependencyTs.path, + errors: [ + emptyDiagnostics(dependencyTs), + usageDiagnostics() + ] + } + ], + expectedSyncDiagnostics: () => [ + // Without project + usageDiagnostics(), + emptyDiagnostics(dependencyTs), + // With project + syncDiagnostics(usageDiagnostics(), usageConfig.path), + syncDiagnostics(emptyDiagnostics(dependencyTs), usageConfig.path), + ], + expectedConfigFileDiagEvents: () => [ + usageConfigDiag() + ], + }); + }); + + describe("when the depedency file is open", () => { + verifyScenario({ + allFiles: () => allFiles, + openFiles: () => [usageTs, dependencyTs], + expectedGetErr: () => [ + usageDiagnostics(), + dependencyDiagnostics(), + ], + expectedGetErrForProject: () => [ + usageProjectDiagnostics(), + dependencyProjectDiagnostics() + ], + expectedSyncDiagnostics: () => [ + // Without project + usageDiagnostics(), + dependencyDiagnostics(), + // With project + syncDiagnostics(usageDiagnostics(), usageConfig.path), + syncDiagnostics(emptyDiagnostics(dependencyTs), usageConfig.path), + syncDiagnostics(dependencyDiagnostics(), dependencyConfig.path), + ], + expectedConfigFileDiagEvents: () => [ + usageConfigDiag(), + dependencyConfigDiag() + ], + }); + }); + } + + describe("with module scenario", () => { + const dependencyTs: File = { + path: `${dependecyLocation}/fns.ts`, + content: `export function fn1() { } +export function fn2() { } +// Introduce error for fnErr import in main +// export function fnErr() { } +// Error in dependency ts file +export let x: string = 10;` + }; + const dependencyConfig: File = { + path: `${dependecyLocation}/tsconfig.json`, + content: JSON.stringify({ compilerOptions: { composite: true, declarationDir: "../decls" } }) + }; + const usageTs: File = { + path: `${usageLocation}/usage.ts`, + content: `import { + fn1, + fn2, + fnErr +} from '../decls/fns' +fn1(); +fn2(); +fnErr(); +` + }; + const usageConfig: File = { + path: `${usageLocation}/tsconfig.json`, + content: JSON.stringify({ + compilerOptions: { composite: true }, + references: [{ path: "../dependency" }] + }) + }; + function usageDiagnostics(): GetErrDiagnostics { + return { + file: usageTs, + syntax: emptyArray, + semantic: [ + createDiagnostic( + { line: 4, offset: 5 }, + { line: 4, offset: 10 }, + Diagnostics.Module_0_has_no_exported_member_1, + [`"../dependency/fns"`, "fnErr"], + "error", + ) + ], + suggestion: emptyArray + }; + } + + function dependencyDiagnostics(): GetErrDiagnostics { + return { + file: dependencyTs, + syntax: emptyArray, + semantic: [ + createDiagnostic( + { line: 6, offset: 12 }, + { line: 6, offset: 13 }, + Diagnostics.Type_0_is_not_assignable_to_type_1, + ["10", "string"], + "error", + ) + ], + suggestion: emptyArray + }; + } + + verifyUsageAndDependency({ + allFiles: [dependencyTs, dependencyConfig, usageTs, usageConfig], + usageDiagnostics, + dependencyDiagnostics + }); + }); + + describe("with non module --out", () => { + const dependencyTs: File = { + path: `${dependecyLocation}/fns.ts`, + content: `function fn1() { } +function fn2() { } +// Introduce error for fnErr import in main +// function fnErr() { } +// Error in dependency ts file +let x: string = 10;` + }; + const dependencyConfig: File = { + path: `${dependecyLocation}/tsconfig.json`, + content: JSON.stringify({ compilerOptions: { composite: true, outFile: "../dependency.js" } }) + }; + const usageTs: File = { + path: `${usageLocation}/usage.ts`, + content: `fn1(); +fn2(); +fnErr(); +` + }; + const usageConfig: File = { + path: `${usageLocation}/tsconfig.json`, + content: JSON.stringify({ + compilerOptions: { composite: true, outFile: "../usage.js" }, + references: [{ path: "../dependency" }] + }) + }; + function usageDiagnostics(): GetErrDiagnostics { + return { + file: usageTs, + syntax: emptyArray, + semantic: [ + createDiagnostic( + { line: 3, offset: 1 }, + { line: 3, offset: 6 }, + Diagnostics.Cannot_find_name_0, + ["fnErr"], + "error", + ) + ], + suggestion: emptyArray + }; + } + + function dependencyDiagnostics(): GetErrDiagnostics { + return { + file: dependencyTs, + syntax: emptyArray, + semantic: [ + createDiagnostic( + { line: 6, offset: 5 }, + { line: 6, offset: 6 }, + Diagnostics.Type_0_is_not_assignable_to_type_1, + ["10", "string"], + "error", + ) + ], + suggestion: emptyArray + }; + } + + verifyUsageAndDependency({ + allFiles: [dependencyTs, dependencyConfig, usageTs, usageConfig], + usageDiagnostics, + dependencyDiagnostics + }); + }); + }); +} diff --git a/src/testRunner/unittests/tsserver/projectReferences.ts b/src/testRunner/unittests/tsserver/projectReferences.ts index 7db9d755b2691..2e886e2169ef3 100644 --- a/src/testRunner/unittests/tsserver/projectReferences.ts +++ b/src/testRunner/unittests/tsserver/projectReferences.ts @@ -85,8 +85,8 @@ namespace ts.projectSystem { }); const { file: _, ...renameTextOfMyConstInLib } = locationOfMyConstInLib; assert.deepEqual(response.locs, [ - { file: myConstFile, locs: [{ start: myConstStart, end: myConstEnd }] }, - { file: locationOfMyConstInLib.file, locs: [renameTextOfMyConstInLib] } + { file: locationOfMyConstInLib.file, locs: [renameTextOfMyConstInLib] }, + { file: myConstFile, locs: [{ start: myConstStart, end: myConstEnd }] } ]); }); }); @@ -105,6 +105,7 @@ export function fn4() { } export function fn5() { } ` }; + const dependencyTsPath = dependencyTs.path.toLowerCase(); const dependencyConfig: File = { path: `${dependecyLocation}/tsconfig.json`, content: JSON.stringify({ compilerOptions: { composite: true, declarationMap: true, declarationDir: "../decls" } }) @@ -150,31 +151,42 @@ fn5(); const files = [dependencyTs, dependencyConfig, mainTs, mainConfig, libFile, randomFile, randomConfig]; - function verifyScriptInfos(session: TestSession, host: TestServerHost, openInfos: readonly string[], closedInfos: readonly string[], otherWatchedFiles: readonly string[]) { - checkScriptInfos(session.getProjectService(), openInfos.concat(closedInfos)); - checkWatchedFiles(host, closedInfos.concat(otherWatchedFiles).map(f => f.toLowerCase())); + function verifyScriptInfos(session: TestSession, host: TestServerHost, openInfos: readonly string[], closedInfos: readonly string[], otherWatchedFiles: readonly string[], additionalInfo: string) { + checkScriptInfos(session.getProjectService(), openInfos.concat(closedInfos), additionalInfo); + checkWatchedFiles(host, closedInfos.concat(otherWatchedFiles).map(f => f.toLowerCase()), additionalInfo); } - function verifyInfosWithRandom(session: TestSession, host: TestServerHost, openInfos: readonly string[], closedInfos: readonly string[], otherWatchedFiles: readonly string[]) { - verifyScriptInfos(session, host, openInfos.concat(randomFile.path), closedInfos, otherWatchedFiles.concat(randomConfig.path)); + function verifyInfosWithRandom(session: TestSession, host: TestServerHost, openInfos: readonly string[], closedInfos: readonly string[], otherWatchedFiles: readonly string[], reqName: string) { + verifyScriptInfos(session, host, openInfos.concat(randomFile.path), closedInfos, otherWatchedFiles.concat(randomConfig.path), reqName); } function verifyOnlyRandomInfos(session: TestSession, host: TestServerHost) { - verifyScriptInfos(session, host, [randomFile.path], [libFile.path], [randomConfig.path]); + verifyScriptInfos(session, host, [randomFile.path], [libFile.path], [randomConfig.path], "Random"); } - // Returns request and expected Response, expected response when no map file - interface SessionAction { - reqName: string; - request: Partial; - expectedResponse: Response; - expectedResponseNoMap?: Response; - expectedResponseNoDts?: Response; + function declarationSpan(fn: number): protocol.TextSpanWithContext { + return { + start: { line: fn, offset: 17 }, + end: { line: fn, offset: 20 }, + contextStart: { line: fn, offset: 1 }, + contextEnd: { line: fn, offset: 26 } + }; + } + function importSpan(fn: number): protocol.TextSpanWithContext { + return { + start: { line: fn + 1, offset: 5 }, + end: { line: fn + 1, offset: 8 }, + contextStart: { line: 1, offset: 1 }, + contextEnd: { line: 7, offset: 22 } + }; } - function gotoDefintinionFromMainTs(fn: number): SessionAction { + function usageSpan(fn: number): protocol.TextSpan { + return { start: { line: fn + 8, offset: 1 }, end: { line: fn + 8, offset: 4 } }; + } + + function goToDefFromMainTs(fn: number): Action { const textSpan = usageSpan(fn); const definition: protocol.FileSpan = { file: dependencyTs.path, ...declarationSpan(fn) }; - const declareSpaceLength = "declare ".length; return { reqName: "goToDef", request: { @@ -185,8 +197,21 @@ fn5(); // To dependency definitions: [definition], textSpan + } + }; + } + + function goToDefFromMainTsWithNoMap(fn: number): Action { + const textSpan = usageSpan(fn); + const definition = declarationSpan(fn); + const declareSpaceLength = "declare ".length; + return { + reqName: "goToDef", + request: { + command: protocol.CommandTypes.DefinitionAndBoundSpan, + arguments: { file: mainTs.path, ...textSpan.start } }, - expectedResponseNoMap: { + expectedResponse: { // To the dts definitions: [{ file: dtsPath, @@ -196,8 +221,19 @@ fn5(); contextEnd: { line: fn, offset: 37 } }], textSpan + } + }; + } + + function goToDefFromMainTsWithNoDts(fn: number): Action { + const textSpan = usageSpan(fn); + return { + reqName: "goToDef", + request: { + command: protocol.CommandTypes.DefinitionAndBoundSpan, + arguments: { file: mainTs.path, ...textSpan.start } }, - expectedResponseNoDts: { + expectedResponse: { // To import declaration definitions: [{ file: mainTs.path, ...importSpan(fn) }], textSpan @@ -205,27 +241,34 @@ fn5(); }; } - function declarationSpan(fn: number): protocol.TextSpanWithContext { + function goToDefFromMainTsWithDependencyChange(fn: number): Action { + const textSpan = usageSpan(fn); return { - start: { line: fn, offset: 17 }, - end: { line: fn, offset: 20 }, - contextStart: { line: fn, offset: 1 }, - contextEnd: { line: fn, offset: 26 } + reqName: "goToDef", + request: { + command: protocol.CommandTypes.DefinitionAndBoundSpan, + arguments: { file: mainTs.path, ...textSpan.start } + }, + expectedResponse: { + // Definition on fn + 1 line + definitions: [{ file: dependencyTs.path, ...declarationSpan(fn + 1) }], + textSpan + } }; } - function importSpan(fn: number): protocol.TextSpanWithContext { + + function goToDefFromMainTsProjectInfoVerifier(withRefs: boolean): ProjectInfoVerifier { return { - start: { line: fn + 1, offset: 5 }, - end: { line: fn + 1, offset: 8 }, - contextStart: { line: 1, offset: 1 }, - contextEnd: { line: 7, offset: 22 } + openFile: mainTs, + openFileLastLine: 14, + configFile: mainConfig, + expectedProjectActualFiles: withRefs ? + [mainTs.path, libFile.path, mainConfig.path, dependencyTs.path] : + [mainTs.path, libFile.path, mainConfig.path, dtsPath] }; } - function usageSpan(fn: number): protocol.TextSpan { - return { start: { line: fn + 8, offset: 1 }, end: { line: fn + 8, offset: 4 } }; - } - function renameFromDependencyTs(fn: number): SessionAction { + function renameFromDependencyTs(fn: number): Action { const defSpan = declarationSpan(fn); const { contextStart: _, contextEnd: _1, ...triggerSpan } = defSpan; return { @@ -251,7 +294,32 @@ fn5(); }; } - function renameFromDependencyTsWithBothProjectsOpen(fn: number): SessionAction { + function renameFromDependencyTsWithDependencyChange(fn: number): Action { + const { expectedResponse: { info, locs }, ...rest } = renameFromDependencyTs(fn + 1); + + return { + ...rest, + expectedResponse: { + info: { + ...info as protocol.RenameInfoSuccess, + displayName: `fn${fn}`, + fullDisplayName: `"${dependecyLocation}/FnS".fn${fn}`, + }, + locs + } + }; + } + + function renameFromDependencyTsProjectInfoVerifier(): ProjectInfoVerifier { + return { + openFile: dependencyTs, + openFileLastLine: 6, + configFile: dependencyConfig, + expectedProjectActualFiles: [dependencyTs.path, libFile.path, dependencyConfig.path] + }; + } + + function renameFromDependencyTsWithBothProjectsOpen(fn: number): Action { const { reqName, request, expectedResponse } = renameFromDependencyTs(fn); const { info, locs } = expectedResponse; return { @@ -269,442 +337,846 @@ fn5(); ] } ] - }, - // Only dependency result - expectedResponseNoMap: expectedResponse, - expectedResponseNoDts: expectedResponse + } }; } - // Returns request and expected Response - type SessionActionGetter = (fn: number) => SessionAction; - // Open File, expectedProjectActualFiles, actionGetter, openFileLastLine - interface DocumentPositionMapperVerifier { + function renameFromDependencyTsWithBothProjectsOpenWithDependencyChange(fn: number): Action { + const { reqName, request, expectedResponse, } = renameFromDependencyTsWithDependencyChange(fn); + const { info, locs } = expectedResponse; + return { + reqName, + request, + expectedResponse: { + info, + locs: [ + locs[0], + { + file: mainTs.path, + locs: [ + importSpan(fn), + usageSpan(fn) + ] + } + ] + } + }; + } + + function removePath(array: readonly string[], ...delPaths: string[]) { + return array.filter(a => { + const aLower = a.toLowerCase(); + return delPaths.every(dPath => dPath !== aLower); + }); + } + + interface Action { + reqName: string; + request: Partial; + expectedResponse: Response; + } + interface ActionInfo { + action: (fn: number) => Action; + closedInfos: readonly string[]; + otherWatchedFiles: readonly string[]; + expectsDts: boolean; + expectsMap: boolean; + freshMapInfo?: boolean; + freshDocumentMapper?: boolean; + skipDtsMapCheck?: boolean; + } + type ActionKey = keyof ActionInfoVerifier; + type ActionInfoGetterFn = () => ActionInfo; + type ActionInfoSpreader = [ + ActionKey, // Key to get initial value and pass this value to spread function + (actionInfo: ActionInfo) => Partial> + ]; + type ActionInfoGetter = ActionInfoGetterFn | ActionKey | ActionInfoSpreader; + interface ProjectInfoVerifier { openFile: File; - expectedProjectActualFiles: readonly string[]; - actionGetter: SessionActionGetter; openFileLastLine: number; + configFile: File; + expectedProjectActualFiles: readonly string[]; + } + interface ActionInfoVerifier { + main: ActionInfoGetter; + change: ActionInfoGetter; + dtsChange: ActionInfoGetter; + mapChange: ActionInfoGetter; + noMap: ActionInfoGetter; + mapFileCreated: ActionInfoGetter; + mapFileDeleted: ActionInfoGetter; + noDts: ActionInfoGetter; + dtsFileCreated: ActionInfoGetter; + dtsFileDeleted: ActionInfoGetter; + dependencyChange: ActionInfoGetter; + noBuild: ActionInfoGetter; + } + interface DocumentPositionMapperVerifier extends ProjectInfoVerifier, ActionInfoVerifier { } - function verifyDocumentPositionMapperUpdates( - mainScenario: string, - verifier: readonly DocumentPositionMapperVerifier[], - closedInfos: readonly string[], - withRefs: boolean) { - - const openFiles = verifier.map(v => v.openFile); - const expectedProjectActualFiles = verifier.map(v => v.expectedProjectActualFiles); - const openFileLastLines = verifier.map(v => v.openFileLastLine); - - const configFiles = openFiles.map(openFile => `${getDirectoryPath(openFile.path)}/tsconfig.json`); - const openInfos = openFiles.map(f => f.path); - // When usage and dependency are used, dependency config is part of closedInfo so ignore - const otherWatchedFiles = withRefs && verifier.length > 1 ? [configFiles[0]] : configFiles; - function openTsFile(onHostCreate?: (host: TestServerHost) => void) { - const host = createHost(files, [mainConfig.path]); - if (!withRefs) { - // Erase project reference - host.writeFile(mainConfig.path, JSON.stringify({ - compilerOptions: { composite: true, declarationMap: true } - })); - } - if (onHostCreate) { - onHostCreate(host); - } - const session = createSession(host); - openFilesForSession([...openFiles, randomFile], session); - return { host, session }; - } - function checkProject(session: TestSession, noDts?: true) { - const service = session.getProjectService(); - checkNumberOfProjects(service, { configuredProjects: 1 + verifier.length }); - configFiles.forEach((configFile, index) => { - checkProjectActualFiles( - service.configuredProjects.get(configFile)!, - noDts ? - expectedProjectActualFiles[index].filter(f => f.toLowerCase() !== dtsPath) : - expectedProjectActualFiles[index] - ); - }); - } + interface VerifierAndWithRefs { + withRefs: boolean; + disableSourceOfProjectReferenceRedirect?: true; + verifier: (withRefs: boolean) => readonly DocumentPositionMapperVerifier[]; + } - function verifyInfos(session: TestSession, host: TestServerHost) { - verifyInfosWithRandom(session, host, openInfos, closedInfos, otherWatchedFiles); + function openFiles(verifiers: readonly DocumentPositionMapperVerifier[]) { + return verifiers.map(v => v.openFile); + } + interface OpenTsFile extends VerifierAndWithRefs { + onHostCreate?: (host: TestServerHost) => void; + } + function openTsFile({ withRefs, disableSourceOfProjectReferenceRedirect, verifier, onHostCreate }: OpenTsFile) { + const host = createHost(files, [mainConfig.path]); + if (!withRefs) { + // Erase project reference + host.writeFile(mainConfig.path, JSON.stringify({ + compilerOptions: { composite: true, declarationMap: true } + })); } + else if (disableSourceOfProjectReferenceRedirect) { + // Erase project reference + host.writeFile(mainConfig.path, JSON.stringify({ + compilerOptions: { + composite: true, + declarationMap: true, + disableSourceOfProjectReferenceRedirect: !!disableSourceOfProjectReferenceRedirect + }, + references: [{ path: "../dependency" }] + })); + } + if (onHostCreate) { + onHostCreate(host); + } + const session = createSession(host); + const verifiers = verifier(withRefs && !disableSourceOfProjectReferenceRedirect); + openFilesForSession([...openFiles(verifiers), randomFile], session); + return { host, session, verifiers }; + } - function verifyInfosWhenNoMapFile(session: TestSession, host: TestServerHost, dependencyTsOK?: true) { - const dtsMapClosedInfo = firstDefined(closedInfos, f => f.toLowerCase() === dtsMapPath ? f : undefined); - verifyInfosWithRandom( - session, - host, - openInfos, - closedInfos.filter(f => f !== dtsMapClosedInfo && (dependencyTsOK || f !== dependencyTs.path)), - dtsMapClosedInfo ? otherWatchedFiles.concat(dtsMapClosedInfo) : otherWatchedFiles + function checkProject(session: TestSession, verifiers: readonly DocumentPositionMapperVerifier[], noDts?: true) { + const service = session.getProjectService(); + checkNumberOfProjects(service, { configuredProjects: 1 + verifiers.length }); + verifiers.forEach(({ configFile, expectedProjectActualFiles }) => { + checkProjectActualFiles( + service.configuredProjects.get(configFile.path.toLowerCase())!, + noDts ? + expectedProjectActualFiles.filter(f => f.toLowerCase() !== dtsPath) : + expectedProjectActualFiles ); + }); + } + + function firstAction(session: TestSession, verifiers: readonly DocumentPositionMapperVerifier[]) { + for (const { action } of getActionInfo(verifiers, "main")) { + const { request } = action(1); + session.executeCommandSeq(request); } + } - function verifyInfosWhenNoDtsFile(session: TestSession, host: TestServerHost, watchDts: boolean, dependencyTsAndMapOk?: true) { - const dtsMapClosedInfo = firstDefined(closedInfos, f => f.toLowerCase() === dtsMapPath ? f : undefined); - const dtsClosedInfo = firstDefined(closedInfos, f => f.toLowerCase() === dtsPath ? f : undefined); - verifyInfosWithRandom( - session, - host, - openInfos, - closedInfos.filter(f => (dependencyTsAndMapOk || f !== dtsMapClosedInfo) && f !== dtsClosedInfo && (dependencyTsAndMapOk || f !== dependencyTs.path)), - dtsClosedInfo && watchDts ? - otherWatchedFiles.concat(dtsClosedInfo) : - otherWatchedFiles - ); + function verifyAction(session: TestSession, { reqName, request, expectedResponse }: Action) { + const { response } = session.executeCommandSeq(request); + assert.deepEqual(response, expectedResponse, `Failed Request: ${reqName}`); + } + + function verifyScriptInfoPresence(session: TestSession, path: string, expectedToBePresent: boolean, reqName: string) { + const info = session.getProjectService().filenameToScriptInfo.get(path); + if (expectedToBePresent) { + assert.isDefined(info, `${reqName}:: ${path} expected to be present`); } + else { + assert.isUndefined(info, `${reqName}:: ${path} expected to be not present`); + } + return info; + } - function verifyDocumentPositionMapper(session: TestSession, dependencyMap: server.ScriptInfo, documentPositionMapper: server.ScriptInfo["documentPositionMapper"], notEqual?: true) { - assert.strictEqual(session.getProjectService().filenameToScriptInfo.get(dtsMapPath), dependencyMap); - if (notEqual) { - assert.notStrictEqual(dependencyMap.documentPositionMapper, documentPositionMapper); + interface VerifyDocumentPositionMapper { + session: TestSession; + dependencyMap: server.ScriptInfo | undefined; + documentPositionMapper: server.ScriptInfo["documentPositionMapper"]; + equal: boolean; + debugInfo: string; + } + function verifyDocumentPositionMapper({ session, dependencyMap, documentPositionMapper, equal, debugInfo }: VerifyDocumentPositionMapper) { + assert.strictEqual(session.getProjectService().filenameToScriptInfo.get(dtsMapPath), dependencyMap, debugInfo); + if (dependencyMap) { + if (equal) { + assert.strictEqual(dependencyMap.documentPositionMapper, documentPositionMapper, debugInfo); } else { - assert.strictEqual(dependencyMap.documentPositionMapper, documentPositionMapper); + assert.notStrictEqual(dependencyMap.documentPositionMapper, documentPositionMapper, debugInfo); } } + } - function action(verifier: DocumentPositionMapperVerifier, fn: number, session: TestSession) { - const { reqName, request, expectedResponse, expectedResponseNoMap, expectedResponseNoDts } = verifier.actionGetter(fn); - const { response } = session.executeCommandSeq(request); - return { reqName, response, expectedResponse, expectedResponseNoMap, expectedResponseNoDts, verifier }; + function getActionInfoOfVerfier(verifier: DocumentPositionMapperVerifier, actionKey: ActionKey): ActionInfo { + const actionInfoGetter = verifier[actionKey]; + if (isString(actionInfoGetter)) { + return getActionInfoOfVerfier(verifier, actionInfoGetter); } - function firstAction(session: TestSession) { - verifier.forEach(v => action(v, 1, session)); + if (isArray(actionInfoGetter)) { + const initialValue = getActionInfoOfVerfier(verifier, actionInfoGetter[0]); + return { + ...initialValue, + ...actionInfoGetter[1](initialValue) + }; } - function verifyAllFnActionWorker(session: TestSession, verifyAction: (result: ReturnType, dtsInfo: server.ScriptInfo | undefined, isFirst: boolean) => void, dtsAbsent?: true) { - // action - let isFirst = true; - for (const v of verifier) { - for (let fn = 1; fn <= 5; fn++) { - const result = action(v, fn, session); - const dtsInfo = session.getProjectService().filenameToScriptInfo.get(dtsPath); - if (dtsAbsent) { - assert.isUndefined(dtsInfo); - } - else { - assert.isDefined(dtsInfo); - } - verifyAction(result, dtsInfo, isFirst); - isFirst = false; - } - } - } + return actionInfoGetter(); + } - function verifyAllFnAction( - session: TestSession, - host: TestServerHost, - firstDocumentPositionMapperNotEquals?: true, - dependencyMap?: server.ScriptInfo, - documentPositionMapper?: server.ScriptInfo["documentPositionMapper"] - ) { - // action - verifyAllFnActionWorker(session, ({ reqName, response, expectedResponse }, dtsInfo, isFirst) => { - assert.deepEqual(response, expectedResponse, `Failed on ${reqName}`); - verifyInfos(session, host); - assert.equal(dtsInfo!.sourceMapFilePath, dtsMapPath); - if (isFirst) { - if (dependencyMap) { - verifyDocumentPositionMapper(session, dependencyMap, documentPositionMapper, firstDocumentPositionMapperNotEquals); - documentPositionMapper = dependencyMap.documentPositionMapper; + function getActionInfo(verifiers: readonly DocumentPositionMapperVerifier[], actionKey: ActionKey): ActionInfo[] { + return verifiers.map(v => getActionInfoOfVerfier(v, actionKey)); + } + + interface VerifyAllFnAction { + session: TestSession; + host: TestServerHost; + verifiers: readonly DocumentPositionMapperVerifier[]; + actionKey: ActionKey; + sourceMapPath?: server.ScriptInfo["sourceMapFilePath"]; + dependencyMap?: server.ScriptInfo | undefined; + documentPositionMapper?: server.ScriptInfo["documentPositionMapper"]; + } + interface VerifyAllFnActionResult { + actionInfos: readonly ActionInfo[]; + actionKey: ActionKey; + dependencyMap: server.ScriptInfo | undefined; + documentPositionMapper: server.ScriptInfo["documentPositionMapper"] | undefined; + } + function verifyAllFnAction({ + session, + host, + verifiers, + actionKey, + dependencyMap, + documentPositionMapper, + }: VerifyAllFnAction): VerifyAllFnActionResult { + const actionInfos = getActionInfo(verifiers, actionKey); + let sourceMapPath: server.ScriptInfo["sourceMapFilePath"] | undefined; + // action + let first = true; + for (const { + action, + closedInfos, + otherWatchedFiles, + expectsDts, + expectsMap, + freshMapInfo, + freshDocumentMapper, + skipDtsMapCheck + } of actionInfos) { + for (let fn = 1; fn <= 5; fn++) { + const fnAction = action(fn); + verifyAction(session, fnAction); + const debugInfo = `${actionKey}:: ${fnAction.reqName}:: ${fn}`; + const dtsInfo = verifyScriptInfoPresence(session, dtsPath, expectsDts, debugInfo); + const dtsMapInfo = verifyScriptInfoPresence(session, dtsMapPath, expectsMap, debugInfo); + verifyInfosWithRandom( + session, + host, + openFiles(verifiers).map(f => f.path), + closedInfos, + otherWatchedFiles, + debugInfo + ); + + if (dtsInfo) { + if (first || (fn === 1 && freshMapInfo)) { + if (!skipDtsMapCheck) { + if (dtsMapInfo) { + assert.equal(dtsInfo.sourceMapFilePath, dtsMapPath, debugInfo); + } + else { + assert.isNotString(dtsInfo.sourceMapFilePath, debugInfo); + assert.isNotFalse(dtsInfo.sourceMapFilePath, debugInfo); + assert.isDefined(dtsInfo.sourceMapFilePath, debugInfo); + } + } } else { - dependencyMap = session.getProjectService().filenameToScriptInfo.get(dtsMapPath)!; - documentPositionMapper = dependencyMap.documentPositionMapper; + assert.equal(dtsInfo.sourceMapFilePath, sourceMapPath, debugInfo); } } - else { - verifyDocumentPositionMapper(session, dependencyMap!, documentPositionMapper); - } - }); - return { dependencyMap: dependencyMap!, documentPositionMapper }; - } - function verifyAllFnActionWithNoMap( - session: TestSession, - host: TestServerHost, - dependencyTsOK?: true - ) { - let sourceMapFilePath: server.ScriptInfo["sourceMapFilePath"]; - // action - verifyAllFnActionWorker(session, ({ reqName, response, expectedResponse, expectedResponseNoMap }, dtsInfo, isFirst) => { - assert.deepEqual(response, expectedResponseNoMap || expectedResponse, `Failed on ${reqName}`); - verifyInfosWhenNoMapFile(session, host, dependencyTsOK); - assert.isUndefined(session.getProjectService().filenameToScriptInfo.get(dtsMapPath)); - if (isFirst) { - assert.isNotString(dtsInfo!.sourceMapFilePath); - assert.isNotFalse(dtsInfo!.sourceMapFilePath); - assert.isDefined(dtsInfo!.sourceMapFilePath); - sourceMapFilePath = dtsInfo!.sourceMapFilePath; - } - else { - assert.equal(dtsInfo!.sourceMapFilePath, sourceMapFilePath); + if (!first && (fn !== 1 || !freshMapInfo)) { + verifyDocumentPositionMapper({ + session, + dependencyMap, + documentPositionMapper, + equal: fn !== 1 || !freshDocumentMapper, + debugInfo + }); } - }); - return sourceMapFilePath; + sourceMapPath = dtsInfo && dtsInfo.sourceMapFilePath; + dependencyMap = dtsMapInfo; + documentPositionMapper = dependencyMap && dependencyMap.documentPositionMapper; + first = false; + } } - function verifyAllFnActionWithNoDts( - session: TestSession, - host: TestServerHost, - dependencyTsAndMapOk?: true - ) { - // action - verifyAllFnActionWorker(session, ({ reqName, response, expectedResponse, expectedResponseNoDts, verifier }) => { - assert.deepEqual(response, expectedResponseNoDts || expectedResponse, `Failed on ${reqName}`); - verifyInfosWhenNoDtsFile( - session, - host, - // Even when project actual file contains dts, its not watched because the dts is in another folder and module resolution just fails - // instead of succeeding to source file and then mapping using project reference (When using usage location) - // But watched if sourcemapper is in source project since we need to keep track of dts to update the source mapper for any potential usages - verifier.expectedProjectActualFiles.every(f => f.toLowerCase() !== dtsPath), - dependencyTsAndMapOk, - ); - }, /*dtsAbsent*/ true); - } + return { actionInfos, actionKey, dependencyMap, documentPositionMapper }; + } + + function verifyScriptInfoCollection( + session: TestSession, + host: TestServerHost, + verifiers: readonly DocumentPositionMapperVerifier[], + { dependencyMap, documentPositionMapper, actionInfos, actionKey }: VerifyAllFnActionResult + ) { + // Collecting at this point retains dependency.d.ts and map + closeFilesForSession([randomFile], session); + openFilesForSession([randomFile], session); + + const { closedInfos, otherWatchedFiles } = last(actionInfos); + const debugInfo = `${actionKey} Collection`; + verifyInfosWithRandom( + session, + host, + openFiles(verifiers).map(f => f.path), + closedInfos, + otherWatchedFiles, + debugInfo + ); + verifyDocumentPositionMapper({ + session, + dependencyMap, + documentPositionMapper, + equal: true, + debugInfo + }); + + // Closing open file, removes dependencies too + closeFilesForSession([...openFiles(verifiers), randomFile], session); + openFilesForSession([randomFile], session); + verifyOnlyRandomInfos(session, host); + } + + function verifyScenarioAndScriptInfoCollection( + session: TestSession, + host: TestServerHost, + verifiers: readonly DocumentPositionMapperVerifier[], + actionKey: ActionKey, + noDts?: true + ) { + // Main scenario action + const result = verifyAllFnAction({ session, host, verifiers, actionKey }); + checkProject(session, verifiers, noDts); + verifyScriptInfoCollection(session, host, verifiers, result); + } - function verifyScenarioWithChangesWorker( - change: (host: TestServerHost, session: TestSession) => void, - afterActionDocumentPositionMapperNotEquals: true | undefined, - timeoutBeforeAction: boolean - ) { - const { host, session } = openTsFile(); + function verifyScenarioWithChangesWorker( + { + scenarioName, + verifier, + withRefs, + change, + afterChangeActionKey + }: VerifyScenarioWithChanges, + timeoutBeforeAction: boolean, + ) { + it(scenarioName, () => { + const { host, session, verifiers } = openTsFile({ verifier, withRefs }); // Create DocumentPositionMapper - firstAction(session); - const dependencyMap = session.getProjectService().filenameToScriptInfo.get(dtsMapPath)!; - const documentPositionMapper = dependencyMap.documentPositionMapper; + firstAction(session, verifiers); + const dependencyMap = session.getProjectService().filenameToScriptInfo.get(dtsMapPath); + const documentPositionMapper = dependencyMap && dependencyMap.documentPositionMapper; // change - change(host, session); + change(host, session, verifiers); if (timeoutBeforeAction) { host.runQueuedTimeoutCallbacks(); - checkProject(session); - verifyDocumentPositionMapper(session, dependencyMap, documentPositionMapper); + checkProject(session, verifiers); + verifyDocumentPositionMapper({ + session, + dependencyMap, + documentPositionMapper, + equal: true, + debugInfo: "After change timeout" + }); } // action - verifyAllFnAction(session, host, afterActionDocumentPositionMapperNotEquals, dependencyMap, documentPositionMapper); - } - - function verifyScenarioWithChanges( - scenarioName: string, - change: (host: TestServerHost, session: TestSession) => void, - afterActionDocumentPositionMapperNotEquals?: true - ) { - describe(scenarioName, () => { - it("when timeout occurs before request", () => { - verifyScenarioWithChangesWorker(change, afterActionDocumentPositionMapperNotEquals, /*timeoutBeforeAction*/ true); - }); - - it("when timeout does not occur before request", () => { - verifyScenarioWithChangesWorker(change, afterActionDocumentPositionMapperNotEquals, /*timeoutBeforeAction*/ false); - }); - }); - } - - function verifyMainScenarioAndScriptInfoCollection(session: TestSession, host: TestServerHost) { - // Main scenario action - const { dependencyMap, documentPositionMapper } = verifyAllFnAction(session, host); - checkProject(session); - verifyInfos(session, host); - - // Collecting at this point retains dependency.d.ts and map - closeFilesForSession([randomFile], session); - openFilesForSession([randomFile], session); - verifyInfos(session, host); - verifyDocumentPositionMapper(session, dependencyMap, documentPositionMapper); - - // Closing open file, removes dependencies too - closeFilesForSession([...openFiles, randomFile], session); - openFilesForSession([randomFile], session); - verifyOnlyRandomInfos(session, host); - } - - function verifyMainScenarioAndScriptInfoCollectionWithNoMap(session: TestSession, host: TestServerHost, dependencyTsOKInScenario?: true) { - // Main scenario action - verifyAllFnActionWithNoMap(session, host, dependencyTsOKInScenario); - - // Collecting at this point retains dependency.d.ts and map watcher - closeFilesForSession([randomFile], session); - openFilesForSession([randomFile], session); - verifyInfosWhenNoMapFile(session, host); - - // Closing open file, removes dependencies too - closeFilesForSession([...openFiles, randomFile], session); - openFilesForSession([randomFile], session); - verifyOnlyRandomInfos(session, host); - } - - function verifyMainScenarioAndScriptInfoCollectionWithNoDts(session: TestSession, host: TestServerHost, dependencyTsAndMapOk?: true) { - // Main scenario action - verifyAllFnActionWithNoDts(session, host, dependencyTsAndMapOk); - - // Collecting at this point retains dependency.d.ts and map watcher - closeFilesForSession([randomFile], session); - openFilesForSession([randomFile], session); - verifyInfosWhenNoDtsFile( + verifyAllFnAction({ session, host, - !!forEach(verifier, v => v.expectedProjectActualFiles.every(f => f.toLowerCase() !== dtsPath)) - ); + verifiers, + actionKey: afterChangeActionKey, + dependencyMap, + documentPositionMapper + }); + }); + } - // Closing open file, removes dependencies too - closeFilesForSession([...openFiles, randomFile], session); - openFilesForSession([randomFile], session); - verifyOnlyRandomInfos(session, host); - } + interface VerifyScenarioWithChanges extends VerifierAndWithRefs { + scenarioName: string; + change: (host: TestServerHost, session: TestSession, verifiers: readonly DocumentPositionMapperVerifier[]) => void; + afterChangeActionKey: ActionKey; + } + function verifyScenarioWithChanges(verify: VerifyScenarioWithChanges) { + describe("when timeout occurs before request", () => { + verifyScenarioWithChangesWorker(verify, /*timeoutBeforeAction*/ true); + }); - function verifyScenarioWhenFileNotPresent( - scenarioName: string, - fileLocation: string, - verifyScenarioAndScriptInfoCollection: (session: TestSession, host: TestServerHost, dependencyTsOk?: true) => void, - noDts?: true - ) { - describe(scenarioName, () => { - it(mainScenario, () => { - const { host, session } = openTsFile(host => host.deleteFile(fileLocation)); - checkProject(session, noDts); - - verifyScenarioAndScriptInfoCollection(session, host); + describe("when timeout does not occur before request", () => { + verifyScenarioWithChangesWorker(verify, /*timeoutBeforeAction*/ false); + }); + } + + interface VerifyScenarioWhenFileNotPresent extends VerifierAndWithRefs { + scenarioName: string; + fileLocation: string; + fileNotPresentKey: ActionKey; + fileCreatedKey: ActionKey; + fileDeletedKey: ActionKey; + noDts?: true; + } + function verifyScenarioWhenFileNotPresent({ + scenarioName, + verifier, + withRefs, + fileLocation, + fileNotPresentKey, + fileCreatedKey, + fileDeletedKey, + noDts + }: VerifyScenarioWhenFileNotPresent) { + describe(scenarioName, () => { + it("when file is not present", () => { + const { host, session, verifiers } = openTsFile({ + verifier, + withRefs, + onHostCreate: host => host.deleteFile(fileLocation) }); + checkProject(session, verifiers, noDts); + + verifyScenarioAndScriptInfoCollection(session, host, verifiers, fileNotPresentKey, noDts); + }); - it("when file is created", () => { - let fileContents: string | undefined; - const { host, session } = openTsFile(host => { + it("when file is created after actions on projects", () => { + let fileContents: string | undefined; + const { host, session, verifiers } = openTsFile({ + verifier, + withRefs, + onHostCreate: host => { fileContents = host.readFile(fileLocation); host.deleteFile(fileLocation); - }); - firstAction(session); - - host.writeFile(fileLocation, fileContents!); - verifyMainScenarioAndScriptInfoCollection(session, host); + } }); + firstAction(session, verifiers); - it("when file is deleted", () => { - const { host, session } = openTsFile(); - firstAction(session); + host.writeFile(fileLocation, fileContents!); + verifyScenarioAndScriptInfoCollection(session, host, verifiers, fileCreatedKey); + }); - // The dependency file is deleted when orphan files are collected - host.deleteFile(fileLocation); - verifyScenarioAndScriptInfoCollection(session, host, /*dependencyTsOk*/ true); - }); + it("when file is deleted after actions on the projects", () => { + const { host, session, verifiers } = openTsFile({ verifier, withRefs }); + firstAction(session, verifiers); + + // The dependency file is deleted when orphan files are collected + host.deleteFile(fileLocation); + // Verify with deleted action key + verifyAllFnAction({ session, host, verifiers, actionKey: fileDeletedKey }); + checkProject(session, verifiers, noDts); + + // Script info collection should behave as fileNotPresentKey + verifyScriptInfoCollection( + session, + host, + verifiers, + { + actionInfos: getActionInfo(verifiers, fileNotPresentKey), + actionKey: fileNotPresentKey, + dependencyMap: undefined, + documentPositionMapper: undefined + } + ); }); - } + }); + } + function verifyScenarioWorker({ mainScenario, verifier }: VerifyScenario, withRefs: boolean, disableSourceOfProjectReferenceRedirect?: true) { it(mainScenario, () => { - const { host, session } = openTsFile(); - checkProject(session); - - verifyMainScenarioAndScriptInfoCollection(session, host); + const { host, session, verifiers } = openTsFile({ withRefs, disableSourceOfProjectReferenceRedirect, verifier }); + checkProject(session, verifiers); + verifyScenarioAndScriptInfoCollection(session, host, verifiers, "main"); }); // Edit - verifyScenarioWithChanges( - "when usage file changes, document position mapper doesnt change", - (_host, session) => openFiles.forEach( - (openFile, index) => session.executeCommandSeq({ + verifyScenarioWithChanges({ + scenarioName: "when usage file changes, document position mapper doesnt change", + verifier, + withRefs, + disableSourceOfProjectReferenceRedirect, + change: (_host, session, verifiers) => verifiers.forEach( + verifier => session.executeCommandSeq({ command: protocol.CommandTypes.Change, - arguments: { file: openFile.path, line: openFileLastLines[index], offset: 1, endLine: openFileLastLines[index], endOffset: 1, insertString: "const x = 10;" } + arguments: { + file: verifier.openFile.path, + line: verifier.openFileLastLine, + offset: 1, + endLine: verifier.openFileLastLine, + endOffset: 1, + insertString: "const x = 10;" + } }) - ) - ); + ), + afterChangeActionKey: "change" + }); // Edit dts to add new fn - verifyScenarioWithChanges( - "when dependency .d.ts changes, document position mapper doesnt change", - host => host.writeFile( + verifyScenarioWithChanges({ + scenarioName: "when dependency .d.ts changes, document position mapper doesnt change", + verifier, + withRefs, + disableSourceOfProjectReferenceRedirect, + change: host => host.writeFile( dtsLocation, host.readFile(dtsLocation)!.replace( "//# sourceMappingURL=FnS.d.ts.map", `export declare function fn6(): void; //# sourceMappingURL=FnS.d.ts.map` ) - ) - ); + ), + afterChangeActionKey: "dtsChange" + }); // Edit map file to represent added new line - verifyScenarioWithChanges( - "when dependency file's map changes", - host => host.writeFile( + verifyScenarioWithChanges({ + scenarioName: "when dependency file's map changes", + verifier, + withRefs, + disableSourceOfProjectReferenceRedirect, + change: host => host.writeFile( dtsMapLocation, `{"version":3,"file":"FnS.d.ts","sourceRoot":"","sources":["../dependency/FnS.ts"],"names":[],"mappings":"AAAA,wBAAgB,GAAG,SAAM;AACzB,wBAAgB,GAAG,SAAM;AACzB,wBAAgB,GAAG,SAAM;AACzB,wBAAgB,GAAG,SAAM;AACzB,wBAAgB,GAAG,SAAM;AACzB,eAAO,MAAM,CAAC,KAAK,CAAC"}` ), - /*afterActionDocumentPositionMapperNotEquals*/ true - ); + afterChangeActionKey: "mapChange" + }); - verifyScenarioWhenFileNotPresent( - "when map file is not present", - dtsMapLocation, - verifyMainScenarioAndScriptInfoCollectionWithNoMap - ); + verifyScenarioWhenFileNotPresent({ + scenarioName: "with depedency files map file", + verifier, + withRefs, + disableSourceOfProjectReferenceRedirect, + fileLocation: dtsMapLocation, + fileNotPresentKey: "noMap", + fileCreatedKey: "mapFileCreated", + fileDeletedKey: "mapFileDeleted" + }); - verifyScenarioWhenFileNotPresent( - "when .d.ts file is not present", - dtsLocation, - verifyMainScenarioAndScriptInfoCollectionWithNoDts, - /*noDts*/ true - ); - } + verifyScenarioWhenFileNotPresent({ + scenarioName: "with depedency .d.ts file", + verifier, + withRefs, + disableSourceOfProjectReferenceRedirect, + fileLocation: dtsLocation, + fileNotPresentKey: "noDts", + fileCreatedKey: "dtsFileCreated", + fileDeletedKey: "dtsFileDeleted", + noDts: true + }); - function verifyScenarios(withRefs: boolean) { - describe(withRefs ? "when main tsconfig has project reference" : "when main tsconfig doesnt have project reference", () => { - const usageVerifier: DocumentPositionMapperVerifier = { - openFile: mainTs, - expectedProjectActualFiles: [mainTs.path, libFile.path, mainConfig.path, dtsPath], - actionGetter: gotoDefintinionFromMainTs, - openFileLastLine: 14 - }; - describe("from project that uses dependency", () => { - const closedInfos = withRefs ? - [dependencyTs.path, dependencyConfig.path, libFile.path, dtsPath, dtsMapLocation] : - [dependencyTs.path, libFile.path, dtsPath, dtsMapLocation]; - verifyDocumentPositionMapperUpdates( - "can go to definition correctly", - [usageVerifier], - closedInfos, - withRefs - ); + if (withRefs && !disableSourceOfProjectReferenceRedirect) { + verifyScenarioWithChanges({ + scenarioName: "when defining project source changes", + verifier, + withRefs, + change: (host, session, verifiers) => { + // Make change, without rebuild of solution + if (contains(openFiles(verifiers), dependencyTs)) { + session.executeCommandSeq({ + command: protocol.CommandTypes.Change, + arguments: { + file: dependencyTs.path, line: 1, offset: 1, endLine: 1, endOffset: 1, insertString: `function fooBar() { } +`} + }); + } + else { + host.writeFile(dependencyTs.path, `function fooBar() { } +${dependencyTs.content}`); + } + }, + afterChangeActionKey: "dependencyChange" }); - const definingVerifier: DocumentPositionMapperVerifier = { - openFile: dependencyTs, - expectedProjectActualFiles: [dependencyTs.path, libFile.path, dependencyConfig.path], - actionGetter: renameFromDependencyTs, - openFileLastLine: 6, - }; - describe("from defining project", () => { - const closedInfos = [libFile.path, dtsLocation, dtsMapLocation]; - verifyDocumentPositionMapperUpdates( - "rename locations from dependency", - [definingVerifier], - closedInfos, - withRefs - ); + it("when projects are not built", () => { + const host = createServerHost(files); + const session = createSession(host); + const verifiers = verifier(withRefs); + openFilesForSession([...openFiles(verifiers), randomFile], session); + verifyScenarioAndScriptInfoCollection(session, host, verifiers, "noBuild"); }); + } + } - describe("when opening depedency and usage project", () => { - const closedInfos = withRefs ? - [libFile.path, dtsPath, dtsMapLocation, dependencyConfig.path] : - [libFile.path, dtsPath, dtsMapLocation]; - verifyDocumentPositionMapperUpdates( - "goto Definition in usage and rename locations from defining project", - [usageVerifier, { ...definingVerifier, actionGetter: renameFromDependencyTsWithBothProjectsOpen }], - closedInfos, - withRefs - ); - }); + interface VerifyScenario { + mainScenario: string; + verifier: (withRefs: boolean) => readonly DocumentPositionMapperVerifier[]; + } + function verifyScenario(scenario: VerifyScenario) { + describe("when main tsconfig doesnt have project reference", () => { + verifyScenarioWorker(scenario, /*withRefs*/ false); + }); + describe("when main tsconfig has project reference", () => { + verifyScenarioWorker(scenario, /*withRefs*/ true); + }); + describe("when main tsconfig has but has disableSourceOfProjectReferenceRedirect", () => { + verifyScenarioWorker(scenario, /*withRefs*/ true); }); } - verifyScenarios(/*withRefs*/ false); - verifyScenarios(/*withRefs*/ true); + describe("from project that uses dependency", () => { + verifyScenario({ + mainScenario: "can go to definition correctly", + verifier: withRefs => [ + { + ...goToDefFromMainTsProjectInfoVerifier(withRefs), + main: () => ({ + action: goToDefFromMainTs, + closedInfos: withRefs ? + [dependencyTs.path, dependencyConfig.path, libFile.path] : + [dependencyTs.path, libFile.path, dtsPath, dtsMapLocation], + otherWatchedFiles: [mainConfig.path], + expectsDts: !withRefs, // Dts script info present only if no project reference + expectsMap: !withRefs // Map script info present only if no project reference + }), + change: "main", + dtsChange: "main", + mapChange: ["main", () => ({ + freshDocumentMapper: true + })], + noMap: withRefs ? + "main" : + ["main", main => ({ + action: goToDefFromMainTsWithNoMap, + // Because map is deleted, dts and dependency are released + closedInfos: removePath(main.closedInfos, dtsMapPath, dependencyTsPath), + // Watches deleted file + otherWatchedFiles: main.otherWatchedFiles.concat(dtsMapLocation), + expectsMap: false + })], + mapFileCreated: "main", + mapFileDeleted: withRefs ? + "main" : + ["noMap", noMap => ({ + // The script info for depedency is collected only after file open + closedInfos: noMap.closedInfos.concat(dependencyTs.path) + })], + noDts: withRefs ? + "main" : + ["main", main => ({ + action: goToDefFromMainTsWithNoDts, + // No dts, no map, no dependency + closedInfos: removePath(main.closedInfos, dtsPath, dtsMapPath, dependencyTsPath), + expectsDts: false, + expectsMap: false + })], + dtsFileCreated: "main", + dtsFileDeleted: withRefs ? + "main" : + ["noDts", noDts => ({ + // The script info for map is collected only after file open + closedInfos: noDts.closedInfos.concat(dependencyTs.path, dtsMapLocation), + expectsMap: true + })], + dependencyChange: ["main", () => ({ + action: goToDefFromMainTsWithDependencyChange, + })], + noBuild: "noDts" + } + ] + }); + }); + + describe("from defining project", () => { + verifyScenario({ + mainScenario: "rename locations from dependency", + verifier: () => [ + { + ...renameFromDependencyTsProjectInfoVerifier(), + main: () => ({ + action: renameFromDependencyTs, + closedInfos: [libFile.path, dtsLocation, dtsMapLocation], + otherWatchedFiles: [dependencyConfig.path], + expectsDts: true, + expectsMap: true + }), + change: "main", + dtsChange: "main", + mapChange: ["main", () => ({ + freshDocumentMapper: true + })], + noMap: ["main", main => ({ + // No map + closedInfos: removePath(main.closedInfos, dtsMapPath), + // watch map + otherWatchedFiles: [...main.otherWatchedFiles, dtsMapLocation], + expectsMap: false + })], + mapFileCreated: "main", + mapFileDeleted: "noMap", + noDts: ["main", main => ({ + // no dts or map since dts itself doesnt exist + closedInfos: removePath(main.closedInfos, dtsMapPath, dtsPath), + // watch deleted file + otherWatchedFiles: [...main.otherWatchedFiles, dtsLocation], + expectsDts: false, + expectsMap: false + })], + dtsFileCreated: "main", + dtsFileDeleted: ["noDts", noDts => ({ + // Map is collected after file open + closedInfos: noDts.closedInfos.concat(dtsMapLocation), + expectsMap: true + })], + dependencyChange: ["main", () => ({ + action: renameFromDependencyTsWithDependencyChange + })], + noBuild: "noDts" + } + ] + }); + }); + + describe("when opening depedency and usage project", () => { + verifyScenario({ + mainScenario: "goto Definition in usage and rename locations from defining project", + verifier: withRefs => [ + { + ...goToDefFromMainTsProjectInfoVerifier(withRefs), + main: () => ({ + action: goToDefFromMainTs, + // DependencyTs is open, so omit it from closed infos + closedInfos: withRefs ? + [dependencyConfig.path, libFile.path] : + [libFile.path, dtsPath, dtsMapLocation], + otherWatchedFiles: withRefs ? + [mainConfig.path] : // Its in closed info + [mainConfig.path, dependencyConfig.path], + expectsDts: !withRefs, // Dts script info present only if no project reference + expectsMap: !withRefs // Map script info present only if no project reference + }), + change: withRefs ? + ["main", main => ({ + // Because before this rename is done the closed info remains same as rename's main operation + closedInfos: main.closedInfos.concat(dtsLocation, dtsMapLocation), + expectsDts: true, + expectsMap: true + })] : + "main", + dtsChange: "change", + mapChange: "change", + noMap: withRefs ? + "main" : + ["main", main => ({ + action: goToDefFromMainTsWithNoMap, + closedInfos: removePath(main.closedInfos, dtsMapPath), + otherWatchedFiles: main.otherWatchedFiles.concat(dtsMapLocation), + expectsMap: false + })], + mapFileCreated: withRefs ? + ["main", main => ({ + // Because before this rename is done the closed info remains same as rename's main + closedInfos: main.closedInfos.concat(dtsLocation), + expectsDts: true, + // This operation doesnt need map so the map info path in dts is not refreshed + skipDtsMapCheck: withRefs + })] : + "main", + mapFileDeleted: withRefs ? + ["noMap", noMap => ({ + // Because before this rename is done the closed info remains same as rename's noMap operation + closedInfos: noMap.closedInfos.concat(dtsLocation), + expectsDts: true, + // This operation doesnt need map so the map info path in dts is not refreshed + skipDtsMapCheck: true + })] : + "noMap", + noDts: withRefs ? + "main" : + ["main", main => ({ + action: goToDefFromMainTsWithNoDts, + closedInfos: removePath(main.closedInfos, dtsMapPath, dtsPath), + expectsDts: false, + expectsMap: false + })], + dtsFileCreated: withRefs ? + ["main", main => ({ + // Since the project for dependency is not updated, the watcher from rename for dts still there + otherWatchedFiles: main.otherWatchedFiles.concat(dtsLocation) + })] : + "main", + dtsFileDeleted: ["noDts", noDts => ({ + // Map collection after file open + closedInfos: noDts.closedInfos.concat(dtsMapLocation), + expectsMap: true + })], + dependencyChange: ["change", () => ({ + action: goToDefFromMainTsWithDependencyChange, + })], + noBuild: "noDts" + }, + { + ...renameFromDependencyTsProjectInfoVerifier(), + main: () => ({ + action: renameFromDependencyTsWithBothProjectsOpen, + // DependencyTs is open, so omit it from closed infos + closedInfos: withRefs ? + [dependencyConfig.path, libFile.path, dtsLocation, dtsMapLocation] : + [libFile.path, dtsPath, dtsMapLocation], + otherWatchedFiles: withRefs ? + [mainConfig.path] : // Its in closed info + [mainConfig.path, dependencyConfig.path], + expectsDts: true, + expectsMap: true, + freshMapInfo: withRefs + }), + change: ["main", () => ({ + freshMapInfo: false + })], + dtsChange: "change", + mapChange: ["main", () => ({ + freshMapInfo: false, + freshDocumentMapper: withRefs + })], + noMap: ["main", main => ({ + action: withRefs ? + renameFromDependencyTsWithBothProjectsOpen : + renameFromDependencyTs, + closedInfos: removePath(main.closedInfos, dtsMapPath), + otherWatchedFiles: main.otherWatchedFiles.concat(dtsMapLocation), + expectsMap: false, + freshDocumentMapper: withRefs + })], + mapFileCreated: "main", + mapFileDeleted: "noMap", + noDts: ["change", change => ({ + action: withRefs ? + renameFromDependencyTsWithBothProjectsOpen : + renameFromDependencyTs, + closedInfos: removePath(change.closedInfos, dtsPath, dtsMapPath), + otherWatchedFiles: change.otherWatchedFiles.concat(dtsLocation), + expectsDts: false, + expectsMap: false + })], + dtsFileCreated: "main", + dtsFileDeleted: ["noDts", noDts => ({ + // Map collection after file open + closedInfos: noDts.closedInfos.concat(dtsMapLocation) , + expectsMap: true + })], + dependencyChange: ["change", () => ({ + action: renameFromDependencyTsWithBothProjectsOpenWithDependencyChange + })], + noBuild: "noDts" + } + ] + }); + }); }); it("reusing d.ts files from composite and non composite projects", () => { @@ -774,7 +1246,7 @@ fn5(); service.openClientFile(cTs.path); service.checkNumberOfProjects({ configuredProjects: 2 }); const projectC = service.configuredProjects.get(configC.path)!; - checkProjectActualFiles(projectC, [cTs.path, bDts.path, libFile.path, configC.path]); + checkProjectActualFiles(projectC, [cTs.path, bTs.path, libFile.path, configC.path]); // Now new project for project A tries to reuse b but there is no filesByName mapping for b's source location host.writeFile(a2Ts.path, `${a2Ts.content}export const y = 30;`); diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 6620848321c63..f7a65687f3b61 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -73,7 +73,7 @@ declare namespace ts { end: number; } export type JSDocSyntaxKind = SyntaxKind.EndOfFileToken | SyntaxKind.WhitespaceTrivia | SyntaxKind.AtToken | SyntaxKind.NewLineTrivia | SyntaxKind.AsteriskToken | SyntaxKind.OpenBraceToken | SyntaxKind.CloseBraceToken | SyntaxKind.LessThanToken | SyntaxKind.GreaterThanToken | SyntaxKind.OpenBracketToken | SyntaxKind.CloseBracketToken | SyntaxKind.EqualsToken | SyntaxKind.CommaToken | SyntaxKind.DotToken | SyntaxKind.Identifier | SyntaxKind.BacktickToken | SyntaxKind.Unknown | KeywordSyntaxKind; - export type KeywordSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.BreakKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword | SyntaxKind.ContinueKeyword | SyntaxKind.ConstKeyword | SyntaxKind.ConstructorKeyword | SyntaxKind.DebuggerKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.DeleteKeyword | SyntaxKind.DoKeyword | SyntaxKind.ElseKeyword | SyntaxKind.EnumKeyword | SyntaxKind.ExportKeyword | SyntaxKind.ExtendsKeyword | SyntaxKind.FalseKeyword | SyntaxKind.FinallyKeyword | SyntaxKind.ForKeyword | SyntaxKind.FromKeyword | SyntaxKind.FunctionKeyword | SyntaxKind.GetKeyword | SyntaxKind.IfKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InKeyword | SyntaxKind.InferKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.InterfaceKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.LetKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NewKeyword | SyntaxKind.NullKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.PackageKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.RequireKeyword | SyntaxKind.GlobalKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SetKeyword | SyntaxKind.StaticKeyword | SyntaxKind.StringKeyword | SyntaxKind.SuperKeyword | SyntaxKind.SwitchKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.ThisKeyword | SyntaxKind.ThrowKeyword | SyntaxKind.TrueKeyword | SyntaxKind.TryKeyword | SyntaxKind.TypeKeyword | SyntaxKind.TypeOfKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VarKeyword | SyntaxKind.VoidKeyword | SyntaxKind.WhileKeyword | SyntaxKind.WithKeyword | SyntaxKind.YieldKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.AwaitKeyword | SyntaxKind.OfKeyword; + export type KeywordSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsKeyword | SyntaxKind.AssertsKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.BreakKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword | SyntaxKind.ContinueKeyword | SyntaxKind.ConstKeyword | SyntaxKind.ConstructorKeyword | SyntaxKind.DebuggerKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.DeleteKeyword | SyntaxKind.DoKeyword | SyntaxKind.ElseKeyword | SyntaxKind.EnumKeyword | SyntaxKind.ExportKeyword | SyntaxKind.ExtendsKeyword | SyntaxKind.FalseKeyword | SyntaxKind.FinallyKeyword | SyntaxKind.ForKeyword | SyntaxKind.FromKeyword | SyntaxKind.FunctionKeyword | SyntaxKind.GetKeyword | SyntaxKind.IfKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InKeyword | SyntaxKind.InferKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.InterfaceKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.LetKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NewKeyword | SyntaxKind.NullKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.PackageKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.RequireKeyword | SyntaxKind.GlobalKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SetKeyword | SyntaxKind.StaticKeyword | SyntaxKind.StringKeyword | SyntaxKind.SuperKeyword | SyntaxKind.SwitchKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.ThisKeyword | SyntaxKind.ThrowKeyword | SyntaxKind.TrueKeyword | SyntaxKind.TryKeyword | SyntaxKind.TypeKeyword | SyntaxKind.TypeOfKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VarKeyword | SyntaxKind.VoidKeyword | SyntaxKind.WhileKeyword | SyntaxKind.WithKeyword | SyntaxKind.YieldKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.AwaitKeyword | SyntaxKind.OfKeyword; export type JsxTokenSyntaxKind = SyntaxKind.LessThanSlashToken | SyntaxKind.EndOfFileToken | SyntaxKind.ConflictMarkerTrivia | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.OpenBraceToken | SyntaxKind.LessThanToken; export enum SyntaxKind { Unknown = 0, @@ -198,206 +198,207 @@ declare namespace ts { YieldKeyword = 118, AbstractKeyword = 119, AsKeyword = 120, - AnyKeyword = 121, - AsyncKeyword = 122, - AwaitKeyword = 123, - BooleanKeyword = 124, - ConstructorKeyword = 125, - DeclareKeyword = 126, - GetKeyword = 127, - InferKeyword = 128, - IsKeyword = 129, - KeyOfKeyword = 130, - ModuleKeyword = 131, - NamespaceKeyword = 132, - NeverKeyword = 133, - ReadonlyKeyword = 134, - RequireKeyword = 135, - NumberKeyword = 136, - ObjectKeyword = 137, - SetKeyword = 138, - StringKeyword = 139, - SymbolKeyword = 140, - TypeKeyword = 141, - UndefinedKeyword = 142, - UniqueKeyword = 143, - UnknownKeyword = 144, - FromKeyword = 145, - GlobalKeyword = 146, - BigIntKeyword = 147, - OfKeyword = 148, - QualifiedName = 149, - ComputedPropertyName = 150, - TypeParameter = 151, - Parameter = 152, - Decorator = 153, - PropertySignature = 154, - PropertyDeclaration = 155, - MethodSignature = 156, - MethodDeclaration = 157, - Constructor = 158, - GetAccessor = 159, - SetAccessor = 160, - CallSignature = 161, - ConstructSignature = 162, - IndexSignature = 163, - TypePredicate = 164, - TypeReference = 165, - FunctionType = 166, - ConstructorType = 167, - TypeQuery = 168, - TypeLiteral = 169, - ArrayType = 170, - TupleType = 171, - OptionalType = 172, - RestType = 173, - UnionType = 174, - IntersectionType = 175, - ConditionalType = 176, - InferType = 177, - ParenthesizedType = 178, - ThisType = 179, - TypeOperator = 180, - IndexedAccessType = 181, - MappedType = 182, - LiteralType = 183, - ImportType = 184, - ObjectBindingPattern = 185, - ArrayBindingPattern = 186, - BindingElement = 187, - ArrayLiteralExpression = 188, - ObjectLiteralExpression = 189, - PropertyAccessExpression = 190, - ElementAccessExpression = 191, - CallExpression = 192, - NewExpression = 193, - TaggedTemplateExpression = 194, - TypeAssertionExpression = 195, - ParenthesizedExpression = 196, - FunctionExpression = 197, - ArrowFunction = 198, - DeleteExpression = 199, - TypeOfExpression = 200, - VoidExpression = 201, - AwaitExpression = 202, - PrefixUnaryExpression = 203, - PostfixUnaryExpression = 204, - BinaryExpression = 205, - ConditionalExpression = 206, - TemplateExpression = 207, - YieldExpression = 208, - SpreadElement = 209, - ClassExpression = 210, - OmittedExpression = 211, - ExpressionWithTypeArguments = 212, - AsExpression = 213, - NonNullExpression = 214, - MetaProperty = 215, - SyntheticExpression = 216, - TemplateSpan = 217, - SemicolonClassElement = 218, - Block = 219, - VariableStatement = 220, + AssertsKeyword = 121, + AnyKeyword = 122, + AsyncKeyword = 123, + AwaitKeyword = 124, + BooleanKeyword = 125, + ConstructorKeyword = 126, + DeclareKeyword = 127, + GetKeyword = 128, + InferKeyword = 129, + IsKeyword = 130, + KeyOfKeyword = 131, + ModuleKeyword = 132, + NamespaceKeyword = 133, + NeverKeyword = 134, + ReadonlyKeyword = 135, + RequireKeyword = 136, + NumberKeyword = 137, + ObjectKeyword = 138, + SetKeyword = 139, + StringKeyword = 140, + SymbolKeyword = 141, + TypeKeyword = 142, + UndefinedKeyword = 143, + UniqueKeyword = 144, + UnknownKeyword = 145, + FromKeyword = 146, + GlobalKeyword = 147, + BigIntKeyword = 148, + OfKeyword = 149, + QualifiedName = 150, + ComputedPropertyName = 151, + TypeParameter = 152, + Parameter = 153, + Decorator = 154, + PropertySignature = 155, + PropertyDeclaration = 156, + MethodSignature = 157, + MethodDeclaration = 158, + Constructor = 159, + GetAccessor = 160, + SetAccessor = 161, + CallSignature = 162, + ConstructSignature = 163, + IndexSignature = 164, + TypePredicate = 165, + TypeReference = 166, + FunctionType = 167, + ConstructorType = 168, + TypeQuery = 169, + TypeLiteral = 170, + ArrayType = 171, + TupleType = 172, + OptionalType = 173, + RestType = 174, + UnionType = 175, + IntersectionType = 176, + ConditionalType = 177, + InferType = 178, + ParenthesizedType = 179, + ThisType = 180, + TypeOperator = 181, + IndexedAccessType = 182, + MappedType = 183, + LiteralType = 184, + ImportType = 185, + ObjectBindingPattern = 186, + ArrayBindingPattern = 187, + BindingElement = 188, + ArrayLiteralExpression = 189, + ObjectLiteralExpression = 190, + PropertyAccessExpression = 191, + ElementAccessExpression = 192, + CallExpression = 193, + NewExpression = 194, + TaggedTemplateExpression = 195, + TypeAssertionExpression = 196, + ParenthesizedExpression = 197, + FunctionExpression = 198, + ArrowFunction = 199, + DeleteExpression = 200, + TypeOfExpression = 201, + VoidExpression = 202, + AwaitExpression = 203, + PrefixUnaryExpression = 204, + PostfixUnaryExpression = 205, + BinaryExpression = 206, + ConditionalExpression = 207, + TemplateExpression = 208, + YieldExpression = 209, + SpreadElement = 210, + ClassExpression = 211, + OmittedExpression = 212, + ExpressionWithTypeArguments = 213, + AsExpression = 214, + NonNullExpression = 215, + MetaProperty = 216, + SyntheticExpression = 217, + TemplateSpan = 218, + SemicolonClassElement = 219, + Block = 220, EmptyStatement = 221, - ExpressionStatement = 222, - IfStatement = 223, - DoStatement = 224, - WhileStatement = 225, - ForStatement = 226, - ForInStatement = 227, - ForOfStatement = 228, - ContinueStatement = 229, - BreakStatement = 230, - ReturnStatement = 231, - WithStatement = 232, - SwitchStatement = 233, - LabeledStatement = 234, - ThrowStatement = 235, - TryStatement = 236, - DebuggerStatement = 237, - VariableDeclaration = 238, - VariableDeclarationList = 239, - FunctionDeclaration = 240, - ClassDeclaration = 241, - InterfaceDeclaration = 242, - TypeAliasDeclaration = 243, - EnumDeclaration = 244, - ModuleDeclaration = 245, - ModuleBlock = 246, - CaseBlock = 247, - NamespaceExportDeclaration = 248, - ImportEqualsDeclaration = 249, - ImportDeclaration = 250, - ImportClause = 251, - NamespaceImport = 252, - NamedImports = 253, - ImportSpecifier = 254, - ExportAssignment = 255, - ExportDeclaration = 256, - NamedExports = 257, - ExportSpecifier = 258, - MissingDeclaration = 259, - ExternalModuleReference = 260, - JsxElement = 261, - JsxSelfClosingElement = 262, - JsxOpeningElement = 263, - JsxClosingElement = 264, - JsxFragment = 265, - JsxOpeningFragment = 266, - JsxClosingFragment = 267, - JsxAttribute = 268, - JsxAttributes = 269, - JsxSpreadAttribute = 270, - JsxExpression = 271, - CaseClause = 272, - DefaultClause = 273, - HeritageClause = 274, - CatchClause = 275, - PropertyAssignment = 276, - ShorthandPropertyAssignment = 277, - SpreadAssignment = 278, - EnumMember = 279, - UnparsedPrologue = 280, - UnparsedPrepend = 281, - UnparsedText = 282, - UnparsedInternalText = 283, - UnparsedSyntheticReference = 284, - SourceFile = 285, - Bundle = 286, - UnparsedSource = 287, - InputFiles = 288, - JSDocTypeExpression = 289, - JSDocAllType = 290, - JSDocUnknownType = 291, - JSDocNullableType = 292, - JSDocNonNullableType = 293, - JSDocOptionalType = 294, - JSDocFunctionType = 295, - JSDocVariadicType = 296, - JSDocNamepathType = 297, - JSDocComment = 298, - JSDocTypeLiteral = 299, - JSDocSignature = 300, - JSDocTag = 301, - JSDocAugmentsTag = 302, - JSDocAuthorTag = 303, - JSDocClassTag = 304, - JSDocCallbackTag = 305, - JSDocEnumTag = 306, - JSDocParameterTag = 307, - JSDocReturnTag = 308, - JSDocThisTag = 309, - JSDocTypeTag = 310, - JSDocTemplateTag = 311, - JSDocTypedefTag = 312, - JSDocPropertyTag = 313, - SyntaxList = 314, - NotEmittedStatement = 315, - PartiallyEmittedExpression = 316, - CommaListExpression = 317, - MergeDeclarationMarker = 318, - EndOfDeclarationMarker = 319, - Count = 320, + VariableStatement = 222, + ExpressionStatement = 223, + IfStatement = 224, + DoStatement = 225, + WhileStatement = 226, + ForStatement = 227, + ForInStatement = 228, + ForOfStatement = 229, + ContinueStatement = 230, + BreakStatement = 231, + ReturnStatement = 232, + WithStatement = 233, + SwitchStatement = 234, + LabeledStatement = 235, + ThrowStatement = 236, + TryStatement = 237, + DebuggerStatement = 238, + VariableDeclaration = 239, + VariableDeclarationList = 240, + FunctionDeclaration = 241, + ClassDeclaration = 242, + InterfaceDeclaration = 243, + TypeAliasDeclaration = 244, + EnumDeclaration = 245, + ModuleDeclaration = 246, + ModuleBlock = 247, + CaseBlock = 248, + NamespaceExportDeclaration = 249, + ImportEqualsDeclaration = 250, + ImportDeclaration = 251, + ImportClause = 252, + NamespaceImport = 253, + NamedImports = 254, + ImportSpecifier = 255, + ExportAssignment = 256, + ExportDeclaration = 257, + NamedExports = 258, + ExportSpecifier = 259, + MissingDeclaration = 260, + ExternalModuleReference = 261, + JsxElement = 262, + JsxSelfClosingElement = 263, + JsxOpeningElement = 264, + JsxClosingElement = 265, + JsxFragment = 266, + JsxOpeningFragment = 267, + JsxClosingFragment = 268, + JsxAttribute = 269, + JsxAttributes = 270, + JsxSpreadAttribute = 271, + JsxExpression = 272, + CaseClause = 273, + DefaultClause = 274, + HeritageClause = 275, + CatchClause = 276, + PropertyAssignment = 277, + ShorthandPropertyAssignment = 278, + SpreadAssignment = 279, + EnumMember = 280, + UnparsedPrologue = 281, + UnparsedPrepend = 282, + UnparsedText = 283, + UnparsedInternalText = 284, + UnparsedSyntheticReference = 285, + SourceFile = 286, + Bundle = 287, + UnparsedSource = 288, + InputFiles = 289, + JSDocTypeExpression = 290, + JSDocAllType = 291, + JSDocUnknownType = 292, + JSDocNullableType = 293, + JSDocNonNullableType = 294, + JSDocOptionalType = 295, + JSDocFunctionType = 296, + JSDocVariadicType = 297, + JSDocNamepathType = 298, + JSDocComment = 299, + JSDocTypeLiteral = 300, + JSDocSignature = 301, + JSDocTag = 302, + JSDocAugmentsTag = 303, + JSDocAuthorTag = 304, + JSDocClassTag = 305, + JSDocCallbackTag = 306, + JSDocEnumTag = 307, + JSDocParameterTag = 308, + JSDocReturnTag = 309, + JSDocThisTag = 310, + JSDocTypeTag = 311, + JSDocTemplateTag = 312, + JSDocTypedefTag = 313, + JSDocPropertyTag = 314, + SyntaxList = 315, + NotEmittedStatement = 316, + PartiallyEmittedExpression = 317, + CommaListExpression = 318, + MergeDeclarationMarker = 319, + EndOfDeclarationMarker = 320, + Count = 321, FirstAssignment = 60, LastAssignment = 72, FirstCompoundAssignment = 61, @@ -405,15 +406,15 @@ declare namespace ts { FirstReservedWord = 74, LastReservedWord = 109, FirstKeyword = 74, - LastKeyword = 148, + LastKeyword = 149, FirstFutureReservedWord = 110, LastFutureReservedWord = 118, - FirstTypeNode = 164, - LastTypeNode = 184, + FirstTypeNode = 165, + LastTypeNode = 185, FirstPunctuation = 18, LastPunctuation = 72, FirstToken = 0, - LastToken = 148, + LastToken = 149, FirstTriviaToken = 2, LastTriviaToken = 7, FirstLiteralToken = 8, @@ -422,11 +423,13 @@ declare namespace ts { LastTemplateToken = 17, FirstBinaryOperator = 28, LastBinaryOperator = 72, - FirstNode = 149, - FirstJSDocNode = 289, - LastJSDocNode = 313, - FirstJSDocTagNode = 301, - LastJSDocTagNode = 313, + FirstStatement = 222, + LastStatement = 238, + FirstNode = 150, + FirstJSDocNode = 290, + LastJSDocNode = 314, + FirstJSDocTagNode = 302, + LastJSDocTagNode = 314, } export enum NodeFlags { None = 0, @@ -517,6 +520,7 @@ declare namespace ts { export type AwaitKeywordToken = Token; export type PlusToken = Token; export type MinusToken = Token; + export type AssertsToken = Token; export type Modifier = Token | Token | Token | Token | Token | Token | Token | Token | Token | Token | Token; export type ModifiersArray = NodeArray; export interface Identifier extends PrimaryExpression, Declaration { @@ -770,8 +774,9 @@ declare namespace ts { export interface TypePredicateNode extends TypeNode { kind: SyntaxKind.TypePredicate; parent: SignatureDeclaration | JSDocTypeExpression; + assertsModifier?: AssertsToken; parameterName: Identifier | ThisTypeNode; - type: TypeNode; + type?: TypeNode; } export interface TypeQueryNode extends TypeNode { kind: SyntaxKind.TypeQuery; @@ -1669,13 +1674,19 @@ declare namespace ts { FalseCondition = 64, SwitchClause = 128, ArrayMutation = 256, - Referenced = 512, - Shared = 1024, - PreFinally = 2048, - AfterFinally = 4096, + Call = 512, + Referenced = 1024, + Shared = 2048, + PreFinally = 4096, + AfterFinally = 8192, Label = 12, Condition = 96 } + export type FlowNode = AfterFinallyFlow | PreFinallyFlow | FlowStart | FlowLabel | FlowAssignment | FlowCall | FlowCondition | FlowSwitchClause | FlowArrayMutation; + export interface FlowNodeBase { + flags: FlowFlags; + id?: number; + } export interface FlowLock { locked?: boolean; } @@ -1686,13 +1697,8 @@ declare namespace ts { antecedent: FlowNode; lock: FlowLock; } - export type FlowNode = AfterFinallyFlow | PreFinallyFlow | FlowStart | FlowLabel | FlowAssignment | FlowCondition | FlowSwitchClause | FlowArrayMutation; - export interface FlowNodeBase { - flags: FlowFlags; - id?: number; - } export interface FlowStart extends FlowNodeBase { - container?: FunctionExpression | ArrowFunction | MethodDeclaration; + node?: FunctionExpression | ArrowFunction | MethodDeclaration; } export interface FlowLabel extends FlowNodeBase { antecedents: FlowNode[] | undefined; @@ -1701,8 +1707,12 @@ declare namespace ts { node: Expression | VariableDeclaration | BindingElement; antecedent: FlowNode; } + export interface FlowCall extends FlowNodeBase { + node: CallExpression; + antecedent: FlowNode; + } export interface FlowCondition extends FlowNodeBase { - expression: Expression; + node: Expression; antecedent: FlowNode; } export interface FlowSwitchClause extends FlowNodeBase { @@ -1883,6 +1893,15 @@ declare namespace ts { * Gets a type checker that can be used to semantically analyze source files in the program. */ getTypeChecker(): TypeChecker; + getNodeCount(): number; + getIdentifierCount(): number; + getSymbolCount(): number; + getTypeCount(): number; + getRelationCacheSizes(): { + assignable: number; + identity: number; + subtype: number; + }; isSourceFileFromExternalLibrary(file: SourceFile): boolean; isSourceFileDefaultLibrary(file: SourceFile): boolean; getProjectReferences(): readonly ProjectReference[] | undefined; @@ -2089,21 +2108,39 @@ declare namespace ts { } export enum TypePredicateKind { This = 0, - Identifier = 1 + Identifier = 1, + AssertsThis = 2, + AssertsIdentifier = 3 } export interface TypePredicateBase { kind: TypePredicateKind; - type: Type; + type: Type | undefined; } export interface ThisTypePredicate extends TypePredicateBase { kind: TypePredicateKind.This; + parameterName: undefined; + parameterIndex: undefined; + type: Type; } export interface IdentifierTypePredicate extends TypePredicateBase { kind: TypePredicateKind.Identifier; parameterName: string; parameterIndex: number; + type: Type; + } + export interface AssertsThisTypePredicate extends TypePredicateBase { + kind: TypePredicateKind.AssertsThis; + parameterName: undefined; + parameterIndex: undefined; + type: Type | undefined; + } + export interface AssertsIdentifierTypePredicate extends TypePredicateBase { + kind: TypePredicateKind.AssertsIdentifier; + parameterName: string; + parameterIndex: number; + type: Type | undefined; } - export type TypePredicate = IdentifierTypePredicate | ThisTypePredicate; + export type TypePredicate = ThisTypePredicate | IdentifierTypePredicate | AssertsThisTypePredicate | AssertsIdentifierTypePredicate; export enum SymbolFlags { None = 0, FunctionScopedVariable = 1, @@ -2331,7 +2368,7 @@ declare namespace ts { localTypeParameters: TypeParameter[] | undefined; thisType: TypeParameter | undefined; } - export type BaseType = ObjectType | IntersectionType; + export type BaseType = ObjectType | IntersectionType | TypeVariable; export interface InterfaceTypeWithDeclaredMembers extends InterfaceType { declaredProperties: Symbol[]; declaredCallSignatures: Signature[]; @@ -2530,6 +2567,7 @@ declare namespace ts { emitDeclarationOnly?: boolean; declarationDir?: string; disableSizeLimit?: boolean; + disableSourceOfProjectReferenceRedirect?: boolean; downlevelIteration?: boolean; emitBOM?: boolean; emitDecoratorMetadata?: boolean; @@ -3265,7 +3303,7 @@ declare namespace ts { parent: ConstructorDeclaration; name: Identifier; }; - function isParameterPropertyDeclaration(node: Node): node is ParameterPropertyDeclaration; + function isParameterPropertyDeclaration(node: Node, parent: Node): node is ParameterPropertyDeclaration; function isEmptyBindingPattern(node: BindingName): node is BindingPattern; function isEmptyBindingElement(node: BindingElement): boolean; function walkUpBindingElementsAndPatterns(binding: BindingElement): VariableDeclaration | ParameterDeclaration; @@ -3836,7 +3874,9 @@ declare namespace ts { function updateIndexSignature(node: IndexSignatureDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode): IndexSignatureDeclaration; function createKeywordTypeNode(kind: KeywordTypeNode["kind"]): KeywordTypeNode; function createTypePredicateNode(parameterName: Identifier | ThisTypeNode | string, type: TypeNode): TypePredicateNode; + function createTypePredicateNodeWithModifier(assertsModifier: AssertsToken | undefined, parameterName: Identifier | ThisTypeNode | string, type: TypeNode | undefined): TypePredicateNode; function updateTypePredicateNode(node: TypePredicateNode, parameterName: Identifier | ThisTypeNode, type: TypeNode): TypePredicateNode; + function updateTypePredicateNodeWithModifier(node: TypePredicateNode, assertsModifier: AssertsToken | undefined, parameterName: Identifier | ThisTypeNode, type: TypeNode | undefined): TypePredicateNode; function createTypeReferenceNode(typeName: string | EntityName, typeArguments: readonly TypeNode[] | undefined): TypeReferenceNode; function updateTypeReferenceNode(node: TypeReferenceNode, typeName: EntityName, typeArguments: NodeArray | undefined): TypeReferenceNode; function createFunctionTypeNode(typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined): FunctionTypeNode; @@ -4280,6 +4320,8 @@ declare namespace ts { function visitEachChild(node: T | undefined, visitor: Visitor, context: TransformationContext, nodesVisitor?: typeof visitNodes, tokenVisitor?: Visitor): T | undefined; } declare namespace ts { + function getTsBuildInfoEmitOutputFilePath(options: CompilerOptions): string | undefined; + function getOutputFileNames(commandLine: ParsedCommandLine, inputFileName: string, ignoreCase: boolean): readonly string[]; function createPrinter(printerOptions?: PrinterOptions, handlers?: PrintHandlers): Printer; } declare namespace ts { @@ -8488,7 +8530,6 @@ declare namespace ts.server { getGlobalProjectErrors(): readonly Diagnostic[]; getAllProjectErrors(): readonly Diagnostic[]; getLanguageService(ensureSynchronized?: boolean): LanguageService; - private shouldEmitFile; getCompileOnSaveAffectedFileList(scriptInfo: ScriptInfo): string[]; /** * Returns true if emit was conducted @@ -8569,11 +8610,25 @@ declare namespace ts.server { private typeAcquisition; private directoriesWatchedForWildcards; readonly canonicalConfigFilePath: NormalizedPath; + private projectReferenceCallbacks; + private mapOfDeclarationDirectories; /** Ref count to the project when opened from external project */ private externalProjectRefCount; private projectErrors; private projectReferences; protected isInitialLoadPending: () => boolean; + /** + * This implementation of fileExists checks if the file being requested is + * .d.ts file for the referenced Project. + * If it is it returns true irrespective of whether that file exists on host + */ + fileExists(file: string): boolean; + /** + * This implementation of directoryExists checks if the directory being requested is + * directory of .d.ts file for the referenced Project. + * If it is it returns true irrespective of whether that directory exists on host + */ + directoryExists(path: string): boolean; /** * If the project has reload from disk pending, it reloads (and then updates graph as part of that) instead of just updating the graph * @returns: true if set of files in the project stays the same and false - otherwise. diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index eaef5a454e20b..23fd01a86c1ba 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -73,7 +73,7 @@ declare namespace ts { end: number; } export type JSDocSyntaxKind = SyntaxKind.EndOfFileToken | SyntaxKind.WhitespaceTrivia | SyntaxKind.AtToken | SyntaxKind.NewLineTrivia | SyntaxKind.AsteriskToken | SyntaxKind.OpenBraceToken | SyntaxKind.CloseBraceToken | SyntaxKind.LessThanToken | SyntaxKind.GreaterThanToken | SyntaxKind.OpenBracketToken | SyntaxKind.CloseBracketToken | SyntaxKind.EqualsToken | SyntaxKind.CommaToken | SyntaxKind.DotToken | SyntaxKind.Identifier | SyntaxKind.BacktickToken | SyntaxKind.Unknown | KeywordSyntaxKind; - export type KeywordSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.BreakKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword | SyntaxKind.ContinueKeyword | SyntaxKind.ConstKeyword | SyntaxKind.ConstructorKeyword | SyntaxKind.DebuggerKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.DeleteKeyword | SyntaxKind.DoKeyword | SyntaxKind.ElseKeyword | SyntaxKind.EnumKeyword | SyntaxKind.ExportKeyword | SyntaxKind.ExtendsKeyword | SyntaxKind.FalseKeyword | SyntaxKind.FinallyKeyword | SyntaxKind.ForKeyword | SyntaxKind.FromKeyword | SyntaxKind.FunctionKeyword | SyntaxKind.GetKeyword | SyntaxKind.IfKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InKeyword | SyntaxKind.InferKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.InterfaceKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.LetKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NewKeyword | SyntaxKind.NullKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.PackageKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.RequireKeyword | SyntaxKind.GlobalKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SetKeyword | SyntaxKind.StaticKeyword | SyntaxKind.StringKeyword | SyntaxKind.SuperKeyword | SyntaxKind.SwitchKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.ThisKeyword | SyntaxKind.ThrowKeyword | SyntaxKind.TrueKeyword | SyntaxKind.TryKeyword | SyntaxKind.TypeKeyword | SyntaxKind.TypeOfKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VarKeyword | SyntaxKind.VoidKeyword | SyntaxKind.WhileKeyword | SyntaxKind.WithKeyword | SyntaxKind.YieldKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.AwaitKeyword | SyntaxKind.OfKeyword; + export type KeywordSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsKeyword | SyntaxKind.AssertsKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.BreakKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword | SyntaxKind.ContinueKeyword | SyntaxKind.ConstKeyword | SyntaxKind.ConstructorKeyword | SyntaxKind.DebuggerKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.DeleteKeyword | SyntaxKind.DoKeyword | SyntaxKind.ElseKeyword | SyntaxKind.EnumKeyword | SyntaxKind.ExportKeyword | SyntaxKind.ExtendsKeyword | SyntaxKind.FalseKeyword | SyntaxKind.FinallyKeyword | SyntaxKind.ForKeyword | SyntaxKind.FromKeyword | SyntaxKind.FunctionKeyword | SyntaxKind.GetKeyword | SyntaxKind.IfKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InKeyword | SyntaxKind.InferKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.InterfaceKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.LetKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NewKeyword | SyntaxKind.NullKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.PackageKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.RequireKeyword | SyntaxKind.GlobalKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SetKeyword | SyntaxKind.StaticKeyword | SyntaxKind.StringKeyword | SyntaxKind.SuperKeyword | SyntaxKind.SwitchKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.ThisKeyword | SyntaxKind.ThrowKeyword | SyntaxKind.TrueKeyword | SyntaxKind.TryKeyword | SyntaxKind.TypeKeyword | SyntaxKind.TypeOfKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VarKeyword | SyntaxKind.VoidKeyword | SyntaxKind.WhileKeyword | SyntaxKind.WithKeyword | SyntaxKind.YieldKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.AwaitKeyword | SyntaxKind.OfKeyword; export type JsxTokenSyntaxKind = SyntaxKind.LessThanSlashToken | SyntaxKind.EndOfFileToken | SyntaxKind.ConflictMarkerTrivia | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.OpenBraceToken | SyntaxKind.LessThanToken; export enum SyntaxKind { Unknown = 0, @@ -198,206 +198,207 @@ declare namespace ts { YieldKeyword = 118, AbstractKeyword = 119, AsKeyword = 120, - AnyKeyword = 121, - AsyncKeyword = 122, - AwaitKeyword = 123, - BooleanKeyword = 124, - ConstructorKeyword = 125, - DeclareKeyword = 126, - GetKeyword = 127, - InferKeyword = 128, - IsKeyword = 129, - KeyOfKeyword = 130, - ModuleKeyword = 131, - NamespaceKeyword = 132, - NeverKeyword = 133, - ReadonlyKeyword = 134, - RequireKeyword = 135, - NumberKeyword = 136, - ObjectKeyword = 137, - SetKeyword = 138, - StringKeyword = 139, - SymbolKeyword = 140, - TypeKeyword = 141, - UndefinedKeyword = 142, - UniqueKeyword = 143, - UnknownKeyword = 144, - FromKeyword = 145, - GlobalKeyword = 146, - BigIntKeyword = 147, - OfKeyword = 148, - QualifiedName = 149, - ComputedPropertyName = 150, - TypeParameter = 151, - Parameter = 152, - Decorator = 153, - PropertySignature = 154, - PropertyDeclaration = 155, - MethodSignature = 156, - MethodDeclaration = 157, - Constructor = 158, - GetAccessor = 159, - SetAccessor = 160, - CallSignature = 161, - ConstructSignature = 162, - IndexSignature = 163, - TypePredicate = 164, - TypeReference = 165, - FunctionType = 166, - ConstructorType = 167, - TypeQuery = 168, - TypeLiteral = 169, - ArrayType = 170, - TupleType = 171, - OptionalType = 172, - RestType = 173, - UnionType = 174, - IntersectionType = 175, - ConditionalType = 176, - InferType = 177, - ParenthesizedType = 178, - ThisType = 179, - TypeOperator = 180, - IndexedAccessType = 181, - MappedType = 182, - LiteralType = 183, - ImportType = 184, - ObjectBindingPattern = 185, - ArrayBindingPattern = 186, - BindingElement = 187, - ArrayLiteralExpression = 188, - ObjectLiteralExpression = 189, - PropertyAccessExpression = 190, - ElementAccessExpression = 191, - CallExpression = 192, - NewExpression = 193, - TaggedTemplateExpression = 194, - TypeAssertionExpression = 195, - ParenthesizedExpression = 196, - FunctionExpression = 197, - ArrowFunction = 198, - DeleteExpression = 199, - TypeOfExpression = 200, - VoidExpression = 201, - AwaitExpression = 202, - PrefixUnaryExpression = 203, - PostfixUnaryExpression = 204, - BinaryExpression = 205, - ConditionalExpression = 206, - TemplateExpression = 207, - YieldExpression = 208, - SpreadElement = 209, - ClassExpression = 210, - OmittedExpression = 211, - ExpressionWithTypeArguments = 212, - AsExpression = 213, - NonNullExpression = 214, - MetaProperty = 215, - SyntheticExpression = 216, - TemplateSpan = 217, - SemicolonClassElement = 218, - Block = 219, - VariableStatement = 220, + AssertsKeyword = 121, + AnyKeyword = 122, + AsyncKeyword = 123, + AwaitKeyword = 124, + BooleanKeyword = 125, + ConstructorKeyword = 126, + DeclareKeyword = 127, + GetKeyword = 128, + InferKeyword = 129, + IsKeyword = 130, + KeyOfKeyword = 131, + ModuleKeyword = 132, + NamespaceKeyword = 133, + NeverKeyword = 134, + ReadonlyKeyword = 135, + RequireKeyword = 136, + NumberKeyword = 137, + ObjectKeyword = 138, + SetKeyword = 139, + StringKeyword = 140, + SymbolKeyword = 141, + TypeKeyword = 142, + UndefinedKeyword = 143, + UniqueKeyword = 144, + UnknownKeyword = 145, + FromKeyword = 146, + GlobalKeyword = 147, + BigIntKeyword = 148, + OfKeyword = 149, + QualifiedName = 150, + ComputedPropertyName = 151, + TypeParameter = 152, + Parameter = 153, + Decorator = 154, + PropertySignature = 155, + PropertyDeclaration = 156, + MethodSignature = 157, + MethodDeclaration = 158, + Constructor = 159, + GetAccessor = 160, + SetAccessor = 161, + CallSignature = 162, + ConstructSignature = 163, + IndexSignature = 164, + TypePredicate = 165, + TypeReference = 166, + FunctionType = 167, + ConstructorType = 168, + TypeQuery = 169, + TypeLiteral = 170, + ArrayType = 171, + TupleType = 172, + OptionalType = 173, + RestType = 174, + UnionType = 175, + IntersectionType = 176, + ConditionalType = 177, + InferType = 178, + ParenthesizedType = 179, + ThisType = 180, + TypeOperator = 181, + IndexedAccessType = 182, + MappedType = 183, + LiteralType = 184, + ImportType = 185, + ObjectBindingPattern = 186, + ArrayBindingPattern = 187, + BindingElement = 188, + ArrayLiteralExpression = 189, + ObjectLiteralExpression = 190, + PropertyAccessExpression = 191, + ElementAccessExpression = 192, + CallExpression = 193, + NewExpression = 194, + TaggedTemplateExpression = 195, + TypeAssertionExpression = 196, + ParenthesizedExpression = 197, + FunctionExpression = 198, + ArrowFunction = 199, + DeleteExpression = 200, + TypeOfExpression = 201, + VoidExpression = 202, + AwaitExpression = 203, + PrefixUnaryExpression = 204, + PostfixUnaryExpression = 205, + BinaryExpression = 206, + ConditionalExpression = 207, + TemplateExpression = 208, + YieldExpression = 209, + SpreadElement = 210, + ClassExpression = 211, + OmittedExpression = 212, + ExpressionWithTypeArguments = 213, + AsExpression = 214, + NonNullExpression = 215, + MetaProperty = 216, + SyntheticExpression = 217, + TemplateSpan = 218, + SemicolonClassElement = 219, + Block = 220, EmptyStatement = 221, - ExpressionStatement = 222, - IfStatement = 223, - DoStatement = 224, - WhileStatement = 225, - ForStatement = 226, - ForInStatement = 227, - ForOfStatement = 228, - ContinueStatement = 229, - BreakStatement = 230, - ReturnStatement = 231, - WithStatement = 232, - SwitchStatement = 233, - LabeledStatement = 234, - ThrowStatement = 235, - TryStatement = 236, - DebuggerStatement = 237, - VariableDeclaration = 238, - VariableDeclarationList = 239, - FunctionDeclaration = 240, - ClassDeclaration = 241, - InterfaceDeclaration = 242, - TypeAliasDeclaration = 243, - EnumDeclaration = 244, - ModuleDeclaration = 245, - ModuleBlock = 246, - CaseBlock = 247, - NamespaceExportDeclaration = 248, - ImportEqualsDeclaration = 249, - ImportDeclaration = 250, - ImportClause = 251, - NamespaceImport = 252, - NamedImports = 253, - ImportSpecifier = 254, - ExportAssignment = 255, - ExportDeclaration = 256, - NamedExports = 257, - ExportSpecifier = 258, - MissingDeclaration = 259, - ExternalModuleReference = 260, - JsxElement = 261, - JsxSelfClosingElement = 262, - JsxOpeningElement = 263, - JsxClosingElement = 264, - JsxFragment = 265, - JsxOpeningFragment = 266, - JsxClosingFragment = 267, - JsxAttribute = 268, - JsxAttributes = 269, - JsxSpreadAttribute = 270, - JsxExpression = 271, - CaseClause = 272, - DefaultClause = 273, - HeritageClause = 274, - CatchClause = 275, - PropertyAssignment = 276, - ShorthandPropertyAssignment = 277, - SpreadAssignment = 278, - EnumMember = 279, - UnparsedPrologue = 280, - UnparsedPrepend = 281, - UnparsedText = 282, - UnparsedInternalText = 283, - UnparsedSyntheticReference = 284, - SourceFile = 285, - Bundle = 286, - UnparsedSource = 287, - InputFiles = 288, - JSDocTypeExpression = 289, - JSDocAllType = 290, - JSDocUnknownType = 291, - JSDocNullableType = 292, - JSDocNonNullableType = 293, - JSDocOptionalType = 294, - JSDocFunctionType = 295, - JSDocVariadicType = 296, - JSDocNamepathType = 297, - JSDocComment = 298, - JSDocTypeLiteral = 299, - JSDocSignature = 300, - JSDocTag = 301, - JSDocAugmentsTag = 302, - JSDocAuthorTag = 303, - JSDocClassTag = 304, - JSDocCallbackTag = 305, - JSDocEnumTag = 306, - JSDocParameterTag = 307, - JSDocReturnTag = 308, - JSDocThisTag = 309, - JSDocTypeTag = 310, - JSDocTemplateTag = 311, - JSDocTypedefTag = 312, - JSDocPropertyTag = 313, - SyntaxList = 314, - NotEmittedStatement = 315, - PartiallyEmittedExpression = 316, - CommaListExpression = 317, - MergeDeclarationMarker = 318, - EndOfDeclarationMarker = 319, - Count = 320, + VariableStatement = 222, + ExpressionStatement = 223, + IfStatement = 224, + DoStatement = 225, + WhileStatement = 226, + ForStatement = 227, + ForInStatement = 228, + ForOfStatement = 229, + ContinueStatement = 230, + BreakStatement = 231, + ReturnStatement = 232, + WithStatement = 233, + SwitchStatement = 234, + LabeledStatement = 235, + ThrowStatement = 236, + TryStatement = 237, + DebuggerStatement = 238, + VariableDeclaration = 239, + VariableDeclarationList = 240, + FunctionDeclaration = 241, + ClassDeclaration = 242, + InterfaceDeclaration = 243, + TypeAliasDeclaration = 244, + EnumDeclaration = 245, + ModuleDeclaration = 246, + ModuleBlock = 247, + CaseBlock = 248, + NamespaceExportDeclaration = 249, + ImportEqualsDeclaration = 250, + ImportDeclaration = 251, + ImportClause = 252, + NamespaceImport = 253, + NamedImports = 254, + ImportSpecifier = 255, + ExportAssignment = 256, + ExportDeclaration = 257, + NamedExports = 258, + ExportSpecifier = 259, + MissingDeclaration = 260, + ExternalModuleReference = 261, + JsxElement = 262, + JsxSelfClosingElement = 263, + JsxOpeningElement = 264, + JsxClosingElement = 265, + JsxFragment = 266, + JsxOpeningFragment = 267, + JsxClosingFragment = 268, + JsxAttribute = 269, + JsxAttributes = 270, + JsxSpreadAttribute = 271, + JsxExpression = 272, + CaseClause = 273, + DefaultClause = 274, + HeritageClause = 275, + CatchClause = 276, + PropertyAssignment = 277, + ShorthandPropertyAssignment = 278, + SpreadAssignment = 279, + EnumMember = 280, + UnparsedPrologue = 281, + UnparsedPrepend = 282, + UnparsedText = 283, + UnparsedInternalText = 284, + UnparsedSyntheticReference = 285, + SourceFile = 286, + Bundle = 287, + UnparsedSource = 288, + InputFiles = 289, + JSDocTypeExpression = 290, + JSDocAllType = 291, + JSDocUnknownType = 292, + JSDocNullableType = 293, + JSDocNonNullableType = 294, + JSDocOptionalType = 295, + JSDocFunctionType = 296, + JSDocVariadicType = 297, + JSDocNamepathType = 298, + JSDocComment = 299, + JSDocTypeLiteral = 300, + JSDocSignature = 301, + JSDocTag = 302, + JSDocAugmentsTag = 303, + JSDocAuthorTag = 304, + JSDocClassTag = 305, + JSDocCallbackTag = 306, + JSDocEnumTag = 307, + JSDocParameterTag = 308, + JSDocReturnTag = 309, + JSDocThisTag = 310, + JSDocTypeTag = 311, + JSDocTemplateTag = 312, + JSDocTypedefTag = 313, + JSDocPropertyTag = 314, + SyntaxList = 315, + NotEmittedStatement = 316, + PartiallyEmittedExpression = 317, + CommaListExpression = 318, + MergeDeclarationMarker = 319, + EndOfDeclarationMarker = 320, + Count = 321, FirstAssignment = 60, LastAssignment = 72, FirstCompoundAssignment = 61, @@ -405,15 +406,15 @@ declare namespace ts { FirstReservedWord = 74, LastReservedWord = 109, FirstKeyword = 74, - LastKeyword = 148, + LastKeyword = 149, FirstFutureReservedWord = 110, LastFutureReservedWord = 118, - FirstTypeNode = 164, - LastTypeNode = 184, + FirstTypeNode = 165, + LastTypeNode = 185, FirstPunctuation = 18, LastPunctuation = 72, FirstToken = 0, - LastToken = 148, + LastToken = 149, FirstTriviaToken = 2, LastTriviaToken = 7, FirstLiteralToken = 8, @@ -422,11 +423,13 @@ declare namespace ts { LastTemplateToken = 17, FirstBinaryOperator = 28, LastBinaryOperator = 72, - FirstNode = 149, - FirstJSDocNode = 289, - LastJSDocNode = 313, - FirstJSDocTagNode = 301, - LastJSDocTagNode = 313, + FirstStatement = 222, + LastStatement = 238, + FirstNode = 150, + FirstJSDocNode = 290, + LastJSDocNode = 314, + FirstJSDocTagNode = 302, + LastJSDocTagNode = 314, } export enum NodeFlags { None = 0, @@ -517,6 +520,7 @@ declare namespace ts { export type AwaitKeywordToken = Token; export type PlusToken = Token; export type MinusToken = Token; + export type AssertsToken = Token; export type Modifier = Token | Token | Token | Token | Token | Token | Token | Token | Token | Token | Token; export type ModifiersArray = NodeArray; export interface Identifier extends PrimaryExpression, Declaration { @@ -770,8 +774,9 @@ declare namespace ts { export interface TypePredicateNode extends TypeNode { kind: SyntaxKind.TypePredicate; parent: SignatureDeclaration | JSDocTypeExpression; + assertsModifier?: AssertsToken; parameterName: Identifier | ThisTypeNode; - type: TypeNode; + type?: TypeNode; } export interface TypeQueryNode extends TypeNode { kind: SyntaxKind.TypeQuery; @@ -1669,13 +1674,19 @@ declare namespace ts { FalseCondition = 64, SwitchClause = 128, ArrayMutation = 256, - Referenced = 512, - Shared = 1024, - PreFinally = 2048, - AfterFinally = 4096, + Call = 512, + Referenced = 1024, + Shared = 2048, + PreFinally = 4096, + AfterFinally = 8192, Label = 12, Condition = 96 } + export type FlowNode = AfterFinallyFlow | PreFinallyFlow | FlowStart | FlowLabel | FlowAssignment | FlowCall | FlowCondition | FlowSwitchClause | FlowArrayMutation; + export interface FlowNodeBase { + flags: FlowFlags; + id?: number; + } export interface FlowLock { locked?: boolean; } @@ -1686,13 +1697,8 @@ declare namespace ts { antecedent: FlowNode; lock: FlowLock; } - export type FlowNode = AfterFinallyFlow | PreFinallyFlow | FlowStart | FlowLabel | FlowAssignment | FlowCondition | FlowSwitchClause | FlowArrayMutation; - export interface FlowNodeBase { - flags: FlowFlags; - id?: number; - } export interface FlowStart extends FlowNodeBase { - container?: FunctionExpression | ArrowFunction | MethodDeclaration; + node?: FunctionExpression | ArrowFunction | MethodDeclaration; } export interface FlowLabel extends FlowNodeBase { antecedents: FlowNode[] | undefined; @@ -1701,8 +1707,12 @@ declare namespace ts { node: Expression | VariableDeclaration | BindingElement; antecedent: FlowNode; } + export interface FlowCall extends FlowNodeBase { + node: CallExpression; + antecedent: FlowNode; + } export interface FlowCondition extends FlowNodeBase { - expression: Expression; + node: Expression; antecedent: FlowNode; } export interface FlowSwitchClause extends FlowNodeBase { @@ -1883,6 +1893,15 @@ declare namespace ts { * Gets a type checker that can be used to semantically analyze source files in the program. */ getTypeChecker(): TypeChecker; + getNodeCount(): number; + getIdentifierCount(): number; + getSymbolCount(): number; + getTypeCount(): number; + getRelationCacheSizes(): { + assignable: number; + identity: number; + subtype: number; + }; isSourceFileFromExternalLibrary(file: SourceFile): boolean; isSourceFileDefaultLibrary(file: SourceFile): boolean; getProjectReferences(): readonly ProjectReference[] | undefined; @@ -2089,21 +2108,39 @@ declare namespace ts { } export enum TypePredicateKind { This = 0, - Identifier = 1 + Identifier = 1, + AssertsThis = 2, + AssertsIdentifier = 3 } export interface TypePredicateBase { kind: TypePredicateKind; - type: Type; + type: Type | undefined; } export interface ThisTypePredicate extends TypePredicateBase { kind: TypePredicateKind.This; + parameterName: undefined; + parameterIndex: undefined; + type: Type; } export interface IdentifierTypePredicate extends TypePredicateBase { kind: TypePredicateKind.Identifier; parameterName: string; parameterIndex: number; + type: Type; + } + export interface AssertsThisTypePredicate extends TypePredicateBase { + kind: TypePredicateKind.AssertsThis; + parameterName: undefined; + parameterIndex: undefined; + type: Type | undefined; + } + export interface AssertsIdentifierTypePredicate extends TypePredicateBase { + kind: TypePredicateKind.AssertsIdentifier; + parameterName: string; + parameterIndex: number; + type: Type | undefined; } - export type TypePredicate = IdentifierTypePredicate | ThisTypePredicate; + export type TypePredicate = ThisTypePredicate | IdentifierTypePredicate | AssertsThisTypePredicate | AssertsIdentifierTypePredicate; export enum SymbolFlags { None = 0, FunctionScopedVariable = 1, @@ -2331,7 +2368,7 @@ declare namespace ts { localTypeParameters: TypeParameter[] | undefined; thisType: TypeParameter | undefined; } - export type BaseType = ObjectType | IntersectionType; + export type BaseType = ObjectType | IntersectionType | TypeVariable; export interface InterfaceTypeWithDeclaredMembers extends InterfaceType { declaredProperties: Symbol[]; declaredCallSignatures: Signature[]; @@ -2530,6 +2567,7 @@ declare namespace ts { emitDeclarationOnly?: boolean; declarationDir?: string; disableSizeLimit?: boolean; + disableSourceOfProjectReferenceRedirect?: boolean; downlevelIteration?: boolean; emitBOM?: boolean; emitDecoratorMetadata?: boolean; @@ -3265,7 +3303,7 @@ declare namespace ts { parent: ConstructorDeclaration; name: Identifier; }; - function isParameterPropertyDeclaration(node: Node): node is ParameterPropertyDeclaration; + function isParameterPropertyDeclaration(node: Node, parent: Node): node is ParameterPropertyDeclaration; function isEmptyBindingPattern(node: BindingName): node is BindingPattern; function isEmptyBindingElement(node: BindingElement): boolean; function walkUpBindingElementsAndPatterns(binding: BindingElement): VariableDeclaration | ParameterDeclaration; @@ -3836,7 +3874,9 @@ declare namespace ts { function updateIndexSignature(node: IndexSignatureDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode): IndexSignatureDeclaration; function createKeywordTypeNode(kind: KeywordTypeNode["kind"]): KeywordTypeNode; function createTypePredicateNode(parameterName: Identifier | ThisTypeNode | string, type: TypeNode): TypePredicateNode; + function createTypePredicateNodeWithModifier(assertsModifier: AssertsToken | undefined, parameterName: Identifier | ThisTypeNode | string, type: TypeNode | undefined): TypePredicateNode; function updateTypePredicateNode(node: TypePredicateNode, parameterName: Identifier | ThisTypeNode, type: TypeNode): TypePredicateNode; + function updateTypePredicateNodeWithModifier(node: TypePredicateNode, assertsModifier: AssertsToken | undefined, parameterName: Identifier | ThisTypeNode, type: TypeNode | undefined): TypePredicateNode; function createTypeReferenceNode(typeName: string | EntityName, typeArguments: readonly TypeNode[] | undefined): TypeReferenceNode; function updateTypeReferenceNode(node: TypeReferenceNode, typeName: EntityName, typeArguments: NodeArray | undefined): TypeReferenceNode; function createFunctionTypeNode(typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined): FunctionTypeNode; @@ -4280,6 +4320,8 @@ declare namespace ts { function visitEachChild(node: T | undefined, visitor: Visitor, context: TransformationContext, nodesVisitor?: typeof visitNodes, tokenVisitor?: Visitor): T | undefined; } declare namespace ts { + function getTsBuildInfoEmitOutputFilePath(options: CompilerOptions): string | undefined; + function getOutputFileNames(commandLine: ParsedCommandLine, inputFileName: string, ignoreCase: boolean): readonly string[]; function createPrinter(printerOptions?: PrinterOptions, handlers?: PrintHandlers): Printer; } declare namespace ts { diff --git a/tests/baselines/reference/arrayLiterals3.errors.txt b/tests/baselines/reference/arrayLiterals3.errors.txt index 4d398978c96c1..5f592b74f3ebc 100644 --- a/tests/baselines/reference/arrayLiterals3.errors.txt +++ b/tests/baselines/reference/arrayLiterals3.errors.txt @@ -8,10 +8,9 @@ tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(17,5): error tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(32,5): error TS2739: Type '(number[] | string[])[]' is missing the following properties from type 'tup': 0, 1 tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(33,5): error TS2739: Type 'number[]' is missing the following properties from type '[number, number, number]': 0, 1, 2 tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(34,5): error TS2322: Type '(string | number)[]' is not assignable to type 'myArray'. - Types of property 'pop' are incompatible. - Type '() => string | number' is not assignable to type '() => Number'. - Type 'string | number' is not assignable to type 'Number'. - Type 'string' is not assignable to type 'Number'. + The types returned by 'pop()' are incompatible between these types. + Type 'string | number' is not assignable to type 'Number'. + Type 'string' is not assignable to type 'Number'. ==== tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts (8 errors) ==== @@ -67,8 +66,7 @@ tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(34,5): error var c2: myArray = [...temp1, ...temp]; // Error cannot assign (number|string)[] to number[] ~~ !!! error TS2322: Type '(string | number)[]' is not assignable to type 'myArray'. -!!! error TS2322: Types of property 'pop' are incompatible. -!!! error TS2322: Type '() => string | number' is not assignable to type '() => Number'. -!!! error TS2322: Type 'string | number' is not assignable to type 'Number'. -!!! error TS2322: Type 'string' is not assignable to type 'Number'. +!!! error TS2322: The types returned by 'pop()' are incompatible between these types. +!!! error TS2322: Type 'string | number' is not assignable to type 'Number'. +!!! error TS2322: Type 'string' is not assignable to type 'Number'. \ No newline at end of file diff --git a/tests/baselines/reference/arrayOfSubtypeIsAssignableToReadonlyArray.errors.txt b/tests/baselines/reference/arrayOfSubtypeIsAssignableToReadonlyArray.errors.txt index 63d3a6f7b641e..66b3c2c869106 100644 --- a/tests/baselines/reference/arrayOfSubtypeIsAssignableToReadonlyArray.errors.txt +++ b/tests/baselines/reference/arrayOfSubtypeIsAssignableToReadonlyArray.errors.txt @@ -1,10 +1,9 @@ tests/cases/compiler/arrayOfSubtypeIsAssignableToReadonlyArray.ts(13,1): error TS2322: Type 'A[]' is not assignable to type 'readonly B[]'. Property 'b' is missing in type 'A' but required in type 'B'. tests/cases/compiler/arrayOfSubtypeIsAssignableToReadonlyArray.ts(18,1): error TS2322: Type 'C' is not assignable to type 'readonly B[]'. - Types of property 'concat' are incompatible. - Type '{ (...items: ConcatArray[]): A[]; (...items: (A | ConcatArray)[]): A[]; }' is not assignable to type '{ (...items: ConcatArray[]): B[]; (...items: (B | ConcatArray)[]): B[]; }'. - Type 'A[]' is not assignable to type 'B[]'. - Type 'A' is not assignable to type 'B'. + The types returned by 'concat(...)' are incompatible between these types. + Type 'A[]' is not assignable to type 'B[]'. + Type 'A' is not assignable to type 'B'. ==== tests/cases/compiler/arrayOfSubtypeIsAssignableToReadonlyArray.ts (2 errors) ==== @@ -32,8 +31,7 @@ tests/cases/compiler/arrayOfSubtypeIsAssignableToReadonlyArray.ts(18,1): error T rrb = cra; // error: 'A' is not assignable to 'B' ~~~ !!! error TS2322: Type 'C' is not assignable to type 'readonly B[]'. -!!! error TS2322: Types of property 'concat' are incompatible. -!!! error TS2322: Type '{ (...items: ConcatArray[]): A[]; (...items: (A | ConcatArray)[]): A[]; }' is not assignable to type '{ (...items: ConcatArray[]): B[]; (...items: (B | ConcatArray)[]): B[]; }'. -!!! error TS2322: Type 'A[]' is not assignable to type 'B[]'. -!!! error TS2322: Type 'A' is not assignable to type 'B'. +!!! error TS2322: The types returned by 'concat(...)' are incompatible between these types. +!!! error TS2322: Type 'A[]' is not assignable to type 'B[]'. +!!! error TS2322: Type 'A' is not assignable to type 'B'. \ No newline at end of file diff --git a/tests/baselines/reference/assertionTypePredicates1.errors.txt b/tests/baselines/reference/assertionTypePredicates1.errors.txt new file mode 100644 index 0000000000000..91d2e869bd2e2 --- /dev/null +++ b/tests/baselines/reference/assertionTypePredicates1.errors.txt @@ -0,0 +1,150 @@ +tests/cases/conformance/controlFlow/assertionTypePredicates1.ts(116,37): error TS1228: A type predicate is only allowed in return type position for functions and methods. +tests/cases/conformance/controlFlow/assertionTypePredicates1.ts(117,37): error TS1228: A type predicate is only allowed in return type position for functions and methods. +tests/cases/conformance/controlFlow/assertionTypePredicates1.ts(118,37): error TS1228: A type predicate is only allowed in return type position for functions and methods. +tests/cases/conformance/controlFlow/assertionTypePredicates1.ts(121,15): error TS1228: A type predicate is only allowed in return type position for functions and methods. +tests/cases/conformance/controlFlow/assertionTypePredicates1.ts(122,15): error TS1228: A type predicate is only allowed in return type position for functions and methods. +tests/cases/conformance/controlFlow/assertionTypePredicates1.ts(123,15): error TS1228: A type predicate is only allowed in return type position for functions and methods. +tests/cases/conformance/controlFlow/assertionTypePredicates1.ts(124,15): error TS1228: A type predicate is only allowed in return type position for functions and methods. + + +==== tests/cases/conformance/controlFlow/assertionTypePredicates1.ts (7 errors) ==== + declare function isString(value: unknown): value is string; + declare function isArrayOfStrings(value: unknown): value is string[]; + + const assert: (value: unknown) => asserts value = value => {} + + declare function assertIsString(value: unknown): asserts value is string; + declare function assertIsArrayOfStrings(value: unknown): asserts value is string[]; + declare function assertDefined(value: T): asserts value is NonNullable; + + function f01(x: unknown) { + if (!!true) { + assert(typeof x === "string"); + x.length; + } + if (!!true) { + assert(x instanceof Error); + x.message; + } + if (!!true) { + assert(typeof x === "boolean" || typeof x === "number"); + x.toLocaleString; + } + if (!!true) { + assert(isArrayOfStrings(x)); + x[0].length; + } + if (!!true) { + assertIsArrayOfStrings(x); + x[0].length; + } + if (!!true) { + assert(x === undefined || typeof x === "string"); + x; // string | undefined + assertDefined(x); + x; // string + } + } + + function f02(x: string | undefined) { + if (!!true) { + assert(x); + x.length; + } + if (!!true) { + assert(x !== undefined); + x.length; + } + if (!!true) { + assertDefined(x); + x.length; + } + } + + function f03(x: string | undefined, assert: (value: unknown) => asserts value) { + assert(x); + x.length; + } + + namespace Debug { + export declare function assert(value: unknown, message?: string): asserts value; + export declare function assertDefined(value: T): asserts value is NonNullable; + } + + function f10(x: string | undefined) { + if (!!true) { + Debug.assert(x); + x.length; + } + if (!!true) { + Debug.assert(x !== undefined); + x.length; + } + if (!!true) { + Debug.assertDefined(x); + x.length; + } + } + + class Test { + assert(value: unknown): asserts value { + if (value) return; + throw new Error(); + } + isTest2(): this is Test2 { + return this instanceof Test2; + } + assertIsTest2(): asserts this is Test2 { + if (this instanceof Test2) return; + throw new Error(); + } + assertThis(): asserts this { + if (!this) return; + throw new Error(); + } + bar() { + this.assertThis(); + this; + } + foo(x: unknown) { + this.assert(typeof x === "string"); + x.length; + if (this.isTest2()) { + this.z; + } + this.assertIsTest2(); + this.z; + } + } + + class Test2 extends Test { + z = 0; + } + + // Invalid constructs + + declare let Q1: new (x: unknown) => x is string; + ~~~~~~~~~~~ +!!! error TS1228: A type predicate is only allowed in return type position for functions and methods. + declare let Q2: new (x: boolean) => asserts x; + ~~~~~~~~~ +!!! error TS1228: A type predicate is only allowed in return type position for functions and methods. + declare let Q3: new (x: unknown) => asserts x is string; + ~~~~~~~~~~~~~~~~~~~ +!!! error TS1228: A type predicate is only allowed in return type position for functions and methods. + + declare class Wat { + get p1(): this is string; + ~~~~~~~~~~~~~~ +!!! error TS1228: A type predicate is only allowed in return type position for functions and methods. + set p1(x: this is string); + ~~~~~~~~~~~~~~ +!!! error TS1228: A type predicate is only allowed in return type position for functions and methods. + get p2(): asserts this is string; + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1228: A type predicate is only allowed in return type position for functions and methods. + set p2(x: asserts this is string); + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1228: A type predicate is only allowed in return type position for functions and methods. + } + \ No newline at end of file diff --git a/tests/baselines/reference/assertionTypePredicates1.js b/tests/baselines/reference/assertionTypePredicates1.js new file mode 100644 index 0000000000000..ad21d116b73ab --- /dev/null +++ b/tests/baselines/reference/assertionTypePredicates1.js @@ -0,0 +1,289 @@ +//// [assertionTypePredicates1.ts] +declare function isString(value: unknown): value is string; +declare function isArrayOfStrings(value: unknown): value is string[]; + +const assert: (value: unknown) => asserts value = value => {} + +declare function assertIsString(value: unknown): asserts value is string; +declare function assertIsArrayOfStrings(value: unknown): asserts value is string[]; +declare function assertDefined(value: T): asserts value is NonNullable; + +function f01(x: unknown) { + if (!!true) { + assert(typeof x === "string"); + x.length; + } + if (!!true) { + assert(x instanceof Error); + x.message; + } + if (!!true) { + assert(typeof x === "boolean" || typeof x === "number"); + x.toLocaleString; + } + if (!!true) { + assert(isArrayOfStrings(x)); + x[0].length; + } + if (!!true) { + assertIsArrayOfStrings(x); + x[0].length; + } + if (!!true) { + assert(x === undefined || typeof x === "string"); + x; // string | undefined + assertDefined(x); + x; // string + } +} + +function f02(x: string | undefined) { + if (!!true) { + assert(x); + x.length; + } + if (!!true) { + assert(x !== undefined); + x.length; + } + if (!!true) { + assertDefined(x); + x.length; + } +} + +function f03(x: string | undefined, assert: (value: unknown) => asserts value) { + assert(x); + x.length; +} + +namespace Debug { + export declare function assert(value: unknown, message?: string): asserts value; + export declare function assertDefined(value: T): asserts value is NonNullable; +} + +function f10(x: string | undefined) { + if (!!true) { + Debug.assert(x); + x.length; + } + if (!!true) { + Debug.assert(x !== undefined); + x.length; + } + if (!!true) { + Debug.assertDefined(x); + x.length; + } +} + +class Test { + assert(value: unknown): asserts value { + if (value) return; + throw new Error(); + } + isTest2(): this is Test2 { + return this instanceof Test2; + } + assertIsTest2(): asserts this is Test2 { + if (this instanceof Test2) return; + throw new Error(); + } + assertThis(): asserts this { + if (!this) return; + throw new Error(); + } + bar() { + this.assertThis(); + this; + } + foo(x: unknown) { + this.assert(typeof x === "string"); + x.length; + if (this.isTest2()) { + this.z; + } + this.assertIsTest2(); + this.z; + } +} + +class Test2 extends Test { + z = 0; +} + +// Invalid constructs + +declare let Q1: new (x: unknown) => x is string; +declare let Q2: new (x: boolean) => asserts x; +declare let Q3: new (x: unknown) => asserts x is string; + +declare class Wat { + get p1(): this is string; + set p1(x: this is string); + get p2(): asserts this is string; + set p2(x: asserts this is string); +} + + +//// [assertionTypePredicates1.js] +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var assert = function (value) { }; +function f01(x) { + if (!!true) { + assert(typeof x === "string"); + x.length; + } + if (!!true) { + assert(x instanceof Error); + x.message; + } + if (!!true) { + assert(typeof x === "boolean" || typeof x === "number"); + x.toLocaleString; + } + if (!!true) { + assert(isArrayOfStrings(x)); + x[0].length; + } + if (!!true) { + assertIsArrayOfStrings(x); + x[0].length; + } + if (!!true) { + assert(x === undefined || typeof x === "string"); + x; // string | undefined + assertDefined(x); + x; // string + } +} +function f02(x) { + if (!!true) { + assert(x); + x.length; + } + if (!!true) { + assert(x !== undefined); + x.length; + } + if (!!true) { + assertDefined(x); + x.length; + } +} +function f03(x, assert) { + assert(x); + x.length; +} +var Debug; +(function (Debug) { +})(Debug || (Debug = {})); +function f10(x) { + if (!!true) { + Debug.assert(x); + x.length; + } + if (!!true) { + Debug.assert(x !== undefined); + x.length; + } + if (!!true) { + Debug.assertDefined(x); + x.length; + } +} +var Test = /** @class */ (function () { + function Test() { + } + Test.prototype.assert = function (value) { + if (value) + return; + throw new Error(); + }; + Test.prototype.isTest2 = function () { + return this instanceof Test2; + }; + Test.prototype.assertIsTest2 = function () { + if (this instanceof Test2) + return; + throw new Error(); + }; + Test.prototype.assertThis = function () { + if (!this) + return; + throw new Error(); + }; + Test.prototype.bar = function () { + this.assertThis(); + this; + }; + Test.prototype.foo = function (x) { + this.assert(typeof x === "string"); + x.length; + if (this.isTest2()) { + this.z; + } + this.assertIsTest2(); + this.z; + }; + return Test; +}()); +var Test2 = /** @class */ (function (_super) { + __extends(Test2, _super); + function Test2() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this.z = 0; + return _this; + } + return Test2; +}(Test)); + + +//// [assertionTypePredicates1.d.ts] +declare function isString(value: unknown): value is string; +declare function isArrayOfStrings(value: unknown): value is string[]; +declare const assert: (value: unknown) => asserts value; +declare function assertIsString(value: unknown): asserts value is string; +declare function assertIsArrayOfStrings(value: unknown): asserts value is string[]; +declare function assertDefined(value: T): asserts value is NonNullable; +declare function f01(x: unknown): void; +declare function f02(x: string | undefined): void; +declare function f03(x: string | undefined, assert: (value: unknown) => asserts value): void; +declare namespace Debug { + function assert(value: unknown, message?: string): asserts value; + function assertDefined(value: T): asserts value is NonNullable; +} +declare function f10(x: string | undefined): void; +declare class Test { + assert(value: unknown): asserts value; + isTest2(): this is Test2; + assertIsTest2(): asserts this is Test2; + assertThis(): asserts this; + bar(): void; + foo(x: unknown): void; +} +declare class Test2 extends Test { + z: number; +} +declare let Q1: new (x: unknown) => x is string; +declare let Q2: new (x: boolean) => asserts x; +declare let Q3: new (x: unknown) => asserts x is string; +declare class Wat { + get p1(): this is string; + set p1(x: this is string); + get p2(): asserts this is string; + set p2(x: asserts this is string); +} diff --git a/tests/baselines/reference/assertionTypePredicates1.symbols b/tests/baselines/reference/assertionTypePredicates1.symbols new file mode 100644 index 0000000000000..c68a1926aff49 --- /dev/null +++ b/tests/baselines/reference/assertionTypePredicates1.symbols @@ -0,0 +1,359 @@ +=== tests/cases/conformance/controlFlow/assertionTypePredicates1.ts === +declare function isString(value: unknown): value is string; +>isString : Symbol(isString, Decl(assertionTypePredicates1.ts, 0, 0)) +>value : Symbol(value, Decl(assertionTypePredicates1.ts, 0, 26)) +>value : Symbol(value, Decl(assertionTypePredicates1.ts, 0, 26)) + +declare function isArrayOfStrings(value: unknown): value is string[]; +>isArrayOfStrings : Symbol(isArrayOfStrings, Decl(assertionTypePredicates1.ts, 0, 59)) +>value : Symbol(value, Decl(assertionTypePredicates1.ts, 1, 34)) +>value : Symbol(value, Decl(assertionTypePredicates1.ts, 1, 34)) + +const assert: (value: unknown) => asserts value = value => {} +>assert : Symbol(assert, Decl(assertionTypePredicates1.ts, 3, 5)) +>value : Symbol(value, Decl(assertionTypePredicates1.ts, 3, 15)) +>value : Symbol(value, Decl(assertionTypePredicates1.ts, 3, 15)) +>value : Symbol(value, Decl(assertionTypePredicates1.ts, 3, 49)) + +declare function assertIsString(value: unknown): asserts value is string; +>assertIsString : Symbol(assertIsString, Decl(assertionTypePredicates1.ts, 3, 61)) +>value : Symbol(value, Decl(assertionTypePredicates1.ts, 5, 32)) +>value : Symbol(value, Decl(assertionTypePredicates1.ts, 5, 32)) + +declare function assertIsArrayOfStrings(value: unknown): asserts value is string[]; +>assertIsArrayOfStrings : Symbol(assertIsArrayOfStrings, Decl(assertionTypePredicates1.ts, 5, 73)) +>value : Symbol(value, Decl(assertionTypePredicates1.ts, 6, 40)) +>value : Symbol(value, Decl(assertionTypePredicates1.ts, 6, 40)) + +declare function assertDefined(value: T): asserts value is NonNullable; +>assertDefined : Symbol(assertDefined, Decl(assertionTypePredicates1.ts, 6, 83)) +>T : Symbol(T, Decl(assertionTypePredicates1.ts, 7, 31)) +>value : Symbol(value, Decl(assertionTypePredicates1.ts, 7, 34)) +>T : Symbol(T, Decl(assertionTypePredicates1.ts, 7, 31)) +>value : Symbol(value, Decl(assertionTypePredicates1.ts, 7, 34)) +>NonNullable : Symbol(NonNullable, Decl(lib.es5.d.ts, --, --)) +>T : Symbol(T, Decl(assertionTypePredicates1.ts, 7, 31)) + +function f01(x: unknown) { +>f01 : Symbol(f01, Decl(assertionTypePredicates1.ts, 7, 77)) +>x : Symbol(x, Decl(assertionTypePredicates1.ts, 9, 13)) + + if (!!true) { + assert(typeof x === "string"); +>assert : Symbol(assert, Decl(assertionTypePredicates1.ts, 3, 5)) +>x : Symbol(x, Decl(assertionTypePredicates1.ts, 9, 13)) + + x.length; +>x.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) +>x : Symbol(x, Decl(assertionTypePredicates1.ts, 9, 13)) +>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) + } + if (!!true) { + assert(x instanceof Error); +>assert : Symbol(assert, Decl(assertionTypePredicates1.ts, 3, 5)) +>x : Symbol(x, Decl(assertionTypePredicates1.ts, 9, 13)) +>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + + x.message; +>x.message : Symbol(Error.message, Decl(lib.es5.d.ts, --, --)) +>x : Symbol(x, Decl(assertionTypePredicates1.ts, 9, 13)) +>message : Symbol(Error.message, Decl(lib.es5.d.ts, --, --)) + } + if (!!true) { + assert(typeof x === "boolean" || typeof x === "number"); +>assert : Symbol(assert, Decl(assertionTypePredicates1.ts, 3, 5)) +>x : Symbol(x, Decl(assertionTypePredicates1.ts, 9, 13)) +>x : Symbol(x, Decl(assertionTypePredicates1.ts, 9, 13)) + + x.toLocaleString; +>x.toLocaleString : Symbol(toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>x : Symbol(x, Decl(assertionTypePredicates1.ts, 9, 13)) +>toLocaleString : Symbol(toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + } + if (!!true) { + assert(isArrayOfStrings(x)); +>assert : Symbol(assert, Decl(assertionTypePredicates1.ts, 3, 5)) +>isArrayOfStrings : Symbol(isArrayOfStrings, Decl(assertionTypePredicates1.ts, 0, 59)) +>x : Symbol(x, Decl(assertionTypePredicates1.ts, 9, 13)) + + x[0].length; +>x[0].length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) +>x : Symbol(x, Decl(assertionTypePredicates1.ts, 9, 13)) +>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) + } + if (!!true) { + assertIsArrayOfStrings(x); +>assertIsArrayOfStrings : Symbol(assertIsArrayOfStrings, Decl(assertionTypePredicates1.ts, 5, 73)) +>x : Symbol(x, Decl(assertionTypePredicates1.ts, 9, 13)) + + x[0].length; +>x[0].length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) +>x : Symbol(x, Decl(assertionTypePredicates1.ts, 9, 13)) +>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) + } + if (!!true) { + assert(x === undefined || typeof x === "string"); +>assert : Symbol(assert, Decl(assertionTypePredicates1.ts, 3, 5)) +>x : Symbol(x, Decl(assertionTypePredicates1.ts, 9, 13)) +>undefined : Symbol(undefined) +>x : Symbol(x, Decl(assertionTypePredicates1.ts, 9, 13)) + + x; // string | undefined +>x : Symbol(x, Decl(assertionTypePredicates1.ts, 9, 13)) + + assertDefined(x); +>assertDefined : Symbol(assertDefined, Decl(assertionTypePredicates1.ts, 6, 83)) +>x : Symbol(x, Decl(assertionTypePredicates1.ts, 9, 13)) + + x; // string +>x : Symbol(x, Decl(assertionTypePredicates1.ts, 9, 13)) + } +} + +function f02(x: string | undefined) { +>f02 : Symbol(f02, Decl(assertionTypePredicates1.ts, 36, 1)) +>x : Symbol(x, Decl(assertionTypePredicates1.ts, 38, 13)) + + if (!!true) { + assert(x); +>assert : Symbol(assert, Decl(assertionTypePredicates1.ts, 3, 5)) +>x : Symbol(x, Decl(assertionTypePredicates1.ts, 38, 13)) + + x.length; +>x.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) +>x : Symbol(x, Decl(assertionTypePredicates1.ts, 38, 13)) +>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) + } + if (!!true) { + assert(x !== undefined); +>assert : Symbol(assert, Decl(assertionTypePredicates1.ts, 3, 5)) +>x : Symbol(x, Decl(assertionTypePredicates1.ts, 38, 13)) +>undefined : Symbol(undefined) + + x.length; +>x.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) +>x : Symbol(x, Decl(assertionTypePredicates1.ts, 38, 13)) +>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) + } + if (!!true) { + assertDefined(x); +>assertDefined : Symbol(assertDefined, Decl(assertionTypePredicates1.ts, 6, 83)) +>x : Symbol(x, Decl(assertionTypePredicates1.ts, 38, 13)) + + x.length; +>x.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) +>x : Symbol(x, Decl(assertionTypePredicates1.ts, 38, 13)) +>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) + } +} + +function f03(x: string | undefined, assert: (value: unknown) => asserts value) { +>f03 : Symbol(f03, Decl(assertionTypePredicates1.ts, 51, 1)) +>x : Symbol(x, Decl(assertionTypePredicates1.ts, 53, 13)) +>assert : Symbol(assert, Decl(assertionTypePredicates1.ts, 53, 35)) +>value : Symbol(value, Decl(assertionTypePredicates1.ts, 53, 45)) +>value : Symbol(value, Decl(assertionTypePredicates1.ts, 53, 45)) + + assert(x); +>assert : Symbol(assert, Decl(assertionTypePredicates1.ts, 53, 35)) +>x : Symbol(x, Decl(assertionTypePredicates1.ts, 53, 13)) + + x.length; +>x.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) +>x : Symbol(x, Decl(assertionTypePredicates1.ts, 53, 13)) +>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) +} + +namespace Debug { +>Debug : Symbol(Debug, Decl(assertionTypePredicates1.ts, 56, 1)) + + export declare function assert(value: unknown, message?: string): asserts value; +>assert : Symbol(assert, Decl(assertionTypePredicates1.ts, 58, 17)) +>value : Symbol(value, Decl(assertionTypePredicates1.ts, 59, 35)) +>message : Symbol(message, Decl(assertionTypePredicates1.ts, 59, 50)) +>value : Symbol(value, Decl(assertionTypePredicates1.ts, 59, 35)) + + export declare function assertDefined(value: T): asserts value is NonNullable; +>assertDefined : Symbol(assertDefined, Decl(assertionTypePredicates1.ts, 59, 84)) +>T : Symbol(T, Decl(assertionTypePredicates1.ts, 60, 42)) +>value : Symbol(value, Decl(assertionTypePredicates1.ts, 60, 45)) +>T : Symbol(T, Decl(assertionTypePredicates1.ts, 60, 42)) +>value : Symbol(value, Decl(assertionTypePredicates1.ts, 60, 45)) +>NonNullable : Symbol(NonNullable, Decl(lib.es5.d.ts, --, --)) +>T : Symbol(T, Decl(assertionTypePredicates1.ts, 60, 42)) +} + +function f10(x: string | undefined) { +>f10 : Symbol(f10, Decl(assertionTypePredicates1.ts, 61, 1)) +>x : Symbol(x, Decl(assertionTypePredicates1.ts, 63, 13)) + + if (!!true) { + Debug.assert(x); +>Debug.assert : Symbol(Debug.assert, Decl(assertionTypePredicates1.ts, 58, 17)) +>Debug : Symbol(Debug, Decl(assertionTypePredicates1.ts, 56, 1)) +>assert : Symbol(Debug.assert, Decl(assertionTypePredicates1.ts, 58, 17)) +>x : Symbol(x, Decl(assertionTypePredicates1.ts, 63, 13)) + + x.length; +>x.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) +>x : Symbol(x, Decl(assertionTypePredicates1.ts, 63, 13)) +>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) + } + if (!!true) { + Debug.assert(x !== undefined); +>Debug.assert : Symbol(Debug.assert, Decl(assertionTypePredicates1.ts, 58, 17)) +>Debug : Symbol(Debug, Decl(assertionTypePredicates1.ts, 56, 1)) +>assert : Symbol(Debug.assert, Decl(assertionTypePredicates1.ts, 58, 17)) +>x : Symbol(x, Decl(assertionTypePredicates1.ts, 63, 13)) +>undefined : Symbol(undefined) + + x.length; +>x.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) +>x : Symbol(x, Decl(assertionTypePredicates1.ts, 63, 13)) +>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) + } + if (!!true) { + Debug.assertDefined(x); +>Debug.assertDefined : Symbol(Debug.assertDefined, Decl(assertionTypePredicates1.ts, 59, 84)) +>Debug : Symbol(Debug, Decl(assertionTypePredicates1.ts, 56, 1)) +>assertDefined : Symbol(Debug.assertDefined, Decl(assertionTypePredicates1.ts, 59, 84)) +>x : Symbol(x, Decl(assertionTypePredicates1.ts, 63, 13)) + + x.length; +>x.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) +>x : Symbol(x, Decl(assertionTypePredicates1.ts, 63, 13)) +>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) + } +} + +class Test { +>Test : Symbol(Test, Decl(assertionTypePredicates1.ts, 76, 1)) + + assert(value: unknown): asserts value { +>assert : Symbol(Test.assert, Decl(assertionTypePredicates1.ts, 78, 12)) +>value : Symbol(value, Decl(assertionTypePredicates1.ts, 79, 11)) +>value : Symbol(value, Decl(assertionTypePredicates1.ts, 79, 11)) + + if (value) return; +>value : Symbol(value, Decl(assertionTypePredicates1.ts, 79, 11)) + + throw new Error(); +>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + } + isTest2(): this is Test2 { +>isTest2 : Symbol(Test.isTest2, Decl(assertionTypePredicates1.ts, 82, 5)) +>Test2 : Symbol(Test2, Decl(assertionTypePredicates1.ts, 107, 1)) + + return this instanceof Test2; +>this : Symbol(Test, Decl(assertionTypePredicates1.ts, 76, 1)) +>Test2 : Symbol(Test2, Decl(assertionTypePredicates1.ts, 107, 1)) + } + assertIsTest2(): asserts this is Test2 { +>assertIsTest2 : Symbol(Test.assertIsTest2, Decl(assertionTypePredicates1.ts, 85, 5)) +>Test2 : Symbol(Test2, Decl(assertionTypePredicates1.ts, 107, 1)) + + if (this instanceof Test2) return; +>this : Symbol(Test, Decl(assertionTypePredicates1.ts, 76, 1)) +>Test2 : Symbol(Test2, Decl(assertionTypePredicates1.ts, 107, 1)) + + throw new Error(); +>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + } + assertThis(): asserts this { +>assertThis : Symbol(Test.assertThis, Decl(assertionTypePredicates1.ts, 89, 5)) + + if (!this) return; +>this : Symbol(Test, Decl(assertionTypePredicates1.ts, 76, 1)) + + throw new Error(); +>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + } + bar() { +>bar : Symbol(Test.bar, Decl(assertionTypePredicates1.ts, 93, 5)) + + this.assertThis(); +>this.assertThis : Symbol(Test.assertThis, Decl(assertionTypePredicates1.ts, 89, 5)) +>this : Symbol(Test, Decl(assertionTypePredicates1.ts, 76, 1)) +>assertThis : Symbol(Test.assertThis, Decl(assertionTypePredicates1.ts, 89, 5)) + + this; +>this : Symbol(Test, Decl(assertionTypePredicates1.ts, 76, 1)) + } + foo(x: unknown) { +>foo : Symbol(Test.foo, Decl(assertionTypePredicates1.ts, 97, 5)) +>x : Symbol(x, Decl(assertionTypePredicates1.ts, 98, 8)) + + this.assert(typeof x === "string"); +>this.assert : Symbol(Test.assert, Decl(assertionTypePredicates1.ts, 78, 12)) +>this : Symbol(Test, Decl(assertionTypePredicates1.ts, 76, 1)) +>assert : Symbol(Test.assert, Decl(assertionTypePredicates1.ts, 78, 12)) +>x : Symbol(x, Decl(assertionTypePredicates1.ts, 98, 8)) + + x.length; +>x.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) +>x : Symbol(x, Decl(assertionTypePredicates1.ts, 98, 8)) +>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) + + if (this.isTest2()) { +>this.isTest2 : Symbol(Test.isTest2, Decl(assertionTypePredicates1.ts, 82, 5)) +>this : Symbol(Test, Decl(assertionTypePredicates1.ts, 76, 1)) +>isTest2 : Symbol(Test.isTest2, Decl(assertionTypePredicates1.ts, 82, 5)) + + this.z; +>this.z : Symbol(Test2.z, Decl(assertionTypePredicates1.ts, 109, 26)) +>z : Symbol(Test2.z, Decl(assertionTypePredicates1.ts, 109, 26)) + } + this.assertIsTest2(); +>this.assertIsTest2 : Symbol(Test.assertIsTest2, Decl(assertionTypePredicates1.ts, 85, 5)) +>this : Symbol(Test, Decl(assertionTypePredicates1.ts, 76, 1)) +>assertIsTest2 : Symbol(Test.assertIsTest2, Decl(assertionTypePredicates1.ts, 85, 5)) + + this.z; +>this.z : Symbol(Test2.z, Decl(assertionTypePredicates1.ts, 109, 26)) +>z : Symbol(Test2.z, Decl(assertionTypePredicates1.ts, 109, 26)) + } +} + +class Test2 extends Test { +>Test2 : Symbol(Test2, Decl(assertionTypePredicates1.ts, 107, 1)) +>Test : Symbol(Test, Decl(assertionTypePredicates1.ts, 76, 1)) + + z = 0; +>z : Symbol(Test2.z, Decl(assertionTypePredicates1.ts, 109, 26)) +} + +// Invalid constructs + +declare let Q1: new (x: unknown) => x is string; +>Q1 : Symbol(Q1, Decl(assertionTypePredicates1.ts, 115, 11)) +>x : Symbol(x, Decl(assertionTypePredicates1.ts, 115, 21)) +>x : Symbol(x, Decl(assertionTypePredicates1.ts, 115, 21)) + +declare let Q2: new (x: boolean) => asserts x; +>Q2 : Symbol(Q2, Decl(assertionTypePredicates1.ts, 116, 11)) +>x : Symbol(x, Decl(assertionTypePredicates1.ts, 116, 21)) +>x : Symbol(x, Decl(assertionTypePredicates1.ts, 116, 21)) + +declare let Q3: new (x: unknown) => asserts x is string; +>Q3 : Symbol(Q3, Decl(assertionTypePredicates1.ts, 117, 11)) +>x : Symbol(x, Decl(assertionTypePredicates1.ts, 117, 21)) +>x : Symbol(x, Decl(assertionTypePredicates1.ts, 117, 21)) + +declare class Wat { +>Wat : Symbol(Wat, Decl(assertionTypePredicates1.ts, 117, 56)) + + get p1(): this is string; +>p1 : Symbol(Wat.p1, Decl(assertionTypePredicates1.ts, 119, 19), Decl(assertionTypePredicates1.ts, 120, 29)) + + set p1(x: this is string); +>p1 : Symbol(Wat.p1, Decl(assertionTypePredicates1.ts, 119, 19), Decl(assertionTypePredicates1.ts, 120, 29)) +>x : Symbol(x, Decl(assertionTypePredicates1.ts, 121, 11)) + + get p2(): asserts this is string; +>p2 : Symbol(Wat.p2, Decl(assertionTypePredicates1.ts, 121, 30), Decl(assertionTypePredicates1.ts, 122, 37)) + + set p2(x: asserts this is string); +>p2 : Symbol(Wat.p2, Decl(assertionTypePredicates1.ts, 121, 30), Decl(assertionTypePredicates1.ts, 122, 37)) +>x : Symbol(x, Decl(assertionTypePredicates1.ts, 123, 11)) +} + diff --git a/tests/baselines/reference/assertionTypePredicates1.types b/tests/baselines/reference/assertionTypePredicates1.types new file mode 100644 index 0000000000000..f72ec641013aa --- /dev/null +++ b/tests/baselines/reference/assertionTypePredicates1.types @@ -0,0 +1,438 @@ +=== tests/cases/conformance/controlFlow/assertionTypePredicates1.ts === +declare function isString(value: unknown): value is string; +>isString : (value: unknown) => value is string +>value : unknown + +declare function isArrayOfStrings(value: unknown): value is string[]; +>isArrayOfStrings : (value: unknown) => value is string[] +>value : unknown + +const assert: (value: unknown) => asserts value = value => {} +>assert : (value: unknown) => asserts value +>value : unknown +>value => {} : (value: unknown) => void +>value : unknown + +declare function assertIsString(value: unknown): asserts value is string; +>assertIsString : (value: unknown) => asserts value is string +>value : unknown + +declare function assertIsArrayOfStrings(value: unknown): asserts value is string[]; +>assertIsArrayOfStrings : (value: unknown) => asserts value is string[] +>value : unknown + +declare function assertDefined(value: T): asserts value is NonNullable; +>assertDefined : (value: T) => asserts value is NonNullable +>value : T + +function f01(x: unknown) { +>f01 : (x: unknown) => void +>x : unknown + + if (!!true) { +>!!true : true +>!true : false +>true : true + + assert(typeof x === "string"); +>assert(typeof x === "string") : void +>assert : (value: unknown) => asserts value +>typeof x === "string" : boolean +>typeof x : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" +>x : unknown +>"string" : "string" + + x.length; +>x.length : number +>x : string +>length : number + } + if (!!true) { +>!!true : true +>!true : false +>true : true + + assert(x instanceof Error); +>assert(x instanceof Error) : void +>assert : (value: unknown) => asserts value +>x instanceof Error : boolean +>x : unknown +>Error : ErrorConstructor + + x.message; +>x.message : string +>x : Error +>message : string + } + if (!!true) { +>!!true : true +>!true : false +>true : true + + assert(typeof x === "boolean" || typeof x === "number"); +>assert(typeof x === "boolean" || typeof x === "number") : void +>assert : (value: unknown) => asserts value +>typeof x === "boolean" || typeof x === "number" : boolean +>typeof x === "boolean" : boolean +>typeof x : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" +>x : unknown +>"boolean" : "boolean" +>typeof x === "number" : boolean +>typeof x : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" +>x : unknown +>"number" : "number" + + x.toLocaleString; +>x.toLocaleString : ((locales?: string | string[] | undefined, options?: Intl.NumberFormatOptions | undefined) => string) | (() => string) +>x : number | boolean +>toLocaleString : ((locales?: string | string[] | undefined, options?: Intl.NumberFormatOptions | undefined) => string) | (() => string) + } + if (!!true) { +>!!true : true +>!true : false +>true : true + + assert(isArrayOfStrings(x)); +>assert(isArrayOfStrings(x)) : void +>assert : (value: unknown) => asserts value +>isArrayOfStrings(x) : boolean +>isArrayOfStrings : (value: unknown) => value is string[] +>x : unknown + + x[0].length; +>x[0].length : number +>x[0] : string +>x : string[] +>0 : 0 +>length : number + } + if (!!true) { +>!!true : true +>!true : false +>true : true + + assertIsArrayOfStrings(x); +>assertIsArrayOfStrings(x) : void +>assertIsArrayOfStrings : (value: unknown) => asserts value is string[] +>x : unknown + + x[0].length; +>x[0].length : number +>x[0] : string +>x : string[] +>0 : 0 +>length : number + } + if (!!true) { +>!!true : true +>!true : false +>true : true + + assert(x === undefined || typeof x === "string"); +>assert(x === undefined || typeof x === "string") : void +>assert : (value: unknown) => asserts value +>x === undefined || typeof x === "string" : boolean +>x === undefined : boolean +>x : unknown +>undefined : undefined +>typeof x === "string" : boolean +>typeof x : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" +>x : unknown +>"string" : "string" + + x; // string | undefined +>x : string | undefined + + assertDefined(x); +>assertDefined(x) : void +>assertDefined : (value: T) => asserts value is NonNullable +>x : string | undefined + + x; // string +>x : string + } +} + +function f02(x: string | undefined) { +>f02 : (x: string | undefined) => void +>x : string | undefined + + if (!!true) { +>!!true : true +>!true : false +>true : true + + assert(x); +>assert(x) : void +>assert : (value: unknown) => asserts value +>x : string | undefined + + x.length; +>x.length : number +>x : string +>length : number + } + if (!!true) { +>!!true : true +>!true : false +>true : true + + assert(x !== undefined); +>assert(x !== undefined) : void +>assert : (value: unknown) => asserts value +>x !== undefined : boolean +>x : string | undefined +>undefined : undefined + + x.length; +>x.length : number +>x : string +>length : number + } + if (!!true) { +>!!true : true +>!true : false +>true : true + + assertDefined(x); +>assertDefined(x) : void +>assertDefined : (value: T) => asserts value is NonNullable +>x : string | undefined + + x.length; +>x.length : number +>x : string +>length : number + } +} + +function f03(x: string | undefined, assert: (value: unknown) => asserts value) { +>f03 : (x: string | undefined, assert: (value: unknown) => asserts value) => void +>x : string | undefined +>assert : (value: unknown) => asserts value +>value : unknown + + assert(x); +>assert(x) : void +>assert : (value: unknown) => asserts value +>x : string | undefined + + x.length; +>x.length : number +>x : string +>length : number +} + +namespace Debug { +>Debug : typeof Debug + + export declare function assert(value: unknown, message?: string): asserts value; +>assert : (value: unknown, message?: string | undefined) => asserts value +>value : unknown +>message : string | undefined + + export declare function assertDefined(value: T): asserts value is NonNullable; +>assertDefined : (value: T) => asserts value is NonNullable +>value : T +} + +function f10(x: string | undefined) { +>f10 : (x: string | undefined) => void +>x : string | undefined + + if (!!true) { +>!!true : true +>!true : false +>true : true + + Debug.assert(x); +>Debug.assert(x) : void +>Debug.assert : (value: unknown, message?: string | undefined) => asserts value +>Debug : typeof Debug +>assert : (value: unknown, message?: string | undefined) => asserts value +>x : string | undefined + + x.length; +>x.length : number +>x : string +>length : number + } + if (!!true) { +>!!true : true +>!true : false +>true : true + + Debug.assert(x !== undefined); +>Debug.assert(x !== undefined) : void +>Debug.assert : (value: unknown, message?: string | undefined) => asserts value +>Debug : typeof Debug +>assert : (value: unknown, message?: string | undefined) => asserts value +>x !== undefined : boolean +>x : string | undefined +>undefined : undefined + + x.length; +>x.length : number +>x : string +>length : number + } + if (!!true) { +>!!true : true +>!true : false +>true : true + + Debug.assertDefined(x); +>Debug.assertDefined(x) : void +>Debug.assertDefined : (value: T) => asserts value is NonNullable +>Debug : typeof Debug +>assertDefined : (value: T) => asserts value is NonNullable +>x : string | undefined + + x.length; +>x.length : number +>x : string +>length : number + } +} + +class Test { +>Test : Test + + assert(value: unknown): asserts value { +>assert : (value: unknown) => asserts value +>value : unknown + + if (value) return; +>value : unknown + + throw new Error(); +>new Error() : Error +>Error : ErrorConstructor + } + isTest2(): this is Test2 { +>isTest2 : () => this is Test2 + + return this instanceof Test2; +>this instanceof Test2 : boolean +>this : this +>Test2 : typeof Test2 + } + assertIsTest2(): asserts this is Test2 { +>assertIsTest2 : () => asserts this is Test2 + + if (this instanceof Test2) return; +>this instanceof Test2 : boolean +>this : this +>Test2 : typeof Test2 + + throw new Error(); +>new Error() : Error +>Error : ErrorConstructor + } + assertThis(): asserts this { +>assertThis : () => asserts this + + if (!this) return; +>!this : false +>this : this + + throw new Error(); +>new Error() : Error +>Error : ErrorConstructor + } + bar() { +>bar : () => void + + this.assertThis(); +>this.assertThis() : void +>this.assertThis : () => asserts this +>this : this +>assertThis : () => asserts this + + this; +>this : this + } + foo(x: unknown) { +>foo : (x: unknown) => void +>x : unknown + + this.assert(typeof x === "string"); +>this.assert(typeof x === "string") : void +>this.assert : (value: unknown) => asserts value +>this : this +>assert : (value: unknown) => asserts value +>typeof x === "string" : boolean +>typeof x : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" +>x : unknown +>"string" : "string" + + x.length; +>x.length : number +>x : string +>length : number + + if (this.isTest2()) { +>this.isTest2() : boolean +>this.isTest2 : () => this is Test2 +>this : this +>isTest2 : () => this is Test2 + + this.z; +>this.z : number +>this : this & Test2 +>z : number + } + this.assertIsTest2(); +>this.assertIsTest2() : void +>this.assertIsTest2 : () => asserts this is Test2 +>this : this +>assertIsTest2 : () => asserts this is Test2 + + this.z; +>this.z : number +>this : this & Test2 +>z : number + } +} + +class Test2 extends Test { +>Test2 : Test2 +>Test : Test + + z = 0; +>z : number +>0 : 0 +} + +// Invalid constructs + +declare let Q1: new (x: unknown) => x is string; +>Q1 : new (x: unknown) => x is string +>x : unknown + +declare let Q2: new (x: boolean) => asserts x; +>Q2 : new (x: boolean) => asserts x +>x : boolean + +declare let Q3: new (x: unknown) => asserts x is string; +>Q3 : new (x: unknown) => asserts x is string +>x : unknown + +declare class Wat { +>Wat : Wat + + get p1(): this is string; +>p1 : boolean + + set p1(x: this is string); +>p1 : boolean +>x : boolean + + get p2(): asserts this is string; +>p2 : void + + set p2(x: asserts this is string); +>p2 : void +>x : void +} + diff --git a/tests/baselines/reference/assertionsAndNonReturningFunctions.errors.txt b/tests/baselines/reference/assertionsAndNonReturningFunctions.errors.txt new file mode 100644 index 0000000000000..e1648d7643dee --- /dev/null +++ b/tests/baselines/reference/assertionsAndNonReturningFunctions.errors.txt @@ -0,0 +1,69 @@ +tests/cases/conformance/jsdoc/assertionsAndNonReturningFunctions.js(46,9): error TS7027: Unreachable code detected. +tests/cases/conformance/jsdoc/assertionsAndNonReturningFunctions.js(58,5): error TS7027: Unreachable code detected. + + +==== tests/cases/conformance/jsdoc/assertionsAndNonReturningFunctions.js (2 errors) ==== + /** @typedef {(check: boolean) => asserts check} AssertFunc */ + + /** @type {AssertFunc} */ + const assert = check => { + if (!check) throw new Error(); + } + + /** @type {(x: unknown) => asserts x is string } */ + function assertIsString(x) { + if (!(typeof x === "string")) throw new Error(); + } + + /** + * @param {boolean} check + * @returns {asserts check} + */ + function assert2(check) { + if (!check) throw new Error(); + } + + /** + * @returns {never} + */ + function fail() { + throw new Error(); + } + + /** + * @param {*} x + */ + function f1(x) { + if (!!true) { + assert(typeof x === "string"); + x.length; + } + if (!!true) { + assert2(typeof x === "string"); + x.length; + } + if (!!true) { + assertIsString(x); + x.length; + } + if (!!true) { + fail(); + x; // Unreachable + ~~ +!!! error TS7027: Unreachable code detected. + } + } + + /** + * @param {boolean} b + */ + function f2(b) { + switch (b) { + case true: return 1; + case false: return 0; + } + b; // Unreachable + ~~ +!!! error TS7027: Unreachable code detected. + } + \ No newline at end of file diff --git a/tests/baselines/reference/assertionsAndNonReturningFunctions.symbols b/tests/baselines/reference/assertionsAndNonReturningFunctions.symbols new file mode 100644 index 0000000000000..88931cffbd87c --- /dev/null +++ b/tests/baselines/reference/assertionsAndNonReturningFunctions.symbols @@ -0,0 +1,109 @@ +=== tests/cases/conformance/jsdoc/assertionsAndNonReturningFunctions.js === +/** @typedef {(check: boolean) => asserts check} AssertFunc */ + +/** @type {AssertFunc} */ +const assert = check => { +>assert : Symbol(assert, Decl(assertionsAndNonReturningFunctions.js, 3, 5)) +>check : Symbol(check, Decl(assertionsAndNonReturningFunctions.js, 3, 14)) + + if (!check) throw new Error(); +>check : Symbol(check, Decl(assertionsAndNonReturningFunctions.js, 3, 14)) +>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +} + +/** @type {(x: unknown) => asserts x is string } */ +function assertIsString(x) { +>assertIsString : Symbol(assertIsString, Decl(assertionsAndNonReturningFunctions.js, 5, 1)) +>x : Symbol(x, Decl(assertionsAndNonReturningFunctions.js, 8, 24)) + + if (!(typeof x === "string")) throw new Error(); +>x : Symbol(x, Decl(assertionsAndNonReturningFunctions.js, 8, 24)) +>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +} + +/** + * @param {boolean} check + * @returns {asserts check} +*/ +function assert2(check) { +>assert2 : Symbol(assert2, Decl(assertionsAndNonReturningFunctions.js, 10, 1)) +>check : Symbol(check, Decl(assertionsAndNonReturningFunctions.js, 16, 17)) + + if (!check) throw new Error(); +>check : Symbol(check, Decl(assertionsAndNonReturningFunctions.js, 16, 17)) +>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +} + +/** + * @returns {never} + */ +function fail() { +>fail : Symbol(fail, Decl(assertionsAndNonReturningFunctions.js, 18, 1)) + + throw new Error(); +>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +} + +/** + * @param {*} x + */ +function f1(x) { +>f1 : Symbol(f1, Decl(assertionsAndNonReturningFunctions.js, 25, 1)) +>x : Symbol(x, Decl(assertionsAndNonReturningFunctions.js, 30, 12)) + + if (!!true) { + assert(typeof x === "string"); +>assert : Symbol(assert, Decl(assertionsAndNonReturningFunctions.js, 3, 5)) +>x : Symbol(x, Decl(assertionsAndNonReturningFunctions.js, 30, 12)) + + x.length; +>x.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) +>x : Symbol(x, Decl(assertionsAndNonReturningFunctions.js, 30, 12)) +>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) + } + if (!!true) { + assert2(typeof x === "string"); +>assert2 : Symbol(assert2, Decl(assertionsAndNonReturningFunctions.js, 10, 1)) +>x : Symbol(x, Decl(assertionsAndNonReturningFunctions.js, 30, 12)) + + x.length; +>x.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) +>x : Symbol(x, Decl(assertionsAndNonReturningFunctions.js, 30, 12)) +>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) + } + if (!!true) { + assertIsString(x); +>assertIsString : Symbol(assertIsString, Decl(assertionsAndNonReturningFunctions.js, 5, 1)) +>x : Symbol(x, Decl(assertionsAndNonReturningFunctions.js, 30, 12)) + + x.length; +>x.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) +>x : Symbol(x, Decl(assertionsAndNonReturningFunctions.js, 30, 12)) +>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) + } + if (!!true) { + fail(); +>fail : Symbol(fail, Decl(assertionsAndNonReturningFunctions.js, 18, 1)) + + x; // Unreachable +>x : Symbol(x, Decl(assertionsAndNonReturningFunctions.js, 30, 12)) + } +} + +/** + * @param {boolean} b + */ +function f2(b) { +>f2 : Symbol(f2, Decl(assertionsAndNonReturningFunctions.js, 47, 1)) +>b : Symbol(b, Decl(assertionsAndNonReturningFunctions.js, 52, 12)) + + switch (b) { +>b : Symbol(b, Decl(assertionsAndNonReturningFunctions.js, 52, 12)) + + case true: return 1; + case false: return 0; + } + b; // Unreachable +>b : Symbol(b, Decl(assertionsAndNonReturningFunctions.js, 52, 12)) +} + diff --git a/tests/baselines/reference/assertionsAndNonReturningFunctions.types b/tests/baselines/reference/assertionsAndNonReturningFunctions.types new file mode 100644 index 0000000000000..32100b6c3d2d6 --- /dev/null +++ b/tests/baselines/reference/assertionsAndNonReturningFunctions.types @@ -0,0 +1,152 @@ +=== tests/cases/conformance/jsdoc/assertionsAndNonReturningFunctions.js === +/** @typedef {(check: boolean) => asserts check} AssertFunc */ + +/** @type {AssertFunc} */ +const assert = check => { +>assert : (check: boolean) => asserts check +>check => { if (!check) throw new Error();} : (check: boolean) => asserts check +>check : boolean + + if (!check) throw new Error(); +>!check : boolean +>check : boolean +>new Error() : Error +>Error : ErrorConstructor +} + +/** @type {(x: unknown) => asserts x is string } */ +function assertIsString(x) { +>assertIsString : (x: unknown) => asserts x is string +>x : unknown + + if (!(typeof x === "string")) throw new Error(); +>!(typeof x === "string") : boolean +>(typeof x === "string") : boolean +>typeof x === "string" : boolean +>typeof x : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" +>x : unknown +>"string" : "string" +>new Error() : Error +>Error : ErrorConstructor +} + +/** + * @param {boolean} check + * @returns {asserts check} +*/ +function assert2(check) { +>assert2 : (check: boolean) => asserts check +>check : boolean + + if (!check) throw new Error(); +>!check : boolean +>check : boolean +>new Error() : Error +>Error : ErrorConstructor +} + +/** + * @returns {never} + */ +function fail() { +>fail : () => never + + throw new Error(); +>new Error() : Error +>Error : ErrorConstructor +} + +/** + * @param {*} x + */ +function f1(x) { +>f1 : (x: any) => void +>x : any + + if (!!true) { +>!!true : boolean +>!true : boolean +>true : true + + assert(typeof x === "string"); +>assert(typeof x === "string") : void +>assert : (check: boolean) => asserts check +>typeof x === "string" : boolean +>typeof x : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" +>x : any +>"string" : "string" + + x.length; +>x.length : number +>x : string +>length : number + } + if (!!true) { +>!!true : boolean +>!true : boolean +>true : true + + assert2(typeof x === "string"); +>assert2(typeof x === "string") : void +>assert2 : (check: boolean) => asserts check +>typeof x === "string" : boolean +>typeof x : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" +>x : any +>"string" : "string" + + x.length; +>x.length : number +>x : string +>length : number + } + if (!!true) { +>!!true : boolean +>!true : boolean +>true : true + + assertIsString(x); +>assertIsString(x) : void +>assertIsString : (x: unknown) => asserts x is string +>x : any + + x.length; +>x.length : number +>x : string +>length : number + } + if (!!true) { +>!!true : boolean +>!true : boolean +>true : true + + fail(); +>fail() : never +>fail : () => never + + x; // Unreachable +>x : any + } +} + +/** + * @param {boolean} b + */ +function f2(b) { +>f2 : (b: boolean) => 1 | 0 +>b : boolean + + switch (b) { +>b : boolean + + case true: return 1; +>true : true +>1 : 1 + + case false: return 0; +>false : false +>0 : 0 + } + b; // Unreachable +>b : never +} + diff --git a/tests/baselines/reference/assignFromBooleanInterface2.errors.txt b/tests/baselines/reference/assignFromBooleanInterface2.errors.txt index 6c7ebbe5ee83f..ba8b2f5a9c903 100644 --- a/tests/baselines/reference/assignFromBooleanInterface2.errors.txt +++ b/tests/baselines/reference/assignFromBooleanInterface2.errors.txt @@ -1,7 +1,6 @@ tests/cases/conformance/types/primitives/boolean/assignFromBooleanInterface2.ts(14,1): error TS2322: Type 'NotBoolean' is not assignable to type 'Boolean'. - Types of property 'valueOf' are incompatible. - Type '() => Object' is not assignable to type '() => boolean'. - Type 'Object' is not assignable to type 'boolean'. + The types returned by 'valueOf()' are incompatible between these types. + Type 'Object' is not assignable to type 'boolean'. tests/cases/conformance/types/primitives/boolean/assignFromBooleanInterface2.ts(19,1): error TS2322: Type 'Boolean' is not assignable to type 'boolean'. 'boolean' is a primitive, but 'Boolean' is a wrapper object. Prefer using 'boolean' when possible. tests/cases/conformance/types/primitives/boolean/assignFromBooleanInterface2.ts(20,1): error TS2322: Type 'NotBoolean' is not assignable to type 'boolean'. @@ -24,9 +23,8 @@ tests/cases/conformance/types/primitives/boolean/assignFromBooleanInterface2.ts( a = b; ~ !!! error TS2322: Type 'NotBoolean' is not assignable to type 'Boolean'. -!!! error TS2322: Types of property 'valueOf' are incompatible. -!!! error TS2322: Type '() => Object' is not assignable to type '() => boolean'. -!!! error TS2322: Type 'Object' is not assignable to type 'boolean'. +!!! error TS2322: The types returned by 'valueOf()' are incompatible between these types. +!!! error TS2322: Type 'Object' is not assignable to type 'boolean'. b = a; b = x; diff --git a/tests/baselines/reference/asyncFunctionDeclaration15_es5.errors.txt b/tests/baselines/reference/asyncFunctionDeclaration15_es5.errors.txt index 6b4b0a71c6fe1..7e3595ec6f4e0 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration15_es5.errors.txt +++ b/tests/baselines/reference/asyncFunctionDeclaration15_es5.errors.txt @@ -5,10 +5,9 @@ tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration1 tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration15_es5.ts(8,23): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value. tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration15_es5.ts(9,23): error TS1055: Type 'PromiseLike' is not a valid async function return type in ES5/ES3 because it does not refer to a Promise-compatible constructor value. tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration15_es5.ts(10,23): error TS1055: Type 'typeof Thenable' is not a valid async function return type in ES5/ES3 because it does not refer to a Promise-compatible constructor value. - Type 'Thenable' is not assignable to type 'PromiseLike'. - Types of property 'then' are incompatible. - Type '() => void' is not assignable to type '(onfulfilled?: (value: T) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => PromiseLike'. - Type 'void' is not assignable to type 'PromiseLike'. + Construct signature return types 'Thenable' and 'PromiseLike' are incompatible. + The types returned by 'then(...)' are incompatible between these types. + Type 'void' is not assignable to type 'PromiseLike'. tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration15_es5.ts(17,16): error TS1058: The return type of an async function must either be a valid promise or must not contain a callable 'then' member. tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration15_es5.ts(23,25): error TS1320: Type of 'await' operand must either be a valid promise or must not contain a callable 'then' member. @@ -38,10 +37,9 @@ tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration1 async function fn6(): Thenable { } // error ~~~~~~~~ !!! error TS1055: Type 'typeof Thenable' is not a valid async function return type in ES5/ES3 because it does not refer to a Promise-compatible constructor value. -!!! error TS1055: Type 'Thenable' is not assignable to type 'PromiseLike'. -!!! error TS1055: Types of property 'then' are incompatible. -!!! error TS1055: Type '() => void' is not assignable to type '(onfulfilled?: (value: T) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => PromiseLike'. -!!! error TS1055: Type 'void' is not assignable to type 'PromiseLike'. +!!! error TS1055: Construct signature return types 'Thenable' and 'PromiseLike' are incompatible. +!!! error TS1055: The types returned by 'then(...)' are incompatible between these types. +!!! error TS1055: Type 'void' is not assignable to type 'PromiseLike'. async function fn7() { return; } // valid: Promise async function fn8() { return 1; } // valid: Promise async function fn9() { return null; } // valid: Promise diff --git a/tests/baselines/reference/baseConstraintOfDecorator.errors.txt b/tests/baselines/reference/baseConstraintOfDecorator.errors.txt index 8317e5c55c660..8aad9f6feadb5 100644 --- a/tests/baselines/reference/baseConstraintOfDecorator.errors.txt +++ b/tests/baselines/reference/baseConstraintOfDecorator.errors.txt @@ -1,11 +1,10 @@ tests/cases/compiler/baseConstraintOfDecorator.ts(2,5): error TS2322: Type 'typeof decoratorFunc' is not assignable to type 'TFunction'. 'typeof decoratorFunc' is assignable to the constraint of type 'TFunction', but 'TFunction' could be instantiated with a different subtype of constraint '{}'. tests/cases/compiler/baseConstraintOfDecorator.ts(2,40): error TS2507: Type 'TFunction' is not a constructor function type. -tests/cases/compiler/baseConstraintOfDecorator.ts(12,5): error TS2322: Type 'typeof decoratorFunc' is not assignable to type 'TFunction'. -tests/cases/compiler/baseConstraintOfDecorator.ts(12,40): error TS2507: Type 'TFunction' is not a constructor function type. +tests/cases/compiler/baseConstraintOfDecorator.ts(12,18): error TS2545: A mixin class must have a constructor with a single rest parameter of type 'any[]'. -==== tests/cases/compiler/baseConstraintOfDecorator.ts (4 errors) ==== +==== tests/cases/compiler/baseConstraintOfDecorator.ts (3 errors) ==== export function classExtender(superClass: TFunction, _instanceModifier: (instance: any, args: any[]) => void): TFunction { return class decoratorFunc extends superClass { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -29,20 +28,12 @@ tests/cases/compiler/baseConstraintOfDecorator.ts(12,40): error TS2507: Type 'TF class MyClass { private x; } export function classExtender2 MyClass>(superClass: TFunction, _instanceModifier: (instance: any, args: any[]) => void): TFunction { return class decoratorFunc extends superClass { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ~~~~~~~~~~ -!!! error TS2507: Type 'TFunction' is not a constructor function type. -!!! related TS2735 tests/cases/compiler/baseConstraintOfDecorator.ts:11:32: Did you mean for 'TFunction' to be constrained to type 'new (...args: any[]) => MyClass'? + ~~~~~~~~~~~~~ +!!! error TS2545: A mixin class must have a constructor with a single rest parameter of type 'any[]'. constructor(...args: any[]) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ super(...args); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ _instanceModifier(this, args); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } - ~~~~~~~~~ }; - ~~~~~~ -!!! error TS2322: Type 'typeof decoratorFunc' is not assignable to type 'TFunction'. } \ No newline at end of file diff --git a/tests/baselines/reference/baseConstraintOfDecorator.symbols b/tests/baselines/reference/baseConstraintOfDecorator.symbols index 9048d7ed568e8..0a1dad239afc2 100644 --- a/tests/baselines/reference/baseConstraintOfDecorator.symbols +++ b/tests/baselines/reference/baseConstraintOfDecorator.symbols @@ -51,6 +51,7 @@ export function classExtender2 MyCl >args : Symbol(args, Decl(baseConstraintOfDecorator.ts, 12, 20)) super(...args); +>super : Symbol(TFunction, Decl(baseConstraintOfDecorator.ts, 10, 31)) >args : Symbol(args, Decl(baseConstraintOfDecorator.ts, 12, 20)) _instanceModifier(this, args); diff --git a/tests/baselines/reference/baseConstraintOfDecorator.types b/tests/baselines/reference/baseConstraintOfDecorator.types index a5a277c5d2a68..78c77ee78a2ab 100644 --- a/tests/baselines/reference/baseConstraintOfDecorator.types +++ b/tests/baselines/reference/baseConstraintOfDecorator.types @@ -42,16 +42,16 @@ export function classExtender2 MyCl >args : any[] return class decoratorFunc extends superClass { ->class decoratorFunc extends superClass { constructor(...args: any[]) { super(...args); _instanceModifier(this, args); } } : typeof decoratorFunc ->decoratorFunc : typeof decoratorFunc ->superClass : TFunction +>class decoratorFunc extends superClass { constructor(...args: any[]) { super(...args); _instanceModifier(this, args); } } : { new (...args: any[]): decoratorFunc; prototype: classExtender2.decoratorFunc; } & TFunction +>decoratorFunc : { new (...args: any[]): decoratorFunc; prototype: classExtender2.decoratorFunc; } & TFunction +>superClass : MyClass constructor(...args: any[]) { >args : any[] super(...args); >super(...args) : void ->super : any +>super : TFunction >...args : any >args : any[] diff --git a/tests/baselines/reference/bigintWithLib.errors.txt b/tests/baselines/reference/bigintWithLib.errors.txt index b4c9f65cf9c02..fb54c2a530bca 100644 --- a/tests/baselines/reference/bigintWithLib.errors.txt +++ b/tests/baselines/reference/bigintWithLib.errors.txt @@ -4,15 +4,11 @@ tests/cases/compiler/bigintWithLib.ts(16,33): error TS2769: No overload matches Argument of type 'number[]' is not assignable to parameter of type 'number'. Overload 2 of 3, '(array: Iterable): BigInt64Array', gave the following error. Argument of type 'number[]' is not assignable to parameter of type 'Iterable'. - Types of property '[Symbol.iterator]' are incompatible. - Type '() => IterableIterator' is not assignable to type '() => Iterator'. - Type 'IterableIterator' is not assignable to type 'Iterator'. - Types of property 'next' are incompatible. - Type '(...args: [] | [undefined]) => IteratorResult' is not assignable to type '(...args: [] | [undefined]) => IteratorResult'. - Type 'IteratorResult' is not assignable to type 'IteratorResult'. - Type 'IteratorYieldResult' is not assignable to type 'IteratorResult'. - Type 'IteratorYieldResult' is not assignable to type 'IteratorYieldResult'. - Type 'number' is not assignable to type 'bigint'. + The types returned by '[Symbol.iterator]().next(...)' are incompatible between these types. + Type 'IteratorResult' is not assignable to type 'IteratorResult'. + Type 'IteratorYieldResult' is not assignable to type 'IteratorResult'. + Type 'IteratorYieldResult' is not assignable to type 'IteratorYieldResult'. + Type 'number' is not assignable to type 'bigint'. Overload 3 of 3, '(buffer: ArrayBuffer | SharedArrayBuffer, byteOffset?: number, length?: number): BigInt64Array', gave the following error. Argument of type 'number[]' is not assignable to parameter of type 'ArrayBuffer | SharedArrayBuffer'. Type 'number[]' is missing the following properties from type 'SharedArrayBuffer': byteLength, [Symbol.species], [Symbol.toStringTag] @@ -55,15 +51,11 @@ tests/cases/compiler/bigintWithLib.ts(43,26): error TS2345: Argument of type '12 !!! error TS2769: Argument of type 'number[]' is not assignable to parameter of type 'number'. !!! error TS2769: Overload 2 of 3, '(array: Iterable): BigInt64Array', gave the following error. !!! error TS2769: Argument of type 'number[]' is not assignable to parameter of type 'Iterable'. -!!! error TS2769: Types of property '[Symbol.iterator]' are incompatible. -!!! error TS2769: Type '() => IterableIterator' is not assignable to type '() => Iterator'. -!!! error TS2769: Type 'IterableIterator' is not assignable to type 'Iterator'. -!!! error TS2769: Types of property 'next' are incompatible. -!!! error TS2769: Type '(...args: [] | [undefined]) => IteratorResult' is not assignable to type '(...args: [] | [undefined]) => IteratorResult'. -!!! error TS2769: Type 'IteratorResult' is not assignable to type 'IteratorResult'. -!!! error TS2769: Type 'IteratorYieldResult' is not assignable to type 'IteratorResult'. -!!! error TS2769: Type 'IteratorYieldResult' is not assignable to type 'IteratorYieldResult'. -!!! error TS2769: Type 'number' is not assignable to type 'bigint'. +!!! error TS2769: The types returned by '[Symbol.iterator]().next(...)' are incompatible between these types. +!!! error TS2769: Type 'IteratorResult' is not assignable to type 'IteratorResult'. +!!! error TS2769: Type 'IteratorYieldResult' is not assignable to type 'IteratorResult'. +!!! error TS2769: Type 'IteratorYieldResult' is not assignable to type 'IteratorYieldResult'. +!!! error TS2769: Type 'number' is not assignable to type 'bigint'. !!! error TS2769: Overload 3 of 3, '(buffer: ArrayBuffer | SharedArrayBuffer, byteOffset?: number, length?: number): BigInt64Array', gave the following error. !!! error TS2769: Argument of type 'number[]' is not assignable to parameter of type 'ArrayBuffer | SharedArrayBuffer'. !!! error TS2769: Type 'number[]' is missing the following properties from type 'SharedArrayBuffer': byteLength, [Symbol.species], [Symbol.toStringTag] diff --git a/tests/baselines/reference/booleanAssignment.errors.txt b/tests/baselines/reference/booleanAssignment.errors.txt index fc25fd4007fff..8a928c57404b9 100644 --- a/tests/baselines/reference/booleanAssignment.errors.txt +++ b/tests/baselines/reference/booleanAssignment.errors.txt @@ -1,9 +1,8 @@ tests/cases/compiler/booleanAssignment.ts(2,1): error TS2322: Type '1' is not assignable to type 'Boolean'. tests/cases/compiler/booleanAssignment.ts(3,1): error TS2322: Type '"a"' is not assignable to type 'Boolean'. tests/cases/compiler/booleanAssignment.ts(4,1): error TS2322: Type '{}' is not assignable to type 'Boolean'. - Types of property 'valueOf' are incompatible. - Type '() => Object' is not assignable to type '() => boolean'. - Type 'Object' is not assignable to type 'boolean'. + The types returned by 'valueOf()' are incompatible between these types. + Type 'Object' is not assignable to type 'boolean'. ==== tests/cases/compiler/booleanAssignment.ts (3 errors) ==== @@ -17,9 +16,8 @@ tests/cases/compiler/booleanAssignment.ts(4,1): error TS2322: Type '{}' is not a b = {}; // Error ~ !!! error TS2322: Type '{}' is not assignable to type 'Boolean'. -!!! error TS2322: Types of property 'valueOf' are incompatible. -!!! error TS2322: Type '() => Object' is not assignable to type '() => boolean'. -!!! error TS2322: Type 'Object' is not assignable to type 'boolean'. +!!! error TS2322: The types returned by 'valueOf()' are incompatible between these types. +!!! error TS2322: Type 'Object' is not assignable to type 'boolean'. var o = {}; o = b; // OK diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance.errors.txt b/tests/baselines/reference/callSignatureAssignabilityInInheritance.errors.txt index 2ca3bb1aaf00a..43589e943703f 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance.errors.txt +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance.errors.txt @@ -1,12 +1,10 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance.ts(57,15): error TS2430: Interface 'I2' incorrectly extends interface 'Base2'. - Types of property 'a' are incompatible. - Type '(x: number) => string' is not assignable to type '(x: number) => number'. - Type 'string' is not assignable to type 'number'. + The types returned by 'a(...)' are incompatible between these types. + Type 'string' is not assignable to type 'number'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance.ts(63,15): error TS2430: Interface 'I3' incorrectly extends interface 'Base2'. - Types of property 'a2' are incompatible. - Type '(x: T) => string' is not assignable to type '(x: T) => T'. - Type 'string' is not assignable to type 'T'. - 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. + The types returned by 'a2(...)' are incompatible between these types. + Type 'string' is not assignable to type 'T'. + 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance.ts (2 errors) ==== @@ -69,9 +67,8 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSign interface I2 extends Base2 { ~~ !!! error TS2430: Interface 'I2' incorrectly extends interface 'Base2'. -!!! error TS2430: Types of property 'a' are incompatible. -!!! error TS2430: Type '(x: number) => string' is not assignable to type '(x: number) => number'. -!!! error TS2430: Type 'string' is not assignable to type 'number'. +!!! error TS2430: The types returned by 'a(...)' are incompatible between these types. +!!! error TS2430: Type 'string' is not assignable to type 'number'. // N's a: (x: number) => string; // error because base returns non-void; } @@ -80,10 +77,9 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSign interface I3 extends Base2 { ~~ !!! error TS2430: Interface 'I3' incorrectly extends interface 'Base2'. -!!! error TS2430: Types of property 'a2' are incompatible. -!!! error TS2430: Type '(x: T) => string' is not assignable to type '(x: T) => T'. -!!! error TS2430: Type 'string' is not assignable to type 'T'. -!!! error TS2430: 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: The types returned by 'a2(...)' are incompatible between these types. +!!! error TS2430: Type 'string' is not assignable to type 'T'. +!!! error TS2430: 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. // N's a2: (x: T) => string; // error because base returns non-void; } diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance3.errors.txt b/tests/baselines/reference/callSignatureAssignabilityInInheritance3.errors.txt index 671c09b3d7906..287875d44da72 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance3.errors.txt +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance3.errors.txt @@ -27,16 +27,14 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSign Types of property 'a' are incompatible. Type 'string' is not assignable to type 'Base'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance3.ts(100,19): error TS2430: Interface 'I6' incorrectly extends interface 'B'. - Types of property 'a2' are incompatible. - Type '(x: T) => string[]' is not assignable to type '(x: T) => T[]'. - Type 'string[]' is not assignable to type 'T[]'. - Type 'string' is not assignable to type 'T'. - 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. + The types returned by 'a2(...)' are incompatible between these types. + Type 'string[]' is not assignable to type 'T[]'. + Type 'string' is not assignable to type 'T'. + 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance3.ts(109,19): error TS2430: Interface 'I7' incorrectly extends interface 'C'. - Types of property 'a2' are incompatible. - Type '(x: T) => T[]' is not assignable to type '(x: T) => string[]'. - Type 'T[]' is not assignable to type 'string[]'. - Type 'T' is not assignable to type 'string'. + The types returned by 'a2(...)' are incompatible between these types. + Type 'T[]' is not assignable to type 'string[]'. + Type 'T' is not assignable to type 'string'. ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance3.ts (6 errors) ==== @@ -174,11 +172,10 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSign interface I6 extends B { ~~ !!! error TS2430: Interface 'I6' incorrectly extends interface 'B'. -!!! error TS2430: Types of property 'a2' are incompatible. -!!! error TS2430: Type '(x: T) => string[]' is not assignable to type '(x: T) => T[]'. -!!! error TS2430: Type 'string[]' is not assignable to type 'T[]'. -!!! error TS2430: Type 'string' is not assignable to type 'T'. -!!! error TS2430: 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: The types returned by 'a2(...)' are incompatible between these types. +!!! error TS2430: Type 'string[]' is not assignable to type 'T[]'. +!!! error TS2430: Type 'string' is not assignable to type 'T'. +!!! error TS2430: 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a2: (x: T) => string[]; // error } @@ -190,10 +187,9 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSign interface I7 extends C { ~~ !!! error TS2430: Interface 'I7' incorrectly extends interface 'C'. -!!! error TS2430: Types of property 'a2' are incompatible. -!!! error TS2430: Type '(x: T) => T[]' is not assignable to type '(x: T) => string[]'. -!!! error TS2430: Type 'T[]' is not assignable to type 'string[]'. -!!! error TS2430: Type 'T' is not assignable to type 'string'. +!!! error TS2430: The types returned by 'a2(...)' are incompatible between these types. +!!! error TS2430: Type 'T[]' is not assignable to type 'string[]'. +!!! error TS2430: Type 'T' is not assignable to type 'string'. a2: (x: T) => T[]; // error } } diff --git a/tests/baselines/reference/checkJsxChildrenCanBeTupleType.errors.txt b/tests/baselines/reference/checkJsxChildrenCanBeTupleType.errors.txt index aeaeb56ea7543..0780f4e92c181 100644 --- a/tests/baselines/reference/checkJsxChildrenCanBeTupleType.errors.txt +++ b/tests/baselines/reference/checkJsxChildrenCanBeTupleType.errors.txt @@ -1,10 +1,8 @@ tests/cases/conformance/jsx/checkJsxChildrenCanBeTupleType.tsx(17,18): error TS2769: No overload matches this call. Overload 1 of 2, '(props: Readonly): ResizablePanel', gave the following error. Type '{ children: [Element, Element, Element]; }' is not assignable to type 'Readonly'. - Types of property 'children' are incompatible. - Type '[Element, Element, Element]' is not assignable to type '[ReactNode, ReactNode]'. - Types of property 'length' are incompatible. - Type '3' is not assignable to type '2'. + The types of 'children.length' are incompatible between these types. + Type '3' is not assignable to type '2'. Overload 2 of 2, '(props: ResizablePanelProps, context?: any): ResizablePanel', gave the following error. Type '{ children: [Element, Element, Element]; }' is not assignable to type 'Readonly'. Types of property 'children' are incompatible. @@ -33,10 +31,8 @@ tests/cases/conformance/jsx/checkJsxChildrenCanBeTupleType.tsx(17,18): error TS2 !!! error TS2769: No overload matches this call. !!! error TS2769: Overload 1 of 2, '(props: Readonly): ResizablePanel', gave the following error. !!! error TS2769: Type '{ children: [Element, Element, Element]; }' is not assignable to type 'Readonly'. -!!! error TS2769: Types of property 'children' are incompatible. -!!! error TS2769: Type '[Element, Element, Element]' is not assignable to type '[ReactNode, ReactNode]'. -!!! error TS2769: Types of property 'length' are incompatible. -!!! error TS2769: Type '3' is not assignable to type '2'. +!!! error TS2769: The types of 'children.length' are incompatible between these types. +!!! error TS2769: Type '3' is not assignable to type '2'. !!! error TS2769: Overload 2 of 2, '(props: ResizablePanelProps, context?: any): ResizablePanel', gave the following error. !!! error TS2769: Type '{ children: [Element, Element, Element]; }' is not assignable to type 'Readonly'. !!! error TS2769: Types of property 'children' are incompatible. diff --git a/tests/baselines/reference/checkJsxChildrenProperty15.errors.txt b/tests/baselines/reference/checkJsxChildrenProperty15.errors.txt index 605a293ffaab3..d0be275765ffd 100644 --- a/tests/baselines/reference/checkJsxChildrenProperty15.errors.txt +++ b/tests/baselines/reference/checkJsxChildrenProperty15.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/jsx/file.tsx(10,13): error TS2322: Type '{ children: Element; }' is not assignable to type 'IntrinsicAttributes'. +tests/cases/conformance/jsx/file.tsx(10,17): error TS2322: Type '{ children: Element; }' is not assignable to type 'IntrinsicAttributes'. Property 'children' does not exist on type 'IntrinsicAttributes'. tests/cases/conformance/jsx/file.tsx(11,13): error TS2322: Type '{ children: Element; key: string; }' is not assignable to type 'IntrinsicAttributes'. Property 'children' does not exist on type 'IntrinsicAttributes'. @@ -17,7 +17,7 @@ tests/cases/conformance/jsx/file.tsx(12,13): error TS2322: Type '{ children: Ele // Not OK (excess children) const k3 = } />; - ~~~ + ~~~~~~~~ !!! error TS2322: Type '{ children: Element; }' is not assignable to type 'IntrinsicAttributes'. !!! error TS2322: Property 'children' does not exist on type 'IntrinsicAttributes'. const k4 =
; diff --git a/tests/baselines/reference/complexRecursiveCollections.errors.txt b/tests/baselines/reference/complexRecursiveCollections.errors.txt index 27bb24bc5cc14..cd88e596fd160 100644 --- a/tests/baselines/reference/complexRecursiveCollections.errors.txt +++ b/tests/baselines/reference/complexRecursiveCollections.errors.txt @@ -1,18 +1,15 @@ tests/cases/compiler/immutable.ts(341,22): error TS2430: Interface 'Keyed' incorrectly extends interface 'Collection'. - Types of property 'toSeq' are incompatible. - Type '() => Keyed' is not assignable to type '() => this'. - Type 'Keyed' is not assignable to type 'this'. - 'Keyed' is assignable to the constraint of type 'this', but 'this' could be instantiated with a different subtype of constraint 'Keyed'. + The types returned by 'toSeq()' are incompatible between these types. + Type 'Keyed' is not assignable to type 'this'. + 'Keyed' is assignable to the constraint of type 'this', but 'this' could be instantiated with a different subtype of constraint 'Keyed'. tests/cases/compiler/immutable.ts(359,22): error TS2430: Interface 'Indexed' incorrectly extends interface 'Collection'. - Types of property 'toSeq' are incompatible. - Type '() => Indexed' is not assignable to type '() => this'. - Type 'Indexed' is not assignable to type 'this'. - 'Indexed' is assignable to the constraint of type 'this', but 'this' could be instantiated with a different subtype of constraint 'Indexed'. + The types returned by 'toSeq()' are incompatible between these types. + Type 'Indexed' is not assignable to type 'this'. + 'Indexed' is assignable to the constraint of type 'this', but 'this' could be instantiated with a different subtype of constraint 'Indexed'. tests/cases/compiler/immutable.ts(391,22): error TS2430: Interface 'Set' incorrectly extends interface 'Collection'. - Types of property 'toSeq' are incompatible. - Type '() => Set' is not assignable to type '() => this'. - Type 'Set' is not assignable to type 'this'. - 'Set' is assignable to the constraint of type 'this', but 'this' could be instantiated with a different subtype of constraint 'Set'. + The types returned by 'toSeq()' are incompatible between these types. + Type 'Set' is not assignable to type 'this'. + 'Set' is assignable to the constraint of type 'this', but 'this' could be instantiated with a different subtype of constraint 'Set'. ==== tests/cases/compiler/complex.ts (0 errors) ==== @@ -380,10 +377,9 @@ tests/cases/compiler/immutable.ts(391,22): error TS2430: Interface 'Set' inco export interface Keyed extends Collection { ~~~~~ !!! error TS2430: Interface 'Keyed' incorrectly extends interface 'Collection'. -!!! error TS2430: Types of property 'toSeq' are incompatible. -!!! error TS2430: Type '() => Keyed' is not assignable to type '() => this'. -!!! error TS2430: Type 'Keyed' is not assignable to type 'this'. -!!! error TS2430: 'Keyed' is assignable to the constraint of type 'this', but 'this' could be instantiated with a different subtype of constraint 'Keyed'. +!!! error TS2430: The types returned by 'toSeq()' are incompatible between these types. +!!! error TS2430: Type 'Keyed' is not assignable to type 'this'. +!!! error TS2430: 'Keyed' is assignable to the constraint of type 'this', but 'this' could be instantiated with a different subtype of constraint 'Keyed'. toJS(): Object; toJSON(): { [key: string]: V }; toSeq(): Seq.Keyed; @@ -404,10 +400,9 @@ tests/cases/compiler/immutable.ts(391,22): error TS2430: Interface 'Set' inco export interface Indexed extends Collection { ~~~~~~~ !!! error TS2430: Interface 'Indexed' incorrectly extends interface 'Collection'. -!!! error TS2430: Types of property 'toSeq' are incompatible. -!!! error TS2430: Type '() => Indexed' is not assignable to type '() => this'. -!!! error TS2430: Type 'Indexed' is not assignable to type 'this'. -!!! error TS2430: 'Indexed' is assignable to the constraint of type 'this', but 'this' could be instantiated with a different subtype of constraint 'Indexed'. +!!! error TS2430: The types returned by 'toSeq()' are incompatible between these types. +!!! error TS2430: Type 'Indexed' is not assignable to type 'this'. +!!! error TS2430: 'Indexed' is assignable to the constraint of type 'this', but 'this' could be instantiated with a different subtype of constraint 'Indexed'. toJS(): Array; toJSON(): Array; // Reading values @@ -442,10 +437,9 @@ tests/cases/compiler/immutable.ts(391,22): error TS2430: Interface 'Set' inco export interface Set extends Collection { ~~~ !!! error TS2430: Interface 'Set' incorrectly extends interface 'Collection'. -!!! error TS2430: Types of property 'toSeq' are incompatible. -!!! error TS2430: Type '() => Set' is not assignable to type '() => this'. -!!! error TS2430: Type 'Set' is not assignable to type 'this'. -!!! error TS2430: 'Set' is assignable to the constraint of type 'this', but 'this' could be instantiated with a different subtype of constraint 'Set'. +!!! error TS2430: The types returned by 'toSeq()' are incompatible between these types. +!!! error TS2430: Type 'Set' is not assignable to type 'this'. +!!! error TS2430: 'Set' is assignable to the constraint of type 'this', but 'this' could be instantiated with a different subtype of constraint 'Set'. toJS(): Array; toJSON(): Array; toSeq(): Seq.Set; diff --git a/tests/baselines/reference/constEnum2.errors.txt b/tests/baselines/reference/constEnum2.errors.txt index 4748b1840b8cb..2ab0f624d608d 100644 --- a/tests/baselines/reference/constEnum2.errors.txt +++ b/tests/baselines/reference/constEnum2.errors.txt @@ -1,6 +1,6 @@ tests/cases/conformance/constEnums/constEnum2.ts(10,9): error TS2474: const enum member initializers can only contain literal values and other computed enum values. tests/cases/conformance/constEnums/constEnum2.ts(11,9): error TS2474: const enum member initializers can only contain literal values and other computed enum values. -tests/cases/conformance/constEnums/constEnum2.ts(12,5): error TS1005: ',' expected. +tests/cases/conformance/constEnums/constEnum2.ts(12,5): error TS1357: An enum member name must be followed by a ',', '=', or '}'. tests/cases/conformance/constEnums/constEnum2.ts(12,9): error TS2474: const enum member initializers can only contain literal values and other computed enum values. @@ -22,7 +22,7 @@ tests/cases/conformance/constEnums/constEnum2.ts(12,9): error TS2474: const enum !!! error TS2474: const enum member initializers can only contain literal values and other computed enum values. g = CONST, ~ -!!! error TS1005: ',' expected. +!!! error TS1357: An enum member name must be followed by a ',', '=', or '}'. ~~~~~ !!! error TS2474: const enum member initializers can only contain literal values and other computed enum values. } \ No newline at end of file diff --git a/tests/baselines/reference/constructSignatureAssignabilityInInheritance.errors.txt b/tests/baselines/reference/constructSignatureAssignabilityInInheritance.errors.txt index e326d163c8ced..1cc019746bad2 100644 --- a/tests/baselines/reference/constructSignatureAssignabilityInInheritance.errors.txt +++ b/tests/baselines/reference/constructSignatureAssignabilityInInheritance.errors.txt @@ -1,12 +1,10 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance.ts(61,15): error TS2430: Interface 'I2' incorrectly extends interface 'Base2'. - Types of property 'a' are incompatible. - Type 'new (x: number) => string' is not assignable to type 'new (x: number) => number'. - Type 'string' is not assignable to type 'number'. + The types returned by 'new a(...)' are incompatible between these types. + Type 'string' is not assignable to type 'number'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance.ts(67,15): error TS2430: Interface 'I3' incorrectly extends interface 'Base2'. - Types of property 'a2' are incompatible. - Type 'new (x: T) => string' is not assignable to type 'new (x: T) => T'. - Type 'string' is not assignable to type 'T'. - 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. + The types returned by 'new a2(...)' are incompatible between these types. + Type 'string' is not assignable to type 'T'. + 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance.ts (2 errors) ==== @@ -73,9 +71,8 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/construc interface I2 extends Base2 { ~~ !!! error TS2430: Interface 'I2' incorrectly extends interface 'Base2'. -!!! error TS2430: Types of property 'a' are incompatible. -!!! error TS2430: Type 'new (x: number) => string' is not assignable to type 'new (x: number) => number'. -!!! error TS2430: Type 'string' is not assignable to type 'number'. +!!! error TS2430: The types returned by 'new a(...)' are incompatible between these types. +!!! error TS2430: Type 'string' is not assignable to type 'number'. // N's a: new (x: number) => string; // error because base returns non-void; } @@ -84,10 +81,9 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/construc interface I3 extends Base2 { ~~ !!! error TS2430: Interface 'I3' incorrectly extends interface 'Base2'. -!!! error TS2430: Types of property 'a2' are incompatible. -!!! error TS2430: Type 'new (x: T) => string' is not assignable to type 'new (x: T) => T'. -!!! error TS2430: Type 'string' is not assignable to type 'T'. -!!! error TS2430: 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: The types returned by 'new a2(...)' are incompatible between these types. +!!! error TS2430: Type 'string' is not assignable to type 'T'. +!!! error TS2430: 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. // N's a2: new (x: T) => string; // error because base returns non-void; } diff --git a/tests/baselines/reference/constructSignatureAssignabilityInInheritance3.errors.txt b/tests/baselines/reference/constructSignatureAssignabilityInInheritance3.errors.txt index 59d8105c59cc9..d4c9e808200d2 100644 --- a/tests/baselines/reference/constructSignatureAssignabilityInInheritance3.errors.txt +++ b/tests/baselines/reference/constructSignatureAssignabilityInInheritance3.errors.txt @@ -27,16 +27,14 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/construc Types of property 'a' are incompatible. Type 'string' is not assignable to type 'Base'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance3.ts(86,19): error TS2430: Interface 'I6' incorrectly extends interface 'B'. - Types of property 'a2' are incompatible. - Type 'new (x: T) => string[]' is not assignable to type 'new (x: T) => T[]'. - Type 'string[]' is not assignable to type 'T[]'. - Type 'string' is not assignable to type 'T'. - 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. + The types returned by 'new a2(...)' are incompatible between these types. + Type 'string[]' is not assignable to type 'T[]'. + Type 'string' is not assignable to type 'T'. + 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance3.ts(95,19): error TS2430: Interface 'I7' incorrectly extends interface 'C'. - Types of property 'a2' are incompatible. - Type 'new (x: T) => T[]' is not assignable to type 'new (x: T) => string[]'. - Type 'T[]' is not assignable to type 'string[]'. - Type 'T' is not assignable to type 'string'. + The types returned by 'new a2(...)' are incompatible between these types. + Type 'T[]' is not assignable to type 'string[]'. + Type 'T' is not assignable to type 'string'. ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance3.ts (6 errors) ==== @@ -160,11 +158,10 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/construc interface I6 extends B { ~~ !!! error TS2430: Interface 'I6' incorrectly extends interface 'B'. -!!! error TS2430: Types of property 'a2' are incompatible. -!!! error TS2430: Type 'new (x: T) => string[]' is not assignable to type 'new (x: T) => T[]'. -!!! error TS2430: Type 'string[]' is not assignable to type 'T[]'. -!!! error TS2430: Type 'string' is not assignable to type 'T'. -!!! error TS2430: 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: The types returned by 'new a2(...)' are incompatible between these types. +!!! error TS2430: Type 'string[]' is not assignable to type 'T[]'. +!!! error TS2430: Type 'string' is not assignable to type 'T'. +!!! error TS2430: 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a2: new (x: T) => string[]; // error } @@ -176,10 +173,9 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/construc interface I7 extends C { ~~ !!! error TS2430: Interface 'I7' incorrectly extends interface 'C'. -!!! error TS2430: Types of property 'a2' are incompatible. -!!! error TS2430: Type 'new (x: T) => T[]' is not assignable to type 'new (x: T) => string[]'. -!!! error TS2430: Type 'T[]' is not assignable to type 'string[]'. -!!! error TS2430: Type 'T' is not assignable to type 'string'. +!!! error TS2430: The types returned by 'new a2(...)' are incompatible between these types. +!!! error TS2430: Type 'T[]' is not assignable to type 'string[]'. +!!! error TS2430: Type 'T' is not assignable to type 'string'. a2: new (x: T) => T[]; // error } diff --git a/tests/baselines/reference/contextualSignatureInstantiation4.js b/tests/baselines/reference/contextualSignatureInstantiation4.js new file mode 100644 index 0000000000000..8db041b29b5f9 --- /dev/null +++ b/tests/baselines/reference/contextualSignatureInstantiation4.js @@ -0,0 +1,29 @@ +//// [contextualSignatureInstantiation4.ts] +// Repros from #32976 + +declare class Banana { constructor(a: string, property: T) } + +declare function fruitFactory1(Fruit: new (...args: any[]) => TFruit): TFruit +const banana1 = fruitFactory1(Banana) // Banana + +declare function fruitFactory2(Fruit: new (a: string, ...args: any[]) => TFruit): TFruit +const banana2 = fruitFactory2(Banana) // Banana + +declare function fruitFactory3(Fruit: new (a: string, s: "foo", ...args: any[]) => TFruit): TFruit +const banana3 = fruitFactory3(Banana) // Banana<"foo"> + +declare function fruitFactory4(Fruit: new (a: string, ...args: "foo"[]) => TFruit): TFruit +const banana4 = fruitFactory4(Banana) // Banana<"foo"> + +declare function fruitFactory5(Fruit: new (...args: "foo"[]) => TFruit): TFruit +const banana5 = fruitFactory5(Banana) // Banana<"foo"> + + +//// [contextualSignatureInstantiation4.js] +"use strict"; +// Repros from #32976 +var banana1 = fruitFactory1(Banana); // Banana +var banana2 = fruitFactory2(Banana); // Banana +var banana3 = fruitFactory3(Banana); // Banana<"foo"> +var banana4 = fruitFactory4(Banana); // Banana<"foo"> +var banana5 = fruitFactory5(Banana); // Banana<"foo"> diff --git a/tests/baselines/reference/contextualSignatureInstantiation4.symbols b/tests/baselines/reference/contextualSignatureInstantiation4.symbols new file mode 100644 index 0000000000000..a08486b43d8fa --- /dev/null +++ b/tests/baselines/reference/contextualSignatureInstantiation4.symbols @@ -0,0 +1,79 @@ +=== tests/cases/compiler/contextualSignatureInstantiation4.ts === +// Repros from #32976 + +declare class Banana { constructor(a: string, property: T) } +>Banana : Symbol(Banana, Decl(contextualSignatureInstantiation4.ts, 0, 0)) +>T : Symbol(T, Decl(contextualSignatureInstantiation4.ts, 2, 21)) +>a : Symbol(a, Decl(contextualSignatureInstantiation4.ts, 2, 53)) +>property : Symbol(property, Decl(contextualSignatureInstantiation4.ts, 2, 63)) +>T : Symbol(T, Decl(contextualSignatureInstantiation4.ts, 2, 21)) + +declare function fruitFactory1(Fruit: new (...args: any[]) => TFruit): TFruit +>fruitFactory1 : Symbol(fruitFactory1, Decl(contextualSignatureInstantiation4.ts, 2, 78)) +>TFruit : Symbol(TFruit, Decl(contextualSignatureInstantiation4.ts, 4, 31)) +>Fruit : Symbol(Fruit, Decl(contextualSignatureInstantiation4.ts, 4, 39)) +>args : Symbol(args, Decl(contextualSignatureInstantiation4.ts, 4, 51)) +>TFruit : Symbol(TFruit, Decl(contextualSignatureInstantiation4.ts, 4, 31)) +>TFruit : Symbol(TFruit, Decl(contextualSignatureInstantiation4.ts, 4, 31)) + +const banana1 = fruitFactory1(Banana) // Banana +>banana1 : Symbol(banana1, Decl(contextualSignatureInstantiation4.ts, 5, 5)) +>fruitFactory1 : Symbol(fruitFactory1, Decl(contextualSignatureInstantiation4.ts, 2, 78)) +>Banana : Symbol(Banana, Decl(contextualSignatureInstantiation4.ts, 0, 0)) + +declare function fruitFactory2(Fruit: new (a: string, ...args: any[]) => TFruit): TFruit +>fruitFactory2 : Symbol(fruitFactory2, Decl(contextualSignatureInstantiation4.ts, 5, 37)) +>TFruit : Symbol(TFruit, Decl(contextualSignatureInstantiation4.ts, 7, 31)) +>Fruit : Symbol(Fruit, Decl(contextualSignatureInstantiation4.ts, 7, 39)) +>a : Symbol(a, Decl(contextualSignatureInstantiation4.ts, 7, 51)) +>args : Symbol(args, Decl(contextualSignatureInstantiation4.ts, 7, 61)) +>TFruit : Symbol(TFruit, Decl(contextualSignatureInstantiation4.ts, 7, 31)) +>TFruit : Symbol(TFruit, Decl(contextualSignatureInstantiation4.ts, 7, 31)) + +const banana2 = fruitFactory2(Banana) // Banana +>banana2 : Symbol(banana2, Decl(contextualSignatureInstantiation4.ts, 8, 5)) +>fruitFactory2 : Symbol(fruitFactory2, Decl(contextualSignatureInstantiation4.ts, 5, 37)) +>Banana : Symbol(Banana, Decl(contextualSignatureInstantiation4.ts, 0, 0)) + +declare function fruitFactory3(Fruit: new (a: string, s: "foo", ...args: any[]) => TFruit): TFruit +>fruitFactory3 : Symbol(fruitFactory3, Decl(contextualSignatureInstantiation4.ts, 8, 37)) +>TFruit : Symbol(TFruit, Decl(contextualSignatureInstantiation4.ts, 10, 31)) +>Fruit : Symbol(Fruit, Decl(contextualSignatureInstantiation4.ts, 10, 39)) +>a : Symbol(a, Decl(contextualSignatureInstantiation4.ts, 10, 51)) +>s : Symbol(s, Decl(contextualSignatureInstantiation4.ts, 10, 61)) +>args : Symbol(args, Decl(contextualSignatureInstantiation4.ts, 10, 71)) +>TFruit : Symbol(TFruit, Decl(contextualSignatureInstantiation4.ts, 10, 31)) +>TFruit : Symbol(TFruit, Decl(contextualSignatureInstantiation4.ts, 10, 31)) + +const banana3 = fruitFactory3(Banana) // Banana<"foo"> +>banana3 : Symbol(banana3, Decl(contextualSignatureInstantiation4.ts, 11, 5)) +>fruitFactory3 : Symbol(fruitFactory3, Decl(contextualSignatureInstantiation4.ts, 8, 37)) +>Banana : Symbol(Banana, Decl(contextualSignatureInstantiation4.ts, 0, 0)) + +declare function fruitFactory4(Fruit: new (a: string, ...args: "foo"[]) => TFruit): TFruit +>fruitFactory4 : Symbol(fruitFactory4, Decl(contextualSignatureInstantiation4.ts, 11, 37)) +>TFruit : Symbol(TFruit, Decl(contextualSignatureInstantiation4.ts, 13, 31)) +>Fruit : Symbol(Fruit, Decl(contextualSignatureInstantiation4.ts, 13, 39)) +>a : Symbol(a, Decl(contextualSignatureInstantiation4.ts, 13, 51)) +>args : Symbol(args, Decl(contextualSignatureInstantiation4.ts, 13, 61)) +>TFruit : Symbol(TFruit, Decl(contextualSignatureInstantiation4.ts, 13, 31)) +>TFruit : Symbol(TFruit, Decl(contextualSignatureInstantiation4.ts, 13, 31)) + +const banana4 = fruitFactory4(Banana) // Banana<"foo"> +>banana4 : Symbol(banana4, Decl(contextualSignatureInstantiation4.ts, 14, 5)) +>fruitFactory4 : Symbol(fruitFactory4, Decl(contextualSignatureInstantiation4.ts, 11, 37)) +>Banana : Symbol(Banana, Decl(contextualSignatureInstantiation4.ts, 0, 0)) + +declare function fruitFactory5(Fruit: new (...args: "foo"[]) => TFruit): TFruit +>fruitFactory5 : Symbol(fruitFactory5, Decl(contextualSignatureInstantiation4.ts, 14, 37)) +>TFruit : Symbol(TFruit, Decl(contextualSignatureInstantiation4.ts, 16, 31)) +>Fruit : Symbol(Fruit, Decl(contextualSignatureInstantiation4.ts, 16, 39)) +>args : Symbol(args, Decl(contextualSignatureInstantiation4.ts, 16, 51)) +>TFruit : Symbol(TFruit, Decl(contextualSignatureInstantiation4.ts, 16, 31)) +>TFruit : Symbol(TFruit, Decl(contextualSignatureInstantiation4.ts, 16, 31)) + +const banana5 = fruitFactory5(Banana) // Banana<"foo"> +>banana5 : Symbol(banana5, Decl(contextualSignatureInstantiation4.ts, 17, 5)) +>fruitFactory5 : Symbol(fruitFactory5, Decl(contextualSignatureInstantiation4.ts, 14, 37)) +>Banana : Symbol(Banana, Decl(contextualSignatureInstantiation4.ts, 0, 0)) + diff --git a/tests/baselines/reference/contextualSignatureInstantiation4.types b/tests/baselines/reference/contextualSignatureInstantiation4.types new file mode 100644 index 0000000000000..1c27df7ff6963 --- /dev/null +++ b/tests/baselines/reference/contextualSignatureInstantiation4.types @@ -0,0 +1,67 @@ +=== tests/cases/compiler/contextualSignatureInstantiation4.ts === +// Repros from #32976 + +declare class Banana { constructor(a: string, property: T) } +>Banana : Banana +>a : string +>property : T + +declare function fruitFactory1(Fruit: new (...args: any[]) => TFruit): TFruit +>fruitFactory1 : (Fruit: new (...args: any[]) => TFruit) => TFruit +>Fruit : new (...args: any[]) => TFruit +>args : any[] + +const banana1 = fruitFactory1(Banana) // Banana +>banana1 : Banana +>fruitFactory1(Banana) : Banana +>fruitFactory1 : (Fruit: new (...args: any[]) => TFruit) => TFruit +>Banana : typeof Banana + +declare function fruitFactory2(Fruit: new (a: string, ...args: any[]) => TFruit): TFruit +>fruitFactory2 : (Fruit: new (a: string, ...args: any[]) => TFruit) => TFruit +>Fruit : new (a: string, ...args: any[]) => TFruit +>a : string +>args : any[] + +const banana2 = fruitFactory2(Banana) // Banana +>banana2 : Banana +>fruitFactory2(Banana) : Banana +>fruitFactory2 : (Fruit: new (a: string, ...args: any[]) => TFruit) => TFruit +>Banana : typeof Banana + +declare function fruitFactory3(Fruit: new (a: string, s: "foo", ...args: any[]) => TFruit): TFruit +>fruitFactory3 : (Fruit: new (a: string, s: "foo", ...args: any[]) => TFruit) => TFruit +>Fruit : new (a: string, s: "foo", ...args: any[]) => TFruit +>a : string +>s : "foo" +>args : any[] + +const banana3 = fruitFactory3(Banana) // Banana<"foo"> +>banana3 : Banana<"foo"> +>fruitFactory3(Banana) : Banana<"foo"> +>fruitFactory3 : (Fruit: new (a: string, s: "foo", ...args: any[]) => TFruit) => TFruit +>Banana : typeof Banana + +declare function fruitFactory4(Fruit: new (a: string, ...args: "foo"[]) => TFruit): TFruit +>fruitFactory4 : (Fruit: new (a: string, ...args: "foo"[]) => TFruit) => TFruit +>Fruit : new (a: string, ...args: "foo"[]) => TFruit +>a : string +>args : "foo"[] + +const banana4 = fruitFactory4(Banana) // Banana<"foo"> +>banana4 : Banana<"foo"> +>fruitFactory4(Banana) : Banana<"foo"> +>fruitFactory4 : (Fruit: new (a: string, ...args: "foo"[]) => TFruit) => TFruit +>Banana : typeof Banana + +declare function fruitFactory5(Fruit: new (...args: "foo"[]) => TFruit): TFruit +>fruitFactory5 : (Fruit: new (...args: "foo"[]) => TFruit) => TFruit +>Fruit : new (...args: "foo"[]) => TFruit +>args : "foo"[] + +const banana5 = fruitFactory5(Banana) // Banana<"foo"> +>banana5 : Banana<"foo"> +>fruitFactory5(Banana) : Banana<"foo"> +>fruitFactory5 : (Fruit: new (...args: "foo"[]) => TFruit) => TFruit +>Banana : typeof Banana + diff --git a/tests/baselines/reference/contextuallyTypedStringLiteralsInJsxAttributes02.errors.txt b/tests/baselines/reference/contextuallyTypedStringLiteralsInJsxAttributes02.errors.txt index ff2ec7e510628..b66975fdb731e 100644 --- a/tests/baselines/reference/contextuallyTypedStringLiteralsInJsxAttributes02.errors.txt +++ b/tests/baselines/reference/contextuallyTypedStringLiteralsInJsxAttributes02.errors.txt @@ -1,34 +1,34 @@ -tests/cases/conformance/types/contextualTypes/jsxAttributes/file.tsx(27,13): error TS2769: No overload matches this call. +tests/cases/conformance/types/contextualTypes/jsxAttributes/file.tsx(27,64): error TS2769: No overload matches this call. Overload 1 of 2, '(buttonProps: ButtonProps): Element', gave the following error. Type '{ extra: true; onClick: (k: "left" | "right") => void; }' is not assignable to type 'IntrinsicAttributes & ButtonProps'. Property 'extra' does not exist on type 'IntrinsicAttributes & ButtonProps'. Overload 2 of 2, '(linkProps: LinkProps): Element', gave the following error. Type '{ extra: true; onClick: (k: "left" | "right") => void; }' is not assignable to type 'IntrinsicAttributes & LinkProps'. Property 'extra' does not exist on type 'IntrinsicAttributes & LinkProps'. -tests/cases/conformance/types/contextualTypes/jsxAttributes/file.tsx(28,13): error TS2769: No overload matches this call. +tests/cases/conformance/types/contextualTypes/jsxAttributes/file.tsx(28,12): error TS2769: No overload matches this call. Overload 1 of 2, '(buttonProps: ButtonProps): Element', gave the following error. Type '{ onClick: (k: "left" | "right") => void; extra: true; }' is not assignable to type 'IntrinsicAttributes & ButtonProps'. Property 'extra' does not exist on type 'IntrinsicAttributes & ButtonProps'. Overload 2 of 2, '(linkProps: LinkProps): Element', gave the following error. Type '{ onClick: (k: "left" | "right") => void; extra: true; }' is not assignable to type 'IntrinsicAttributes & LinkProps'. Property 'onClick' does not exist on type 'IntrinsicAttributes & LinkProps'. -tests/cases/conformance/types/contextualTypes/jsxAttributes/file.tsx(29,13): error TS2769: No overload matches this call. +tests/cases/conformance/types/contextualTypes/jsxAttributes/file.tsx(29,43): error TS2769: No overload matches this call. Overload 1 of 2, '(buttonProps: ButtonProps): Element', gave the following error. Type '{ extra: true; goTo: string; }' is not assignable to type 'IntrinsicAttributes & ButtonProps'. Property 'extra' does not exist on type 'IntrinsicAttributes & ButtonProps'. Overload 2 of 2, '(linkProps: LinkProps): Element', gave the following error. Type '{ extra: true; goTo: "home"; }' is not assignable to type 'IntrinsicAttributes & LinkProps'. Property 'extra' does not exist on type 'IntrinsicAttributes & LinkProps'. -tests/cases/conformance/types/contextualTypes/jsxAttributes/file.tsx(30,13): error TS2769: No overload matches this call. +tests/cases/conformance/types/contextualTypes/jsxAttributes/file.tsx(30,12): error TS2769: No overload matches this call. Overload 1 of 2, '(buttonProps: ButtonProps): Element', gave the following error. Type '{ goTo: string; extra: true; }' is not assignable to type 'IntrinsicAttributes & ButtonProps'. Property 'goTo' does not exist on type 'IntrinsicAttributes & ButtonProps'. Overload 2 of 2, '(linkProps: LinkProps): Element', gave the following error. Type '{ goTo: "home"; extra: true; }' is not assignable to type 'IntrinsicAttributes & LinkProps'. Property 'extra' does not exist on type 'IntrinsicAttributes & LinkProps'. -tests/cases/conformance/types/contextualTypes/jsxAttributes/file.tsx(33,13): error TS2322: Type '{ extra: true; onClick: (k: "left" | "right") => void; }' is not assignable to type 'IntrinsicAttributes & ButtonProps'. +tests/cases/conformance/types/contextualTypes/jsxAttributes/file.tsx(33,65): error TS2322: Type '{ extra: true; onClick: (k: "left" | "right") => void; }' is not assignable to type 'IntrinsicAttributes & ButtonProps'. Property 'extra' does not exist on type 'IntrinsicAttributes & ButtonProps'. -tests/cases/conformance/types/contextualTypes/jsxAttributes/file.tsx(36,13): error TS2322: Type '{ extra: true; goTo: "home"; }' is not assignable to type 'IntrinsicAttributes & LinkProps'. +tests/cases/conformance/types/contextualTypes/jsxAttributes/file.tsx(36,44): error TS2322: Type '{ extra: true; goTo: "home"; }' is not assignable to type 'IntrinsicAttributes & LinkProps'. Property 'extra' does not exist on type 'IntrinsicAttributes & LinkProps'. @@ -60,7 +60,7 @@ tests/cases/conformance/types/contextualTypes/jsxAttributes/file.tsx(36,13): err } const b0 = {console.log(k)}}} extra />; // k has type "left" | "right" - ~~~~~~~~~~ + ~~~~~ !!! error TS2769: No overload matches this call. !!! error TS2769: Overload 1 of 2, '(buttonProps: ButtonProps): Element', gave the following error. !!! error TS2769: Type '{ extra: true; onClick: (k: "left" | "right") => void; }' is not assignable to type 'IntrinsicAttributes & ButtonProps'. @@ -69,7 +69,7 @@ tests/cases/conformance/types/contextualTypes/jsxAttributes/file.tsx(36,13): err !!! error TS2769: Type '{ extra: true; onClick: (k: "left" | "right") => void; }' is not assignable to type 'IntrinsicAttributes & LinkProps'. !!! error TS2769: Property 'extra' does not exist on type 'IntrinsicAttributes & LinkProps'. const b2 = {console.log(k)}} extra />; // k has type "left" | "right" - ~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2769: No overload matches this call. !!! error TS2769: Overload 1 of 2, '(buttonProps: ButtonProps): Element', gave the following error. !!! error TS2769: Type '{ onClick: (k: "left" | "right") => void; extra: true; }' is not assignable to type 'IntrinsicAttributes & ButtonProps'. @@ -78,7 +78,7 @@ tests/cases/conformance/types/contextualTypes/jsxAttributes/file.tsx(36,13): err !!! error TS2769: Type '{ onClick: (k: "left" | "right") => void; extra: true; }' is not assignable to type 'IntrinsicAttributes & LinkProps'. !!! error TS2769: Property 'onClick' does not exist on type 'IntrinsicAttributes & LinkProps'. const b3 = ; // goTo has type"home" | "contact" - ~~~~~~~~~~ + ~~~~~ !!! error TS2769: No overload matches this call. !!! error TS2769: Overload 1 of 2, '(buttonProps: ButtonProps): Element', gave the following error. !!! error TS2769: Type '{ extra: true; goTo: string; }' is not assignable to type 'IntrinsicAttributes & ButtonProps'. @@ -87,7 +87,7 @@ tests/cases/conformance/types/contextualTypes/jsxAttributes/file.tsx(36,13): err !!! error TS2769: Type '{ extra: true; goTo: "home"; }' is not assignable to type 'IntrinsicAttributes & LinkProps'. !!! error TS2769: Property 'extra' does not exist on type 'IntrinsicAttributes & LinkProps'. const b4 = ; // goTo has type "home" | "contact" - ~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2769: No overload matches this call. !!! error TS2769: Overload 1 of 2, '(buttonProps: ButtonProps): Element', gave the following error. !!! error TS2769: Type '{ goTo: string; extra: true; }' is not assignable to type 'IntrinsicAttributes & ButtonProps'. @@ -98,13 +98,13 @@ tests/cases/conformance/types/contextualTypes/jsxAttributes/file.tsx(36,13): err export function NoOverload(buttonProps: ButtonProps): JSX.Element { return undefined } const c1 = {console.log(k)}}} extra />; // k has type any - ~~~~~~~~~~ + ~~~~~ !!! error TS2322: Type '{ extra: true; onClick: (k: "left" | "right") => void; }' is not assignable to type 'IntrinsicAttributes & ButtonProps'. !!! error TS2322: Property 'extra' does not exist on type 'IntrinsicAttributes & ButtonProps'. export function NoOverload1(linkProps: LinkProps): JSX.Element { return undefined } const d1 = ; // goTo has type "home" | "contact" - ~~~~~~~~~~~ + ~~~~~ !!! error TS2322: Type '{ extra: true; goTo: "home"; }' is not assignable to type 'IntrinsicAttributes & LinkProps'. !!! error TS2322: Property 'extra' does not exist on type 'IntrinsicAttributes & LinkProps'. \ No newline at end of file diff --git a/tests/baselines/reference/correctOrderOfPromiseMethod.js b/tests/baselines/reference/correctOrderOfPromiseMethod.js index 58c98189a4319..fadda95374f3e 100644 --- a/tests/baselines/reference/correctOrderOfPromiseMethod.js +++ b/tests/baselines/reference/correctOrderOfPromiseMethod.js @@ -15,7 +15,7 @@ async function countEverything(): Promise { const [resultA, resultB] = await Promise.all([ providerA(), providerB(), - ]); + ] as const); const dataA: A[] = resultA; const dataB: B[] = resultB; @@ -23,7 +23,8 @@ async function countEverything(): Promise { return dataA.length + dataB.length; } return 0; -} +} + //// [correctOrderOfPromiseMethod.js] var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { diff --git a/tests/baselines/reference/correctOrderOfPromiseMethod.symbols b/tests/baselines/reference/correctOrderOfPromiseMethod.symbols index 290b482e5c762..1e67e9444c67f 100644 --- a/tests/baselines/reference/correctOrderOfPromiseMethod.symbols +++ b/tests/baselines/reference/correctOrderOfPromiseMethod.symbols @@ -43,7 +43,7 @@ async function countEverything(): Promise { providerB(), >providerB : Symbol(providerB, Decl(correctOrderOfPromiseMethod.ts, 11, 9)) - ]); + ] as const); const dataA: A[] = resultA; >dataA : Symbol(dataA, Decl(correctOrderOfPromiseMethod.ts, 18, 9)) @@ -69,3 +69,4 @@ async function countEverything(): Promise { } return 0; } + diff --git a/tests/baselines/reference/correctOrderOfPromiseMethod.types b/tests/baselines/reference/correctOrderOfPromiseMethod.types index 5e8eaa72f429b..a6f2c46782e0a 100644 --- a/tests/baselines/reference/correctOrderOfPromiseMethod.types +++ b/tests/baselines/reference/correctOrderOfPromiseMethod.types @@ -28,12 +28,13 @@ async function countEverything(): Promise { const [resultA, resultB] = await Promise.all([ >resultA : A[] >resultB : B[] ->await Promise.all([ providerA(), providerB(), ]) : [A[], B[]] ->Promise.all([ providerA(), providerB(), ]) : Promise<[A[], B[]]> ->Promise.all : { (values: Iterable>): Promise; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike, T10 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike]): Promise<[T1, T2, T3, T4, T5]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike]): Promise<[T1, T2, T3, T4]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise<[T1, T2, T3]>; (values: [T1 | PromiseLike, T2 | PromiseLike]): Promise<[T1, T2]>; (values: (T | PromiseLike)[]): Promise; } +>await Promise.all([ providerA(), providerB(), ] as const) : [A[], B[]] +>Promise.all([ providerA(), providerB(), ] as const) : Promise<[A[], B[]]> +>Promise.all : { (values: Iterable>): Promise; (values: readonly [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike, T10 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>; (values: readonly [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; (values: readonly [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>; (values: readonly [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; (values: readonly [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6]>; (values: readonly [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike]): Promise<[T1, T2, T3, T4, T5]>; (values: readonly [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike]): Promise<[T1, T2, T3, T4]>; (values: readonly [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise<[T1, T2, T3]>; (values: readonly [T1 | PromiseLike, T2 | PromiseLike]): Promise<[T1, T2]>; (values: readonly (T | PromiseLike)[]): Promise; } >Promise : PromiseConstructor ->all : { (values: Iterable>): Promise; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike, T10 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike]): Promise<[T1, T2, T3, T4, T5]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike]): Promise<[T1, T2, T3, T4]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise<[T1, T2, T3]>; (values: [T1 | PromiseLike, T2 | PromiseLike]): Promise<[T1, T2]>; (values: (T | PromiseLike)[]): Promise; } ->[ providerA(), providerB(), ] : [Promise, Promise] +>all : { (values: Iterable>): Promise; (values: readonly [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike, T10 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>; (values: readonly [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; (values: readonly [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>; (values: readonly [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; (values: readonly [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6]>; (values: readonly [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike]): Promise<[T1, T2, T3, T4, T5]>; (values: readonly [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike]): Promise<[T1, T2, T3, T4]>; (values: readonly [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise<[T1, T2, T3]>; (values: readonly [T1 | PromiseLike, T2 | PromiseLike]): Promise<[T1, T2]>; (values: readonly (T | PromiseLike)[]): Promise; } +>[ providerA(), providerB(), ] as const : readonly [Promise, Promise] +>[ providerA(), providerB(), ] : readonly [Promise, Promise] providerA(), >providerA() : Promise @@ -43,7 +44,7 @@ async function countEverything(): Promise { >providerB() : Promise >providerB : () => Promise - ]); + ] as const); const dataA: A[] = resultA; >dataA : A[] @@ -70,3 +71,4 @@ async function countEverything(): Promise { return 0; >0 : 0 } + diff --git a/tests/baselines/reference/covariantCallbacks.errors.txt b/tests/baselines/reference/covariantCallbacks.errors.txt index 9ee5a9e2fedae..401bf454baa19 100644 --- a/tests/baselines/reference/covariantCallbacks.errors.txt +++ b/tests/baselines/reference/covariantCallbacks.errors.txt @@ -10,9 +10,8 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/covarian Type 'A' is not assignable to type 'B'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/covariantCallbacks.ts(43,5): error TS2322: Type 'AList2' is not assignable to type 'BList2'. Types of property 'forEach' are incompatible. - Type '(cb: (item: A) => boolean) => void' is not assignable to type '(cb: (item: A) => void) => void'. - Types of parameters 'cb' and 'cb' are incompatible. - Type 'void' is not assignable to type 'boolean'. + Types of parameters 'cb' and 'cb' are incompatible. + Type 'void' is not assignable to type 'boolean'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/covariantCallbacks.ts(56,5): error TS2322: Type 'AList3' is not assignable to type 'BList3'. Types of property 'forEach' are incompatible. Type '(cb: (item: A) => void) => void' is not assignable to type '(cb: (item: A, context: any) => void) => void'. @@ -86,9 +85,8 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/covarian ~ !!! error TS2322: Type 'AList2' is not assignable to type 'BList2'. !!! error TS2322: Types of property 'forEach' are incompatible. -!!! error TS2322: Type '(cb: (item: A) => boolean) => void' is not assignable to type '(cb: (item: A) => void) => void'. -!!! error TS2322: Types of parameters 'cb' and 'cb' are incompatible. -!!! error TS2322: Type 'void' is not assignable to type 'boolean'. +!!! error TS2322: Types of parameters 'cb' and 'cb' are incompatible. +!!! error TS2322: Type 'void' is not assignable to type 'boolean'. } interface AList3 { diff --git a/tests/baselines/reference/customAsyncIterator.js b/tests/baselines/reference/customAsyncIterator.js new file mode 100644 index 0000000000000..c0a86218e8d5c --- /dev/null +++ b/tests/baselines/reference/customAsyncIterator.js @@ -0,0 +1,26 @@ +//// [customAsyncIterator.ts] +// GH: https://github.com/microsoft/TypeScript/issues/33239 +class ConstantIterator implements AsyncIterator { + constructor(private constant: T) { + } + async next(value?: T): Promise> { + if (value != null) { + throw new Error("ConstantIterator.prototype.next may not take any values"); + } + return { value: this.constant, done: false }; + } +} + +//// [customAsyncIterator.js] +// GH: https://github.com/microsoft/TypeScript/issues/33239 +class ConstantIterator { + constructor(constant) { + this.constant = constant; + } + async next(value) { + if (value != null) { + throw new Error("ConstantIterator.prototype.next may not take any values"); + } + return { value: this.constant, done: false }; + } +} diff --git a/tests/baselines/reference/customAsyncIterator.symbols b/tests/baselines/reference/customAsyncIterator.symbols new file mode 100644 index 0000000000000..59c099ec40363 --- /dev/null +++ b/tests/baselines/reference/customAsyncIterator.symbols @@ -0,0 +1,35 @@ +=== tests/cases/compiler/customAsyncIterator.ts === +// GH: https://github.com/microsoft/TypeScript/issues/33239 +class ConstantIterator implements AsyncIterator { +>ConstantIterator : Symbol(ConstantIterator, Decl(customAsyncIterator.ts, 0, 0)) +>T : Symbol(T, Decl(customAsyncIterator.ts, 1, 23)) +>AsyncIterator : Symbol(AsyncIterator, Decl(lib.es2018.asynciterable.d.ts, --, --)) +>T : Symbol(T, Decl(customAsyncIterator.ts, 1, 23)) +>T : Symbol(T, Decl(customAsyncIterator.ts, 1, 23)) + + constructor(private constant: T) { +>constant : Symbol(ConstantIterator.constant, Decl(customAsyncIterator.ts, 2, 16)) +>T : Symbol(T, Decl(customAsyncIterator.ts, 1, 23)) + } + async next(value?: T): Promise> { +>next : Symbol(ConstantIterator.next, Decl(customAsyncIterator.ts, 3, 5)) +>value : Symbol(value, Decl(customAsyncIterator.ts, 4, 15)) +>T : Symbol(T, Decl(customAsyncIterator.ts, 1, 23)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --)) +>IteratorResult : Symbol(IteratorResult, Decl(lib.es2015.iterable.d.ts, --, --)) +>T : Symbol(T, Decl(customAsyncIterator.ts, 1, 23)) + + if (value != null) { +>value : Symbol(value, Decl(customAsyncIterator.ts, 4, 15)) + + throw new Error("ConstantIterator.prototype.next may not take any values"); +>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + } + return { value: this.constant, done: false }; +>value : Symbol(value, Decl(customAsyncIterator.ts, 8, 16)) +>this.constant : Symbol(ConstantIterator.constant, Decl(customAsyncIterator.ts, 2, 16)) +>this : Symbol(ConstantIterator, Decl(customAsyncIterator.ts, 0, 0)) +>constant : Symbol(ConstantIterator.constant, Decl(customAsyncIterator.ts, 2, 16)) +>done : Symbol(done, Decl(customAsyncIterator.ts, 8, 38)) + } +} diff --git a/tests/baselines/reference/customAsyncIterator.types b/tests/baselines/reference/customAsyncIterator.types new file mode 100644 index 0000000000000..63c67cfddd314 --- /dev/null +++ b/tests/baselines/reference/customAsyncIterator.types @@ -0,0 +1,32 @@ +=== tests/cases/compiler/customAsyncIterator.ts === +// GH: https://github.com/microsoft/TypeScript/issues/33239 +class ConstantIterator implements AsyncIterator { +>ConstantIterator : ConstantIterator + + constructor(private constant: T) { +>constant : T + } + async next(value?: T): Promise> { +>next : (value?: T) => Promise> +>value : T + + if (value != null) { +>value != null : boolean +>value : T +>null : null + + throw new Error("ConstantIterator.prototype.next may not take any values"); +>new Error("ConstantIterator.prototype.next may not take any values") : Error +>Error : ErrorConstructor +>"ConstantIterator.prototype.next may not take any values" : "ConstantIterator.prototype.next may not take any values" + } + return { value: this.constant, done: false }; +>{ value: this.constant, done: false } : { value: T; done: false; } +>value : T +>this.constant : T +>this : this +>constant : T +>done : false +>false : false + } +} diff --git a/tests/baselines/reference/decoratorCallGeneric.errors.txt b/tests/baselines/reference/decoratorCallGeneric.errors.txt index c2e4042743ec8..495160a191b0e 100644 --- a/tests/baselines/reference/decoratorCallGeneric.errors.txt +++ b/tests/baselines/reference/decoratorCallGeneric.errors.txt @@ -1,7 +1,6 @@ tests/cases/conformance/decorators/decoratorCallGeneric.ts(7,2): error TS2345: Argument of type 'typeof C' is not assignable to parameter of type 'I'. - Types of property 'm' are incompatible. - Type '() => void' is not assignable to type '() => C'. - Type 'void' is not assignable to type 'C'. + The types returned by 'm()' are incompatible between these types. + Type 'void' is not assignable to type 'C'. ==== tests/cases/conformance/decorators/decoratorCallGeneric.ts (1 errors) ==== @@ -14,9 +13,8 @@ tests/cases/conformance/decorators/decoratorCallGeneric.ts(7,2): error TS2345: A @dec ~~~ !!! error TS2345: Argument of type 'typeof C' is not assignable to parameter of type 'I'. -!!! error TS2345: Types of property 'm' are incompatible. -!!! error TS2345: Type '() => void' is not assignable to type '() => C'. -!!! error TS2345: Type 'void' is not assignable to type 'C'. +!!! error TS2345: The types returned by 'm()' are incompatible between these types. +!!! error TS2345: Type 'void' is not assignable to type 'C'. class C { _brand: any; static m() {} diff --git a/tests/baselines/reference/deepExcessPropertyCheckingWhenTargetIsIntersection.errors.txt b/tests/baselines/reference/deepExcessPropertyCheckingWhenTargetIsIntersection.errors.txt index 6a83638ba9076..1f2552d47f271 100644 --- a/tests/baselines/reference/deepExcessPropertyCheckingWhenTargetIsIntersection.errors.txt +++ b/tests/baselines/reference/deepExcessPropertyCheckingWhenTargetIsIntersection.errors.txt @@ -1,10 +1,8 @@ tests/cases/compiler/deepExcessPropertyCheckingWhenTargetIsIntersection.ts(21,33): error TS2322: Type '{ INVALID_PROP_NAME: string; ariaLabel: string; }' is not assignable to type 'ITestProps'. Object literal may only specify known properties, and 'INVALID_PROP_NAME' does not exist in type 'ITestProps'. -tests/cases/compiler/deepExcessPropertyCheckingWhenTargetIsIntersection.ts(27,34): error TS2326: Types of property 'icon' are incompatible. - Type '{ props: { INVALID_PROP_NAME: string; ariaLabel: string; }; }' is not assignable to type 'NestedProp'. - Types of property 'props' are incompatible. - Type '{ INVALID_PROP_NAME: string; ariaLabel: string; }' is not assignable to type 'ITestProps'. - Object literal may only specify known properties, and 'INVALID_PROP_NAME' does not exist in type 'ITestProps'. +tests/cases/compiler/deepExcessPropertyCheckingWhenTargetIsIntersection.ts(27,34): error TS2200: The types of 'icon.props' are incompatible between these types. + Type '{ INVALID_PROP_NAME: string; ariaLabel: string; }' is not assignable to type 'ITestProps'. + Object literal may only specify known properties, and 'INVALID_PROP_NAME' does not exist in type 'ITestProps'. ==== tests/cases/compiler/deepExcessPropertyCheckingWhenTargetIsIntersection.ts (2 errors) ==== @@ -40,9 +38,7 @@ tests/cases/compiler/deepExcessPropertyCheckingWhenTargetIsIntersection.ts(27,34 TestComponent2({icon: { props: { INVALID_PROP_NAME: 'share', ariaLabel: 'test label' } }}); ~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2326: Types of property 'icon' are incompatible. -!!! error TS2326: Type '{ props: { INVALID_PROP_NAME: string; ariaLabel: string; }; }' is not assignable to type 'NestedProp'. -!!! error TS2326: Types of property 'props' are incompatible. -!!! error TS2326: Type '{ INVALID_PROP_NAME: string; ariaLabel: string; }' is not assignable to type 'ITestProps'. -!!! error TS2326: Object literal may only specify known properties, and 'INVALID_PROP_NAME' does not exist in type 'ITestProps'. +!!! error TS2200: The types of 'icon.props' are incompatible between these types. +!!! error TS2200: Type '{ INVALID_PROP_NAME: string; ariaLabel: string; }' is not assignable to type 'ITestProps'. +!!! error TS2200: Object literal may only specify known properties, and 'INVALID_PROP_NAME' does not exist in type 'ITestProps'. \ No newline at end of file diff --git a/tests/baselines/reference/deeplyNestedAssignabilityErrorsCombined.errors.txt b/tests/baselines/reference/deeplyNestedAssignabilityErrorsCombined.errors.txt new file mode 100644 index 0000000000000..6245d06d2b732 --- /dev/null +++ b/tests/baselines/reference/deeplyNestedAssignabilityErrorsCombined.errors.txt @@ -0,0 +1,32 @@ +tests/cases/compiler/deeplyNestedAssignabilityErrorsCombined.ts(3,1): error TS2322: Type '{ a: { b: { c: { d: { e: { f(): { g: number; }; }; }; }; }; }; }' is not assignable to type '{ a: { b: { c: { d: { e: { f(): { g: string; }; }; }; }; }; }; }'. + The types of 'a.b.c.d.e.f().g' are incompatible between these types. + Type 'number' is not assignable to type 'string'. +tests/cases/compiler/deeplyNestedAssignabilityErrorsCombined.ts(15,1): error TS2322: Type '{ a: { b: { c: { d: { e: { f: typeof Ctor2; }; }; }; }; }; }' is not assignable to type '{ a: { b: { c: { d: { e: { f: typeof Ctor1; }; }; }; }; }; }'. + The types of '(new a.b.c.d.e.f()).g' are incompatible between these types. + Type 'number' is not assignable to type 'string'. + + +==== tests/cases/compiler/deeplyNestedAssignabilityErrorsCombined.ts (2 errors) ==== + let x = { a: { b: { c: { d: { e: { f() { return { g: "hello" }; } } } } } } }; + let y = { a: { b: { c: { d: { e: { f() { return { g: 12345 }; } } } } } } }; + x = y; + ~ +!!! error TS2322: Type '{ a: { b: { c: { d: { e: { f(): { g: number; }; }; }; }; }; }; }' is not assignable to type '{ a: { b: { c: { d: { e: { f(): { g: string; }; }; }; }; }; }; }'. +!!! error TS2322: The types of 'a.b.c.d.e.f().g' are incompatible between these types. +!!! error TS2322: Type 'number' is not assignable to type 'string'. + + class Ctor1 { + g = "ok" + } + + class Ctor2 { + g = 12; + } + + let x2 = { a: { b: { c: { d: { e: { f: Ctor1 } } } } } }; + let y2 = { a: { b: { c: { d: { e: { f: Ctor2 } } } } } }; + x2 = y2; + ~~ +!!! error TS2322: Type '{ a: { b: { c: { d: { e: { f: typeof Ctor2; }; }; }; }; }; }' is not assignable to type '{ a: { b: { c: { d: { e: { f: typeof Ctor1; }; }; }; }; }; }'. +!!! error TS2322: The types of '(new a.b.c.d.e.f()).g' are incompatible between these types. +!!! error TS2322: Type 'number' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/deeplyNestedAssignabilityErrorsCombined.js b/tests/baselines/reference/deeplyNestedAssignabilityErrorsCombined.js new file mode 100644 index 0000000000000..01bdcc7f2538a --- /dev/null +++ b/tests/baselines/reference/deeplyNestedAssignabilityErrorsCombined.js @@ -0,0 +1,36 @@ +//// [deeplyNestedAssignabilityErrorsCombined.ts] +let x = { a: { b: { c: { d: { e: { f() { return { g: "hello" }; } } } } } } }; +let y = { a: { b: { c: { d: { e: { f() { return { g: 12345 }; } } } } } } }; +x = y; + +class Ctor1 { + g = "ok" +} + +class Ctor2 { + g = 12; +} + +let x2 = { a: { b: { c: { d: { e: { f: Ctor1 } } } } } }; +let y2 = { a: { b: { c: { d: { e: { f: Ctor2 } } } } } }; +x2 = y2; + +//// [deeplyNestedAssignabilityErrorsCombined.js] +var x = { a: { b: { c: { d: { e: { f: function () { return { g: "hello" }; } } } } } } }; +var y = { a: { b: { c: { d: { e: { f: function () { return { g: 12345 }; } } } } } } }; +x = y; +var Ctor1 = /** @class */ (function () { + function Ctor1() { + this.g = "ok"; + } + return Ctor1; +}()); +var Ctor2 = /** @class */ (function () { + function Ctor2() { + this.g = 12; + } + return Ctor2; +}()); +var x2 = { a: { b: { c: { d: { e: { f: Ctor1 } } } } } }; +var y2 = { a: { b: { c: { d: { e: { f: Ctor2 } } } } } }; +x2 = y2; diff --git a/tests/baselines/reference/deeplyNestedAssignabilityErrorsCombined.symbols b/tests/baselines/reference/deeplyNestedAssignabilityErrorsCombined.symbols new file mode 100644 index 0000000000000..12333869923df --- /dev/null +++ b/tests/baselines/reference/deeplyNestedAssignabilityErrorsCombined.symbols @@ -0,0 +1,63 @@ +=== tests/cases/compiler/deeplyNestedAssignabilityErrorsCombined.ts === +let x = { a: { b: { c: { d: { e: { f() { return { g: "hello" }; } } } } } } }; +>x : Symbol(x, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 0, 3)) +>a : Symbol(a, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 0, 9)) +>b : Symbol(b, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 0, 14)) +>c : Symbol(c, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 0, 19)) +>d : Symbol(d, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 0, 24)) +>e : Symbol(e, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 0, 29)) +>f : Symbol(f, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 0, 34)) +>g : Symbol(g, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 0, 49)) + +let y = { a: { b: { c: { d: { e: { f() { return { g: 12345 }; } } } } } } }; +>y : Symbol(y, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 1, 3)) +>a : Symbol(a, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 1, 9)) +>b : Symbol(b, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 1, 14)) +>c : Symbol(c, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 1, 19)) +>d : Symbol(d, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 1, 24)) +>e : Symbol(e, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 1, 29)) +>f : Symbol(f, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 1, 34)) +>g : Symbol(g, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 1, 49)) + +x = y; +>x : Symbol(x, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 0, 3)) +>y : Symbol(y, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 1, 3)) + +class Ctor1 { +>Ctor1 : Symbol(Ctor1, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 2, 6)) + + g = "ok" +>g : Symbol(Ctor1.g, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 4, 13)) +} + +class Ctor2 { +>Ctor2 : Symbol(Ctor2, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 6, 1)) + + g = 12; +>g : Symbol(Ctor2.g, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 8, 13)) +} + +let x2 = { a: { b: { c: { d: { e: { f: Ctor1 } } } } } }; +>x2 : Symbol(x2, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 12, 3)) +>a : Symbol(a, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 12, 10)) +>b : Symbol(b, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 12, 15)) +>c : Symbol(c, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 12, 20)) +>d : Symbol(d, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 12, 25)) +>e : Symbol(e, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 12, 30)) +>f : Symbol(f, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 12, 35)) +>Ctor1 : Symbol(Ctor1, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 2, 6)) + +let y2 = { a: { b: { c: { d: { e: { f: Ctor2 } } } } } }; +>y2 : Symbol(y2, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 13, 3)) +>a : Symbol(a, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 13, 10)) +>b : Symbol(b, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 13, 15)) +>c : Symbol(c, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 13, 20)) +>d : Symbol(d, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 13, 25)) +>e : Symbol(e, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 13, 30)) +>f : Symbol(f, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 13, 35)) +>Ctor2 : Symbol(Ctor2, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 6, 1)) + +x2 = y2; +>x2 : Symbol(x2, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 12, 3)) +>y2 : Symbol(y2, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 13, 3)) + diff --git a/tests/baselines/reference/deeplyNestedAssignabilityErrorsCombined.types b/tests/baselines/reference/deeplyNestedAssignabilityErrorsCombined.types new file mode 100644 index 0000000000000..565de61ef08e7 --- /dev/null +++ b/tests/baselines/reference/deeplyNestedAssignabilityErrorsCombined.types @@ -0,0 +1,95 @@ +=== tests/cases/compiler/deeplyNestedAssignabilityErrorsCombined.ts === +let x = { a: { b: { c: { d: { e: { f() { return { g: "hello" }; } } } } } } }; +>x : { a: { b: { c: { d: { e: { f(): { g: string; }; }; }; }; }; }; } +>{ a: { b: { c: { d: { e: { f() { return { g: "hello" }; } } } } } } } : { a: { b: { c: { d: { e: { f(): { g: string; }; }; }; }; }; }; } +>a : { b: { c: { d: { e: { f(): { g: string; }; }; }; }; }; } +>{ b: { c: { d: { e: { f() { return { g: "hello" }; } } } } } } : { b: { c: { d: { e: { f(): { g: string; }; }; }; }; }; } +>b : { c: { d: { e: { f(): { g: string; }; }; }; }; } +>{ c: { d: { e: { f() { return { g: "hello" }; } } } } } : { c: { d: { e: { f(): { g: string; }; }; }; }; } +>c : { d: { e: { f(): { g: string; }; }; }; } +>{ d: { e: { f() { return { g: "hello" }; } } } } : { d: { e: { f(): { g: string; }; }; }; } +>d : { e: { f(): { g: string; }; }; } +>{ e: { f() { return { g: "hello" }; } } } : { e: { f(): { g: string; }; }; } +>e : { f(): { g: string; }; } +>{ f() { return { g: "hello" }; } } : { f(): { g: string; }; } +>f : () => { g: string; } +>{ g: "hello" } : { g: string; } +>g : string +>"hello" : "hello" + +let y = { a: { b: { c: { d: { e: { f() { return { g: 12345 }; } } } } } } }; +>y : { a: { b: { c: { d: { e: { f(): { g: number; }; }; }; }; }; }; } +>{ a: { b: { c: { d: { e: { f() { return { g: 12345 }; } } } } } } } : { a: { b: { c: { d: { e: { f(): { g: number; }; }; }; }; }; }; } +>a : { b: { c: { d: { e: { f(): { g: number; }; }; }; }; }; } +>{ b: { c: { d: { e: { f() { return { g: 12345 }; } } } } } } : { b: { c: { d: { e: { f(): { g: number; }; }; }; }; }; } +>b : { c: { d: { e: { f(): { g: number; }; }; }; }; } +>{ c: { d: { e: { f() { return { g: 12345 }; } } } } } : { c: { d: { e: { f(): { g: number; }; }; }; }; } +>c : { d: { e: { f(): { g: number; }; }; }; } +>{ d: { e: { f() { return { g: 12345 }; } } } } : { d: { e: { f(): { g: number; }; }; }; } +>d : { e: { f(): { g: number; }; }; } +>{ e: { f() { return { g: 12345 }; } } } : { e: { f(): { g: number; }; }; } +>e : { f(): { g: number; }; } +>{ f() { return { g: 12345 }; } } : { f(): { g: number; }; } +>f : () => { g: number; } +>{ g: 12345 } : { g: number; } +>g : number +>12345 : 12345 + +x = y; +>x = y : { a: { b: { c: { d: { e: { f(): { g: number; }; }; }; }; }; }; } +>x : { a: { b: { c: { d: { e: { f(): { g: string; }; }; }; }; }; }; } +>y : { a: { b: { c: { d: { e: { f(): { g: number; }; }; }; }; }; }; } + +class Ctor1 { +>Ctor1 : Ctor1 + + g = "ok" +>g : string +>"ok" : "ok" +} + +class Ctor2 { +>Ctor2 : Ctor2 + + g = 12; +>g : number +>12 : 12 +} + +let x2 = { a: { b: { c: { d: { e: { f: Ctor1 } } } } } }; +>x2 : { a: { b: { c: { d: { e: { f: typeof Ctor1; }; }; }; }; }; } +>{ a: { b: { c: { d: { e: { f: Ctor1 } } } } } } : { a: { b: { c: { d: { e: { f: typeof Ctor1; }; }; }; }; }; } +>a : { b: { c: { d: { e: { f: typeof Ctor1; }; }; }; }; } +>{ b: { c: { d: { e: { f: Ctor1 } } } } } : { b: { c: { d: { e: { f: typeof Ctor1; }; }; }; }; } +>b : { c: { d: { e: { f: typeof Ctor1; }; }; }; } +>{ c: { d: { e: { f: Ctor1 } } } } : { c: { d: { e: { f: typeof Ctor1; }; }; }; } +>c : { d: { e: { f: typeof Ctor1; }; }; } +>{ d: { e: { f: Ctor1 } } } : { d: { e: { f: typeof Ctor1; }; }; } +>d : { e: { f: typeof Ctor1; }; } +>{ e: { f: Ctor1 } } : { e: { f: typeof Ctor1; }; } +>e : { f: typeof Ctor1; } +>{ f: Ctor1 } : { f: typeof Ctor1; } +>f : typeof Ctor1 +>Ctor1 : typeof Ctor1 + +let y2 = { a: { b: { c: { d: { e: { f: Ctor2 } } } } } }; +>y2 : { a: { b: { c: { d: { e: { f: typeof Ctor2; }; }; }; }; }; } +>{ a: { b: { c: { d: { e: { f: Ctor2 } } } } } } : { a: { b: { c: { d: { e: { f: typeof Ctor2; }; }; }; }; }; } +>a : { b: { c: { d: { e: { f: typeof Ctor2; }; }; }; }; } +>{ b: { c: { d: { e: { f: Ctor2 } } } } } : { b: { c: { d: { e: { f: typeof Ctor2; }; }; }; }; } +>b : { c: { d: { e: { f: typeof Ctor2; }; }; }; } +>{ c: { d: { e: { f: Ctor2 } } } } : { c: { d: { e: { f: typeof Ctor2; }; }; }; } +>c : { d: { e: { f: typeof Ctor2; }; }; } +>{ d: { e: { f: Ctor2 } } } : { d: { e: { f: typeof Ctor2; }; }; } +>d : { e: { f: typeof Ctor2; }; } +>{ e: { f: Ctor2 } } : { e: { f: typeof Ctor2; }; } +>e : { f: typeof Ctor2; } +>{ f: Ctor2 } : { f: typeof Ctor2; } +>f : typeof Ctor2 +>Ctor2 : typeof Ctor2 + +x2 = y2; +>x2 = y2 : { a: { b: { c: { d: { e: { f: typeof Ctor2; }; }; }; }; }; } +>x2 : { a: { b: { c: { d: { e: { f: typeof Ctor1; }; }; }; }; }; } +>y2 : { a: { b: { c: { d: { e: { f: typeof Ctor2; }; }; }; }; }; } + diff --git a/tests/baselines/reference/docker/azure-sdk.log b/tests/baselines/reference/docker/azure-sdk.log index 347a6c188a9c6..6a02c105f95d7 100644 --- a/tests/baselines/reference/docker/azure-sdk.log +++ b/tests/baselines/reference/docker/azure-sdk.log @@ -18,7 +18,7 @@ XX of XX: [@azure/event-hubs] completed successfully in ? seconds XX of XX: [@azure/event-processor-host] completed successfully in ? seconds XX of XX: [@azure/keyvault-keys] completed successfully in ? seconds XX of XX: [@azure/keyvault-secrets] completed successfully in ? seconds -XX of XX: [@azure/app-configuration] completed successfully in ? seconds +Warning: You have changed the public API signature for this project. Updating review/app-configuration.api.md XX of XX: [@azure/core-asynciterator-polyfill] completed successfully in ? seconds Warning: You have changed the public API signature for this project. Updating review/cosmos.api.md dist-esm/index.js → dist/index.js... @@ -39,7 +39,7 @@ crypto-hash (imported by dist-esm/queryExecutionContext/EndpointComponent/Ordere fast-json-stable-stringify (imported by dist-esm/queryExecutionContext/EndpointComponent/OrderedDistinctEndpointComponent.js, dist-esm/queryExecutionContext/EndpointComponent/UnorderedDistinctEndpointComponent.js) (!) Missing global variable names Use output.globals to specify browser global variable names corresponding to external modules -universal-user-agent (guessing 'userAgent') +universal-user-agent (guessing 'universalUserAgent') tslib (guessing 'tslib') @azure/cosmos-sign (guessing 'cosmosSign') debug (guessing 'debugLib') @@ -57,14 +57,14 @@ atob (guessing 'atob') (!) Circular dependency: dist-esm/request/RequestHandler.js -> dist-esm/retry/retryUtility.js -> dist-esm/request/RequestHandler.js created dist/index.js in ?s XX of XX: [@azure/eventhubs-checkpointstore-blob] completed successfully in ? seconds -XX of XX: [@azure/keyvault-certificates] completed successfully in ? seconds +XX of XX: [@azure/keyvault-certificates] completed successfully in ? seconds Warning: You have changed the public API signature for this project. Updating review/service-bus.api.md XX of XX: [@azure/storage-blob] completed successfully in ? seconds XX of XX: [@azure/storage-file] completed successfully in ? seconds XX of XX: [@azure/storage-queue] completed successfully in ? seconds XX of XX: [@azure/template] completed successfully in ? seconds XX of XX: [testhub] completed successfully in ? seconds -SUCCESS (22) +SUCCESS (21) ================================ @azure/abort-controller (? seconds) @azure/core-auth (? seconds) @@ -79,18 +79,19 @@ SUCCESS (22) @azure/event-processor-host (? seconds) @azure/keyvault-keys (? seconds) @azure/keyvault-secrets (? seconds) -@azure/app-configuration (? seconds) @azure/core-asynciterator-polyfill (? seconds) @azure/eventhubs-checkpointstore-blob (? seconds) -@azure/keyvault-certificates (? seconds) +@azure/keyvault-certificates ( ? seconds) @azure/storage-blob (? seconds) @azure/storage-file (? seconds) @azure/storage-queue (? seconds) @azure/template (? seconds) testhub (? seconds) ================================ -SUCCESS WITH WARNINGS (2) +SUCCESS WITH WARNINGS (3) ================================ +@azure/app-configuration (? seconds) +Warning: You have changed the public API signature for this project. Updating review/app-configuration.api.md @azure/cosmos (? seconds) Warning: You have changed the public API signature for this project. Updating review/cosmos.api.md dist-esm/index.js → dist/index.js... @@ -111,7 +112,7 @@ crypto-hash (imported by dist-esm/queryExecutionContext/EndpointComponent/Ordere fast-json-stable-stringify (imported by dist-esm/queryExecutionContext/EndpointComponent/OrderedDistinctEndpointComponent.js, dist-esm/queryExecutionContext/EndpointComponent/UnorderedDistinctEndpointComponent.js) (!) Missing global variable names Use output.globals to specify browser global variable names corresponding to external modules -universal-user-agent (guessing 'userAgent') +universal-user-agent (guessing 'universalUserAgent') tslib (guessing 'tslib') @azure/cosmos-sign (guessing 'cosmosSign') debug (guessing 'debugLib') @@ -136,6 +137,7 @@ rush rebuild ( ? seconds) Standard error: +XX of XX: [@azure/app-configuration] completed with warnings in ? seconds XX of XX: [@azure/cosmos] completed with warnings in ? seconds XX of XX: [@azure/service-bus] completed with warnings in ? seconds Project(s) succeeded with warnings diff --git a/tests/baselines/reference/docker/office-ui-fabric.log b/tests/baselines/reference/docker/office-ui-fabric.log index b36e3e50ffc94..7a8f1b1dcf8a6 100644 --- a/tests/baselines/reference/docker/office-ui-fabric.log +++ b/tests/baselines/reference/docker/office-ui-fabric.log @@ -1,14 +1,5 @@ Exit Code: 1 Standard output: -@uifabric/codepen-loader: yarn run vX.X.X -@uifabric/codepen-loader: $ just-scripts build --production --lint -@uifabric/codepen-loader: [XX:XX:XX XM] ■ Removing [lib, temp, dist, coverage, lib-commonjs] -@uifabric/codepen-loader: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/codepen-loader/tsconfig.json -@uifabric/codepen-loader: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --module commonjs --outDir "./lib" --project "/office-ui-fabric-react/packages/codepen-loader/tsconfig.json" -@uifabric/codepen-loader: [XX:XX:XX XM] ■ Running Jest -@uifabric/codepen-loader: [XX:XX:XX XM] ■ /usr/local/bin/node "/office-ui-fabric-react/node_modules/jest/bin/jest.js" --config "/office-ui-fabric-react/packages/codepen-loader/jest.config.js" --passWithNoTests --colors --forceExit -@uifabric/codepen-loader: PASS src/__tests__/codepenTransform.test.ts -@uifabric/codepen-loader: Done in ?s. @uifabric/build: yarn run vX.X.X @uifabric/build: $ node ./just-scripts.js no-op --production --lint @uifabric/build: Done in ?s. @@ -34,6 +25,14 @@ Standard output: @uifabric/migration: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/migration/tsconfig.json @uifabric/migration: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --inlineSources --sourceRoot "../src" --outDir lib --module commonjs --project "/office-ui-fabric-react/packages/migration/tsconfig.json" @uifabric/migration: Done in ?s. +@uifabric/monaco-editor: yarn run vX.X.X +@uifabric/monaco-editor: $ just-scripts build --production --lint +@uifabric/monaco-editor: [XX:XX:XX XM] ■ Removing [esm, lib, lib-commonjs] +@uifabric/monaco-editor: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/monaco-editor/tsconfig.json +@uifabric/monaco-editor: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --inlineSources --sourceRoot "../src" --outDir lib --module esnext --project "/office-ui-fabric-react/packages/monaco-editor/tsconfig.json" +@uifabric/monaco-editor: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/monaco-editor/tsconfig.json +@uifabric/monaco-editor: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --inlineSources --sourceRoot "../src" --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/packages/monaco-editor/tsconfig.json" +@uifabric/monaco-editor: Done in ?s. @uifabric/set-version: yarn run vX.X.X @uifabric/set-version: $ just-scripts build --production --lint @uifabric/set-version: [XX:XX:XX XM] ■ Removing [lib, temp, dist, lib-amd, lib-commonjs, lib-es2015, coverage, src/**/*.scss.ts] @@ -84,6 +83,7 @@ Standard output: @uifabric/merge-styles: PASS src/Stylesheet.test.ts @uifabric/merge-styles: PASS src/extractStyleParts.test.ts @uifabric/merge-styles: PASS src/server.test.ts +@uifabric/merge-styles: PASS src/concatStyleSetsWithProps.test.ts @uifabric/merge-styles: PASS src/fontFace.test.ts @uifabric/merge-styles: [XX:XX:XX XM] ■ Extracting Public API surface from '/office-ui-fabric-react/packages/merge-styles/lib/index.d.ts' @uifabric/merge-styles: Done in ?s. @@ -128,9 +128,9 @@ Standard output: @uifabric/utilities: PASS src/warn/warnControlledUsage.test.ts @uifabric/utilities: PASS src/focus.test.tsx @uifabric/utilities: PASS src/styled.test.tsx +@uifabric/utilities: PASS src/customizations/Customizer.test.tsx @uifabric/utilities: PASS src/EventGroup.test.ts @uifabric/utilities: PASS src/array.test.ts -@uifabric/utilities: PASS src/customizations/Customizer.test.tsx @uifabric/utilities: PASS src/math.test.ts @uifabric/utilities: PASS src/warn/warn.test.ts @uifabric/utilities: PASS src/dom/dom.test.ts @@ -161,6 +161,26 @@ Standard output: @uifabric/utilities: PASS src/keyboard.test.ts @uifabric/utilities: [XX:XX:XX XM] ■ Extracting Public API surface from '/office-ui-fabric-react/packages/utilities/lib/index.d.ts' @uifabric/utilities: Done in ?s. +@uifabric/react-hooks: yarn run vX.X.X +@uifabric/react-hooks: $ just-scripts build --production --lint +@uifabric/react-hooks: [XX:XX:XX XM] ■ Removing [lib, temp, dist, lib-amd, lib-commonjs, lib-es2015, coverage, src/**/*.scss.ts] +@uifabric/react-hooks: [XX:XX:XX XM] ■ Running tslint +@uifabric/react-hooks: [XX:XX:XX XM] ■ /usr/local/bin/node "/office-ui-fabric-react/node_modules/tslint/lib/tslintCli.js" --project "/office-ui-fabric-react/packages/react-hooks/tsconfig.json" -t stylish -r /office-ui-fabric-react/node_modules/tslint-microsoft-contrib +@uifabric/react-hooks: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/react-hooks/tsconfig.json +@uifabric/react-hooks: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --inlineSources --sourceRoot "../src" --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/packages/react-hooks/tsconfig.json" +@uifabric/react-hooks: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/react-hooks/tsconfig.json +@uifabric/react-hooks: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --inlineSources --sourceRoot "../src" --outDir lib --module esnext --project "/office-ui-fabric-react/packages/react-hooks/tsconfig.json" +@uifabric/react-hooks: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/react-hooks/tsconfig.json +@uifabric/react-hooks: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --inlineSources --sourceRoot "../src" --outDir lib-amd --module amd --project "/office-ui-fabric-react/packages/react-hooks/tsconfig.json" +@uifabric/react-hooks: [XX:XX:XX XM] ■ Running Jest +@uifabric/react-hooks: [XX:XX:XX XM] ■ /usr/local/bin/node "/office-ui-fabric-react/node_modules/jest/bin/jest.js" --config "/office-ui-fabric-react/packages/react-hooks/jest.config.js" --passWithNoTests --colors --forceExit +@uifabric/react-hooks: [XX:XX:XX XM] ■ Running Webpack +@uifabric/react-hooks: [XX:XX:XX XM] ■ Webpack Config Path: /office-ui-fabric-react/packages/react-hooks/webpack.config.js +@uifabric/react-hooks: Webpack version: 4.29.5 +@uifabric/react-hooks: PASS src/useConst.test.tsx +@uifabric/react-hooks: PASS src/useId.test.tsx +@uifabric/react-hooks: [XX:XX:XX XM] ■ Extracting Public API surface from '/office-ui-fabric-react/packages/react-hooks/lib/index.d.ts' +@uifabric/react-hooks: Done in ?s. @uifabric/styling: yarn run vX.X.X @uifabric/styling: $ just-scripts build --production --lint @uifabric/styling: [XX:XX:XX XM] ■ Removing [lib, temp, dist, lib-amd, lib-commonjs, lib-es2015, coverage, src/**/*.scss.ts] @@ -223,11 +243,7 @@ Standard output: Standard error: info cli using local version of lerna lerna notice cli vX.X.X -lerna info Executing command in 41 packages: "yarn run build --production --lint" -@uifabric/codepen-loader: ts-jest[versions] (WARN) Version X.X.X-insiders.xxxxxxxx of typescript installed has not been tested with ts-jest. If you're experiencing issues, consider using a supported version (>=2.7.0 <4.0.0). Please do not report issues in ts-jest if you are using unsupported versions. -@uifabric/codepen-loader: Force exiting Jest -@uifabric/codepen-loader: -@uifabric/codepen-loader: Have you considered using `--detectOpenHandles` to detect async operations that kept running after all tests finished? +lerna info Executing command in 42 packages: "yarn run build --production --lint" @uifabric/example-data: [XX:XX:XX XM] ▲ One of these [node-sass, postcss, autoprefixer] is not installed, so this task has no effect @uifabric/set-version: [XX:XX:XX XM] ▲ One of these [node-sass, postcss, autoprefixer] is not installed, so this task has no effect @uifabric/merge-styles: [XX:XX:XX XM] ▲ One of these [node-sass, postcss, autoprefixer] is not installed, so this task has no effect @@ -244,6 +260,11 @@ lerna info Executing command in 41 packages: "yarn run build --production --lint @uifabric/utilities: Force exiting Jest @uifabric/utilities: @uifabric/utilities: Have you considered using `--detectOpenHandles` to detect async operations that kept running after all tests finished? +@uifabric/react-hooks: [XX:XX:XX XM] ▲ One of these [node-sass, postcss, autoprefixer] is not installed, so this task has no effect +@uifabric/react-hooks: ts-jest[versions] (WARN) Version X.X.X-insiders.xxxxxxxx of typescript installed has not been tested with ts-jest. If you're experiencing issues, consider using a supported version (>=2.7.0 <4.0.0). Please do not report issues in ts-jest if you are using unsupported versions. +@uifabric/react-hooks: Force exiting Jest +@uifabric/react-hooks: +@uifabric/react-hooks: Have you considered using `--detectOpenHandles` to detect async operations that kept running after all tests finished? @uifabric/styling: [XX:XX:XX XM] ▲ One of these [node-sass, postcss, autoprefixer] is not installed, so this task has no effect @uifabric/styling: ts-jest[versions] (WARN) Version X.X.X-insiders.xxxxxxxx of typescript installed has not been tested with ts-jest. If you're experiencing issues, consider using a supported version (>=2.7.0 <4.0.0). Please do not report issues in ts-jest if you are using unsupported versions. @uifabric/styling: Force exiting Jest diff --git a/tests/baselines/reference/docker/vscode.log b/tests/baselines/reference/docker/vscode.log index 8bc85ffef1263..fdd7db9d71335 100644 --- a/tests/baselines/reference/docker/vscode.log +++ b/tests/baselines/reference/docker/vscode.log @@ -1,14 +1,24 @@ -Exit Code: 0 +Exit Code: 1 Standard output: yarn run vX.X.X $ gulp compile --max_old_space_size=4095 [XX:XX:XX] Node flags detected: --max_old_space_size=4095 [XX:XX:XX] Using gulpfile /vscode/gulpfile.js -Done in ?s. +info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. Standard error: -{"type":"warning","data":"package.json: No license field"} -{"type":"warning","data":"../package.json: No license field"} -{"type":"warning","data":"vscode-web@X.X.X: No license field"} +[XX:XX:XX] 'compile' errored after ?s +[XX:XX:XX] TypeError: Cannot read property 'text' of undefined + at DeclarationResolver._getDeclarationSourceFile (/vscode/build/monaco/api.js:519:75) + at DeclarationResolver.getDeclarationSourceFile (/vscode/build/monaco/api.js:493:52) + at sourceFileGetter (/vscode/build/monaco/api.js:525:53) + at lines.forEach.line (/vscode/build/monaco/api.js:330:32) + at Array.forEach () + at generateDeclarationFile (/vscode/build/monaco/api.js:319:11) + at _run (/vscode/build/monaco/api.js:438:15) + at Object.run3 (/vscode/build/monaco/api.js:526:12) + at MonacoGenerator._run (/vscode/build/lib/compilation.js:142:27) + at MonacoGenerator.execute (/vscode/build/lib/compilation.js:154:29) +error Command failed with exit code 1. diff --git a/tests/baselines/reference/elaboratedErrorsOnNullableTargets01.errors.txt b/tests/baselines/reference/elaboratedErrorsOnNullableTargets01.errors.txt index dc7e3f10bd120..b84fb863ad8d8 100644 --- a/tests/baselines/reference/elaboratedErrorsOnNullableTargets01.errors.txt +++ b/tests/baselines/reference/elaboratedErrorsOnNullableTargets01.errors.txt @@ -1,9 +1,7 @@ tests/cases/compiler/elaboratedErrorsOnNullableTargets01.ts(4,1): error TS2322: Type '{ foo: { bar: number | undefined; }; }' is not assignable to type '{ foo: { bar: string | null; } | undefined; }'. - Types of property 'foo' are incompatible. - Type '{ bar: number | undefined; }' is not assignable to type '{ bar: string | null; }'. - Types of property 'bar' are incompatible. - Type 'number | undefined' is not assignable to type 'string | null'. - Type 'undefined' is not assignable to type 'string | null'. + The types of 'foo.bar' are incompatible between these types. + Type 'number | undefined' is not assignable to type 'string | null'. + Type 'undefined' is not assignable to type 'string | null'. tests/cases/compiler/elaboratedErrorsOnNullableTargets01.ts(6,1): error TS2322: Type '{ foo: { bar: string | null; } | undefined; } | null | undefined' is not assignable to type '{ foo: { bar: number | undefined; }; }'. Type 'undefined' is not assignable to type '{ foo: { bar: number | undefined; }; }'. @@ -15,11 +13,9 @@ tests/cases/compiler/elaboratedErrorsOnNullableTargets01.ts(6,1): error TS2322: x = y; ~ !!! error TS2322: Type '{ foo: { bar: number | undefined; }; }' is not assignable to type '{ foo: { bar: string | null; } | undefined; }'. -!!! error TS2322: Types of property 'foo' are incompatible. -!!! error TS2322: Type '{ bar: number | undefined; }' is not assignable to type '{ bar: string | null; }'. -!!! error TS2322: Types of property 'bar' are incompatible. -!!! error TS2322: Type 'number | undefined' is not assignable to type 'string | null'. -!!! error TS2322: Type 'undefined' is not assignable to type 'string | null'. +!!! error TS2322: The types of 'foo.bar' are incompatible between these types. +!!! error TS2322: Type 'number | undefined' is not assignable to type 'string | null'. +!!! error TS2322: Type 'undefined' is not assignable to type 'string | null'. y = x; ~ diff --git a/tests/baselines/reference/enumErrors.errors.txt b/tests/baselines/reference/enumErrors.errors.txt index 49205e3630e52..23b5e97e71b74 100644 --- a/tests/baselines/reference/enumErrors.errors.txt +++ b/tests/baselines/reference/enumErrors.errors.txt @@ -11,9 +11,19 @@ tests/cases/conformance/enums/enumErrors.ts(35,9): error TS2553: Computed values tests/cases/conformance/enums/enumErrors.ts(36,9): error TS2553: Computed values are not permitted in an enum with string valued members. tests/cases/conformance/enums/enumErrors.ts(37,9): error TS2553: Computed values are not permitted in an enum with string valued members. tests/cases/conformance/enums/enumErrors.ts(38,9): error TS2553: Computed values are not permitted in an enum with string valued members. +tests/cases/conformance/enums/enumErrors.ts(46,18): error TS1357: An enum member name must be followed by a ',', '=', or '}'. +tests/cases/conformance/enums/enumErrors.ts(47,24): error TS1357: An enum member name must be followed by a ',', '=', or '}'. +tests/cases/conformance/enums/enumErrors.ts(47,26): error TS2452: An enum member cannot have a numeric name. +tests/cases/conformance/enums/enumErrors.ts(48,28): error TS1357: An enum member name must be followed by a ',', '=', or '}'. +tests/cases/conformance/enums/enumErrors.ts(48,30): error TS2452: An enum member cannot have a numeric name. +tests/cases/conformance/enums/enumErrors.ts(48,31): error TS1357: An enum member name must be followed by a ',', '=', or '}'. +tests/cases/conformance/enums/enumErrors.ts(51,16): error TS1357: An enum member name must be followed by a ',', '=', or '}'. +tests/cases/conformance/enums/enumErrors.ts(51,22): error TS1357: An enum member name must be followed by a ',', '=', or '}'. +tests/cases/conformance/enums/enumErrors.ts(51,30): error TS1357: An enum member name must be followed by a ',', '=', or '}'. +tests/cases/conformance/enums/enumErrors.ts(51,33): error TS2452: An enum member cannot have a numeric name. -==== tests/cases/conformance/enums/enumErrors.ts (13 errors) ==== +==== tests/cases/conformance/enums/enumErrors.ts (23 errors) ==== // Enum named with PredefinedTypes enum any { } ~~~ @@ -79,4 +89,36 @@ tests/cases/conformance/enums/enumErrors.ts(38,9): error TS2553: Computed values ~~~~~ !!! error TS2553: Computed values are not permitted in an enum with string valued members. } + + // Enum with incorrect syntax + enum E13 { + postComma, + postValueComma = 1, + + postSemicolon; + ~ +!!! error TS1357: An enum member name must be followed by a ',', '=', or '}'. + postColonValueComma: 2, + ~ +!!! error TS1357: An enum member name must be followed by a ',', '=', or '}'. + ~ +!!! error TS2452: An enum member cannot have a numeric name. + postColonValueSemicolon: 3; + ~ +!!! error TS1357: An enum member name must be followed by a ',', '=', or '}'. + ~ +!!! error TS2452: An enum member cannot have a numeric name. + ~ +!!! error TS1357: An enum member name must be followed by a ',', '=', or '}'. + }; + + enum E14 { a, b: any "hello" += 1, c, d} + ~ +!!! error TS1357: An enum member name must be followed by a ',', '=', or '}'. + ~~~~~~~ +!!! error TS1357: An enum member name must be followed by a ',', '=', or '}'. + ~~ +!!! error TS1357: An enum member name must be followed by a ',', '=', or '}'. + ~ +!!! error TS2452: An enum member cannot have a numeric name. \ No newline at end of file diff --git a/tests/baselines/reference/enumErrors.js b/tests/baselines/reference/enumErrors.js index 17b67864c7068..64a884a0979d0 100644 --- a/tests/baselines/reference/enumErrors.js +++ b/tests/baselines/reference/enumErrors.js @@ -38,6 +38,18 @@ enum E12 { D = {}, E = 1 + 1, } + +// Enum with incorrect syntax +enum E13 { + postComma, + postValueComma = 1, + + postSemicolon; + postColonValueComma: 2, + postColonValueSemicolon: 3; +}; + +enum E14 { a, b: any "hello" += 1, c, d} //// [enumErrors.js] @@ -88,3 +100,25 @@ var E12; E12[E12["D"] = 0] = "D"; E12[E12["E"] = 0] = "E"; })(E12 || (E12 = {})); +// Enum with incorrect syntax +var E13; +(function (E13) { + E13[E13["postComma"] = 0] = "postComma"; + E13[E13["postValueComma"] = 1] = "postValueComma"; + E13[E13["postSemicolon"] = 2] = "postSemicolon"; + E13[E13["postColonValueComma"] = 3] = "postColonValueComma"; + E13[E13[2] = 4] = 2; + E13[E13["postColonValueSemicolon"] = 5] = "postColonValueSemicolon"; + E13[E13[3] = 6] = 3; +})(E13 || (E13 = {})); +; +var E14; +(function (E14) { + E14[E14["a"] = 0] = "a"; + E14[E14["b"] = 1] = "b"; + E14[E14["any"] = 2] = "any"; + E14[E14["hello"] = 3] = "hello"; + E14[E14[1] = 4] = 1; + E14[E14["c"] = 5] = "c"; + E14[E14["d"] = 6] = "d"; +})(E14 || (E14 = {})); diff --git a/tests/baselines/reference/enumErrors.symbols b/tests/baselines/reference/enumErrors.symbols index 3dab3ef5f7657..d20fea828b184 100644 --- a/tests/baselines/reference/enumErrors.symbols +++ b/tests/baselines/reference/enumErrors.symbols @@ -91,3 +91,36 @@ enum E12 { >E : Symbol(E12.E, Decl(enumErrors.ts, 36, 11)) } +// Enum with incorrect syntax +enum E13 { +>E13 : Symbol(E13, Decl(enumErrors.ts, 38, 1)) + + postComma, +>postComma : Symbol(E13.postComma, Decl(enumErrors.ts, 41, 10)) + + postValueComma = 1, +>postValueComma : Symbol(E13.postValueComma, Decl(enumErrors.ts, 42, 14)) + + postSemicolon; +>postSemicolon : Symbol(E13.postSemicolon, Decl(enumErrors.ts, 43, 23)) + + postColonValueComma: 2, +>postColonValueComma : Symbol(E13.postColonValueComma, Decl(enumErrors.ts, 45, 18)) +>2 : Symbol(E13[2], Decl(enumErrors.ts, 46, 24)) + + postColonValueSemicolon: 3; +>postColonValueSemicolon : Symbol(E13.postColonValueSemicolon, Decl(enumErrors.ts, 46, 27)) +>3 : Symbol(E13[3], Decl(enumErrors.ts, 47, 28)) + +}; + +enum E14 { a, b: any "hello" += 1, c, d} +>E14 : Symbol(E14, Decl(enumErrors.ts, 48, 2)) +>a : Symbol(E14.a, Decl(enumErrors.ts, 50, 10)) +>b : Symbol(E14.b, Decl(enumErrors.ts, 50, 13)) +>any : Symbol(E14.any, Decl(enumErrors.ts, 50, 16)) +>"hello" : Symbol(E14["hello"], Decl(enumErrors.ts, 50, 20)) +>1 : Symbol(E14[1], Decl(enumErrors.ts, 50, 31)) +>c : Symbol(E14.c, Decl(enumErrors.ts, 50, 34)) +>d : Symbol(E14.d, Decl(enumErrors.ts, 50, 37)) + diff --git a/tests/baselines/reference/enumErrors.types b/tests/baselines/reference/enumErrors.types index 9759ec253905e..24859e89b9738 100644 --- a/tests/baselines/reference/enumErrors.types +++ b/tests/baselines/reference/enumErrors.types @@ -102,3 +102,37 @@ enum E12 { >1 : 1 } +// Enum with incorrect syntax +enum E13 { +>E13 : E13 + + postComma, +>postComma : E13.postComma + + postValueComma = 1, +>postValueComma : E13.postValueComma +>1 : 1 + + postSemicolon; +>postSemicolon : E13.postSemicolon + + postColonValueComma: 2, +>postColonValueComma : E13.postColonValueComma +>2 : E13.2 + + postColonValueSemicolon: 3; +>postColonValueSemicolon : E13.postColonValueSemicolon +>3 : E13.3 + +}; + +enum E14 { a, b: any "hello" += 1, c, d} +>E14 : E14 +>a : E14.a +>b : E14.b +>any : E14.any +>"hello" : E14.hello +>1 : E14.1 +>c : E14.c +>d : E14.d + diff --git a/tests/baselines/reference/everyTypeWithAnnotationAndInvalidInitializer.errors.txt b/tests/baselines/reference/everyTypeWithAnnotationAndInvalidInitializer.errors.txt index 31848458a87e8..f552bb35ca480 100644 --- a/tests/baselines/reference/everyTypeWithAnnotationAndInvalidInitializer.errors.txt +++ b/tests/baselines/reference/everyTypeWithAnnotationAndInvalidInitializer.errors.txt @@ -17,9 +17,8 @@ tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAnd Type 'string' is not assignable to type 'number'. tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(48,32): error TS2322: Type 'string' is not assignable to type 'number'. tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(50,5): error TS2322: Type 'typeof N' is not assignable to type 'typeof M'. - Types of property 'A' are incompatible. - Type 'typeof N.A' is not assignable to type 'typeof M.A'. - Property 'name' is missing in type 'N.A' but required in type 'M.A'. + The types returned by 'new A()' are incompatible between these types. + Property 'name' is missing in type 'N.A' but required in type 'M.A'. tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(51,5): error TS2322: Type 'N.A' is not assignable to type 'M.A'. tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(52,5): error TS2322: Type '(x: number) => boolean' is not assignable to type '(x: number) => string'. Type 'boolean' is not assignable to type 'string'. @@ -112,9 +111,8 @@ tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAnd var aModule: typeof M = N; ~~~~~~~ !!! error TS2322: Type 'typeof N' is not assignable to type 'typeof M'. -!!! error TS2322: Types of property 'A' are incompatible. -!!! error TS2322: Type 'typeof N.A' is not assignable to type 'typeof M.A'. -!!! error TS2322: Property 'name' is missing in type 'N.A' but required in type 'M.A'. +!!! error TS2322: The types returned by 'new A()' are incompatible between these types. +!!! error TS2322: Property 'name' is missing in type 'N.A' but required in type 'M.A'. !!! related TS2728 tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts:20:9: 'name' is declared here. var aClassInModule: M.A = new N.A(); ~~~~~~~~~~~~~~ diff --git a/tests/baselines/reference/exhaustiveSwitchImplicitReturn.errors.txt b/tests/baselines/reference/exhaustiveSwitchImplicitReturn.errors.txt index 43b5467f0d20f..89daa42c2686f 100644 --- a/tests/baselines/reference/exhaustiveSwitchImplicitReturn.errors.txt +++ b/tests/baselines/reference/exhaustiveSwitchImplicitReturn.errors.txt @@ -44,4 +44,18 @@ tests/cases/compiler/exhaustiveSwitchImplicitReturn.ts(35,32): error TS7030: Not return 1; } } + + function foo6(bar: "a", a: boolean, b: boolean): number { + if (a) { + switch (bar) { + case "a": return 1; + } + } + else { + switch (b) { + case true: return -1; + case false: return 0; + } + } + } \ No newline at end of file diff --git a/tests/baselines/reference/exhaustiveSwitchImplicitReturn.js b/tests/baselines/reference/exhaustiveSwitchImplicitReturn.js index 5f8bf348c5f40..9877f251993f7 100644 --- a/tests/baselines/reference/exhaustiveSwitchImplicitReturn.js +++ b/tests/baselines/reference/exhaustiveSwitchImplicitReturn.js @@ -39,6 +39,20 @@ function foo5(bar: "a" | "b"): number { return 1; } } + +function foo6(bar: "a", a: boolean, b: boolean): number { + if (a) { + switch (bar) { + case "a": return 1; + } + } + else { + switch (b) { + case true: return -1; + case false: return 0; + } + } +} //// [exhaustiveSwitchImplicitReturn.js] @@ -75,3 +89,16 @@ function foo5(bar) { return 1; } } +function foo6(bar, a, b) { + if (a) { + switch (bar) { + case "a": return 1; + } + } + else { + switch (b) { + case true: return -1; + case false: return 0; + } + } +} diff --git a/tests/baselines/reference/exhaustiveSwitchImplicitReturn.symbols b/tests/baselines/reference/exhaustiveSwitchImplicitReturn.symbols index d93a522836247..dcad190a9b330 100644 --- a/tests/baselines/reference/exhaustiveSwitchImplicitReturn.symbols +++ b/tests/baselines/reference/exhaustiveSwitchImplicitReturn.symbols @@ -69,3 +69,28 @@ function foo5(bar: "a" | "b"): number { } } +function foo6(bar: "a", a: boolean, b: boolean): number { +>foo6 : Symbol(foo6, Decl(exhaustiveSwitchImplicitReturn.ts, 39, 1)) +>bar : Symbol(bar, Decl(exhaustiveSwitchImplicitReturn.ts, 41, 14)) +>a : Symbol(a, Decl(exhaustiveSwitchImplicitReturn.ts, 41, 23)) +>b : Symbol(b, Decl(exhaustiveSwitchImplicitReturn.ts, 41, 35)) + + if (a) { +>a : Symbol(a, Decl(exhaustiveSwitchImplicitReturn.ts, 41, 23)) + + switch (bar) { +>bar : Symbol(bar, Decl(exhaustiveSwitchImplicitReturn.ts, 41, 14)) + + case "a": return 1; + } + } + else { + switch (b) { +>b : Symbol(b, Decl(exhaustiveSwitchImplicitReturn.ts, 41, 35)) + + case true: return -1; + case false: return 0; + } + } +} + diff --git a/tests/baselines/reference/exhaustiveSwitchImplicitReturn.types b/tests/baselines/reference/exhaustiveSwitchImplicitReturn.types index c868aa99b8f1d..c72b3b24477b1 100644 --- a/tests/baselines/reference/exhaustiveSwitchImplicitReturn.types +++ b/tests/baselines/reference/exhaustiveSwitchImplicitReturn.types @@ -85,3 +85,36 @@ function foo5(bar: "a" | "b"): number { } } +function foo6(bar: "a", a: boolean, b: boolean): number { +>foo6 : (bar: "a", a: boolean, b: boolean) => number +>bar : "a" +>a : boolean +>b : boolean + + if (a) { +>a : boolean + + switch (bar) { +>bar : "a" + + case "a": return 1; +>"a" : "a" +>1 : 1 + } + } + else { + switch (b) { +>b : boolean + + case true: return -1; +>true : true +>-1 : -1 +>1 : 1 + + case false: return 0; +>false : false +>0 : 0 + } + } +} + diff --git a/tests/baselines/reference/exhaustiveSwitchStatements1.errors.txt b/tests/baselines/reference/exhaustiveSwitchStatements1.errors.txt new file mode 100644 index 0000000000000..4a54518413d18 --- /dev/null +++ b/tests/baselines/reference/exhaustiveSwitchStatements1.errors.txt @@ -0,0 +1,202 @@ +tests/cases/conformance/controlFlow/exhaustiveSwitchStatements1.ts(7,9): error TS7027: Unreachable code detected. + + +==== tests/cases/conformance/controlFlow/exhaustiveSwitchStatements1.ts (1 errors) ==== + function f1(x: 1 | 2): string { + if (!!true) { + switch (x) { + case 1: return 'a'; + case 2: return 'b'; + } + x; // Unreachable + ~~ +!!! error TS7027: Unreachable code detected. + } + else { + throw 0; + } + } + + function f2(x: 1 | 2) { + let z: number; + switch (x) { + case 1: z = 10; break; + case 2: z = 20; break; + } + z; // Definitely assigned + } + + function f3(x: 1 | 2) { + switch (x) { + case 1: return 10; + case 2: return 20; + // Default considered reachable to allow defensive coding + default: throw new Error("Bad input"); + } + } + + // Repro from #11572 + + enum E { A, B } + + function f(e: E): number { + switch (e) { + case E.A: return 0 + case E.B: return 1 + } + } + + function g(e: E): number { + if (!true) + return -1 + else + switch (e) { + case E.A: return 0 + case E.B: return 1 + } + } + + // Repro from #12668 + + interface Square { kind: "square"; size: number; } + + interface Rectangle { kind: "rectangle"; width: number; height: number; } + + interface Circle { kind: "circle"; radius: number; } + + interface Triangle { kind: "triangle"; side: number; } + + type Shape = Square | Rectangle | Circle | Triangle; + + function area(s: Shape): number { + let area; + switch (s.kind) { + case "square": area = s.size * s.size; break; + case "rectangle": area = s.width * s.height; break; + case "circle": area = Math.PI * s.radius * s.radius; break; + case "triangle": area = Math.sqrt(3) / 4 * s.side * s.side; break; + } + return area; + } + + function areaWrapped(s: Shape): number { + let area; + area = (() => { + switch (s.kind) { + case "square": return s.size * s.size; + case "rectangle": return s.width * s.height; + case "circle": return Math.PI * s.radius * s.radius; + case "triangle": return Math.sqrt(3) / 4 * s.side * s.side; + } + })(); + return area; + } + + // Repro from #13241 + + enum MyEnum { + A, + B + } + + function thisGivesError(e: MyEnum): string { + let s: string; + switch (e) { + case MyEnum.A: s = "it was A"; break; + case MyEnum.B: s = "it was B"; break; + } + return s; + } + + function good1(e: MyEnum): string { + let s: string; + switch (e) { + case MyEnum.A: s = "it was A"; break; + case MyEnum.B: s = "it was B"; break; + default: s = "it was something else"; break; + } + return s; + } + + function good2(e: MyEnum): string { + switch (e) { + case MyEnum.A: return "it was A"; + case MyEnum.B: return "it was B"; + } + } + + // Repro from #18362 + + enum Level { + One, + Two, + } + + const doSomethingWithLevel = (level: Level) => { + let next: Level; + switch (level) { + case Level.One: + next = Level.Two; + break; + case Level.Two: + next = Level.One; + break; + } + return next; + }; + + // Repro from #20409 + + interface Square2 { + kind: "square"; + size: number; + } + + interface Circle2 { + kind: "circle"; + radius: number; + } + + type Shape2 = Square2 | Circle2; + + function withDefault(s1: Shape2, s2: Shape2): string { + switch (s1.kind) { + case "square": + return "1"; + case "circle": + switch (s2.kind) { + case "square": + return "2"; + case "circle": + return "3"; + default: + return "never"; + } + } + } + + function withoutDefault(s1: Shape2, s2: Shape2): string { + switch (s1.kind) { + case "square": + return "1"; + case "circle": + switch (s2.kind) { + case "square": + return "2"; + case "circle": + return "3"; + } + } + } + + // Repro from #20823 + + function test4(value: 1 | 2) { + let x: string; + switch (value) { + case 1: x = "one"; break; + case 2: x = "two"; break; + } + return x; + } + \ No newline at end of file diff --git a/tests/baselines/reference/exhaustiveSwitchStatements1.js b/tests/baselines/reference/exhaustiveSwitchStatements1.js new file mode 100644 index 0000000000000..a39db3b8101d5 --- /dev/null +++ b/tests/baselines/reference/exhaustiveSwitchStatements1.js @@ -0,0 +1,437 @@ +//// [exhaustiveSwitchStatements1.ts] +function f1(x: 1 | 2): string { + if (!!true) { + switch (x) { + case 1: return 'a'; + case 2: return 'b'; + } + x; // Unreachable + } + else { + throw 0; + } +} + +function f2(x: 1 | 2) { + let z: number; + switch (x) { + case 1: z = 10; break; + case 2: z = 20; break; + } + z; // Definitely assigned +} + +function f3(x: 1 | 2) { + switch (x) { + case 1: return 10; + case 2: return 20; + // Default considered reachable to allow defensive coding + default: throw new Error("Bad input"); + } +} + +// Repro from #11572 + +enum E { A, B } + +function f(e: E): number { + switch (e) { + case E.A: return 0 + case E.B: return 1 + } +} + +function g(e: E): number { + if (!true) + return -1 + else + switch (e) { + case E.A: return 0 + case E.B: return 1 + } +} + +// Repro from #12668 + +interface Square { kind: "square"; size: number; } + +interface Rectangle { kind: "rectangle"; width: number; height: number; } + +interface Circle { kind: "circle"; radius: number; } + +interface Triangle { kind: "triangle"; side: number; } + +type Shape = Square | Rectangle | Circle | Triangle; + +function area(s: Shape): number { + let area; + switch (s.kind) { + case "square": area = s.size * s.size; break; + case "rectangle": area = s.width * s.height; break; + case "circle": area = Math.PI * s.radius * s.radius; break; + case "triangle": area = Math.sqrt(3) / 4 * s.side * s.side; break; + } + return area; +} + +function areaWrapped(s: Shape): number { + let area; + area = (() => { + switch (s.kind) { + case "square": return s.size * s.size; + case "rectangle": return s.width * s.height; + case "circle": return Math.PI * s.radius * s.radius; + case "triangle": return Math.sqrt(3) / 4 * s.side * s.side; + } + })(); + return area; +} + +// Repro from #13241 + +enum MyEnum { + A, + B +} + +function thisGivesError(e: MyEnum): string { + let s: string; + switch (e) { + case MyEnum.A: s = "it was A"; break; + case MyEnum.B: s = "it was B"; break; + } + return s; +} + +function good1(e: MyEnum): string { + let s: string; + switch (e) { + case MyEnum.A: s = "it was A"; break; + case MyEnum.B: s = "it was B"; break; + default: s = "it was something else"; break; + } + return s; +} + +function good2(e: MyEnum): string { + switch (e) { + case MyEnum.A: return "it was A"; + case MyEnum.B: return "it was B"; + } +} + +// Repro from #18362 + +enum Level { + One, + Two, +} + +const doSomethingWithLevel = (level: Level) => { + let next: Level; + switch (level) { + case Level.One: + next = Level.Two; + break; + case Level.Two: + next = Level.One; + break; + } + return next; +}; + +// Repro from #20409 + +interface Square2 { + kind: "square"; + size: number; +} + +interface Circle2 { + kind: "circle"; + radius: number; +} + +type Shape2 = Square2 | Circle2; + +function withDefault(s1: Shape2, s2: Shape2): string { + switch (s1.kind) { + case "square": + return "1"; + case "circle": + switch (s2.kind) { + case "square": + return "2"; + case "circle": + return "3"; + default: + return "never"; + } + } +} + +function withoutDefault(s1: Shape2, s2: Shape2): string { + switch (s1.kind) { + case "square": + return "1"; + case "circle": + switch (s2.kind) { + case "square": + return "2"; + case "circle": + return "3"; + } + } +} + +// Repro from #20823 + +function test4(value: 1 | 2) { + let x: string; + switch (value) { + case 1: x = "one"; break; + case 2: x = "two"; break; + } + return x; +} + + +//// [exhaustiveSwitchStatements1.js] +"use strict"; +function f1(x) { + if (!!true) { + switch (x) { + case 1: return 'a'; + case 2: return 'b'; + } + x; // Unreachable + } + else { + throw 0; + } +} +function f2(x) { + var z; + switch (x) { + case 1: + z = 10; + break; + case 2: + z = 20; + break; + } + z; // Definitely assigned +} +function f3(x) { + switch (x) { + case 1: return 10; + case 2: return 20; + // Default considered reachable to allow defensive coding + default: throw new Error("Bad input"); + } +} +// Repro from #11572 +var E; +(function (E) { + E[E["A"] = 0] = "A"; + E[E["B"] = 1] = "B"; +})(E || (E = {})); +function f(e) { + switch (e) { + case E.A: return 0; + case E.B: return 1; + } +} +function g(e) { + if (!true) + return -1; + else + switch (e) { + case E.A: return 0; + case E.B: return 1; + } +} +function area(s) { + var area; + switch (s.kind) { + case "square": + area = s.size * s.size; + break; + case "rectangle": + area = s.width * s.height; + break; + case "circle": + area = Math.PI * s.radius * s.radius; + break; + case "triangle": + area = Math.sqrt(3) / 4 * s.side * s.side; + break; + } + return area; +} +function areaWrapped(s) { + var area; + area = (function () { + switch (s.kind) { + case "square": return s.size * s.size; + case "rectangle": return s.width * s.height; + case "circle": return Math.PI * s.radius * s.radius; + case "triangle": return Math.sqrt(3) / 4 * s.side * s.side; + } + })(); + return area; +} +// Repro from #13241 +var MyEnum; +(function (MyEnum) { + MyEnum[MyEnum["A"] = 0] = "A"; + MyEnum[MyEnum["B"] = 1] = "B"; +})(MyEnum || (MyEnum = {})); +function thisGivesError(e) { + var s; + switch (e) { + case MyEnum.A: + s = "it was A"; + break; + case MyEnum.B: + s = "it was B"; + break; + } + return s; +} +function good1(e) { + var s; + switch (e) { + case MyEnum.A: + s = "it was A"; + break; + case MyEnum.B: + s = "it was B"; + break; + default: + s = "it was something else"; + break; + } + return s; +} +function good2(e) { + switch (e) { + case MyEnum.A: return "it was A"; + case MyEnum.B: return "it was B"; + } +} +// Repro from #18362 +var Level; +(function (Level) { + Level[Level["One"] = 0] = "One"; + Level[Level["Two"] = 1] = "Two"; +})(Level || (Level = {})); +var doSomethingWithLevel = function (level) { + var next; + switch (level) { + case Level.One: + next = Level.Two; + break; + case Level.Two: + next = Level.One; + break; + } + return next; +}; +function withDefault(s1, s2) { + switch (s1.kind) { + case "square": + return "1"; + case "circle": + switch (s2.kind) { + case "square": + return "2"; + case "circle": + return "3"; + default: + return "never"; + } + } +} +function withoutDefault(s1, s2) { + switch (s1.kind) { + case "square": + return "1"; + case "circle": + switch (s2.kind) { + case "square": + return "2"; + case "circle": + return "3"; + } + } +} +// Repro from #20823 +function test4(value) { + var x; + switch (value) { + case 1: + x = "one"; + break; + case 2: + x = "two"; + break; + } + return x; +} + + +//// [exhaustiveSwitchStatements1.d.ts] +declare function f1(x: 1 | 2): string; +declare function f2(x: 1 | 2): void; +declare function f3(x: 1 | 2): 10 | 20; +declare enum E { + A = 0, + B = 1 +} +declare function f(e: E): number; +declare function g(e: E): number; +interface Square { + kind: "square"; + size: number; +} +interface Rectangle { + kind: "rectangle"; + width: number; + height: number; +} +interface Circle { + kind: "circle"; + radius: number; +} +interface Triangle { + kind: "triangle"; + side: number; +} +declare type Shape = Square | Rectangle | Circle | Triangle; +declare function area(s: Shape): number; +declare function areaWrapped(s: Shape): number; +declare enum MyEnum { + A = 0, + B = 1 +} +declare function thisGivesError(e: MyEnum): string; +declare function good1(e: MyEnum): string; +declare function good2(e: MyEnum): string; +declare enum Level { + One = 0, + Two = 1 +} +declare const doSomethingWithLevel: (level: Level) => Level; +interface Square2 { + kind: "square"; + size: number; +} +interface Circle2 { + kind: "circle"; + radius: number; +} +declare type Shape2 = Square2 | Circle2; +declare function withDefault(s1: Shape2, s2: Shape2): string; +declare function withoutDefault(s1: Shape2, s2: Shape2): string; +declare function test4(value: 1 | 2): string; diff --git a/tests/baselines/reference/exhaustiveSwitchStatements1.symbols b/tests/baselines/reference/exhaustiveSwitchStatements1.symbols new file mode 100644 index 0000000000000..8beb391188359 --- /dev/null +++ b/tests/baselines/reference/exhaustiveSwitchStatements1.symbols @@ -0,0 +1,503 @@ +=== tests/cases/conformance/controlFlow/exhaustiveSwitchStatements1.ts === +function f1(x: 1 | 2): string { +>f1 : Symbol(f1, Decl(exhaustiveSwitchStatements1.ts, 0, 0)) +>x : Symbol(x, Decl(exhaustiveSwitchStatements1.ts, 0, 12)) + + if (!!true) { + switch (x) { +>x : Symbol(x, Decl(exhaustiveSwitchStatements1.ts, 0, 12)) + + case 1: return 'a'; + case 2: return 'b'; + } + x; // Unreachable +>x : Symbol(x, Decl(exhaustiveSwitchStatements1.ts, 0, 12)) + } + else { + throw 0; + } +} + +function f2(x: 1 | 2) { +>f2 : Symbol(f2, Decl(exhaustiveSwitchStatements1.ts, 11, 1)) +>x : Symbol(x, Decl(exhaustiveSwitchStatements1.ts, 13, 12)) + + let z: number; +>z : Symbol(z, Decl(exhaustiveSwitchStatements1.ts, 14, 7)) + + switch (x) { +>x : Symbol(x, Decl(exhaustiveSwitchStatements1.ts, 13, 12)) + + case 1: z = 10; break; +>z : Symbol(z, Decl(exhaustiveSwitchStatements1.ts, 14, 7)) + + case 2: z = 20; break; +>z : Symbol(z, Decl(exhaustiveSwitchStatements1.ts, 14, 7)) + } + z; // Definitely assigned +>z : Symbol(z, Decl(exhaustiveSwitchStatements1.ts, 14, 7)) +} + +function f3(x: 1 | 2) { +>f3 : Symbol(f3, Decl(exhaustiveSwitchStatements1.ts, 20, 1)) +>x : Symbol(x, Decl(exhaustiveSwitchStatements1.ts, 22, 12)) + + switch (x) { +>x : Symbol(x, Decl(exhaustiveSwitchStatements1.ts, 22, 12)) + + case 1: return 10; + case 2: return 20; + // Default considered reachable to allow defensive coding + default: throw new Error("Bad input"); +>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + } +} + +// Repro from #11572 + +enum E { A, B } +>E : Symbol(E, Decl(exhaustiveSwitchStatements1.ts, 29, 1)) +>A : Symbol(E.A, Decl(exhaustiveSwitchStatements1.ts, 33, 8)) +>B : Symbol(E.B, Decl(exhaustiveSwitchStatements1.ts, 33, 11)) + +function f(e: E): number { +>f : Symbol(f, Decl(exhaustiveSwitchStatements1.ts, 33, 15)) +>e : Symbol(e, Decl(exhaustiveSwitchStatements1.ts, 35, 11)) +>E : Symbol(E, Decl(exhaustiveSwitchStatements1.ts, 29, 1)) + + switch (e) { +>e : Symbol(e, Decl(exhaustiveSwitchStatements1.ts, 35, 11)) + + case E.A: return 0 +>E.A : Symbol(E.A, Decl(exhaustiveSwitchStatements1.ts, 33, 8)) +>E : Symbol(E, Decl(exhaustiveSwitchStatements1.ts, 29, 1)) +>A : Symbol(E.A, Decl(exhaustiveSwitchStatements1.ts, 33, 8)) + + case E.B: return 1 +>E.B : Symbol(E.B, Decl(exhaustiveSwitchStatements1.ts, 33, 11)) +>E : Symbol(E, Decl(exhaustiveSwitchStatements1.ts, 29, 1)) +>B : Symbol(E.B, Decl(exhaustiveSwitchStatements1.ts, 33, 11)) + } +} + +function g(e: E): number { +>g : Symbol(g, Decl(exhaustiveSwitchStatements1.ts, 40, 1)) +>e : Symbol(e, Decl(exhaustiveSwitchStatements1.ts, 42, 11)) +>E : Symbol(E, Decl(exhaustiveSwitchStatements1.ts, 29, 1)) + + if (!true) + return -1 + else + switch (e) { +>e : Symbol(e, Decl(exhaustiveSwitchStatements1.ts, 42, 11)) + + case E.A: return 0 +>E.A : Symbol(E.A, Decl(exhaustiveSwitchStatements1.ts, 33, 8)) +>E : Symbol(E, Decl(exhaustiveSwitchStatements1.ts, 29, 1)) +>A : Symbol(E.A, Decl(exhaustiveSwitchStatements1.ts, 33, 8)) + + case E.B: return 1 +>E.B : Symbol(E.B, Decl(exhaustiveSwitchStatements1.ts, 33, 11)) +>E : Symbol(E, Decl(exhaustiveSwitchStatements1.ts, 29, 1)) +>B : Symbol(E.B, Decl(exhaustiveSwitchStatements1.ts, 33, 11)) + } +} + +// Repro from #12668 + +interface Square { kind: "square"; size: number; } +>Square : Symbol(Square, Decl(exhaustiveSwitchStatements1.ts, 50, 1)) +>kind : Symbol(Square.kind, Decl(exhaustiveSwitchStatements1.ts, 54, 18)) +>size : Symbol(Square.size, Decl(exhaustiveSwitchStatements1.ts, 54, 34)) + +interface Rectangle { kind: "rectangle"; width: number; height: number; } +>Rectangle : Symbol(Rectangle, Decl(exhaustiveSwitchStatements1.ts, 54, 50)) +>kind : Symbol(Rectangle.kind, Decl(exhaustiveSwitchStatements1.ts, 56, 21)) +>width : Symbol(Rectangle.width, Decl(exhaustiveSwitchStatements1.ts, 56, 40)) +>height : Symbol(Rectangle.height, Decl(exhaustiveSwitchStatements1.ts, 56, 55)) + +interface Circle { kind: "circle"; radius: number; } +>Circle : Symbol(Circle, Decl(exhaustiveSwitchStatements1.ts, 56, 73)) +>kind : Symbol(Circle.kind, Decl(exhaustiveSwitchStatements1.ts, 58, 18)) +>radius : Symbol(Circle.radius, Decl(exhaustiveSwitchStatements1.ts, 58, 34)) + +interface Triangle { kind: "triangle"; side: number; } +>Triangle : Symbol(Triangle, Decl(exhaustiveSwitchStatements1.ts, 58, 52)) +>kind : Symbol(Triangle.kind, Decl(exhaustiveSwitchStatements1.ts, 60, 20)) +>side : Symbol(Triangle.side, Decl(exhaustiveSwitchStatements1.ts, 60, 38)) + +type Shape = Square | Rectangle | Circle | Triangle; +>Shape : Symbol(Shape, Decl(exhaustiveSwitchStatements1.ts, 60, 54)) +>Square : Symbol(Square, Decl(exhaustiveSwitchStatements1.ts, 50, 1)) +>Rectangle : Symbol(Rectangle, Decl(exhaustiveSwitchStatements1.ts, 54, 50)) +>Circle : Symbol(Circle, Decl(exhaustiveSwitchStatements1.ts, 56, 73)) +>Triangle : Symbol(Triangle, Decl(exhaustiveSwitchStatements1.ts, 58, 52)) + +function area(s: Shape): number { +>area : Symbol(area, Decl(exhaustiveSwitchStatements1.ts, 62, 52)) +>s : Symbol(s, Decl(exhaustiveSwitchStatements1.ts, 64, 14)) +>Shape : Symbol(Shape, Decl(exhaustiveSwitchStatements1.ts, 60, 54)) + + let area; +>area : Symbol(area, Decl(exhaustiveSwitchStatements1.ts, 65, 7)) + + switch (s.kind) { +>s.kind : Symbol(kind, Decl(exhaustiveSwitchStatements1.ts, 54, 18), Decl(exhaustiveSwitchStatements1.ts, 56, 21), Decl(exhaustiveSwitchStatements1.ts, 58, 18), Decl(exhaustiveSwitchStatements1.ts, 60, 20)) +>s : Symbol(s, Decl(exhaustiveSwitchStatements1.ts, 64, 14)) +>kind : Symbol(kind, Decl(exhaustiveSwitchStatements1.ts, 54, 18), Decl(exhaustiveSwitchStatements1.ts, 56, 21), Decl(exhaustiveSwitchStatements1.ts, 58, 18), Decl(exhaustiveSwitchStatements1.ts, 60, 20)) + + case "square": area = s.size * s.size; break; +>area : Symbol(area, Decl(exhaustiveSwitchStatements1.ts, 65, 7)) +>s.size : Symbol(Square.size, Decl(exhaustiveSwitchStatements1.ts, 54, 34)) +>s : Symbol(s, Decl(exhaustiveSwitchStatements1.ts, 64, 14)) +>size : Symbol(Square.size, Decl(exhaustiveSwitchStatements1.ts, 54, 34)) +>s.size : Symbol(Square.size, Decl(exhaustiveSwitchStatements1.ts, 54, 34)) +>s : Symbol(s, Decl(exhaustiveSwitchStatements1.ts, 64, 14)) +>size : Symbol(Square.size, Decl(exhaustiveSwitchStatements1.ts, 54, 34)) + + case "rectangle": area = s.width * s.height; break; +>area : Symbol(area, Decl(exhaustiveSwitchStatements1.ts, 65, 7)) +>s.width : Symbol(Rectangle.width, Decl(exhaustiveSwitchStatements1.ts, 56, 40)) +>s : Symbol(s, Decl(exhaustiveSwitchStatements1.ts, 64, 14)) +>width : Symbol(Rectangle.width, Decl(exhaustiveSwitchStatements1.ts, 56, 40)) +>s.height : Symbol(Rectangle.height, Decl(exhaustiveSwitchStatements1.ts, 56, 55)) +>s : Symbol(s, Decl(exhaustiveSwitchStatements1.ts, 64, 14)) +>height : Symbol(Rectangle.height, Decl(exhaustiveSwitchStatements1.ts, 56, 55)) + + case "circle": area = Math.PI * s.radius * s.radius; break; +>area : Symbol(area, Decl(exhaustiveSwitchStatements1.ts, 65, 7)) +>Math.PI : Symbol(Math.PI, Decl(lib.es5.d.ts, --, --)) +>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>PI : Symbol(Math.PI, Decl(lib.es5.d.ts, --, --)) +>s.radius : Symbol(Circle.radius, Decl(exhaustiveSwitchStatements1.ts, 58, 34)) +>s : Symbol(s, Decl(exhaustiveSwitchStatements1.ts, 64, 14)) +>radius : Symbol(Circle.radius, Decl(exhaustiveSwitchStatements1.ts, 58, 34)) +>s.radius : Symbol(Circle.radius, Decl(exhaustiveSwitchStatements1.ts, 58, 34)) +>s : Symbol(s, Decl(exhaustiveSwitchStatements1.ts, 64, 14)) +>radius : Symbol(Circle.radius, Decl(exhaustiveSwitchStatements1.ts, 58, 34)) + + case "triangle": area = Math.sqrt(3) / 4 * s.side * s.side; break; +>area : Symbol(area, Decl(exhaustiveSwitchStatements1.ts, 65, 7)) +>Math.sqrt : Symbol(Math.sqrt, Decl(lib.es5.d.ts, --, --)) +>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>sqrt : Symbol(Math.sqrt, Decl(lib.es5.d.ts, --, --)) +>s.side : Symbol(Triangle.side, Decl(exhaustiveSwitchStatements1.ts, 60, 38)) +>s : Symbol(s, Decl(exhaustiveSwitchStatements1.ts, 64, 14)) +>side : Symbol(Triangle.side, Decl(exhaustiveSwitchStatements1.ts, 60, 38)) +>s.side : Symbol(Triangle.side, Decl(exhaustiveSwitchStatements1.ts, 60, 38)) +>s : Symbol(s, Decl(exhaustiveSwitchStatements1.ts, 64, 14)) +>side : Symbol(Triangle.side, Decl(exhaustiveSwitchStatements1.ts, 60, 38)) + } + return area; +>area : Symbol(area, Decl(exhaustiveSwitchStatements1.ts, 65, 7)) +} + +function areaWrapped(s: Shape): number { +>areaWrapped : Symbol(areaWrapped, Decl(exhaustiveSwitchStatements1.ts, 73, 1)) +>s : Symbol(s, Decl(exhaustiveSwitchStatements1.ts, 75, 21)) +>Shape : Symbol(Shape, Decl(exhaustiveSwitchStatements1.ts, 60, 54)) + + let area; +>area : Symbol(area, Decl(exhaustiveSwitchStatements1.ts, 76, 7)) + + area = (() => { +>area : Symbol(area, Decl(exhaustiveSwitchStatements1.ts, 76, 7)) + + switch (s.kind) { +>s.kind : Symbol(kind, Decl(exhaustiveSwitchStatements1.ts, 54, 18), Decl(exhaustiveSwitchStatements1.ts, 56, 21), Decl(exhaustiveSwitchStatements1.ts, 58, 18), Decl(exhaustiveSwitchStatements1.ts, 60, 20)) +>s : Symbol(s, Decl(exhaustiveSwitchStatements1.ts, 75, 21)) +>kind : Symbol(kind, Decl(exhaustiveSwitchStatements1.ts, 54, 18), Decl(exhaustiveSwitchStatements1.ts, 56, 21), Decl(exhaustiveSwitchStatements1.ts, 58, 18), Decl(exhaustiveSwitchStatements1.ts, 60, 20)) + + case "square": return s.size * s.size; +>s.size : Symbol(Square.size, Decl(exhaustiveSwitchStatements1.ts, 54, 34)) +>s : Symbol(s, Decl(exhaustiveSwitchStatements1.ts, 75, 21)) +>size : Symbol(Square.size, Decl(exhaustiveSwitchStatements1.ts, 54, 34)) +>s.size : Symbol(Square.size, Decl(exhaustiveSwitchStatements1.ts, 54, 34)) +>s : Symbol(s, Decl(exhaustiveSwitchStatements1.ts, 75, 21)) +>size : Symbol(Square.size, Decl(exhaustiveSwitchStatements1.ts, 54, 34)) + + case "rectangle": return s.width * s.height; +>s.width : Symbol(Rectangle.width, Decl(exhaustiveSwitchStatements1.ts, 56, 40)) +>s : Symbol(s, Decl(exhaustiveSwitchStatements1.ts, 75, 21)) +>width : Symbol(Rectangle.width, Decl(exhaustiveSwitchStatements1.ts, 56, 40)) +>s.height : Symbol(Rectangle.height, Decl(exhaustiveSwitchStatements1.ts, 56, 55)) +>s : Symbol(s, Decl(exhaustiveSwitchStatements1.ts, 75, 21)) +>height : Symbol(Rectangle.height, Decl(exhaustiveSwitchStatements1.ts, 56, 55)) + + case "circle": return Math.PI * s.radius * s.radius; +>Math.PI : Symbol(Math.PI, Decl(lib.es5.d.ts, --, --)) +>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>PI : Symbol(Math.PI, Decl(lib.es5.d.ts, --, --)) +>s.radius : Symbol(Circle.radius, Decl(exhaustiveSwitchStatements1.ts, 58, 34)) +>s : Symbol(s, Decl(exhaustiveSwitchStatements1.ts, 75, 21)) +>radius : Symbol(Circle.radius, Decl(exhaustiveSwitchStatements1.ts, 58, 34)) +>s.radius : Symbol(Circle.radius, Decl(exhaustiveSwitchStatements1.ts, 58, 34)) +>s : Symbol(s, Decl(exhaustiveSwitchStatements1.ts, 75, 21)) +>radius : Symbol(Circle.radius, Decl(exhaustiveSwitchStatements1.ts, 58, 34)) + + case "triangle": return Math.sqrt(3) / 4 * s.side * s.side; +>Math.sqrt : Symbol(Math.sqrt, Decl(lib.es5.d.ts, --, --)) +>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>sqrt : Symbol(Math.sqrt, Decl(lib.es5.d.ts, --, --)) +>s.side : Symbol(Triangle.side, Decl(exhaustiveSwitchStatements1.ts, 60, 38)) +>s : Symbol(s, Decl(exhaustiveSwitchStatements1.ts, 75, 21)) +>side : Symbol(Triangle.side, Decl(exhaustiveSwitchStatements1.ts, 60, 38)) +>s.side : Symbol(Triangle.side, Decl(exhaustiveSwitchStatements1.ts, 60, 38)) +>s : Symbol(s, Decl(exhaustiveSwitchStatements1.ts, 75, 21)) +>side : Symbol(Triangle.side, Decl(exhaustiveSwitchStatements1.ts, 60, 38)) + } + })(); + return area; +>area : Symbol(area, Decl(exhaustiveSwitchStatements1.ts, 76, 7)) +} + +// Repro from #13241 + +enum MyEnum { +>MyEnum : Symbol(MyEnum, Decl(exhaustiveSwitchStatements1.ts, 86, 1)) + + A, +>A : Symbol(MyEnum.A, Decl(exhaustiveSwitchStatements1.ts, 90, 13)) + + B +>B : Symbol(MyEnum.B, Decl(exhaustiveSwitchStatements1.ts, 91, 3)) +} + +function thisGivesError(e: MyEnum): string { +>thisGivesError : Symbol(thisGivesError, Decl(exhaustiveSwitchStatements1.ts, 93, 1)) +>e : Symbol(e, Decl(exhaustiveSwitchStatements1.ts, 95, 24)) +>MyEnum : Symbol(MyEnum, Decl(exhaustiveSwitchStatements1.ts, 86, 1)) + + let s: string; +>s : Symbol(s, Decl(exhaustiveSwitchStatements1.ts, 96, 4)) + + switch (e) { +>e : Symbol(e, Decl(exhaustiveSwitchStatements1.ts, 95, 24)) + + case MyEnum.A: s = "it was A"; break; +>MyEnum.A : Symbol(MyEnum.A, Decl(exhaustiveSwitchStatements1.ts, 90, 13)) +>MyEnum : Symbol(MyEnum, Decl(exhaustiveSwitchStatements1.ts, 86, 1)) +>A : Symbol(MyEnum.A, Decl(exhaustiveSwitchStatements1.ts, 90, 13)) +>s : Symbol(s, Decl(exhaustiveSwitchStatements1.ts, 96, 4)) + + case MyEnum.B: s = "it was B"; break; +>MyEnum.B : Symbol(MyEnum.B, Decl(exhaustiveSwitchStatements1.ts, 91, 3)) +>MyEnum : Symbol(MyEnum, Decl(exhaustiveSwitchStatements1.ts, 86, 1)) +>B : Symbol(MyEnum.B, Decl(exhaustiveSwitchStatements1.ts, 91, 3)) +>s : Symbol(s, Decl(exhaustiveSwitchStatements1.ts, 96, 4)) + } + return s; +>s : Symbol(s, Decl(exhaustiveSwitchStatements1.ts, 96, 4)) +} + +function good1(e: MyEnum): string { +>good1 : Symbol(good1, Decl(exhaustiveSwitchStatements1.ts, 102, 1)) +>e : Symbol(e, Decl(exhaustiveSwitchStatements1.ts, 104, 15)) +>MyEnum : Symbol(MyEnum, Decl(exhaustiveSwitchStatements1.ts, 86, 1)) + + let s: string; +>s : Symbol(s, Decl(exhaustiveSwitchStatements1.ts, 105, 4)) + + switch (e) { +>e : Symbol(e, Decl(exhaustiveSwitchStatements1.ts, 104, 15)) + + case MyEnum.A: s = "it was A"; break; +>MyEnum.A : Symbol(MyEnum.A, Decl(exhaustiveSwitchStatements1.ts, 90, 13)) +>MyEnum : Symbol(MyEnum, Decl(exhaustiveSwitchStatements1.ts, 86, 1)) +>A : Symbol(MyEnum.A, Decl(exhaustiveSwitchStatements1.ts, 90, 13)) +>s : Symbol(s, Decl(exhaustiveSwitchStatements1.ts, 105, 4)) + + case MyEnum.B: s = "it was B"; break; +>MyEnum.B : Symbol(MyEnum.B, Decl(exhaustiveSwitchStatements1.ts, 91, 3)) +>MyEnum : Symbol(MyEnum, Decl(exhaustiveSwitchStatements1.ts, 86, 1)) +>B : Symbol(MyEnum.B, Decl(exhaustiveSwitchStatements1.ts, 91, 3)) +>s : Symbol(s, Decl(exhaustiveSwitchStatements1.ts, 105, 4)) + + default: s = "it was something else"; break; +>s : Symbol(s, Decl(exhaustiveSwitchStatements1.ts, 105, 4)) + } + return s; +>s : Symbol(s, Decl(exhaustiveSwitchStatements1.ts, 105, 4)) +} + +function good2(e: MyEnum): string { +>good2 : Symbol(good2, Decl(exhaustiveSwitchStatements1.ts, 112, 1)) +>e : Symbol(e, Decl(exhaustiveSwitchStatements1.ts, 114, 15)) +>MyEnum : Symbol(MyEnum, Decl(exhaustiveSwitchStatements1.ts, 86, 1)) + + switch (e) { +>e : Symbol(e, Decl(exhaustiveSwitchStatements1.ts, 114, 15)) + + case MyEnum.A: return "it was A"; +>MyEnum.A : Symbol(MyEnum.A, Decl(exhaustiveSwitchStatements1.ts, 90, 13)) +>MyEnum : Symbol(MyEnum, Decl(exhaustiveSwitchStatements1.ts, 86, 1)) +>A : Symbol(MyEnum.A, Decl(exhaustiveSwitchStatements1.ts, 90, 13)) + + case MyEnum.B: return "it was B"; +>MyEnum.B : Symbol(MyEnum.B, Decl(exhaustiveSwitchStatements1.ts, 91, 3)) +>MyEnum : Symbol(MyEnum, Decl(exhaustiveSwitchStatements1.ts, 86, 1)) +>B : Symbol(MyEnum.B, Decl(exhaustiveSwitchStatements1.ts, 91, 3)) + } +} + +// Repro from #18362 + +enum Level { +>Level : Symbol(Level, Decl(exhaustiveSwitchStatements1.ts, 119, 1)) + + One, +>One : Symbol(Level.One, Decl(exhaustiveSwitchStatements1.ts, 123, 12)) + + Two, +>Two : Symbol(Level.Two, Decl(exhaustiveSwitchStatements1.ts, 124, 6)) +} + +const doSomethingWithLevel = (level: Level) => { +>doSomethingWithLevel : Symbol(doSomethingWithLevel, Decl(exhaustiveSwitchStatements1.ts, 128, 5)) +>level : Symbol(level, Decl(exhaustiveSwitchStatements1.ts, 128, 30)) +>Level : Symbol(Level, Decl(exhaustiveSwitchStatements1.ts, 119, 1)) + + let next: Level; +>next : Symbol(next, Decl(exhaustiveSwitchStatements1.ts, 129, 5)) +>Level : Symbol(Level, Decl(exhaustiveSwitchStatements1.ts, 119, 1)) + + switch (level) { +>level : Symbol(level, Decl(exhaustiveSwitchStatements1.ts, 128, 30)) + + case Level.One: +>Level.One : Symbol(Level.One, Decl(exhaustiveSwitchStatements1.ts, 123, 12)) +>Level : Symbol(Level, Decl(exhaustiveSwitchStatements1.ts, 119, 1)) +>One : Symbol(Level.One, Decl(exhaustiveSwitchStatements1.ts, 123, 12)) + + next = Level.Two; +>next : Symbol(next, Decl(exhaustiveSwitchStatements1.ts, 129, 5)) +>Level.Two : Symbol(Level.Two, Decl(exhaustiveSwitchStatements1.ts, 124, 6)) +>Level : Symbol(Level, Decl(exhaustiveSwitchStatements1.ts, 119, 1)) +>Two : Symbol(Level.Two, Decl(exhaustiveSwitchStatements1.ts, 124, 6)) + + break; + case Level.Two: +>Level.Two : Symbol(Level.Two, Decl(exhaustiveSwitchStatements1.ts, 124, 6)) +>Level : Symbol(Level, Decl(exhaustiveSwitchStatements1.ts, 119, 1)) +>Two : Symbol(Level.Two, Decl(exhaustiveSwitchStatements1.ts, 124, 6)) + + next = Level.One; +>next : Symbol(next, Decl(exhaustiveSwitchStatements1.ts, 129, 5)) +>Level.One : Symbol(Level.One, Decl(exhaustiveSwitchStatements1.ts, 123, 12)) +>Level : Symbol(Level, Decl(exhaustiveSwitchStatements1.ts, 119, 1)) +>One : Symbol(Level.One, Decl(exhaustiveSwitchStatements1.ts, 123, 12)) + + break; + } + return next; +>next : Symbol(next, Decl(exhaustiveSwitchStatements1.ts, 129, 5)) + +}; + +// Repro from #20409 + +interface Square2 { +>Square2 : Symbol(Square2, Decl(exhaustiveSwitchStatements1.ts, 139, 2)) + + kind: "square"; +>kind : Symbol(Square2.kind, Decl(exhaustiveSwitchStatements1.ts, 143, 19)) + + size: number; +>size : Symbol(Square2.size, Decl(exhaustiveSwitchStatements1.ts, 144, 19)) +} + +interface Circle2 { +>Circle2 : Symbol(Circle2, Decl(exhaustiveSwitchStatements1.ts, 146, 1)) + + kind: "circle"; +>kind : Symbol(Circle2.kind, Decl(exhaustiveSwitchStatements1.ts, 148, 19)) + + radius: number; +>radius : Symbol(Circle2.radius, Decl(exhaustiveSwitchStatements1.ts, 149, 19)) +} + +type Shape2 = Square2 | Circle2; +>Shape2 : Symbol(Shape2, Decl(exhaustiveSwitchStatements1.ts, 151, 1)) +>Square2 : Symbol(Square2, Decl(exhaustiveSwitchStatements1.ts, 139, 2)) +>Circle2 : Symbol(Circle2, Decl(exhaustiveSwitchStatements1.ts, 146, 1)) + +function withDefault(s1: Shape2, s2: Shape2): string { +>withDefault : Symbol(withDefault, Decl(exhaustiveSwitchStatements1.ts, 153, 32)) +>s1 : Symbol(s1, Decl(exhaustiveSwitchStatements1.ts, 155, 21)) +>Shape2 : Symbol(Shape2, Decl(exhaustiveSwitchStatements1.ts, 151, 1)) +>s2 : Symbol(s2, Decl(exhaustiveSwitchStatements1.ts, 155, 32)) +>Shape2 : Symbol(Shape2, Decl(exhaustiveSwitchStatements1.ts, 151, 1)) + + switch (s1.kind) { +>s1.kind : Symbol(kind, Decl(exhaustiveSwitchStatements1.ts, 143, 19), Decl(exhaustiveSwitchStatements1.ts, 148, 19)) +>s1 : Symbol(s1, Decl(exhaustiveSwitchStatements1.ts, 155, 21)) +>kind : Symbol(kind, Decl(exhaustiveSwitchStatements1.ts, 143, 19), Decl(exhaustiveSwitchStatements1.ts, 148, 19)) + + case "square": + return "1"; + case "circle": + switch (s2.kind) { +>s2.kind : Symbol(kind, Decl(exhaustiveSwitchStatements1.ts, 143, 19), Decl(exhaustiveSwitchStatements1.ts, 148, 19)) +>s2 : Symbol(s2, Decl(exhaustiveSwitchStatements1.ts, 155, 32)) +>kind : Symbol(kind, Decl(exhaustiveSwitchStatements1.ts, 143, 19), Decl(exhaustiveSwitchStatements1.ts, 148, 19)) + + case "square": + return "2"; + case "circle": + return "3"; + default: + return "never"; + } + } +} + +function withoutDefault(s1: Shape2, s2: Shape2): string { +>withoutDefault : Symbol(withoutDefault, Decl(exhaustiveSwitchStatements1.ts, 169, 1)) +>s1 : Symbol(s1, Decl(exhaustiveSwitchStatements1.ts, 171, 24)) +>Shape2 : Symbol(Shape2, Decl(exhaustiveSwitchStatements1.ts, 151, 1)) +>s2 : Symbol(s2, Decl(exhaustiveSwitchStatements1.ts, 171, 35)) +>Shape2 : Symbol(Shape2, Decl(exhaustiveSwitchStatements1.ts, 151, 1)) + + switch (s1.kind) { +>s1.kind : Symbol(kind, Decl(exhaustiveSwitchStatements1.ts, 143, 19), Decl(exhaustiveSwitchStatements1.ts, 148, 19)) +>s1 : Symbol(s1, Decl(exhaustiveSwitchStatements1.ts, 171, 24)) +>kind : Symbol(kind, Decl(exhaustiveSwitchStatements1.ts, 143, 19), Decl(exhaustiveSwitchStatements1.ts, 148, 19)) + + case "square": + return "1"; + case "circle": + switch (s2.kind) { +>s2.kind : Symbol(kind, Decl(exhaustiveSwitchStatements1.ts, 143, 19), Decl(exhaustiveSwitchStatements1.ts, 148, 19)) +>s2 : Symbol(s2, Decl(exhaustiveSwitchStatements1.ts, 171, 35)) +>kind : Symbol(kind, Decl(exhaustiveSwitchStatements1.ts, 143, 19), Decl(exhaustiveSwitchStatements1.ts, 148, 19)) + + case "square": + return "2"; + case "circle": + return "3"; + } + } +} + +// Repro from #20823 + +function test4(value: 1 | 2) { +>test4 : Symbol(test4, Decl(exhaustiveSwitchStatements1.ts, 183, 1)) +>value : Symbol(value, Decl(exhaustiveSwitchStatements1.ts, 187, 15)) + + let x: string; +>x : Symbol(x, Decl(exhaustiveSwitchStatements1.ts, 188, 7)) + + switch (value) { +>value : Symbol(value, Decl(exhaustiveSwitchStatements1.ts, 187, 15)) + + case 1: x = "one"; break; +>x : Symbol(x, Decl(exhaustiveSwitchStatements1.ts, 188, 7)) + + case 2: x = "two"; break; +>x : Symbol(x, Decl(exhaustiveSwitchStatements1.ts, 188, 7)) + } + return x; +>x : Symbol(x, Decl(exhaustiveSwitchStatements1.ts, 188, 7)) +} + diff --git a/tests/baselines/reference/exhaustiveSwitchStatements1.types b/tests/baselines/reference/exhaustiveSwitchStatements1.types new file mode 100644 index 0000000000000..04a9bf531ce9c --- /dev/null +++ b/tests/baselines/reference/exhaustiveSwitchStatements1.types @@ -0,0 +1,595 @@ +=== tests/cases/conformance/controlFlow/exhaustiveSwitchStatements1.ts === +function f1(x: 1 | 2): string { +>f1 : (x: 1 | 2) => string +>x : 1 | 2 + + if (!!true) { +>!!true : true +>!true : false +>true : true + + switch (x) { +>x : 1 | 2 + + case 1: return 'a'; +>1 : 1 +>'a' : "a" + + case 2: return 'b'; +>2 : 2 +>'b' : "b" + } + x; // Unreachable +>x : never + } + else { + throw 0; +>0 : 0 + } +} + +function f2(x: 1 | 2) { +>f2 : (x: 1 | 2) => void +>x : 1 | 2 + + let z: number; +>z : number + + switch (x) { +>x : 1 | 2 + + case 1: z = 10; break; +>1 : 1 +>z = 10 : 10 +>z : number +>10 : 10 + + case 2: z = 20; break; +>2 : 2 +>z = 20 : 20 +>z : number +>20 : 20 + } + z; // Definitely assigned +>z : number +} + +function f3(x: 1 | 2) { +>f3 : (x: 1 | 2) => 10 | 20 +>x : 1 | 2 + + switch (x) { +>x : 1 | 2 + + case 1: return 10; +>1 : 1 +>10 : 10 + + case 2: return 20; +>2 : 2 +>20 : 20 + + // Default considered reachable to allow defensive coding + default: throw new Error("Bad input"); +>new Error("Bad input") : Error +>Error : ErrorConstructor +>"Bad input" : "Bad input" + } +} + +// Repro from #11572 + +enum E { A, B } +>E : E +>A : E.A +>B : E.B + +function f(e: E): number { +>f : (e: E) => number +>e : E + + switch (e) { +>e : E + + case E.A: return 0 +>E.A : E.A +>E : typeof E +>A : E.A +>0 : 0 + + case E.B: return 1 +>E.B : E.B +>E : typeof E +>B : E.B +>1 : 1 + } +} + +function g(e: E): number { +>g : (e: E) => number +>e : E + + if (!true) +>!true : false +>true : true + + return -1 +>-1 : -1 +>1 : 1 + + else + switch (e) { +>e : E + + case E.A: return 0 +>E.A : E.A +>E : typeof E +>A : E.A +>0 : 0 + + case E.B: return 1 +>E.B : E.B +>E : typeof E +>B : E.B +>1 : 1 + } +} + +// Repro from #12668 + +interface Square { kind: "square"; size: number; } +>kind : "square" +>size : number + +interface Rectangle { kind: "rectangle"; width: number; height: number; } +>kind : "rectangle" +>width : number +>height : number + +interface Circle { kind: "circle"; radius: number; } +>kind : "circle" +>radius : number + +interface Triangle { kind: "triangle"; side: number; } +>kind : "triangle" +>side : number + +type Shape = Square | Rectangle | Circle | Triangle; +>Shape : Shape + +function area(s: Shape): number { +>area : (s: Shape) => number +>s : Shape + + let area; +>area : any + + switch (s.kind) { +>s.kind : "square" | "rectangle" | "circle" | "triangle" +>s : Shape +>kind : "square" | "rectangle" | "circle" | "triangle" + + case "square": area = s.size * s.size; break; +>"square" : "square" +>area = s.size * s.size : number +>area : any +>s.size * s.size : number +>s.size : number +>s : Square +>size : number +>s.size : number +>s : Square +>size : number + + case "rectangle": area = s.width * s.height; break; +>"rectangle" : "rectangle" +>area = s.width * s.height : number +>area : any +>s.width * s.height : number +>s.width : number +>s : Rectangle +>width : number +>s.height : number +>s : Rectangle +>height : number + + case "circle": area = Math.PI * s.radius * s.radius; break; +>"circle" : "circle" +>area = Math.PI * s.radius * s.radius : number +>area : any +>Math.PI * s.radius * s.radius : number +>Math.PI * s.radius : number +>Math.PI : number +>Math : Math +>PI : number +>s.radius : number +>s : Circle +>radius : number +>s.radius : number +>s : Circle +>radius : number + + case "triangle": area = Math.sqrt(3) / 4 * s.side * s.side; break; +>"triangle" : "triangle" +>area = Math.sqrt(3) / 4 * s.side * s.side : number +>area : any +>Math.sqrt(3) / 4 * s.side * s.side : number +>Math.sqrt(3) / 4 * s.side : number +>Math.sqrt(3) / 4 : number +>Math.sqrt(3) : number +>Math.sqrt : (x: number) => number +>Math : Math +>sqrt : (x: number) => number +>3 : 3 +>4 : 4 +>s.side : number +>s : Triangle +>side : number +>s.side : number +>s : Triangle +>side : number + } + return area; +>area : number +} + +function areaWrapped(s: Shape): number { +>areaWrapped : (s: Shape) => number +>s : Shape + + let area; +>area : any + + area = (() => { +>area = (() => { switch (s.kind) { case "square": return s.size * s.size; case "rectangle": return s.width * s.height; case "circle": return Math.PI * s.radius * s.radius; case "triangle": return Math.sqrt(3) / 4 * s.side * s.side; } })() : number +>area : any +>(() => { switch (s.kind) { case "square": return s.size * s.size; case "rectangle": return s.width * s.height; case "circle": return Math.PI * s.radius * s.radius; case "triangle": return Math.sqrt(3) / 4 * s.side * s.side; } })() : number +>(() => { switch (s.kind) { case "square": return s.size * s.size; case "rectangle": return s.width * s.height; case "circle": return Math.PI * s.radius * s.radius; case "triangle": return Math.sqrt(3) / 4 * s.side * s.side; } }) : () => number +>() => { switch (s.kind) { case "square": return s.size * s.size; case "rectangle": return s.width * s.height; case "circle": return Math.PI * s.radius * s.radius; case "triangle": return Math.sqrt(3) / 4 * s.side * s.side; } } : () => number + + switch (s.kind) { +>s.kind : "square" | "rectangle" | "circle" | "triangle" +>s : Shape +>kind : "square" | "rectangle" | "circle" | "triangle" + + case "square": return s.size * s.size; +>"square" : "square" +>s.size * s.size : number +>s.size : number +>s : Square +>size : number +>s.size : number +>s : Square +>size : number + + case "rectangle": return s.width * s.height; +>"rectangle" : "rectangle" +>s.width * s.height : number +>s.width : number +>s : Rectangle +>width : number +>s.height : number +>s : Rectangle +>height : number + + case "circle": return Math.PI * s.radius * s.radius; +>"circle" : "circle" +>Math.PI * s.radius * s.radius : number +>Math.PI * s.radius : number +>Math.PI : number +>Math : Math +>PI : number +>s.radius : number +>s : Circle +>radius : number +>s.radius : number +>s : Circle +>radius : number + + case "triangle": return Math.sqrt(3) / 4 * s.side * s.side; +>"triangle" : "triangle" +>Math.sqrt(3) / 4 * s.side * s.side : number +>Math.sqrt(3) / 4 * s.side : number +>Math.sqrt(3) / 4 : number +>Math.sqrt(3) : number +>Math.sqrt : (x: number) => number +>Math : Math +>sqrt : (x: number) => number +>3 : 3 +>4 : 4 +>s.side : number +>s : Triangle +>side : number +>s.side : number +>s : Triangle +>side : number + } + })(); + return area; +>area : number +} + +// Repro from #13241 + +enum MyEnum { +>MyEnum : MyEnum + + A, +>A : MyEnum.A + + B +>B : MyEnum.B +} + +function thisGivesError(e: MyEnum): string { +>thisGivesError : (e: MyEnum) => string +>e : MyEnum + + let s: string; +>s : string + + switch (e) { +>e : MyEnum + + case MyEnum.A: s = "it was A"; break; +>MyEnum.A : MyEnum.A +>MyEnum : typeof MyEnum +>A : MyEnum.A +>s = "it was A" : "it was A" +>s : string +>"it was A" : "it was A" + + case MyEnum.B: s = "it was B"; break; +>MyEnum.B : MyEnum.B +>MyEnum : typeof MyEnum +>B : MyEnum.B +>s = "it was B" : "it was B" +>s : string +>"it was B" : "it was B" + } + return s; +>s : string +} + +function good1(e: MyEnum): string { +>good1 : (e: MyEnum) => string +>e : MyEnum + + let s: string; +>s : string + + switch (e) { +>e : MyEnum + + case MyEnum.A: s = "it was A"; break; +>MyEnum.A : MyEnum.A +>MyEnum : typeof MyEnum +>A : MyEnum.A +>s = "it was A" : "it was A" +>s : string +>"it was A" : "it was A" + + case MyEnum.B: s = "it was B"; break; +>MyEnum.B : MyEnum.B +>MyEnum : typeof MyEnum +>B : MyEnum.B +>s = "it was B" : "it was B" +>s : string +>"it was B" : "it was B" + + default: s = "it was something else"; break; +>s = "it was something else" : "it was something else" +>s : string +>"it was something else" : "it was something else" + } + return s; +>s : string +} + +function good2(e: MyEnum): string { +>good2 : (e: MyEnum) => string +>e : MyEnum + + switch (e) { +>e : MyEnum + + case MyEnum.A: return "it was A"; +>MyEnum.A : MyEnum.A +>MyEnum : typeof MyEnum +>A : MyEnum.A +>"it was A" : "it was A" + + case MyEnum.B: return "it was B"; +>MyEnum.B : MyEnum.B +>MyEnum : typeof MyEnum +>B : MyEnum.B +>"it was B" : "it was B" + } +} + +// Repro from #18362 + +enum Level { +>Level : Level + + One, +>One : Level.One + + Two, +>Two : Level.Two +} + +const doSomethingWithLevel = (level: Level) => { +>doSomethingWithLevel : (level: Level) => Level +>(level: Level) => { let next: Level; switch (level) { case Level.One: next = Level.Two; break; case Level.Two: next = Level.One; break; } return next;} : (level: Level) => Level +>level : Level + + let next: Level; +>next : Level + + switch (level) { +>level : Level + + case Level.One: +>Level.One : Level.One +>Level : typeof Level +>One : Level.One + + next = Level.Two; +>next = Level.Two : Level.Two +>next : Level +>Level.Two : Level.Two +>Level : typeof Level +>Two : Level.Two + + break; + case Level.Two: +>Level.Two : Level.Two +>Level : typeof Level +>Two : Level.Two + + next = Level.One; +>next = Level.One : Level.One +>next : Level +>Level.One : Level.One +>Level : typeof Level +>One : Level.One + + break; + } + return next; +>next : Level + +}; + +// Repro from #20409 + +interface Square2 { + kind: "square"; +>kind : "square" + + size: number; +>size : number +} + +interface Circle2 { + kind: "circle"; +>kind : "circle" + + radius: number; +>radius : number +} + +type Shape2 = Square2 | Circle2; +>Shape2 : Shape2 + +function withDefault(s1: Shape2, s2: Shape2): string { +>withDefault : (s1: Shape2, s2: Shape2) => string +>s1 : Shape2 +>s2 : Shape2 + + switch (s1.kind) { +>s1.kind : "square" | "circle" +>s1 : Shape2 +>kind : "square" | "circle" + + case "square": +>"square" : "square" + + return "1"; +>"1" : "1" + + case "circle": +>"circle" : "circle" + + switch (s2.kind) { +>s2.kind : "square" | "circle" +>s2 : Shape2 +>kind : "square" | "circle" + + case "square": +>"square" : "square" + + return "2"; +>"2" : "2" + + case "circle": +>"circle" : "circle" + + return "3"; +>"3" : "3" + + default: + return "never"; +>"never" : "never" + } + } +} + +function withoutDefault(s1: Shape2, s2: Shape2): string { +>withoutDefault : (s1: Shape2, s2: Shape2) => string +>s1 : Shape2 +>s2 : Shape2 + + switch (s1.kind) { +>s1.kind : "square" | "circle" +>s1 : Shape2 +>kind : "square" | "circle" + + case "square": +>"square" : "square" + + return "1"; +>"1" : "1" + + case "circle": +>"circle" : "circle" + + switch (s2.kind) { +>s2.kind : "square" | "circle" +>s2 : Shape2 +>kind : "square" | "circle" + + case "square": +>"square" : "square" + + return "2"; +>"2" : "2" + + case "circle": +>"circle" : "circle" + + return "3"; +>"3" : "3" + } + } +} + +// Repro from #20823 + +function test4(value: 1 | 2) { +>test4 : (value: 1 | 2) => string +>value : 1 | 2 + + let x: string; +>x : string + + switch (value) { +>value : 1 | 2 + + case 1: x = "one"; break; +>1 : 1 +>x = "one" : "one" +>x : string +>"one" : "one" + + case 2: x = "two"; break; +>2 : 2 +>x = "two" : "two" +>x : string +>"two" : "two" + } + return x; +>x : string +} + diff --git a/tests/baselines/reference/extendAndImplementTheSameBaseType2.errors.txt b/tests/baselines/reference/extendAndImplementTheSameBaseType2.errors.txt index 799fc7bb8b0d5..e23d9ebd282f5 100644 --- a/tests/baselines/reference/extendAndImplementTheSameBaseType2.errors.txt +++ b/tests/baselines/reference/extendAndImplementTheSameBaseType2.errors.txt @@ -1,7 +1,6 @@ tests/cases/compiler/extendAndImplementTheSameBaseType2.ts(7,7): error TS2720: Class 'D' incorrectly implements class 'C'. Did you mean to extend 'C' and inherit its members as a subclass? - Types of property 'bar' are incompatible. - Type '() => string' is not assignable to type '() => number'. - Type 'string' is not assignable to type 'number'. + The types returned by 'bar()' are incompatible between these types. + Type 'string' is not assignable to type 'number'. tests/cases/compiler/extendAndImplementTheSameBaseType2.ts(12,5): error TS2322: Type 'number' is not assignable to type 'string'. tests/cases/compiler/extendAndImplementTheSameBaseType2.ts(16,5): error TS2322: Type 'string' is not assignable to type 'number'. @@ -16,9 +15,8 @@ tests/cases/compiler/extendAndImplementTheSameBaseType2.ts(16,5): error TS2322: class D extends C implements C { ~ !!! error TS2720: Class 'D' incorrectly implements class 'C'. Did you mean to extend 'C' and inherit its members as a subclass? -!!! error TS2720: Types of property 'bar' are incompatible. -!!! error TS2720: Type '() => string' is not assignable to type '() => number'. -!!! error TS2720: Type 'string' is not assignable to type 'number'. +!!! error TS2720: The types returned by 'bar()' are incompatible between these types. +!!! error TS2720: Type 'string' is not assignable to type 'number'. baz() { } } diff --git a/tests/baselines/reference/extractConstant/extractConstant_ContextualType_Lambda.ts b/tests/baselines/reference/extractConstant/extractConstant_ContextualType_Lambda.ts index d5a5a55bc2723..fae0a6812cdcb 100644 --- a/tests/baselines/reference/extractConstant/extractConstant_ContextualType_Lambda.ts +++ b/tests/baselines/reference/extractConstant/extractConstant_ContextualType_Lambda.ts @@ -5,7 +5,7 @@ const myObj: { member(x: number, y: string): void } = { } // ==SCOPE::Extract to constant in enclosing scope== -const newLocal: (x: number, y: string) => void = (x, y) => x + y; +const newLocal = (x: number, y: string): string => x + y; const myObj: { member(x: number, y: string): void } = { member: /*RENAME*/newLocal, } diff --git a/tests/baselines/reference/for-of39.errors.txt b/tests/baselines/reference/for-of39.errors.txt index a36c1c28a8ca6..3ecdc46bcfc49 100644 --- a/tests/baselines/reference/for-of39.errors.txt +++ b/tests/baselines/reference/for-of39.errors.txt @@ -1,18 +1,14 @@ tests/cases/conformance/es6/for-ofStatements/for-of39.ts(1,11): error TS2769: No overload matches this call. Overload 1 of 3, '(iterable: Iterable): Map', gave the following error. Argument of type '([string, number] | [string, true])[]' is not assignable to parameter of type 'Iterable'. - Types of property '[Symbol.iterator]' are incompatible. - Type '() => IterableIterator<[string, number] | [string, true]>' is not assignable to type '() => Iterator'. - Type 'IterableIterator<[string, number] | [string, true]>' is not assignable to type 'Iterator'. - Types of property 'next' are incompatible. - Type '(...args: [] | [undefined]) => IteratorResult<[string, number] | [string, true], any>' is not assignable to type '(...args: [] | [undefined]) => IteratorResult'. - Type 'IteratorResult<[string, number] | [string, true], any>' is not assignable to type 'IteratorResult'. - Type 'IteratorYieldResult<[string, number] | [string, true]>' is not assignable to type 'IteratorResult'. - Type 'IteratorYieldResult<[string, number] | [string, true]>' is not assignable to type 'IteratorYieldResult'. - Type '[string, number] | [string, true]' is not assignable to type 'readonly [string, boolean]'. - Type '[string, number]' is not assignable to type 'readonly [string, boolean]'. - Types of property '1' are incompatible. - Type 'number' is not assignable to type 'boolean'. + The types returned by '[Symbol.iterator]().next(...)' are incompatible between these types. + Type 'IteratorResult<[string, number] | [string, true], any>' is not assignable to type 'IteratorResult'. + Type 'IteratorYieldResult<[string, number] | [string, true]>' is not assignable to type 'IteratorResult'. + Type 'IteratorYieldResult<[string, number] | [string, true]>' is not assignable to type 'IteratorYieldResult'. + Type '[string, number] | [string, true]' is not assignable to type 'readonly [string, boolean]'. + Type '[string, number]' is not assignable to type 'readonly [string, boolean]'. + Types of property '1' are incompatible. + Type 'number' is not assignable to type 'boolean'. Overload 2 of 3, '(entries?: readonly (readonly [string, boolean])[]): Map', gave the following error. Type 'number' is not assignable to type 'boolean'. @@ -23,18 +19,14 @@ tests/cases/conformance/es6/for-ofStatements/for-of39.ts(1,11): error TS2769: No !!! error TS2769: No overload matches this call. !!! error TS2769: Overload 1 of 3, '(iterable: Iterable): Map', gave the following error. !!! error TS2769: Argument of type '([string, number] | [string, true])[]' is not assignable to parameter of type 'Iterable'. -!!! error TS2769: Types of property '[Symbol.iterator]' are incompatible. -!!! error TS2769: Type '() => IterableIterator<[string, number] | [string, true]>' is not assignable to type '() => Iterator'. -!!! error TS2769: Type 'IterableIterator<[string, number] | [string, true]>' is not assignable to type 'Iterator'. -!!! error TS2769: Types of property 'next' are incompatible. -!!! error TS2769: Type '(...args: [] | [undefined]) => IteratorResult<[string, number] | [string, true], any>' is not assignable to type '(...args: [] | [undefined]) => IteratorResult'. -!!! error TS2769: Type 'IteratorResult<[string, number] | [string, true], any>' is not assignable to type 'IteratorResult'. -!!! error TS2769: Type 'IteratorYieldResult<[string, number] | [string, true]>' is not assignable to type 'IteratorResult'. -!!! error TS2769: Type 'IteratorYieldResult<[string, number] | [string, true]>' is not assignable to type 'IteratorYieldResult'. -!!! error TS2769: Type '[string, number] | [string, true]' is not assignable to type 'readonly [string, boolean]'. -!!! error TS2769: Type '[string, number]' is not assignable to type 'readonly [string, boolean]'. -!!! error TS2769: Types of property '1' are incompatible. -!!! error TS2769: Type 'number' is not assignable to type 'boolean'. +!!! error TS2769: The types returned by '[Symbol.iterator]().next(...)' are incompatible between these types. +!!! error TS2769: Type 'IteratorResult<[string, number] | [string, true], any>' is not assignable to type 'IteratorResult'. +!!! error TS2769: Type 'IteratorYieldResult<[string, number] | [string, true]>' is not assignable to type 'IteratorResult'. +!!! error TS2769: Type 'IteratorYieldResult<[string, number] | [string, true]>' is not assignable to type 'IteratorYieldResult'. +!!! error TS2769: Type '[string, number] | [string, true]' is not assignable to type 'readonly [string, boolean]'. +!!! error TS2769: Type '[string, number]' is not assignable to type 'readonly [string, boolean]'. +!!! error TS2769: Types of property '1' are incompatible. +!!! error TS2769: Type 'number' is not assignable to type 'boolean'. !!! error TS2769: Overload 2 of 3, '(entries?: readonly (readonly [string, boolean])[]): Map', gave the following error. !!! error TS2769: Type 'number' is not assignable to type 'boolean'. for (var [k, v] of map) { diff --git a/tests/baselines/reference/functionConstraintSatisfaction2.types b/tests/baselines/reference/functionConstraintSatisfaction2.types index f5a7eb0fd65ae..f0a0f3b61f221 100644 --- a/tests/baselines/reference/functionConstraintSatisfaction2.types +++ b/tests/baselines/reference/functionConstraintSatisfaction2.types @@ -79,8 +79,8 @@ var r7 = foo2(b); >b : new (x: string) => string var r8 = foo2((x: U) => x); // no error expected ->r8 : (x: string) => string ->foo2((x: U) => x) : (x: string) => string +>r8 : (x: U) => U +>foo2((x: U) => x) : (x: U) => U >foo2 : string>(x: T) => T >(x: U) => x : (x: U) => U >x : U diff --git a/tests/baselines/reference/functionConstraintSatisfaction3.types b/tests/baselines/reference/functionConstraintSatisfaction3.types index 499f73b16645b..dc760608c7355 100644 --- a/tests/baselines/reference/functionConstraintSatisfaction3.types +++ b/tests/baselines/reference/functionConstraintSatisfaction3.types @@ -103,16 +103,16 @@ var c2: { (x: T): T; (x: T, y: T): T }; >y : T var r9 = foo(function (x: U) { return x; }); ->r9 : (x: string) => string ->foo(function (x: U) { return x; }) : (x: string) => string +>r9 : (x: U) => U +>foo(function (x: U) { return x; }) : (x: U) => U >foo : string>(x: T) => T >function (x: U) { return x; } : (x: U) => U >x : U >x : U var r10 = foo((x: U) => x); ->r10 : (x: string) => string ->foo((x: U) => x) : (x: string) => string +>r10 : (x: U) => U +>foo((x: U) => x) : (x: U) => U >foo : string>(x: T) => T >(x: U) => x : (x: U) => U >x : U diff --git a/tests/baselines/reference/generatorTypeCheck25.errors.txt b/tests/baselines/reference/generatorTypeCheck25.errors.txt index 365a19dfdd7a0..e37f1304963a1 100644 --- a/tests/baselines/reference/generatorTypeCheck25.errors.txt +++ b/tests/baselines/reference/generatorTypeCheck25.errors.txt @@ -1,15 +1,11 @@ tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck25.ts(4,5): error TS2322: Type '() => Generator' is not assignable to type '() => Iterable'. - Type 'Generator' is not assignable to type 'Iterable'. - Types of property '[Symbol.iterator]' are incompatible. - Type '() => Generator' is not assignable to type '() => Iterator'. - Type 'Generator' is not assignable to type 'Iterator'. - Types of property 'next' are incompatible. - Type '(...args: [] | [undefined]) => IteratorResult' is not assignable to type '(...args: [] | [undefined]) => IteratorResult'. - Type 'IteratorResult' is not assignable to type 'IteratorResult'. - Type 'IteratorYieldResult' is not assignable to type 'IteratorResult'. - Type 'IteratorYieldResult' is not assignable to type 'IteratorYieldResult'. - Type 'Bar | Baz' is not assignable to type 'Foo'. - Property 'x' is missing in type 'Baz' but required in type 'Foo'. + Call signature return types 'Generator' and 'Iterable' are incompatible. + The types returned by '[Symbol.iterator]().next(...)' are incompatible between these types. + Type 'IteratorResult' is not assignable to type 'IteratorResult'. + Type 'IteratorYieldResult' is not assignable to type 'IteratorResult'. + Type 'IteratorYieldResult' is not assignable to type 'IteratorYieldResult'. + Type 'Bar | Baz' is not assignable to type 'Foo'. + Property 'x' is missing in type 'Baz' but required in type 'Foo'. ==== tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck25.ts (1 errors) ==== @@ -19,17 +15,13 @@ tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck25.ts(4,5): error var g3: () => Iterable = function* () { ~~ !!! error TS2322: Type '() => Generator' is not assignable to type '() => Iterable'. -!!! error TS2322: Type 'Generator' is not assignable to type 'Iterable'. -!!! error TS2322: Types of property '[Symbol.iterator]' are incompatible. -!!! error TS2322: Type '() => Generator' is not assignable to type '() => Iterator'. -!!! error TS2322: Type 'Generator' is not assignable to type 'Iterator'. -!!! error TS2322: Types of property 'next' are incompatible. -!!! error TS2322: Type '(...args: [] | [undefined]) => IteratorResult' is not assignable to type '(...args: [] | [undefined]) => IteratorResult'. -!!! error TS2322: Type 'IteratorResult' is not assignable to type 'IteratorResult'. -!!! error TS2322: Type 'IteratorYieldResult' is not assignable to type 'IteratorResult'. -!!! error TS2322: Type 'IteratorYieldResult' is not assignable to type 'IteratorYieldResult'. -!!! error TS2322: Type 'Bar | Baz' is not assignable to type 'Foo'. -!!! error TS2322: Property 'x' is missing in type 'Baz' but required in type 'Foo'. +!!! error TS2322: Call signature return types 'Generator' and 'Iterable' are incompatible. +!!! error TS2322: The types returned by '[Symbol.iterator]().next(...)' are incompatible between these types. +!!! error TS2322: Type 'IteratorResult' is not assignable to type 'IteratorResult'. +!!! error TS2322: Type 'IteratorYieldResult' is not assignable to type 'IteratorResult'. +!!! error TS2322: Type 'IteratorYieldResult' is not assignable to type 'IteratorYieldResult'. +!!! error TS2322: Type 'Bar | Baz' is not assignable to type 'Foo'. +!!! error TS2322: Property 'x' is missing in type 'Baz' but required in type 'Foo'. !!! related TS2728 tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck25.ts:1:13: 'x' is declared here. yield; yield new Bar; diff --git a/tests/baselines/reference/generatorTypeCheck63.errors.txt b/tests/baselines/reference/generatorTypeCheck63.errors.txt index 60dfb089822ac..10cafbe0ced99 100644 --- a/tests/baselines/reference/generatorTypeCheck63.errors.txt +++ b/tests/baselines/reference/generatorTypeCheck63.errors.txt @@ -1,11 +1,10 @@ tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck63.ts(24,61): error TS2345: Argument of type '(state: State) => Generator' is not assignable to parameter of type '(a: State) => IterableIterator'. - Type 'Generator' is not assignable to type 'IterableIterator'. - Types of property 'next' are incompatible. - Type '(...args: [] | [undefined]) => IteratorResult' is not assignable to type '(...args: [] | [undefined]) => IteratorResult'. - Type 'IteratorResult' is not assignable to type 'IteratorResult'. - Type 'IteratorYieldResult' is not assignable to type 'IteratorResult'. - Type 'IteratorYieldResult' is not assignable to type 'IteratorYieldResult'. - Type 'number' is not assignable to type 'State'. + Call signature return types 'Generator' and 'IterableIterator' are incompatible. + The types returned by 'next(...)' are incompatible between these types. + Type 'IteratorResult' is not assignable to type 'IteratorResult'. + Type 'IteratorYieldResult' is not assignable to type 'IteratorResult'. + Type 'IteratorYieldResult' is not assignable to type 'IteratorYieldResult'. + Type 'number' is not assignable to type 'State'. ==== tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck63.ts (1 errors) ==== @@ -35,13 +34,12 @@ tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck63.ts(24,61): err export const Nothing: Strategy = strategy("Nothing", function* (state: State) { ~~~~~~~~ !!! error TS2345: Argument of type '(state: State) => Generator' is not assignable to parameter of type '(a: State) => IterableIterator'. -!!! error TS2345: Type 'Generator' is not assignable to type 'IterableIterator'. -!!! error TS2345: Types of property 'next' are incompatible. -!!! error TS2345: Type '(...args: [] | [undefined]) => IteratorResult' is not assignable to type '(...args: [] | [undefined]) => IteratorResult'. -!!! error TS2345: Type 'IteratorResult' is not assignable to type 'IteratorResult'. -!!! error TS2345: Type 'IteratorYieldResult' is not assignable to type 'IteratorResult'. -!!! error TS2345: Type 'IteratorYieldResult' is not assignable to type 'IteratorYieldResult'. -!!! error TS2345: Type 'number' is not assignable to type 'State'. +!!! error TS2345: Call signature return types 'Generator' and 'IterableIterator' are incompatible. +!!! error TS2345: The types returned by 'next(...)' are incompatible between these types. +!!! error TS2345: Type 'IteratorResult' is not assignable to type 'IteratorResult'. +!!! error TS2345: Type 'IteratorYieldResult' is not assignable to type 'IteratorResult'. +!!! error TS2345: Type 'IteratorYieldResult' is not assignable to type 'IteratorYieldResult'. +!!! error TS2345: Type 'number' is not assignable to type 'State'. yield 1; return state; }); diff --git a/tests/baselines/reference/generatorTypeCheck8.errors.txt b/tests/baselines/reference/generatorTypeCheck8.errors.txt index 6261d419dddd8..ca0b1e303667b 100644 --- a/tests/baselines/reference/generatorTypeCheck8.errors.txt +++ b/tests/baselines/reference/generatorTypeCheck8.errors.txt @@ -1,10 +1,9 @@ tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck8.ts(2,17): error TS2322: Type 'Generator' is not assignable to type 'BadGenerator'. - Types of property 'next' are incompatible. - Type '(...args: [] | [undefined]) => IteratorResult' is not assignable to type '(...args: [] | [undefined]) => IteratorResult'. - Type 'IteratorResult' is not assignable to type 'IteratorResult'. - Type 'IteratorYieldResult' is not assignable to type 'IteratorResult'. - Type 'IteratorYieldResult' is not assignable to type 'IteratorYieldResult'. - Type 'string' is not assignable to type 'number'. + The types returned by 'next(...)' are incompatible between these types. + Type 'IteratorResult' is not assignable to type 'IteratorResult'. + Type 'IteratorYieldResult' is not assignable to type 'IteratorResult'. + Type 'IteratorYieldResult' is not assignable to type 'IteratorYieldResult'. + Type 'string' is not assignable to type 'number'. ==== tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck8.ts (1 errors) ==== @@ -12,9 +11,8 @@ tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck8.ts(2,17): error function* g3(): BadGenerator { } ~~~~~~~~~~~~ !!! error TS2322: Type 'Generator' is not assignable to type 'BadGenerator'. -!!! error TS2322: Types of property 'next' are incompatible. -!!! error TS2322: Type '(...args: [] | [undefined]) => IteratorResult' is not assignable to type '(...args: [] | [undefined]) => IteratorResult'. -!!! error TS2322: Type 'IteratorResult' is not assignable to type 'IteratorResult'. -!!! error TS2322: Type 'IteratorYieldResult' is not assignable to type 'IteratorResult'. -!!! error TS2322: Type 'IteratorYieldResult' is not assignable to type 'IteratorYieldResult'. -!!! error TS2322: Type 'string' is not assignable to type 'number'. \ No newline at end of file +!!! error TS2322: The types returned by 'next(...)' are incompatible between these types. +!!! error TS2322: Type 'IteratorResult' is not assignable to type 'IteratorResult'. +!!! error TS2322: Type 'IteratorYieldResult' is not assignable to type 'IteratorResult'. +!!! error TS2322: Type 'IteratorYieldResult' is not assignable to type 'IteratorYieldResult'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/generics4.errors.txt b/tests/baselines/reference/generics4.errors.txt index 06bfa122901d6..6181685983ed2 100644 --- a/tests/baselines/reference/generics4.errors.txt +++ b/tests/baselines/reference/generics4.errors.txt @@ -1,8 +1,7 @@ tests/cases/compiler/generics4.ts(7,1): error TS2322: Type 'C' is not assignable to type 'C'. Type 'Y' is not assignable to type 'X'. - Types of property 'f' are incompatible. - Type '() => boolean' is not assignable to type '() => string'. - Type 'boolean' is not assignable to type 'string'. + The types returned by 'f()' are incompatible between these types. + Type 'boolean' is not assignable to type 'string'. ==== tests/cases/compiler/generics4.ts (1 errors) ==== @@ -16,6 +15,5 @@ tests/cases/compiler/generics4.ts(7,1): error TS2322: Type 'C' is not assigna ~ !!! error TS2322: Type 'C' is not assignable to type 'C'. !!! error TS2322: Type 'Y' is not assignable to type 'X'. -!!! error TS2322: Types of property 'f' are incompatible. -!!! error TS2322: Type '() => boolean' is not assignable to type '() => string'. -!!! error TS2322: Type 'boolean' is not assignable to type 'string'. \ No newline at end of file +!!! error TS2322: The types returned by 'f()' are incompatible between these types. +!!! error TS2322: Type 'boolean' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/incompatibleTypes.errors.txt b/tests/baselines/reference/incompatibleTypes.errors.txt index 0b5e587ad53b6..66d94bea79ce8 100644 --- a/tests/baselines/reference/incompatibleTypes.errors.txt +++ b/tests/baselines/reference/incompatibleTypes.errors.txt @@ -12,14 +12,12 @@ tests/cases/compiler/incompatibleTypes.ts(34,12): error TS2416: Property 'p1' in tests/cases/compiler/incompatibleTypes.ts(42,5): error TS2769: No overload matches this call. Overload 1 of 2, '(i: IFoo1): void', gave the following error. Argument of type 'C1' is not assignable to parameter of type 'IFoo1'. - Types of property 'p1' are incompatible. - Type '() => string' is not assignable to type '() => number'. - Type 'string' is not assignable to type 'number'. + The types returned by 'p1()' are incompatible between these types. + Type 'string' is not assignable to type 'number'. Overload 2 of 2, '(i: IFoo2): void', gave the following error. Argument of type 'C1' is not assignable to parameter of type 'IFoo2'. - Types of property 'p1' are incompatible. - Type '() => string' is not assignable to type '(s: string) => number'. - Type 'string' is not assignable to type 'number'. + The types returned by 'p1(...)' are incompatible between these types. + Type 'string' is not assignable to type 'number'. tests/cases/compiler/incompatibleTypes.ts(49,7): error TS2769: No overload matches this call. Overload 1 of 2, '(n: { a: { a: string; }; b: string; }): number', gave the following error. Argument of type '{ e: number; f: number; }' is not assignable to parameter of type '{ a: { a: string; }; b: string; }'. @@ -95,14 +93,12 @@ tests/cases/compiler/incompatibleTypes.ts(74,5): error TS2322: Type '(a: any) => !!! error TS2769: No overload matches this call. !!! error TS2769: Overload 1 of 2, '(i: IFoo1): void', gave the following error. !!! error TS2769: Argument of type 'C1' is not assignable to parameter of type 'IFoo1'. -!!! error TS2769: Types of property 'p1' are incompatible. -!!! error TS2769: Type '() => string' is not assignable to type '() => number'. -!!! error TS2769: Type 'string' is not assignable to type 'number'. +!!! error TS2769: The types returned by 'p1()' are incompatible between these types. +!!! error TS2769: Type 'string' is not assignable to type 'number'. !!! error TS2769: Overload 2 of 2, '(i: IFoo2): void', gave the following error. !!! error TS2769: Argument of type 'C1' is not assignable to parameter of type 'IFoo2'. -!!! error TS2769: Types of property 'p1' are incompatible. -!!! error TS2769: Type '() => string' is not assignable to type '(s: string) => number'. -!!! error TS2769: Type 'string' is not assignable to type 'number'. +!!! error TS2769: The types returned by 'p1(...)' are incompatible between these types. +!!! error TS2769: Type 'string' is not assignable to type 'number'. function of1(n: { a: { a: string; }; b: string; }): number; diff --git a/tests/baselines/reference/inferFromGenericFunctionReturnTypes3.types b/tests/baselines/reference/inferFromGenericFunctionReturnTypes3.types index 4c56070fd3cba..f9192dd11baad 100644 --- a/tests/baselines/reference/inferFromGenericFunctionReturnTypes3.types +++ b/tests/baselines/reference/inferFromGenericFunctionReturnTypes3.types @@ -413,9 +413,9 @@ const f1: F = () => { return Promise.all([ >Promise.all([ { name: "David Gomes", age: 23, position: "GOALKEEPER", }, { name: "Cristiano Ronaldo", age: 33, position: "STRIKER", } ]) : Promise<[{ name: string; age: number; position: "GOALKEEPER"; }, { name: string; age: number; position: "STRIKER"; }]> ->Promise.all : { (values: Iterable>): Promise; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike, T10 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike]): Promise<[T1, T2, T3, T4, T5]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike]): Promise<[T1, T2, T3, T4]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise<[T1, T2, T3]>; (values: [T1 | PromiseLike, T2 | PromiseLike]): Promise<[T1, T2]>; (values: (T | PromiseLike)[]): Promise; } +>Promise.all : { (values: Iterable>): Promise; (values: readonly [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike, T10 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>; (values: readonly [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; (values: readonly [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>; (values: readonly [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; (values: readonly [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6]>; (values: readonly [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike]): Promise<[T1, T2, T3, T4, T5]>; (values: readonly [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike]): Promise<[T1, T2, T3, T4]>; (values: readonly [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise<[T1, T2, T3]>; (values: readonly [T1 | PromiseLike, T2 | PromiseLike]): Promise<[T1, T2]>; (values: readonly (T | PromiseLike)[]): Promise; } >Promise : PromiseConstructor ->all : { (values: Iterable>): Promise; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike, T10 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike]): Promise<[T1, T2, T3, T4, T5]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike]): Promise<[T1, T2, T3, T4]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise<[T1, T2, T3]>; (values: [T1 | PromiseLike, T2 | PromiseLike]): Promise<[T1, T2]>; (values: (T | PromiseLike)[]): Promise; } +>all : { (values: Iterable>): Promise; (values: readonly [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike, T10 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>; (values: readonly [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; (values: readonly [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>; (values: readonly [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; (values: readonly [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6]>; (values: readonly [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike]): Promise<[T1, T2, T3, T4, T5]>; (values: readonly [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike]): Promise<[T1, T2, T3, T4]>; (values: readonly [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise<[T1, T2, T3]>; (values: readonly [T1 | PromiseLike, T2 | PromiseLike]): Promise<[T1, T2]>; (values: readonly (T | PromiseLike)[]): Promise; } >[ { name: "David Gomes", age: 23, position: "GOALKEEPER", }, { name: "Cristiano Ronaldo", age: 33, position: "STRIKER", } ] : [{ name: string; age: number; position: "GOALKEEPER"; }, { name: string; age: number; position: "STRIKER"; }] { >{ name: "David Gomes", age: 23, position: "GOALKEEPER", } : { name: string; age: number; position: "GOALKEEPER"; } diff --git a/tests/baselines/reference/inferenceLimit.types b/tests/baselines/reference/inferenceLimit.types index 6aa7ab501ea16..fc2836e6dea9c 100644 --- a/tests/baselines/reference/inferenceLimit.types +++ b/tests/baselines/reference/inferenceLimit.types @@ -76,9 +76,9 @@ export class BrokenClass { >Promise.all(result.map(populateItems)) .then((orders: Array) => { resolve(orders); }) : Promise >Promise.all(result.map(populateItems)) .then : (onfulfilled?: (value: unknown[]) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >Promise.all(result.map(populateItems)) : Promise ->Promise.all : { (values: Iterable>): Promise; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike, T10 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike]): Promise<[T1, T2, T3, T4, T5]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike]): Promise<[T1, T2, T3, T4]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise<[T1, T2, T3]>; (values: [T1 | PromiseLike, T2 | PromiseLike]): Promise<[T1, T2]>; (values: (T | PromiseLike)[]): Promise; } +>Promise.all : { (values: Iterable>): Promise; (values: readonly [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike, T10 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>; (values: readonly [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; (values: readonly [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>; (values: readonly [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; (values: readonly [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6]>; (values: readonly [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike]): Promise<[T1, T2, T3, T4, T5]>; (values: readonly [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike]): Promise<[T1, T2, T3, T4]>; (values: readonly [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise<[T1, T2, T3]>; (values: readonly [T1 | PromiseLike, T2 | PromiseLike]): Promise<[T1, T2]>; (values: readonly (T | PromiseLike)[]): Promise; } >Promise : PromiseConstructor ->all : { (values: Iterable>): Promise; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike, T10 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike]): Promise<[T1, T2, T3, T4, T5]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike]): Promise<[T1, T2, T3, T4]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise<[T1, T2, T3]>; (values: [T1 | PromiseLike, T2 | PromiseLike]): Promise<[T1, T2]>; (values: (T | PromiseLike)[]): Promise; } +>all : { (values: Iterable>): Promise; (values: readonly [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike, T10 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>; (values: readonly [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; (values: readonly [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>; (values: readonly [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; (values: readonly [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6]>; (values: readonly [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike]): Promise<[T1, T2, T3, T4, T5]>; (values: readonly [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike]): Promise<[T1, T2, T3, T4]>; (values: readonly [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise<[T1, T2, T3]>; (values: readonly [T1 | PromiseLike, T2 | PromiseLike]): Promise<[T1, T2]>; (values: readonly (T | PromiseLike)[]): Promise; } >result.map(populateItems) : Promise[] >result.map : (callbackfn: (value: MyModule.MyModel, index: number, array: MyModule.MyModel[]) => U, thisArg?: any) => U[] >result : MyModule.MyModel[] diff --git a/tests/baselines/reference/inheritedModuleMembersForClodule.errors.txt b/tests/baselines/reference/inheritedModuleMembersForClodule.errors.txt index 0b7e00d95cea3..e2b744d5a25ee 100644 --- a/tests/baselines/reference/inheritedModuleMembersForClodule.errors.txt +++ b/tests/baselines/reference/inheritedModuleMembersForClodule.errors.txt @@ -1,7 +1,6 @@ tests/cases/compiler/inheritedModuleMembersForClodule.ts(7,7): error TS2417: Class static side 'typeof D' incorrectly extends base class static side 'typeof C'. - Types of property 'foo' are incompatible. - Type '() => number' is not assignable to type '() => string'. - Type 'number' is not assignable to type 'string'. + The types returned by 'foo()' are incompatible between these types. + Type 'number' is not assignable to type 'string'. ==== tests/cases/compiler/inheritedModuleMembersForClodule.ts (1 errors) ==== @@ -14,9 +13,8 @@ tests/cases/compiler/inheritedModuleMembersForClodule.ts(7,7): error TS2417: Cla class D extends C { ~ !!! error TS2417: Class static side 'typeof D' incorrectly extends base class static side 'typeof C'. -!!! error TS2417: Types of property 'foo' are incompatible. -!!! error TS2417: Type '() => number' is not assignable to type '() => string'. -!!! error TS2417: Type 'number' is not assignable to type 'string'. +!!! error TS2417: The types returned by 'foo()' are incompatible between these types. +!!! error TS2417: Type 'number' is not assignable to type 'string'. } module D { diff --git a/tests/baselines/reference/interfaceMergedUnconstrainedNoErrorIrrespectiveOfOrder.js b/tests/baselines/reference/interfaceMergedUnconstrainedNoErrorIrrespectiveOfOrder.js new file mode 100644 index 0000000000000..a42411866397b --- /dev/null +++ b/tests/baselines/reference/interfaceMergedUnconstrainedNoErrorIrrespectiveOfOrder.js @@ -0,0 +1,28 @@ +//// [tests/cases/compiler/interfaceMergedUnconstrainedNoErrorIrrespectiveOfOrder.ts] //// + +//// [working.ts] +// minmal samples from #33395 +export namespace ns { + interface Function any> { + throttle(): Function; + } + interface Function { + unary(): Function<() => ReturnType>; + } +} +//// [regression.ts] +export namespace ns { + interface Function { + unary(): Function<() => ReturnType>; + } + interface Function any> { + throttle(): Function; + } +} + +//// [working.js] +"use strict"; +exports.__esModule = true; +//// [regression.js] +"use strict"; +exports.__esModule = true; diff --git a/tests/baselines/reference/interfaceMergedUnconstrainedNoErrorIrrespectiveOfOrder.symbols b/tests/baselines/reference/interfaceMergedUnconstrainedNoErrorIrrespectiveOfOrder.symbols new file mode 100644 index 0000000000000..5dc01da7c4877 --- /dev/null +++ b/tests/baselines/reference/interfaceMergedUnconstrainedNoErrorIrrespectiveOfOrder.symbols @@ -0,0 +1,51 @@ +=== tests/cases/compiler/working.ts === +// minmal samples from #33395 +export namespace ns { +>ns : Symbol(ns, Decl(working.ts, 0, 0)) + + interface Function any> { +>Function : Symbol(Function, Decl(working.ts, 1, 21), Decl(working.ts, 4, 5)) +>T : Symbol(T, Decl(working.ts, 2, 23), Decl(working.ts, 5, 23)) +>args : Symbol(args, Decl(working.ts, 2, 34)) + + throttle(): Function; +>throttle : Symbol(Function.throttle, Decl(working.ts, 2, 57)) +>Function : Symbol(Function, Decl(working.ts, 1, 21), Decl(working.ts, 4, 5)) +>T : Symbol(T, Decl(working.ts, 2, 23), Decl(working.ts, 5, 23)) + } + interface Function { +>Function : Symbol(Function, Decl(working.ts, 1, 21), Decl(working.ts, 4, 5)) +>T : Symbol(T, Decl(working.ts, 2, 23), Decl(working.ts, 5, 23)) + + unary(): Function<() => ReturnType>; +>unary : Symbol(Function.unary, Decl(working.ts, 5, 27)) +>Function : Symbol(Function, Decl(working.ts, 1, 21), Decl(working.ts, 4, 5)) +>ReturnType : Symbol(ReturnType, Decl(lib.es5.d.ts, --, --)) +>T : Symbol(T, Decl(working.ts, 2, 23), Decl(working.ts, 5, 23)) + } +} +=== tests/cases/compiler/regression.ts === +export namespace ns { +>ns : Symbol(ns, Decl(regression.ts, 0, 0)) + + interface Function { +>Function : Symbol(Function, Decl(regression.ts, 0, 21), Decl(regression.ts, 3, 5)) +>T : Symbol(T, Decl(regression.ts, 1, 23), Decl(regression.ts, 4, 23)) + + unary(): Function<() => ReturnType>; +>unary : Symbol(Function.unary, Decl(regression.ts, 1, 27)) +>Function : Symbol(Function, Decl(regression.ts, 0, 21), Decl(regression.ts, 3, 5)) +>ReturnType : Symbol(ReturnType, Decl(lib.es5.d.ts, --, --)) +>T : Symbol(T, Decl(regression.ts, 1, 23), Decl(regression.ts, 4, 23)) + } + interface Function any> { +>Function : Symbol(Function, Decl(regression.ts, 0, 21), Decl(regression.ts, 3, 5)) +>T : Symbol(T, Decl(regression.ts, 1, 23), Decl(regression.ts, 4, 23)) +>args : Symbol(args, Decl(regression.ts, 4, 34)) + + throttle(): Function; +>throttle : Symbol(Function.throttle, Decl(regression.ts, 4, 57)) +>Function : Symbol(Function, Decl(regression.ts, 0, 21), Decl(regression.ts, 3, 5)) +>T : Symbol(T, Decl(regression.ts, 1, 23), Decl(regression.ts, 4, 23)) + } +} diff --git a/tests/baselines/reference/interfaceMergedUnconstrainedNoErrorIrrespectiveOfOrder.types b/tests/baselines/reference/interfaceMergedUnconstrainedNoErrorIrrespectiveOfOrder.types new file mode 100644 index 0000000000000..e42e438c98321 --- /dev/null +++ b/tests/baselines/reference/interfaceMergedUnconstrainedNoErrorIrrespectiveOfOrder.types @@ -0,0 +1,27 @@ +=== tests/cases/compiler/working.ts === +// minmal samples from #33395 +export namespace ns { + interface Function any> { +>args : any + + throttle(): Function; +>throttle : () => Function + } + interface Function { + unary(): Function<() => ReturnType>; +>unary : () => Function<() => ReturnType> + } +} +=== tests/cases/compiler/regression.ts === +export namespace ns { + interface Function { + unary(): Function<() => ReturnType>; +>unary : () => Function<() => ReturnType> + } + interface Function any> { +>args : any + + throttle(): Function; +>throttle : () => Function + } +} diff --git a/tests/baselines/reference/interfaceThatHidesBaseProperty2.errors.txt b/tests/baselines/reference/interfaceThatHidesBaseProperty2.errors.txt index f66e13c0d9d00..779a160c5a691 100644 --- a/tests/baselines/reference/interfaceThatHidesBaseProperty2.errors.txt +++ b/tests/baselines/reference/interfaceThatHidesBaseProperty2.errors.txt @@ -1,8 +1,6 @@ tests/cases/conformance/interfaces/interfaceDeclarations/interfaceThatHidesBaseProperty2.ts(5,11): error TS2430: Interface 'Derived' incorrectly extends interface 'Base'. - Types of property 'x' are incompatible. - Type '{ a: string; }' is not assignable to type '{ a: number; }'. - Types of property 'a' are incompatible. - Type 'string' is not assignable to type 'number'. + The types of 'x.a' are incompatible between these types. + Type 'string' is not assignable to type 'number'. ==== tests/cases/conformance/interfaces/interfaceDeclarations/interfaceThatHidesBaseProperty2.ts (1 errors) ==== @@ -13,10 +11,8 @@ tests/cases/conformance/interfaces/interfaceDeclarations/interfaceThatHidesBaseP interface Derived extends Base { // error ~~~~~~~ !!! error TS2430: Interface 'Derived' incorrectly extends interface 'Base'. -!!! error TS2430: Types of property 'x' are incompatible. -!!! error TS2430: Type '{ a: string; }' is not assignable to type '{ a: number; }'. -!!! error TS2430: Types of property 'a' are incompatible. -!!! error TS2430: Type 'string' is not assignable to type 'number'. +!!! error TS2430: The types of 'x.a' are incompatible between these types. +!!! error TS2430: Type 'string' is not assignable to type 'number'. x: { a: string; }; diff --git a/tests/baselines/reference/interfaceWithMultipleBaseTypes.errors.txt b/tests/baselines/reference/interfaceWithMultipleBaseTypes.errors.txt index 138f3d9209650..c885a7859d4b2 100644 --- a/tests/baselines/reference/interfaceWithMultipleBaseTypes.errors.txt +++ b/tests/baselines/reference/interfaceWithMultipleBaseTypes.errors.txt @@ -1,20 +1,14 @@ tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithMultipleBaseTypes.ts(21,11): error TS2430: Interface 'Derived2' incorrectly extends interface 'Base2'. - Types of property 'x' are incompatible. - Type '{ a: string; b: number; }' is not assignable to type '{ b: string; }'. - Types of property 'b' are incompatible. - Type 'number' is not assignable to type 'string'. + The types of 'x.b' are incompatible between these types. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithMultipleBaseTypes.ts(52,15): error TS2320: Interface 'Derived3' cannot simultaneously extend types 'Base1' and 'Base2'. Named property 'x' of types 'Base1' and 'Base2' are not identical. tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithMultipleBaseTypes.ts(54,15): error TS2430: Interface 'Derived4' incorrectly extends interface 'Base1'. - Types of property 'x' are incompatible. - Type '{ a: T; b: T; }' is not assignable to type '{ a: number; }'. - Types of property 'a' are incompatible. - Type 'T' is not assignable to type 'number'. + The types of 'x.a' are incompatible between these types. + Type 'T' is not assignable to type 'number'. tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithMultipleBaseTypes.ts(54,15): error TS2430: Interface 'Derived4' incorrectly extends interface 'Base2'. - Types of property 'x' are incompatible. - Type '{ a: T; b: T; }' is not assignable to type '{ b: number; }'. - Types of property 'b' are incompatible. - Type 'T' is not assignable to type 'number'. + The types of 'x.b' are incompatible between these types. + Type 'T' is not assignable to type 'number'. tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithMultipleBaseTypes.ts(60,15): error TS2430: Interface 'Derived5' incorrectly extends interface 'Base1'. Types of property 'x' are incompatible. Type 'T' is not assignable to type '{ a: T; }'. @@ -47,10 +41,8 @@ tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithMultipleBa interface Derived2 extends Base1, Base2 { // error ~~~~~~~~ !!! error TS2430: Interface 'Derived2' incorrectly extends interface 'Base2'. -!!! error TS2430: Types of property 'x' are incompatible. -!!! error TS2430: Type '{ a: string; b: number; }' is not assignable to type '{ b: string; }'. -!!! error TS2430: Types of property 'b' are incompatible. -!!! error TS2430: Type 'number' is not assignable to type 'string'. +!!! error TS2430: The types of 'x.b' are incompatible between these types. +!!! error TS2430: Type 'number' is not assignable to type 'string'. x: { a: string; b: number; } @@ -89,16 +81,12 @@ tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithMultipleBa interface Derived4 extends Base1, Base2 { // error ~~~~~~~~ !!! error TS2430: Interface 'Derived4' incorrectly extends interface 'Base1'. -!!! error TS2430: Types of property 'x' are incompatible. -!!! error TS2430: Type '{ a: T; b: T; }' is not assignable to type '{ a: number; }'. -!!! error TS2430: Types of property 'a' are incompatible. -!!! error TS2430: Type 'T' is not assignable to type 'number'. +!!! error TS2430: The types of 'x.a' are incompatible between these types. +!!! error TS2430: Type 'T' is not assignable to type 'number'. ~~~~~~~~ !!! error TS2430: Interface 'Derived4' incorrectly extends interface 'Base2'. -!!! error TS2430: Types of property 'x' are incompatible. -!!! error TS2430: Type '{ a: T; b: T; }' is not assignable to type '{ b: number; }'. -!!! error TS2430: Types of property 'b' are incompatible. -!!! error TS2430: Type 'T' is not assignable to type 'number'. +!!! error TS2430: The types of 'x.b' are incompatible between these types. +!!! error TS2430: Type 'T' is not assignable to type 'number'. x: { a: T; b: T; } diff --git a/tests/baselines/reference/interfaceWithMultipleBaseTypes2.errors.txt b/tests/baselines/reference/interfaceWithMultipleBaseTypes2.errors.txt index b345923392312..9b7b2eff8ec46 100644 --- a/tests/baselines/reference/interfaceWithMultipleBaseTypes2.errors.txt +++ b/tests/baselines/reference/interfaceWithMultipleBaseTypes2.errors.txt @@ -1,8 +1,6 @@ tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithMultipleBaseTypes2.ts(17,11): error TS2430: Interface 'Derived2' incorrectly extends interface 'Base'. - Types of property 'x' are incompatible. - Type '{ a: number; b: string; }' is not assignable to type '{ a?: string; b: string; }'. - Types of property 'a' are incompatible. - Type 'number' is not assignable to type 'string'. + The types of 'x.a' are incompatible between these types. + Type 'number' is not assignable to type 'string'. ==== tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithMultipleBaseTypes2.ts (1 errors) ==== @@ -25,10 +23,8 @@ tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithMultipleBa interface Derived2 extends Base, Base2 { // error ~~~~~~~~ !!! error TS2430: Interface 'Derived2' incorrectly extends interface 'Base'. -!!! error TS2430: Types of property 'x' are incompatible. -!!! error TS2430: Type '{ a: number; b: string; }' is not assignable to type '{ a?: string; b: string; }'. -!!! error TS2430: Types of property 'a' are incompatible. -!!! error TS2430: Type 'number' is not assignable to type 'string'. +!!! error TS2430: The types of 'x.a' are incompatible between these types. +!!! error TS2430: Type 'number' is not assignable to type 'string'. x: { a: number; b: string } } diff --git a/tests/baselines/reference/intersectionWithUnionConstraint.errors.txt b/tests/baselines/reference/intersectionWithUnionConstraint.errors.txt index 97ed1cf489588..7bc436915a113 100644 --- a/tests/baselines/reference/intersectionWithUnionConstraint.errors.txt +++ b/tests/baselines/reference/intersectionWithUnionConstraint.errors.txt @@ -1,23 +1,13 @@ tests/cases/conformance/types/intersection/intersectionWithUnionConstraint.ts(7,9): error TS2322: Type 'T & U' is not assignable to type 'string | number'. - Type 'string | undefined' is not assignable to type 'string | number'. - Type 'undefined' is not assignable to type 'string | number'. - Type 'T & U' is not assignable to type 'number'. + Type 'T & U' is not assignable to type 'number'. tests/cases/conformance/types/intersection/intersectionWithUnionConstraint.ts(8,9): error TS2322: Type 'T & U' is not assignable to type 'string | null'. - Type 'string | undefined' is not assignable to type 'string | null'. - Type 'undefined' is not assignable to type 'string | null'. - Type 'T & U' is not assignable to type 'string'. + Type 'T & U' is not assignable to type 'string'. tests/cases/conformance/types/intersection/intersectionWithUnionConstraint.ts(10,9): error TS2322: Type 'T & U' is not assignable to type 'number | null'. - Type 'string | undefined' is not assignable to type 'number | null'. - Type 'undefined' is not assignable to type 'number | null'. - Type 'T & U' is not assignable to type 'number'. + Type 'T & U' is not assignable to type 'number'. tests/cases/conformance/types/intersection/intersectionWithUnionConstraint.ts(11,9): error TS2322: Type 'T & U' is not assignable to type 'number | undefined'. - Type 'string | undefined' is not assignable to type 'number | undefined'. - Type 'string' is not assignable to type 'number | undefined'. - Type 'T & U' is not assignable to type 'number'. + Type 'T & U' is not assignable to type 'number'. tests/cases/conformance/types/intersection/intersectionWithUnionConstraint.ts(12,9): error TS2322: Type 'T & U' is not assignable to type 'null | undefined'. - Type 'string | undefined' is not assignable to type 'null | undefined'. - Type 'string' is not assignable to type 'null | undefined'. - Type 'T & U' is not assignable to type 'null'. + Type 'T & U' is not assignable to type 'null'. ==== tests/cases/conformance/types/intersection/intersectionWithUnionConstraint.ts (5 errors) ==== @@ -30,34 +20,24 @@ tests/cases/conformance/types/intersection/intersectionWithUnionConstraint.ts(12 let y1: string | number = x; // Error ~~ !!! error TS2322: Type 'T & U' is not assignable to type 'string | number'. -!!! error TS2322: Type 'string | undefined' is not assignable to type 'string | number'. -!!! error TS2322: Type 'undefined' is not assignable to type 'string | number'. -!!! error TS2322: Type 'T & U' is not assignable to type 'number'. +!!! error TS2322: Type 'T & U' is not assignable to type 'number'. let y2: string | null = x; // Error ~~ !!! error TS2322: Type 'T & U' is not assignable to type 'string | null'. -!!! error TS2322: Type 'string | undefined' is not assignable to type 'string | null'. -!!! error TS2322: Type 'undefined' is not assignable to type 'string | null'. -!!! error TS2322: Type 'T & U' is not assignable to type 'string'. +!!! error TS2322: Type 'T & U' is not assignable to type 'string'. let y3: string | undefined = x; let y4: number | null = x; // Error ~~ !!! error TS2322: Type 'T & U' is not assignable to type 'number | null'. -!!! error TS2322: Type 'string | undefined' is not assignable to type 'number | null'. -!!! error TS2322: Type 'undefined' is not assignable to type 'number | null'. -!!! error TS2322: Type 'T & U' is not assignable to type 'number'. +!!! error TS2322: Type 'T & U' is not assignable to type 'number'. let y5: number | undefined = x; // Error ~~ !!! error TS2322: Type 'T & U' is not assignable to type 'number | undefined'. -!!! error TS2322: Type 'string | undefined' is not assignable to type 'number | undefined'. -!!! error TS2322: Type 'string' is not assignable to type 'number | undefined'. -!!! error TS2322: Type 'T & U' is not assignable to type 'number'. +!!! error TS2322: Type 'T & U' is not assignable to type 'number'. let y6: null | undefined = x; // Error ~~ !!! error TS2322: Type 'T & U' is not assignable to type 'null | undefined'. -!!! error TS2322: Type 'string | undefined' is not assignable to type 'null | undefined'. -!!! error TS2322: Type 'string' is not assignable to type 'null | undefined'. -!!! error TS2322: Type 'T & U' is not assignable to type 'null'. +!!! error TS2322: Type 'T & U' is not assignable to type 'null'. } type T1 = (string | number | undefined) & (string | null | undefined); // string | undefined diff --git a/tests/baselines/reference/invariantGenericErrorElaboration.errors.txt b/tests/baselines/reference/invariantGenericErrorElaboration.errors.txt index 0bd79bcf11d6a..7ab83c61bcdd5 100644 --- a/tests/baselines/reference/invariantGenericErrorElaboration.errors.txt +++ b/tests/baselines/reference/invariantGenericErrorElaboration.errors.txt @@ -1,13 +1,7 @@ tests/cases/compiler/invariantGenericErrorElaboration.ts(3,7): error TS2322: Type 'Num' is not assignable to type 'Runtype'. - Types of property 'constraint' are incompatible. - Type 'Constraint' is not assignable to type 'Constraint>'. - Types of property 'constraint' are incompatible. - Type 'Constraint>' is not assignable to type 'Constraint>>'. - Types of property 'constraint' are incompatible. - Type 'Constraint>>' is not assignable to type 'Constraint>>>'. - Type 'Constraint>>' is not assignable to type 'Constraint>'. - Types of property 'underlying' are incompatible. - Type 'Constraint>' is not assignable to type 'Constraint'. + The types of 'constraint.constraint.constraint' are incompatible between these types. + Type 'Constraint>>' is not assignable to type 'Constraint>>>'. + Type 'Constraint>' is not assignable to type 'Constraint'. tests/cases/compiler/invariantGenericErrorElaboration.ts(4,19): error TS2322: Type 'Num' is not assignable to type 'Runtype'. @@ -17,16 +11,9 @@ tests/cases/compiler/invariantGenericErrorElaboration.ts(4,19): error TS2322: Ty const wat: Runtype = Num; ~~~ !!! error TS2322: Type 'Num' is not assignable to type 'Runtype'. -!!! error TS2322: Types of property 'constraint' are incompatible. -!!! error TS2322: Type 'Constraint' is not assignable to type 'Constraint>'. -!!! error TS2322: Types of property 'constraint' are incompatible. -!!! error TS2322: Type 'Constraint>' is not assignable to type 'Constraint>>'. -!!! error TS2322: Types of property 'constraint' are incompatible. -!!! error TS2322: Type 'Constraint>>' is not assignable to type 'Constraint>>>'. -!!! error TS2322: Type 'Constraint>>' is not assignable to type 'Constraint>'. -!!! error TS2322: Types of property 'underlying' are incompatible. -!!! error TS2322: Type 'Constraint>' is not assignable to type 'Constraint'. -!!! related TS2728 tests/cases/compiler/invariantGenericErrorElaboration.ts:12:3: 'tag' is declared here. +!!! error TS2322: The types of 'constraint.constraint.constraint' are incompatible between these types. +!!! error TS2322: Type 'Constraint>>' is not assignable to type 'Constraint>>>'. +!!! error TS2322: Type 'Constraint>' is not assignable to type 'Constraint'. const Foo = Obj({ foo: Num }) ~~~ !!! error TS2322: Type 'Num' is not assignable to type 'Runtype'. diff --git a/tests/baselines/reference/isolatedModulesDeclaration.errors.txt b/tests/baselines/reference/isolatedModulesDeclaration.errors.txt deleted file mode 100644 index 09a655c6da081..0000000000000 --- a/tests/baselines/reference/isolatedModulesDeclaration.errors.txt +++ /dev/null @@ -1,6 +0,0 @@ -error TS5053: Option 'declaration' cannot be specified with option 'isolatedModules'. - - -!!! error TS5053: Option 'declaration' cannot be specified with option 'isolatedModules'. -==== tests/cases/compiler/file1.ts (0 errors) ==== - export var x; \ No newline at end of file diff --git a/tests/baselines/reference/iterableArrayPattern28.errors.txt b/tests/baselines/reference/iterableArrayPattern28.errors.txt index 7a1ff6cf42cb5..605c6feb405d6 100644 --- a/tests/baselines/reference/iterableArrayPattern28.errors.txt +++ b/tests/baselines/reference/iterableArrayPattern28.errors.txt @@ -1,18 +1,14 @@ tests/cases/conformance/es6/destructuring/iterableArrayPattern28.ts(2,24): error TS2769: No overload matches this call. Overload 1 of 3, '(iterable: Iterable): Map', gave the following error. Argument of type '([string, number] | [string, boolean])[]' is not assignable to parameter of type 'Iterable'. - Types of property '[Symbol.iterator]' are incompatible. - Type '() => IterableIterator<[string, number] | [string, boolean]>' is not assignable to type '() => Iterator'. - Type 'IterableIterator<[string, number] | [string, boolean]>' is not assignable to type 'Iterator'. - Types of property 'next' are incompatible. - Type '(...args: [] | [undefined]) => IteratorResult<[string, number] | [string, boolean], any>' is not assignable to type '(...args: [] | [undefined]) => IteratorResult'. - Type 'IteratorResult<[string, number] | [string, boolean], any>' is not assignable to type 'IteratorResult'. - Type 'IteratorYieldResult<[string, number] | [string, boolean]>' is not assignable to type 'IteratorResult'. - Type 'IteratorYieldResult<[string, number] | [string, boolean]>' is not assignable to type 'IteratorYieldResult'. - Type '[string, number] | [string, boolean]' is not assignable to type 'readonly [string, number]'. - Type '[string, boolean]' is not assignable to type 'readonly [string, number]'. - Types of property '1' are incompatible. - Type 'boolean' is not assignable to type 'number'. + The types returned by '[Symbol.iterator]().next(...)' are incompatible between these types. + Type 'IteratorResult<[string, number] | [string, boolean], any>' is not assignable to type 'IteratorResult'. + Type 'IteratorYieldResult<[string, number] | [string, boolean]>' is not assignable to type 'IteratorResult'. + Type 'IteratorYieldResult<[string, number] | [string, boolean]>' is not assignable to type 'IteratorYieldResult'. + Type '[string, number] | [string, boolean]' is not assignable to type 'readonly [string, number]'. + Type '[string, boolean]' is not assignable to type 'readonly [string, number]'. + Types of property '1' are incompatible. + Type 'boolean' is not assignable to type 'number'. Overload 2 of 3, '(entries?: readonly (readonly [string, number])[]): Map', gave the following error. Type 'true' is not assignable to type 'number'. @@ -24,17 +20,13 @@ tests/cases/conformance/es6/destructuring/iterableArrayPattern28.ts(2,24): error !!! error TS2769: No overload matches this call. !!! error TS2769: Overload 1 of 3, '(iterable: Iterable): Map', gave the following error. !!! error TS2769: Argument of type '([string, number] | [string, boolean])[]' is not assignable to parameter of type 'Iterable'. -!!! error TS2769: Types of property '[Symbol.iterator]' are incompatible. -!!! error TS2769: Type '() => IterableIterator<[string, number] | [string, boolean]>' is not assignable to type '() => Iterator'. -!!! error TS2769: Type 'IterableIterator<[string, number] | [string, boolean]>' is not assignable to type 'Iterator'. -!!! error TS2769: Types of property 'next' are incompatible. -!!! error TS2769: Type '(...args: [] | [undefined]) => IteratorResult<[string, number] | [string, boolean], any>' is not assignable to type '(...args: [] | [undefined]) => IteratorResult'. -!!! error TS2769: Type 'IteratorResult<[string, number] | [string, boolean], any>' is not assignable to type 'IteratorResult'. -!!! error TS2769: Type 'IteratorYieldResult<[string, number] | [string, boolean]>' is not assignable to type 'IteratorResult'. -!!! error TS2769: Type 'IteratorYieldResult<[string, number] | [string, boolean]>' is not assignable to type 'IteratorYieldResult'. -!!! error TS2769: Type '[string, number] | [string, boolean]' is not assignable to type 'readonly [string, number]'. -!!! error TS2769: Type '[string, boolean]' is not assignable to type 'readonly [string, number]'. -!!! error TS2769: Types of property '1' are incompatible. -!!! error TS2769: Type 'boolean' is not assignable to type 'number'. +!!! error TS2769: The types returned by '[Symbol.iterator]().next(...)' are incompatible between these types. +!!! error TS2769: Type 'IteratorResult<[string, number] | [string, boolean], any>' is not assignable to type 'IteratorResult'. +!!! error TS2769: Type 'IteratorYieldResult<[string, number] | [string, boolean]>' is not assignable to type 'IteratorResult'. +!!! error TS2769: Type 'IteratorYieldResult<[string, number] | [string, boolean]>' is not assignable to type 'IteratorYieldResult'. +!!! error TS2769: Type '[string, number] | [string, boolean]' is not assignable to type 'readonly [string, number]'. +!!! error TS2769: Type '[string, boolean]' is not assignable to type 'readonly [string, number]'. +!!! error TS2769: Types of property '1' are incompatible. +!!! error TS2769: Type 'boolean' is not assignable to type 'number'. !!! error TS2769: Overload 2 of 3, '(entries?: readonly (readonly [string, number])[]): Map', gave the following error. !!! error TS2769: Type 'true' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/iteratorSpreadInArray6.errors.txt b/tests/baselines/reference/iteratorSpreadInArray6.errors.txt index 0b114bc647704..202c0ab3bf224 100644 --- a/tests/baselines/reference/iteratorSpreadInArray6.errors.txt +++ b/tests/baselines/reference/iteratorSpreadInArray6.errors.txt @@ -1,10 +1,9 @@ tests/cases/conformance/es6/spread/iteratorSpreadInArray6.ts(15,14): error TS2769: No overload matches this call. Overload 1 of 2, '(...items: ConcatArray[]): number[]', gave the following error. Argument of type 'symbol[]' is not assignable to parameter of type 'ConcatArray'. - Types of property 'slice' are incompatible. - Type '(start?: number, end?: number) => symbol[]' is not assignable to type '(start?: number, end?: number) => number[]'. - Type 'symbol[]' is not assignable to type 'number[]'. - Type 'symbol' is not assignable to type 'number'. + The types returned by 'slice(...)' are incompatible between these types. + Type 'symbol[]' is not assignable to type 'number[]'. + Type 'symbol' is not assignable to type 'number'. Overload 2 of 2, '(...items: (number | ConcatArray)[]): number[]', gave the following error. Argument of type 'symbol[]' is not assignable to parameter of type 'number | ConcatArray'. Type 'symbol[]' is not assignable to type 'ConcatArray'. @@ -30,10 +29,9 @@ tests/cases/conformance/es6/spread/iteratorSpreadInArray6.ts(15,14): error TS276 !!! error TS2769: No overload matches this call. !!! error TS2769: Overload 1 of 2, '(...items: ConcatArray[]): number[]', gave the following error. !!! error TS2769: Argument of type 'symbol[]' is not assignable to parameter of type 'ConcatArray'. -!!! error TS2769: Types of property 'slice' are incompatible. -!!! error TS2769: Type '(start?: number, end?: number) => symbol[]' is not assignable to type '(start?: number, end?: number) => number[]'. -!!! error TS2769: Type 'symbol[]' is not assignable to type 'number[]'. -!!! error TS2769: Type 'symbol' is not assignable to type 'number'. +!!! error TS2769: The types returned by 'slice(...)' are incompatible between these types. +!!! error TS2769: Type 'symbol[]' is not assignable to type 'number[]'. +!!! error TS2769: Type 'symbol' is not assignable to type 'number'. !!! error TS2769: Overload 2 of 2, '(...items: (number | ConcatArray)[]): number[]', gave the following error. !!! error TS2769: Argument of type 'symbol[]' is not assignable to parameter of type 'number | ConcatArray'. !!! error TS2769: Type 'symbol[]' is not assignable to type 'ConcatArray'. \ No newline at end of file diff --git a/tests/baselines/reference/jsFileCompilationOptionalClassElementSyntaxOfClass.errors.txt b/tests/baselines/reference/jsFileCompilationOptionalClassElementSyntaxOfClass.errors.txt new file mode 100644 index 0000000000000..b4ebcf4198389 --- /dev/null +++ b/tests/baselines/reference/jsFileCompilationOptionalClassElementSyntaxOfClass.errors.txt @@ -0,0 +1,18 @@ +error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. + Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. +tests/cases/compiler/a.js(2,8): error TS8009: '?' can only be used in a .ts file. +tests/cases/compiler/a.js(4,8): error TS8009: '?' can only be used in a .ts file. + + +!!! error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. +!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. +==== tests/cases/compiler/a.js (2 errors) ==== + class C { + foo?() { + ~ +!!! error TS8009: '?' can only be used in a .ts file. + } + bar? = 1; + ~ +!!! error TS8009: '?' can only be used in a .ts file. + } \ No newline at end of file diff --git a/tests/baselines/reference/jsFileCompilationTypeArgumentSyntaxOfCall.errors.txt b/tests/baselines/reference/jsFileCompilationTypeArgumentSyntaxOfCall.errors.txt index 8d8a1a1a83eaa..5b47b12c534a7 100644 --- a/tests/baselines/reference/jsFileCompilationTypeArgumentSyntaxOfCall.errors.txt +++ b/tests/baselines/reference/jsFileCompilationTypeArgumentSyntaxOfCall.errors.txt @@ -1,11 +1,19 @@ -error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. - Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -tests/cases/compiler/a.js(1,5): error TS8011: 'type arguments' can only be used in a .ts file. +tests/cases/compiler/a.jsx(1,5): error TS8011: 'type arguments' can only be used in a .ts file. +tests/cases/compiler/a.jsx(2,5): error TS8011: 'type arguments' can only be used in a .ts file. +tests/cases/compiler/a.jsx(3,6): error TS8011: 'type arguments' can only be used in a .ts file. +tests/cases/compiler/a.jsx(4,6): error TS8011: 'type arguments' can only be used in a .ts file. -!!! error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. -!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -==== tests/cases/compiler/a.js (1 errors) ==== +==== tests/cases/compiler/a.jsx (4 errors) ==== Foo(); ~~~~~~ +!!! error TS8011: 'type arguments' can only be used in a .ts file. + Foo``; + ~~~~~~ +!!! error TS8011: 'type arguments' can only be used in a .ts file. + >; + ~~~~~~ +!!! error TS8011: 'type arguments' can only be used in a .ts file. + />; + ~~~~~~ !!! error TS8011: 'type arguments' can only be used in a .ts file. \ No newline at end of file diff --git a/tests/baselines/reference/jsFileCompilationTypeArgumentSyntaxOfCall.js b/tests/baselines/reference/jsFileCompilationTypeArgumentSyntaxOfCall.js new file mode 100644 index 0000000000000..f51afa0a6dbbe --- /dev/null +++ b/tests/baselines/reference/jsFileCompilationTypeArgumentSyntaxOfCall.js @@ -0,0 +1,15 @@ +//// [a.jsx] +Foo(); +Foo``; +>; +/>; + +//// [a.js] +var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) { + if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } + return cooked; +}; +Foo(); +Foo(__makeTemplateObject([""], [""])); +; +; diff --git a/tests/baselines/reference/jsFileCompilationTypeArgumentSyntaxOfCall.symbols b/tests/baselines/reference/jsFileCompilationTypeArgumentSyntaxOfCall.symbols deleted file mode 100644 index e0926bb6748fb..0000000000000 --- a/tests/baselines/reference/jsFileCompilationTypeArgumentSyntaxOfCall.symbols +++ /dev/null @@ -1,3 +0,0 @@ -=== tests/cases/compiler/a.js === -Foo(); -No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/jsFileCompilationTypeArgumentSyntaxOfCall.types b/tests/baselines/reference/jsFileCompilationTypeArgumentSyntaxOfCall.types deleted file mode 100644 index ac42dd32d4cc7..0000000000000 --- a/tests/baselines/reference/jsFileCompilationTypeArgumentSyntaxOfCall.types +++ /dev/null @@ -1,5 +0,0 @@ -=== tests/cases/compiler/a.js === -Foo(); ->Foo() : any ->Foo : any - diff --git a/tests/baselines/reference/keyofAndIndexedAccessErrors.errors.txt b/tests/baselines/reference/keyofAndIndexedAccessErrors.errors.txt index 69f992447e8b3..bb628d4f4fb57 100644 --- a/tests/baselines/reference/keyofAndIndexedAccessErrors.errors.txt +++ b/tests/baselines/reference/keyofAndIndexedAccessErrors.errors.txt @@ -48,8 +48,6 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(103,9): error 'string & keyof T' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string'. Type 'string' is not assignable to type 'K'. 'string' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string'. - Type 'string' is not assignable to type 'K'. - 'string' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string'. tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(105,9): error TS2322: Type 'T[Extract]' is not assignable to type 'T[K]'. Type 'Extract' is not assignable to type 'K'. 'Extract' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string'. @@ -68,8 +66,6 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(114,5): error 'string & keyof T' is assignable to the constraint of type 'J', but 'J' could be instantiated with a different subtype of constraint 'string'. Type 'string' is not assignable to type 'J'. 'string' is assignable to the constraint of type 'J', but 'J' could be instantiated with a different subtype of constraint 'string'. - Type 'string' is not assignable to type 'J'. - 'string' is assignable to the constraint of type 'J', but 'J' could be instantiated with a different subtype of constraint 'string'. tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(117,5): error TS2322: Type 'T[K]' is not assignable to type 'U[J]'. Type 'T' is not assignable to type 'U'. 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. @@ -264,8 +260,6 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(142,5): error !!! error TS2322: 'string & keyof T' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string'. !!! error TS2322: Type 'string' is not assignable to type 'K'. !!! error TS2322: 'string' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string'. -!!! error TS2322: Type 'string' is not assignable to type 'K'. -!!! error TS2322: 'string' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string'. t[key] = tk; // ok, T[K] ==> T[keyof T] tk = t[key]; // error, T[keyof T] =/=> T[K] ~~ @@ -299,8 +293,6 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(142,5): error !!! error TS2322: 'string & keyof T' is assignable to the constraint of type 'J', but 'J' could be instantiated with a different subtype of constraint 'string'. !!! error TS2322: Type 'string' is not assignable to type 'J'. !!! error TS2322: 'string' is assignable to the constraint of type 'J', but 'J' could be instantiated with a different subtype of constraint 'string'. -!!! error TS2322: Type 'string' is not assignable to type 'J'. -!!! error TS2322: 'string' is assignable to the constraint of type 'J', but 'J' could be instantiated with a different subtype of constraint 'string'. tk = uj; uj = tk; // error diff --git a/tests/baselines/reference/logicalAndOperatorStrictMode.types b/tests/baselines/reference/logicalAndOperatorStrictMode.types index 2d7ef648aeeac..6bf592c8b7b31 100644 --- a/tests/baselines/reference/logicalAndOperatorStrictMode.types +++ b/tests/baselines/reference/logicalAndOperatorStrictMode.types @@ -256,7 +256,7 @@ const v5 = v && v; >v5 : void >v && v : void >v : void ->v : never +>v : void const v6 = v && u; >v6 : void diff --git a/tests/baselines/reference/mergedDeclarations7.errors.txt b/tests/baselines/reference/mergedDeclarations7.errors.txt index cd9b3a5e939c5..bc09ea081a3c3 100644 --- a/tests/baselines/reference/mergedDeclarations7.errors.txt +++ b/tests/baselines/reference/mergedDeclarations7.errors.txt @@ -1,7 +1,6 @@ tests/cases/compiler/test.ts(4,5): error TS2322: Type 'PassportStatic' is not assignable to type 'Passport'. - Types of property 'use' are incompatible. - Type '() => PassportStatic' is not assignable to type '() => this'. - Type 'PassportStatic' is not assignable to type 'this'. + The types returned by 'use()' are incompatible between these types. + Type 'PassportStatic' is not assignable to type 'this'. ==== tests/cases/compiler/passport.d.ts (0 errors) ==== @@ -27,6 +26,5 @@ tests/cases/compiler/test.ts(4,5): error TS2322: Type 'PassportStatic' is not as let p: Passport = passport.use(); ~ !!! error TS2322: Type 'PassportStatic' is not assignable to type 'Passport'. -!!! error TS2322: Types of property 'use' are incompatible. -!!! error TS2322: Type '() => PassportStatic' is not assignable to type '() => this'. -!!! error TS2322: Type 'PassportStatic' is not assignable to type 'this'. \ No newline at end of file +!!! error TS2322: The types returned by 'use()' are incompatible between these types. +!!! error TS2322: Type 'PassportStatic' is not assignable to type 'this'. \ No newline at end of file diff --git a/tests/baselines/reference/mixinIntersectionIsValidbaseType.js b/tests/baselines/reference/mixinIntersectionIsValidbaseType.js new file mode 100644 index 0000000000000..ed02aecd53f84 --- /dev/null +++ b/tests/baselines/reference/mixinIntersectionIsValidbaseType.js @@ -0,0 +1,77 @@ +//// [mixinIntersectionIsValidbaseType.ts] +export type Constructor = new (...args: any[]) => T; + +export interface Initable { + init(...args: any[]): void; +} + +/** + * Plain mixin where the superclass must be Initable + */ +export const Serializable = & Initable>( + SuperClass: K +) => { + const LocalMixin = (InnerSuperClass: K) => { + return class SerializableLocal extends InnerSuperClass { + } + }; + let ResultClass = LocalMixin(SuperClass); + return ResultClass; +}; + +const AMixin = & Initable>(SuperClass: K) => { + let SomeHowOkay = class A extends SuperClass { + }; + + let SomeHowNotOkay = class A extends Serializable(SuperClass) { + }; +}; + +//// [mixinIntersectionIsValidbaseType.js] +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +exports.__esModule = true; +/** + * Plain mixin where the superclass must be Initable + */ +exports.Serializable = function (SuperClass) { + var LocalMixin = function (InnerSuperClass) { + return /** @class */ (function (_super) { + __extends(SerializableLocal, _super); + function SerializableLocal() { + return _super !== null && _super.apply(this, arguments) || this; + } + return SerializableLocal; + }(InnerSuperClass)); + }; + var ResultClass = LocalMixin(SuperClass); + return ResultClass; +}; +var AMixin = function (SuperClass) { + var SomeHowOkay = /** @class */ (function (_super) { + __extends(A, _super); + function A() { + return _super !== null && _super.apply(this, arguments) || this; + } + return A; + }(SuperClass)); + var SomeHowNotOkay = /** @class */ (function (_super) { + __extends(A, _super); + function A() { + return _super !== null && _super.apply(this, arguments) || this; + } + return A; + }(exports.Serializable(SuperClass))); +}; diff --git a/tests/baselines/reference/mixinIntersectionIsValidbaseType.symbols b/tests/baselines/reference/mixinIntersectionIsValidbaseType.symbols new file mode 100644 index 0000000000000..69fe63bab23b9 --- /dev/null +++ b/tests/baselines/reference/mixinIntersectionIsValidbaseType.symbols @@ -0,0 +1,74 @@ +=== tests/cases/compiler/mixinIntersectionIsValidbaseType.ts === +export type Constructor = new (...args: any[]) => T; +>Constructor : Symbol(Constructor, Decl(mixinIntersectionIsValidbaseType.ts, 0, 0)) +>T : Symbol(T, Decl(mixinIntersectionIsValidbaseType.ts, 0, 24)) +>args : Symbol(args, Decl(mixinIntersectionIsValidbaseType.ts, 0, 58)) +>T : Symbol(T, Decl(mixinIntersectionIsValidbaseType.ts, 0, 24)) + +export interface Initable { +>Initable : Symbol(Initable, Decl(mixinIntersectionIsValidbaseType.ts, 0, 79)) + + init(...args: any[]): void; +>init : Symbol(Initable.init, Decl(mixinIntersectionIsValidbaseType.ts, 2, 27)) +>args : Symbol(args, Decl(mixinIntersectionIsValidbaseType.ts, 3, 9)) +} + +/** + * Plain mixin where the superclass must be Initable + */ +export const Serializable = & Initable>( +>Serializable : Symbol(Serializable, Decl(mixinIntersectionIsValidbaseType.ts, 9, 12)) +>K : Symbol(K, Decl(mixinIntersectionIsValidbaseType.ts, 9, 29)) +>Constructor : Symbol(Constructor, Decl(mixinIntersectionIsValidbaseType.ts, 0, 0)) +>Initable : Symbol(Initable, Decl(mixinIntersectionIsValidbaseType.ts, 0, 79)) +>Initable : Symbol(Initable, Decl(mixinIntersectionIsValidbaseType.ts, 0, 79)) + + SuperClass: K +>SuperClass : Symbol(SuperClass, Decl(mixinIntersectionIsValidbaseType.ts, 9, 73)) +>K : Symbol(K, Decl(mixinIntersectionIsValidbaseType.ts, 9, 29)) + +) => { + const LocalMixin = (InnerSuperClass: K) => { +>LocalMixin : Symbol(LocalMixin, Decl(mixinIntersectionIsValidbaseType.ts, 12, 9)) +>InnerSuperClass : Symbol(InnerSuperClass, Decl(mixinIntersectionIsValidbaseType.ts, 12, 24)) +>K : Symbol(K, Decl(mixinIntersectionIsValidbaseType.ts, 9, 29)) + + return class SerializableLocal extends InnerSuperClass { +>SerializableLocal : Symbol(SerializableLocal, Decl(mixinIntersectionIsValidbaseType.ts, 13, 14)) +>InnerSuperClass : Symbol(InnerSuperClass, Decl(mixinIntersectionIsValidbaseType.ts, 12, 24)) + } + }; + let ResultClass = LocalMixin(SuperClass); +>ResultClass : Symbol(ResultClass, Decl(mixinIntersectionIsValidbaseType.ts, 16, 7)) +>LocalMixin : Symbol(LocalMixin, Decl(mixinIntersectionIsValidbaseType.ts, 12, 9)) +>SuperClass : Symbol(SuperClass, Decl(mixinIntersectionIsValidbaseType.ts, 9, 73)) + + return ResultClass; +>ResultClass : Symbol(ResultClass, Decl(mixinIntersectionIsValidbaseType.ts, 16, 7)) + +}; + +const AMixin = & Initable>(SuperClass: K) => { +>AMixin : Symbol(AMixin, Decl(mixinIntersectionIsValidbaseType.ts, 20, 5)) +>K : Symbol(K, Decl(mixinIntersectionIsValidbaseType.ts, 20, 16)) +>Constructor : Symbol(Constructor, Decl(mixinIntersectionIsValidbaseType.ts, 0, 0)) +>Initable : Symbol(Initable, Decl(mixinIntersectionIsValidbaseType.ts, 0, 79)) +>Initable : Symbol(Initable, Decl(mixinIntersectionIsValidbaseType.ts, 0, 79)) +>SuperClass : Symbol(SuperClass, Decl(mixinIntersectionIsValidbaseType.ts, 20, 60)) +>K : Symbol(K, Decl(mixinIntersectionIsValidbaseType.ts, 20, 16)) + + let SomeHowOkay = class A extends SuperClass { +>SomeHowOkay : Symbol(SomeHowOkay, Decl(mixinIntersectionIsValidbaseType.ts, 21, 7)) +>A : Symbol(A, Decl(mixinIntersectionIsValidbaseType.ts, 21, 21)) +>SuperClass : Symbol(SuperClass, Decl(mixinIntersectionIsValidbaseType.ts, 20, 60)) + + }; + + let SomeHowNotOkay = class A extends Serializable(SuperClass) { +>SomeHowNotOkay : Symbol(SomeHowNotOkay, Decl(mixinIntersectionIsValidbaseType.ts, 24, 7)) +>A : Symbol(A, Decl(mixinIntersectionIsValidbaseType.ts, 24, 24)) +>Serializable : Symbol(Serializable, Decl(mixinIntersectionIsValidbaseType.ts, 9, 12)) +>SuperClass : Symbol(SuperClass, Decl(mixinIntersectionIsValidbaseType.ts, 20, 60)) + + }; +}; diff --git a/tests/baselines/reference/mixinIntersectionIsValidbaseType.types b/tests/baselines/reference/mixinIntersectionIsValidbaseType.types new file mode 100644 index 0000000000000..c828188dcd68b --- /dev/null +++ b/tests/baselines/reference/mixinIntersectionIsValidbaseType.types @@ -0,0 +1,67 @@ +=== tests/cases/compiler/mixinIntersectionIsValidbaseType.ts === +export type Constructor = new (...args: any[]) => T; +>Constructor : Constructor +>args : any[] + +export interface Initable { + init(...args: any[]): void; +>init : (...args: any[]) => void +>args : any[] +} + +/** + * Plain mixin where the superclass must be Initable + */ +export const Serializable = & Initable>( +>Serializable : & Initable>(SuperClass: K) => { new (...args: any[]): SerializableLocal; prototype: Serializable.SerializableLocal; init(...args: any[]): void; } & K +> & Initable>( SuperClass: K) => { const LocalMixin = (InnerSuperClass: K) => { return class SerializableLocal extends InnerSuperClass { } }; let ResultClass = LocalMixin(SuperClass); return ResultClass;} : & Initable>(SuperClass: K) => { new (...args: any[]): SerializableLocal; prototype: Serializable.SerializableLocal; init(...args: any[]): void; } & K + + SuperClass: K +>SuperClass : K + +) => { + const LocalMixin = (InnerSuperClass: K) => { +>LocalMixin : (InnerSuperClass: K) => { new (...args: any[]): SerializableLocal; prototype: Serializable.SerializableLocal; init(...args: any[]): void; } & K +>(InnerSuperClass: K) => { return class SerializableLocal extends InnerSuperClass { } } : (InnerSuperClass: K) => { new (...args: any[]): SerializableLocal; prototype: Serializable.SerializableLocal; init(...args: any[]): void; } & K +>InnerSuperClass : K + + return class SerializableLocal extends InnerSuperClass { +>class SerializableLocal extends InnerSuperClass { } : { new (...args: any[]): SerializableLocal; prototype: Serializable.SerializableLocal; init(...args: any[]): void; } & K +>SerializableLocal : { new (...args: any[]): SerializableLocal; prototype: Serializable.SerializableLocal; init(...args: any[]): void; } & K +>InnerSuperClass : Initable + } + }; + let ResultClass = LocalMixin(SuperClass); +>ResultClass : { new (...args: any[]): SerializableLocal; prototype: Serializable.SerializableLocal; init(...args: any[]): void; } & K +>LocalMixin(SuperClass) : { new (...args: any[]): SerializableLocal; prototype: Serializable.SerializableLocal; init(...args: any[]): void; } & K +>LocalMixin : (InnerSuperClass: K) => { new (...args: any[]): SerializableLocal; prototype: Serializable.SerializableLocal; init(...args: any[]): void; } & K +>SuperClass : K + + return ResultClass; +>ResultClass : { new (...args: any[]): SerializableLocal; prototype: Serializable.SerializableLocal; init(...args: any[]): void; } & K + +}; + +const AMixin = & Initable>(SuperClass: K) => { +>AMixin : & Initable>(SuperClass: K) => void +> & Initable>(SuperClass: K) => { let SomeHowOkay = class A extends SuperClass { }; let SomeHowNotOkay = class A extends Serializable(SuperClass) { };} : & Initable>(SuperClass: K) => void +>SuperClass : K + + let SomeHowOkay = class A extends SuperClass { +>SomeHowOkay : { new (...args: any[]): A; prototype: AMixin.A; init(...args: any[]): void; } & K +>class A extends SuperClass { } : { new (...args: any[]): A; prototype: AMixin.A; init(...args: any[]): void; } & K +>A : { new (...args: any[]): A; prototype: AMixin.A; init(...args: any[]): void; } & K +>SuperClass : Initable + + }; + + let SomeHowNotOkay = class A extends Serializable(SuperClass) { +>SomeHowNotOkay : { new (...args: any[]): A; prototype: AMixin.A; init: (...args: any[]) => void; } & K +>class A extends Serializable(SuperClass) { } : { new (...args: any[]): A; prototype: AMixin.A; init: (...args: any[]) => void; } & K +>A : { new (...args: any[]): A; prototype: AMixin.A; init: (...args: any[]) => void; } & K +>Serializable(SuperClass) : Serializable.SerializableLocal & Initable +>Serializable : & Initable>(SuperClass: K) => { new (...args: any[]): SerializableLocal; prototype: Serializable.SerializableLocal; init(...args: any[]): void; } & K +>SuperClass : K + + }; +}; diff --git a/tests/baselines/reference/multiLineErrors.errors.txt b/tests/baselines/reference/multiLineErrors.errors.txt index 70366aeabedcd..851425baef434 100644 --- a/tests/baselines/reference/multiLineErrors.errors.txt +++ b/tests/baselines/reference/multiLineErrors.errors.txt @@ -1,9 +1,7 @@ tests/cases/compiler/multiLineErrors.ts(3,22): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value. tests/cases/compiler/multiLineErrors.ts(21,1): error TS2322: Type 'A2' is not assignable to type 'A1'. - Types of property 'x' are incompatible. - Type '{ y: string; }' is not assignable to type '{ y: number; }'. - Types of property 'y' are incompatible. - Type 'string' is not assignable to type 'number'. + The types of 'x.y' are incompatible between these types. + Type 'string' is not assignable to type 'number'. ==== tests/cases/compiler/multiLineErrors.ts (2 errors) ==== @@ -35,8 +33,6 @@ tests/cases/compiler/multiLineErrors.ts(21,1): error TS2322: Type 'A2' is not as t1 = t2; ~~ !!! error TS2322: Type 'A2' is not assignable to type 'A1'. -!!! error TS2322: Types of property 'x' are incompatible. -!!! error TS2322: Type '{ y: string; }' is not assignable to type '{ y: number; }'. -!!! error TS2322: Types of property 'y' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! error TS2322: The types of 'x.y' are incompatible between these types. +!!! error TS2322: Type 'string' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/mutuallyRecursiveCallbacks.errors.txt b/tests/baselines/reference/mutuallyRecursiveCallbacks.errors.txt index bb90bcee99943..63a568bf10a99 100644 --- a/tests/baselines/reference/mutuallyRecursiveCallbacks.errors.txt +++ b/tests/baselines/reference/mutuallyRecursiveCallbacks.errors.txt @@ -1,9 +1,8 @@ tests/cases/compiler/mutuallyRecursiveCallbacks.ts(7,1): error TS2322: Type '(bar: Bar) => void' is not assignable to type 'Bar<{}>'. Types of parameters 'bar' and 'foo' are incompatible. Types of parameters 'bar' and 'foo' are incompatible. - Type 'Foo' is not assignable to type 'Bar<{}>'. - Types of parameters 'bar' and 'foo' are incompatible. - Type 'void' is not assignable to type 'Foo'. + Types of parameters 'bar' and 'foo' are incompatible. + Type 'void' is not assignable to type 'Foo'. ==== tests/cases/compiler/mutuallyRecursiveCallbacks.ts (1 errors) ==== @@ -18,7 +17,6 @@ tests/cases/compiler/mutuallyRecursiveCallbacks.ts(7,1): error TS2322: Type ' !!! error TS2322: Type '(bar: Bar) => void' is not assignable to type 'Bar<{}>'. !!! error TS2322: Types of parameters 'bar' and 'foo' are incompatible. !!! error TS2322: Types of parameters 'bar' and 'foo' are incompatible. -!!! error TS2322: Type 'Foo' is not assignable to type 'Bar<{}>'. -!!! error TS2322: Types of parameters 'bar' and 'foo' are incompatible. -!!! error TS2322: Type 'void' is not assignable to type 'Foo'. +!!! error TS2322: Types of parameters 'bar' and 'foo' are incompatible. +!!! error TS2322: Type 'void' is not assignable to type 'Foo'. \ No newline at end of file diff --git a/tests/baselines/reference/nestedCallbackErrorNotFlattened.errors.txt b/tests/baselines/reference/nestedCallbackErrorNotFlattened.errors.txt new file mode 100644 index 0000000000000..3749d3765b082 --- /dev/null +++ b/tests/baselines/reference/nestedCallbackErrorNotFlattened.errors.txt @@ -0,0 +1,20 @@ +tests/cases/compiler/nestedCallbackErrorNotFlattened.ts(6,1): error TS2322: Type '() => () => () => () => number' is not assignable to type '() => () => () => () => string'. + Call signature return types '() => () => () => number' and '() => () => () => string' are incompatible. + Call signature return types '() => () => number' and '() => () => string' are incompatible. + Call signature return types '() => number' and '() => string' are incompatible. + Type 'number' is not assignable to type 'string'. + + +==== tests/cases/compiler/nestedCallbackErrorNotFlattened.ts (1 errors) ==== + type Cb = {noAlias: () => T}["noAlias"]; // `"noAlias"` here prevents an alias symbol from being made + // which means the comparison will definitely be structural, rather than by variance + + declare const x: Cb>>>; // one more layer of `Cb` adn we'd get a `true` from the deeply-nested symbol check + declare let y: Cb>>>; + y = x; + ~ +!!! error TS2322: Type '() => () => () => () => number' is not assignable to type '() => () => () => () => string'. +!!! error TS2322: Call signature return types '() => () => () => number' and '() => () => () => string' are incompatible. +!!! error TS2322: Call signature return types '() => () => number' and '() => () => string' are incompatible. +!!! error TS2322: Call signature return types '() => number' and '() => string' are incompatible. +!!! error TS2322: Type 'number' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/nestedCallbackErrorNotFlattened.js b/tests/baselines/reference/nestedCallbackErrorNotFlattened.js new file mode 100644 index 0000000000000..0c5edf9760bc1 --- /dev/null +++ b/tests/baselines/reference/nestedCallbackErrorNotFlattened.js @@ -0,0 +1,11 @@ +//// [nestedCallbackErrorNotFlattened.ts] +type Cb = {noAlias: () => T}["noAlias"]; // `"noAlias"` here prevents an alias symbol from being made +// which means the comparison will definitely be structural, rather than by variance + +declare const x: Cb>>>; // one more layer of `Cb` adn we'd get a `true` from the deeply-nested symbol check +declare let y: Cb>>>; +y = x; + +//// [nestedCallbackErrorNotFlattened.js] +"use strict"; +y = x; diff --git a/tests/baselines/reference/nestedCallbackErrorNotFlattened.symbols b/tests/baselines/reference/nestedCallbackErrorNotFlattened.symbols new file mode 100644 index 0000000000000..2019b7878221d --- /dev/null +++ b/tests/baselines/reference/nestedCallbackErrorNotFlattened.symbols @@ -0,0 +1,27 @@ +=== tests/cases/compiler/nestedCallbackErrorNotFlattened.ts === +type Cb = {noAlias: () => T}["noAlias"]; // `"noAlias"` here prevents an alias symbol from being made +>Cb : Symbol(Cb, Decl(nestedCallbackErrorNotFlattened.ts, 0, 0)) +>T : Symbol(T, Decl(nestedCallbackErrorNotFlattened.ts, 0, 8)) +>noAlias : Symbol(noAlias, Decl(nestedCallbackErrorNotFlattened.ts, 0, 14)) +>T : Symbol(T, Decl(nestedCallbackErrorNotFlattened.ts, 0, 8)) + +// which means the comparison will definitely be structural, rather than by variance + +declare const x: Cb>>>; // one more layer of `Cb` adn we'd get a `true` from the deeply-nested symbol check +>x : Symbol(x, Decl(nestedCallbackErrorNotFlattened.ts, 3, 13)) +>Cb : Symbol(Cb, Decl(nestedCallbackErrorNotFlattened.ts, 0, 0)) +>Cb : Symbol(Cb, Decl(nestedCallbackErrorNotFlattened.ts, 0, 0)) +>Cb : Symbol(Cb, Decl(nestedCallbackErrorNotFlattened.ts, 0, 0)) +>Cb : Symbol(Cb, Decl(nestedCallbackErrorNotFlattened.ts, 0, 0)) + +declare let y: Cb>>>; +>y : Symbol(y, Decl(nestedCallbackErrorNotFlattened.ts, 4, 11)) +>Cb : Symbol(Cb, Decl(nestedCallbackErrorNotFlattened.ts, 0, 0)) +>Cb : Symbol(Cb, Decl(nestedCallbackErrorNotFlattened.ts, 0, 0)) +>Cb : Symbol(Cb, Decl(nestedCallbackErrorNotFlattened.ts, 0, 0)) +>Cb : Symbol(Cb, Decl(nestedCallbackErrorNotFlattened.ts, 0, 0)) + +y = x; +>y : Symbol(y, Decl(nestedCallbackErrorNotFlattened.ts, 4, 11)) +>x : Symbol(x, Decl(nestedCallbackErrorNotFlattened.ts, 3, 13)) + diff --git a/tests/baselines/reference/nestedCallbackErrorNotFlattened.types b/tests/baselines/reference/nestedCallbackErrorNotFlattened.types new file mode 100644 index 0000000000000..5e753714b34ee --- /dev/null +++ b/tests/baselines/reference/nestedCallbackErrorNotFlattened.types @@ -0,0 +1,18 @@ +=== tests/cases/compiler/nestedCallbackErrorNotFlattened.ts === +type Cb = {noAlias: () => T}["noAlias"]; // `"noAlias"` here prevents an alias symbol from being made +>Cb : () => T +>noAlias : () => T + +// which means the comparison will definitely be structural, rather than by variance + +declare const x: Cb>>>; // one more layer of `Cb` adn we'd get a `true` from the deeply-nested symbol check +>x : () => () => () => () => number + +declare let y: Cb>>>; +>y : () => () => () => () => string + +y = x; +>y = x : () => () => () => () => number +>y : () => () => () => () => string +>x : () => () => () => () => number + diff --git a/tests/baselines/reference/nestedRecursiveArraysOrObjectsError01.errors.txt b/tests/baselines/reference/nestedRecursiveArraysOrObjectsError01.errors.txt index 138a4a8415825..650a808e5986c 100644 --- a/tests/baselines/reference/nestedRecursiveArraysOrObjectsError01.errors.txt +++ b/tests/baselines/reference/nestedRecursiveArraysOrObjectsError01.errors.txt @@ -1,17 +1,14 @@ tests/cases/compiler/nestedRecursiveArraysOrObjectsError01.ts(10,9): error TS2322: Type '{ foo: string; jj: number; }[][][]' is not assignable to type 'Style'. Type '{ foo: string; jj: number; }[][][]' is not assignable to type 'StyleArray'. - Types of property 'pop' are incompatible. - Type '() => { foo: string; jj: number; }[][]' is not assignable to type '() => Style'. - Type '{ foo: string; jj: number; }[][]' is not assignable to type 'Style'. - Type '{ foo: string; jj: number; }[][]' is not assignable to type 'StyleArray'. - Types of property 'pop' are incompatible. - Type '() => { foo: string; jj: number; }[]' is not assignable to type '() => Style'. - Type '{ foo: string; jj: number; }[]' is not assignable to type 'Style'. - Type '{ foo: string; jj: number; }[]' is not assignable to type 'StyleArray'. - Types of property 'pop' are incompatible. - Type '() => { foo: string; jj: number; }' is not assignable to type '() => Style'. - Type '{ foo: string; jj: number; }' is not assignable to type 'Style'. - Object literal may only specify known properties, and 'jj' does not exist in type 'Style'. + The types returned by 'pop()' are incompatible between these types. + Type '{ foo: string; jj: number; }[][]' is not assignable to type 'Style'. + Type '{ foo: string; jj: number; }[][]' is not assignable to type 'StyleArray'. + The types returned by 'pop()' are incompatible between these types. + Type '{ foo: string; jj: number; }[]' is not assignable to type 'Style'. + Type '{ foo: string; jj: number; }[]' is not assignable to type 'StyleArray'. + The types returned by 'pop()' are incompatible between these types. + Type '{ foo: string; jj: number; }' is not assignable to type 'Style'. + Object literal may only specify known properties, and 'jj' does not exist in type 'Style'. ==== tests/cases/compiler/nestedRecursiveArraysOrObjectsError01.ts (1 errors) ==== @@ -28,18 +25,15 @@ tests/cases/compiler/nestedRecursiveArraysOrObjectsError01.ts(10,9): error TS232 ~~~~~ !!! error TS2322: Type '{ foo: string; jj: number; }[][][]' is not assignable to type 'Style'. !!! error TS2322: Type '{ foo: string; jj: number; }[][][]' is not assignable to type 'StyleArray'. -!!! error TS2322: Types of property 'pop' are incompatible. -!!! error TS2322: Type '() => { foo: string; jj: number; }[][]' is not assignable to type '() => Style'. -!!! error TS2322: Type '{ foo: string; jj: number; }[][]' is not assignable to type 'Style'. -!!! error TS2322: Type '{ foo: string; jj: number; }[][]' is not assignable to type 'StyleArray'. -!!! error TS2322: Types of property 'pop' are incompatible. -!!! error TS2322: Type '() => { foo: string; jj: number; }[]' is not assignable to type '() => Style'. -!!! error TS2322: Type '{ foo: string; jj: number; }[]' is not assignable to type 'Style'. -!!! error TS2322: Type '{ foo: string; jj: number; }[]' is not assignable to type 'StyleArray'. -!!! error TS2322: Types of property 'pop' are incompatible. -!!! error TS2322: Type '() => { foo: string; jj: number; }' is not assignable to type '() => Style'. -!!! error TS2322: Type '{ foo: string; jj: number; }' is not assignable to type 'Style'. -!!! error TS2322: Object literal may only specify known properties, and 'jj' does not exist in type 'Style'. +!!! error TS2322: The types returned by 'pop()' are incompatible between these types. +!!! error TS2322: Type '{ foo: string; jj: number; }[][]' is not assignable to type 'Style'. +!!! error TS2322: Type '{ foo: string; jj: number; }[][]' is not assignable to type 'StyleArray'. +!!! error TS2322: The types returned by 'pop()' are incompatible between these types. +!!! error TS2322: Type '{ foo: string; jj: number; }[]' is not assignable to type 'Style'. +!!! error TS2322: Type '{ foo: string; jj: number; }[]' is not assignable to type 'StyleArray'. +!!! error TS2322: The types returned by 'pop()' are incompatible between these types. +!!! error TS2322: Type '{ foo: string; jj: number; }' is not assignable to type 'Style'. +!!! error TS2322: Object literal may only specify known properties, and 'jj' does not exist in type 'Style'. }]] ]; diff --git a/tests/baselines/reference/neverReturningFunctions1.errors.txt b/tests/baselines/reference/neverReturningFunctions1.errors.txt new file mode 100644 index 0000000000000..5eb6659427c46 --- /dev/null +++ b/tests/baselines/reference/neverReturningFunctions1.errors.txt @@ -0,0 +1,296 @@ +tests/cases/conformance/controlFlow/neverReturningFunctions1.ts(13,5): error TS7027: Unreachable code detected. +tests/cases/conformance/controlFlow/neverReturningFunctions1.ts(19,5): error TS7027: Unreachable code detected. +tests/cases/conformance/controlFlow/neverReturningFunctions1.ts(30,5): error TS7027: Unreachable code detected. +tests/cases/conformance/controlFlow/neverReturningFunctions1.ts(36,5): error TS7027: Unreachable code detected. +tests/cases/conformance/controlFlow/neverReturningFunctions1.ts(51,5): error TS7027: Unreachable code detected. +tests/cases/conformance/controlFlow/neverReturningFunctions1.ts(57,5): error TS7027: Unreachable code detected. +tests/cases/conformance/controlFlow/neverReturningFunctions1.ts(63,5): error TS7027: Unreachable code detected. +tests/cases/conformance/controlFlow/neverReturningFunctions1.ts(77,9): error TS7027: Unreachable code detected. +tests/cases/conformance/controlFlow/neverReturningFunctions1.ts(82,9): error TS7027: Unreachable code detected. +tests/cases/conformance/controlFlow/neverReturningFunctions1.ts(89,9): error TS7027: Unreachable code detected. +tests/cases/conformance/controlFlow/neverReturningFunctions1.ts(96,13): error TS7027: Unreachable code detected. +tests/cases/conformance/controlFlow/neverReturningFunctions1.ts(101,13): error TS7027: Unreachable code detected. +tests/cases/conformance/controlFlow/neverReturningFunctions1.ts(103,9): error TS7027: Unreachable code detected. +tests/cases/conformance/controlFlow/neverReturningFunctions1.ts(105,5): error TS7027: Unreachable code detected. +tests/cases/conformance/controlFlow/neverReturningFunctions1.ts(111,9): error TS7027: Unreachable code detected. +tests/cases/conformance/controlFlow/neverReturningFunctions1.ts(112,9): error TS7027: Unreachable code detected. +tests/cases/conformance/controlFlow/neverReturningFunctions1.ts(122,9): error TS7027: Unreachable code detected. +tests/cases/conformance/controlFlow/neverReturningFunctions1.ts(127,9): error TS7027: Unreachable code detected. +tests/cases/conformance/controlFlow/neverReturningFunctions1.ts(129,5): error TS7027: Unreachable code detected. +tests/cases/conformance/controlFlow/neverReturningFunctions1.ts(139,9): error TS7027: Unreachable code detected. +tests/cases/conformance/controlFlow/neverReturningFunctions1.ts(141,5): error TS7027: Unreachable code detected. +tests/cases/conformance/controlFlow/neverReturningFunctions1.ts(148,9): error TS7027: Unreachable code detected. +tests/cases/conformance/controlFlow/neverReturningFunctions1.ts(153,5): error TS7027: Unreachable code detected. + + +==== tests/cases/conformance/controlFlow/neverReturningFunctions1.ts (23 errors) ==== + function fail(message?: string): never { + throw new Error(message); + } + + function f01(x: string | undefined) { + if (x === undefined) fail("undefined argument"); + x.length; // string + } + + function f02(x: number): number { + if (x >= 0) return x; + fail("negative number"); + x; // Unreachable + ~~ +!!! error TS7027: Unreachable code detected. + } + + function f03(x: string) { + x; // string + fail(); + x; // Unreachable + ~~ +!!! error TS7027: Unreachable code detected. + } + + function f11(x: string | undefined, fail: (message?: string) => never) { + if (x === undefined) fail("undefined argument"); + x.length; // string + } + + function f12(x: number, fail: (message?: string) => never): number { + if (x >= 0) return x; + fail("negative number"); + x; // Unreachable + ~~ +!!! error TS7027: Unreachable code detected. + } + + function f13(x: string, fail: (message?: string) => never) { + x; // string + fail(); + x; // Unreachable + ~~ +!!! error TS7027: Unreachable code detected. + } + + namespace Debug { + export declare function fail(message?: string): never; + } + + function f21(x: string | undefined) { + if (x === undefined) Debug.fail("undefined argument"); + x.length; // string + } + + function f22(x: number): number { + if (x >= 0) return x; + Debug.fail("negative number"); + x; // Unreachable + ~~ +!!! error TS7027: Unreachable code detected. + } + + function f23(x: string) { + x; // string + Debug.fail(); + x; // Unreachable + ~~ +!!! error TS7027: Unreachable code detected. + } + + function f24(x: string) { + x; // string + ((Debug).fail)(); + x; // Unreachable + ~~ +!!! error TS7027: Unreachable code detected. + } + + class Test { + fail(message?: string): never { + throw new Error(message); + } + f1(x: string | undefined) { + if (x === undefined) this.fail("undefined argument"); + x.length; // string + } + f2(x: number): number { + if (x >= 0) return x; + this.fail("negative number"); + x; // Unreachable + ~~ +!!! error TS7027: Unreachable code detected. + } + f3(x: string) { + x; // string + this.fail(); + x; // Unreachable + ~~ +!!! error TS7027: Unreachable code detected. + } + } + + function f30(x: string | number | undefined) { + if (typeof x === "string") { + fail(); + x; // Unreachable + ~~ +!!! error TS7027: Unreachable code detected. + } + else { + x; // number | undefined + if (x !== undefined) { + x; // number + fail(); + x; // Unreachable + ~~ +!!! error TS7027: Unreachable code detected. + } + else { + x; // undefined + fail(); + x; // Unreachable + ~~ +!!! error TS7027: Unreachable code detected. + } + x; // Unreachable + ~~ +!!! error TS7027: Unreachable code detected. + } + x; // Unreachable + ~~ +!!! error TS7027: Unreachable code detected. + } + + function f31(x: { a: string | number }) { + if (typeof x.a === "string") { + fail(); + x; // Unreachable + ~~ +!!! error TS7027: Unreachable code detected. + x.a; // Unreachable + ~~~~ +!!! error TS7027: Unreachable code detected. + } + x; // { a: string | number } + x.a; // number + } + + function f40(x: number) { + try { + x; + fail(); + x; // Unreachable + ~~ +!!! error TS7027: Unreachable code detected. + } + finally { + x; + fail(); + x; // Unreachable + ~~ +!!! error TS7027: Unreachable code detected. + } + x; // Unreachable + ~~ +!!! error TS7027: Unreachable code detected. + } + + function f41(x: number) { + try { + x; + } + finally { + x; + fail(); + x; // Unreachable + ~~ +!!! error TS7027: Unreachable code detected. + } + x; // Unreachable + ~~ +!!! error TS7027: Unreachable code detected. + } + + function f42(x: number) { + try { + x; + fail(); + x; // Unreachable + ~~ +!!! error TS7027: Unreachable code detected. + } + finally { + x; + } + x; // Unreachable + ~~ +!!! error TS7027: Unreachable code detected. + } + + // Repro from #33582 + + export interface Component { + attrName?: string; + data: T; + dependencies?: string[]; + el: any; + id: string; + multiple?: boolean; + name: string; + schema: unknown; + system: any; + + init(data?: T): void; + pause(): void; + play(): void; + remove(): void; + tick?(time: number, timeDelta: number): void; + update(oldData: T): void; + updateSchema?(): void; + + extendSchema(update: unknown): void; + flushToDOM(): void; + } + + export interface ComponentConstructor { + new (el: unknown, attrValue: string, id: string): T & Component; + prototype: T & { + name: string; + system: unknown; + play(): void; + pause(): void; + }; + } + + declare function registerComponent( + name: string, + component: ComponentDefinition + ): ComponentConstructor; + + export type ComponentDefinition = T & Partial & ThisType; + + const Component = registerComponent('test-component', { + schema: { + myProperty: { + default: [], + parse() { + return [true]; + } + }, + string: { type: 'string' }, + num: 0 + }, + init() { + this.data.num = 0; + this.el.setAttribute('custom-attribute', 'custom-value'); + }, + update() {}, + tick() {}, + remove() {}, + pause() {}, + play() {}, + + multiply(f: number) { + // Reference to system because both were registered with the same name. + return f * this.data.num * this.system!.data.counter; + } + }); + \ No newline at end of file diff --git a/tests/baselines/reference/neverReturningFunctions1.js b/tests/baselines/reference/neverReturningFunctions1.js new file mode 100644 index 0000000000000..a99cc51e06dad --- /dev/null +++ b/tests/baselines/reference/neverReturningFunctions1.js @@ -0,0 +1,435 @@ +//// [neverReturningFunctions1.ts] +function fail(message?: string): never { + throw new Error(message); +} + +function f01(x: string | undefined) { + if (x === undefined) fail("undefined argument"); + x.length; // string +} + +function f02(x: number): number { + if (x >= 0) return x; + fail("negative number"); + x; // Unreachable +} + +function f03(x: string) { + x; // string + fail(); + x; // Unreachable +} + +function f11(x: string | undefined, fail: (message?: string) => never) { + if (x === undefined) fail("undefined argument"); + x.length; // string +} + +function f12(x: number, fail: (message?: string) => never): number { + if (x >= 0) return x; + fail("negative number"); + x; // Unreachable +} + +function f13(x: string, fail: (message?: string) => never) { + x; // string + fail(); + x; // Unreachable +} + +namespace Debug { + export declare function fail(message?: string): never; +} + +function f21(x: string | undefined) { + if (x === undefined) Debug.fail("undefined argument"); + x.length; // string +} + +function f22(x: number): number { + if (x >= 0) return x; + Debug.fail("negative number"); + x; // Unreachable +} + +function f23(x: string) { + x; // string + Debug.fail(); + x; // Unreachable +} + +function f24(x: string) { + x; // string + ((Debug).fail)(); + x; // Unreachable +} + +class Test { + fail(message?: string): never { + throw new Error(message); + } + f1(x: string | undefined) { + if (x === undefined) this.fail("undefined argument"); + x.length; // string + } + f2(x: number): number { + if (x >= 0) return x; + this.fail("negative number"); + x; // Unreachable + } + f3(x: string) { + x; // string + this.fail(); + x; // Unreachable + } +} + +function f30(x: string | number | undefined) { + if (typeof x === "string") { + fail(); + x; // Unreachable + } + else { + x; // number | undefined + if (x !== undefined) { + x; // number + fail(); + x; // Unreachable + } + else { + x; // undefined + fail(); + x; // Unreachable + } + x; // Unreachable + } + x; // Unreachable +} + +function f31(x: { a: string | number }) { + if (typeof x.a === "string") { + fail(); + x; // Unreachable + x.a; // Unreachable + } + x; // { a: string | number } + x.a; // number +} + +function f40(x: number) { + try { + x; + fail(); + x; // Unreachable + } + finally { + x; + fail(); + x; // Unreachable + } + x; // Unreachable +} + +function f41(x: number) { + try { + x; + } + finally { + x; + fail(); + x; // Unreachable + } + x; // Unreachable +} + +function f42(x: number) { + try { + x; + fail(); + x; // Unreachable + } + finally { + x; + } + x; // Unreachable +} + +// Repro from #33582 + +export interface Component { + attrName?: string; + data: T; + dependencies?: string[]; + el: any; + id: string; + multiple?: boolean; + name: string; + schema: unknown; + system: any; + + init(data?: T): void; + pause(): void; + play(): void; + remove(): void; + tick?(time: number, timeDelta: number): void; + update(oldData: T): void; + updateSchema?(): void; + + extendSchema(update: unknown): void; + flushToDOM(): void; +} + +export interface ComponentConstructor { + new (el: unknown, attrValue: string, id: string): T & Component; + prototype: T & { + name: string; + system: unknown; + play(): void; + pause(): void; + }; +} + +declare function registerComponent( + name: string, + component: ComponentDefinition +): ComponentConstructor; + +export type ComponentDefinition = T & Partial & ThisType; + +const Component = registerComponent('test-component', { + schema: { + myProperty: { + default: [], + parse() { + return [true]; + } + }, + string: { type: 'string' }, + num: 0 + }, + init() { + this.data.num = 0; + this.el.setAttribute('custom-attribute', 'custom-value'); + }, + update() {}, + tick() {}, + remove() {}, + pause() {}, + play() {}, + + multiply(f: number) { + // Reference to system because both were registered with the same name. + return f * this.data.num * this.system!.data.counter; + } +}); + + +//// [neverReturningFunctions1.js] +"use strict"; +exports.__esModule = true; +function fail(message) { + throw new Error(message); +} +function f01(x) { + if (x === undefined) + fail("undefined argument"); + x.length; // string +} +function f02(x) { + if (x >= 0) + return x; + fail("negative number"); + x; // Unreachable +} +function f03(x) { + x; // string + fail(); + x; // Unreachable +} +function f11(x, fail) { + if (x === undefined) + fail("undefined argument"); + x.length; // string +} +function f12(x, fail) { + if (x >= 0) + return x; + fail("negative number"); + x; // Unreachable +} +function f13(x, fail) { + x; // string + fail(); + x; // Unreachable +} +var Debug; +(function (Debug) { +})(Debug || (Debug = {})); +function f21(x) { + if (x === undefined) + Debug.fail("undefined argument"); + x.length; // string +} +function f22(x) { + if (x >= 0) + return x; + Debug.fail("negative number"); + x; // Unreachable +} +function f23(x) { + x; // string + Debug.fail(); + x; // Unreachable +} +function f24(x) { + x; // string + ((Debug).fail)(); + x; // Unreachable +} +var Test = /** @class */ (function () { + function Test() { + } + Test.prototype.fail = function (message) { + throw new Error(message); + }; + Test.prototype.f1 = function (x) { + if (x === undefined) + this.fail("undefined argument"); + x.length; // string + }; + Test.prototype.f2 = function (x) { + if (x >= 0) + return x; + this.fail("negative number"); + x; // Unreachable + }; + Test.prototype.f3 = function (x) { + x; // string + this.fail(); + x; // Unreachable + }; + return Test; +}()); +function f30(x) { + if (typeof x === "string") { + fail(); + x; // Unreachable + } + else { + x; // number | undefined + if (x !== undefined) { + x; // number + fail(); + x; // Unreachable + } + else { + x; // undefined + fail(); + x; // Unreachable + } + x; // Unreachable + } + x; // Unreachable +} +function f31(x) { + if (typeof x.a === "string") { + fail(); + x; // Unreachable + x.a; // Unreachable + } + x; // { a: string | number } + x.a; // number +} +function f40(x) { + try { + x; + fail(); + x; // Unreachable + } + finally { + x; + fail(); + x; // Unreachable + } + x; // Unreachable +} +function f41(x) { + try { + x; + } + finally { + x; + fail(); + x; // Unreachable + } + x; // Unreachable +} +function f42(x) { + try { + x; + fail(); + x; // Unreachable + } + finally { + x; + } + x; // Unreachable +} +var Component = registerComponent('test-component', { + schema: { + myProperty: { + "default": [], + parse: function () { + return [true]; + } + }, + string: { type: 'string' }, + num: 0 + }, + init: function () { + this.data.num = 0; + this.el.setAttribute('custom-attribute', 'custom-value'); + }, + update: function () { }, + tick: function () { }, + remove: function () { }, + pause: function () { }, + play: function () { }, + multiply: function (f) { + // Reference to system because both were registered with the same name. + return f * this.data.num * this.system.data.counter; + } +}); + + +//// [neverReturningFunctions1.d.ts] +export interface Component { + attrName?: string; + data: T; + dependencies?: string[]; + el: any; + id: string; + multiple?: boolean; + name: string; + schema: unknown; + system: any; + init(data?: T): void; + pause(): void; + play(): void; + remove(): void; + tick?(time: number, timeDelta: number): void; + update(oldData: T): void; + updateSchema?(): void; + extendSchema(update: unknown): void; + flushToDOM(): void; +} +export interface ComponentConstructor { + new (el: unknown, attrValue: string, id: string): T & Component; + prototype: T & { + name: string; + system: unknown; + play(): void; + pause(): void; + }; +} +export declare type ComponentDefinition = T & Partial & ThisType; diff --git a/tests/baselines/reference/neverReturningFunctions1.symbols b/tests/baselines/reference/neverReturningFunctions1.symbols new file mode 100644 index 0000000000000..2ec4c5f93d38a --- /dev/null +++ b/tests/baselines/reference/neverReturningFunctions1.symbols @@ -0,0 +1,580 @@ +=== tests/cases/conformance/controlFlow/neverReturningFunctions1.ts === +function fail(message?: string): never { +>fail : Symbol(fail, Decl(neverReturningFunctions1.ts, 0, 0)) +>message : Symbol(message, Decl(neverReturningFunctions1.ts, 0, 14)) + + throw new Error(message); +>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>message : Symbol(message, Decl(neverReturningFunctions1.ts, 0, 14)) +} + +function f01(x: string | undefined) { +>f01 : Symbol(f01, Decl(neverReturningFunctions1.ts, 2, 1)) +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 4, 13)) + + if (x === undefined) fail("undefined argument"); +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 4, 13)) +>undefined : Symbol(undefined) +>fail : Symbol(fail, Decl(neverReturningFunctions1.ts, 0, 0)) + + x.length; // string +>x.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 4, 13)) +>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) +} + +function f02(x: number): number { +>f02 : Symbol(f02, Decl(neverReturningFunctions1.ts, 7, 1)) +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 9, 13)) + + if (x >= 0) return x; +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 9, 13)) +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 9, 13)) + + fail("negative number"); +>fail : Symbol(fail, Decl(neverReturningFunctions1.ts, 0, 0)) + + x; // Unreachable +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 9, 13)) +} + +function f03(x: string) { +>f03 : Symbol(f03, Decl(neverReturningFunctions1.ts, 13, 1)) +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 15, 13)) + + x; // string +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 15, 13)) + + fail(); +>fail : Symbol(fail, Decl(neverReturningFunctions1.ts, 0, 0)) + + x; // Unreachable +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 15, 13)) +} + +function f11(x: string | undefined, fail: (message?: string) => never) { +>f11 : Symbol(f11, Decl(neverReturningFunctions1.ts, 19, 1)) +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 21, 13)) +>fail : Symbol(fail, Decl(neverReturningFunctions1.ts, 21, 35)) +>message : Symbol(message, Decl(neverReturningFunctions1.ts, 21, 43)) + + if (x === undefined) fail("undefined argument"); +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 21, 13)) +>undefined : Symbol(undefined) +>fail : Symbol(fail, Decl(neverReturningFunctions1.ts, 21, 35)) + + x.length; // string +>x.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 21, 13)) +>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) +} + +function f12(x: number, fail: (message?: string) => never): number { +>f12 : Symbol(f12, Decl(neverReturningFunctions1.ts, 24, 1)) +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 26, 13)) +>fail : Symbol(fail, Decl(neverReturningFunctions1.ts, 26, 23)) +>message : Symbol(message, Decl(neverReturningFunctions1.ts, 26, 31)) + + if (x >= 0) return x; +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 26, 13)) +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 26, 13)) + + fail("negative number"); +>fail : Symbol(fail, Decl(neverReturningFunctions1.ts, 26, 23)) + + x; // Unreachable +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 26, 13)) +} + +function f13(x: string, fail: (message?: string) => never) { +>f13 : Symbol(f13, Decl(neverReturningFunctions1.ts, 30, 1)) +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 32, 13)) +>fail : Symbol(fail, Decl(neverReturningFunctions1.ts, 32, 23)) +>message : Symbol(message, Decl(neverReturningFunctions1.ts, 32, 31)) + + x; // string +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 32, 13)) + + fail(); +>fail : Symbol(fail, Decl(neverReturningFunctions1.ts, 32, 23)) + + x; // Unreachable +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 32, 13)) +} + +namespace Debug { +>Debug : Symbol(Debug, Decl(neverReturningFunctions1.ts, 36, 1)) + + export declare function fail(message?: string): never; +>fail : Symbol(fail, Decl(neverReturningFunctions1.ts, 38, 17)) +>message : Symbol(message, Decl(neverReturningFunctions1.ts, 39, 33)) +} + +function f21(x: string | undefined) { +>f21 : Symbol(f21, Decl(neverReturningFunctions1.ts, 40, 1)) +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 42, 13)) + + if (x === undefined) Debug.fail("undefined argument"); +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 42, 13)) +>undefined : Symbol(undefined) +>Debug.fail : Symbol(Debug.fail, Decl(neverReturningFunctions1.ts, 38, 17)) +>Debug : Symbol(Debug, Decl(neverReturningFunctions1.ts, 36, 1)) +>fail : Symbol(Debug.fail, Decl(neverReturningFunctions1.ts, 38, 17)) + + x.length; // string +>x.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 42, 13)) +>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) +} + +function f22(x: number): number { +>f22 : Symbol(f22, Decl(neverReturningFunctions1.ts, 45, 1)) +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 47, 13)) + + if (x >= 0) return x; +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 47, 13)) +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 47, 13)) + + Debug.fail("negative number"); +>Debug.fail : Symbol(Debug.fail, Decl(neverReturningFunctions1.ts, 38, 17)) +>Debug : Symbol(Debug, Decl(neverReturningFunctions1.ts, 36, 1)) +>fail : Symbol(Debug.fail, Decl(neverReturningFunctions1.ts, 38, 17)) + + x; // Unreachable +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 47, 13)) +} + +function f23(x: string) { +>f23 : Symbol(f23, Decl(neverReturningFunctions1.ts, 51, 1)) +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 53, 13)) + + x; // string +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 53, 13)) + + Debug.fail(); +>Debug.fail : Symbol(Debug.fail, Decl(neverReturningFunctions1.ts, 38, 17)) +>Debug : Symbol(Debug, Decl(neverReturningFunctions1.ts, 36, 1)) +>fail : Symbol(Debug.fail, Decl(neverReturningFunctions1.ts, 38, 17)) + + x; // Unreachable +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 53, 13)) +} + +function f24(x: string) { +>f24 : Symbol(f24, Decl(neverReturningFunctions1.ts, 57, 1)) +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 59, 13)) + + x; // string +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 59, 13)) + + ((Debug).fail)(); +>(Debug).fail : Symbol(Debug.fail, Decl(neverReturningFunctions1.ts, 38, 17)) +>Debug : Symbol(Debug, Decl(neverReturningFunctions1.ts, 36, 1)) +>fail : Symbol(Debug.fail, Decl(neverReturningFunctions1.ts, 38, 17)) + + x; // Unreachable +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 59, 13)) +} + +class Test { +>Test : Symbol(Test, Decl(neverReturningFunctions1.ts, 63, 1)) + + fail(message?: string): never { +>fail : Symbol(Test.fail, Decl(neverReturningFunctions1.ts, 65, 12)) +>message : Symbol(message, Decl(neverReturningFunctions1.ts, 66, 9)) + + throw new Error(message); +>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>message : Symbol(message, Decl(neverReturningFunctions1.ts, 66, 9)) + } + f1(x: string | undefined) { +>f1 : Symbol(Test.f1, Decl(neverReturningFunctions1.ts, 68, 5)) +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 69, 7)) + + if (x === undefined) this.fail("undefined argument"); +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 69, 7)) +>undefined : Symbol(undefined) +>this.fail : Symbol(Test.fail, Decl(neverReturningFunctions1.ts, 65, 12)) +>this : Symbol(Test, Decl(neverReturningFunctions1.ts, 63, 1)) +>fail : Symbol(Test.fail, Decl(neverReturningFunctions1.ts, 65, 12)) + + x.length; // string +>x.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 69, 7)) +>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) + } + f2(x: number): number { +>f2 : Symbol(Test.f2, Decl(neverReturningFunctions1.ts, 72, 5)) +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 73, 7)) + + if (x >= 0) return x; +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 73, 7)) +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 73, 7)) + + this.fail("negative number"); +>this.fail : Symbol(Test.fail, Decl(neverReturningFunctions1.ts, 65, 12)) +>this : Symbol(Test, Decl(neverReturningFunctions1.ts, 63, 1)) +>fail : Symbol(Test.fail, Decl(neverReturningFunctions1.ts, 65, 12)) + + x; // Unreachable +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 73, 7)) + } + f3(x: string) { +>f3 : Symbol(Test.f3, Decl(neverReturningFunctions1.ts, 77, 5)) +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 78, 7)) + + x; // string +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 78, 7)) + + this.fail(); +>this.fail : Symbol(Test.fail, Decl(neverReturningFunctions1.ts, 65, 12)) +>this : Symbol(Test, Decl(neverReturningFunctions1.ts, 63, 1)) +>fail : Symbol(Test.fail, Decl(neverReturningFunctions1.ts, 65, 12)) + + x; // Unreachable +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 78, 7)) + } +} + +function f30(x: string | number | undefined) { +>f30 : Symbol(f30, Decl(neverReturningFunctions1.ts, 83, 1)) +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 85, 13)) + + if (typeof x === "string") { +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 85, 13)) + + fail(); +>fail : Symbol(fail, Decl(neverReturningFunctions1.ts, 0, 0)) + + x; // Unreachable +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 85, 13)) + } + else { + x; // number | undefined +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 85, 13)) + + if (x !== undefined) { +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 85, 13)) +>undefined : Symbol(undefined) + + x; // number +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 85, 13)) + + fail(); +>fail : Symbol(fail, Decl(neverReturningFunctions1.ts, 0, 0)) + + x; // Unreachable +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 85, 13)) + } + else { + x; // undefined +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 85, 13)) + + fail(); +>fail : Symbol(fail, Decl(neverReturningFunctions1.ts, 0, 0)) + + x; // Unreachable +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 85, 13)) + } + x; // Unreachable +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 85, 13)) + } + x; // Unreachable +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 85, 13)) +} + +function f31(x: { a: string | number }) { +>f31 : Symbol(f31, Decl(neverReturningFunctions1.ts, 105, 1)) +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 107, 13)) +>a : Symbol(a, Decl(neverReturningFunctions1.ts, 107, 17)) + + if (typeof x.a === "string") { +>x.a : Symbol(a, Decl(neverReturningFunctions1.ts, 107, 17)) +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 107, 13)) +>a : Symbol(a, Decl(neverReturningFunctions1.ts, 107, 17)) + + fail(); +>fail : Symbol(fail, Decl(neverReturningFunctions1.ts, 0, 0)) + + x; // Unreachable +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 107, 13)) + + x.a; // Unreachable +>x.a : Symbol(a, Decl(neverReturningFunctions1.ts, 107, 17)) +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 107, 13)) +>a : Symbol(a, Decl(neverReturningFunctions1.ts, 107, 17)) + } + x; // { a: string | number } +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 107, 13)) + + x.a; // number +>x.a : Symbol(a, Decl(neverReturningFunctions1.ts, 107, 17)) +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 107, 13)) +>a : Symbol(a, Decl(neverReturningFunctions1.ts, 107, 17)) +} + +function f40(x: number) { +>f40 : Symbol(f40, Decl(neverReturningFunctions1.ts, 115, 1)) +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 117, 13)) + + try { + x; +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 117, 13)) + + fail(); +>fail : Symbol(fail, Decl(neverReturningFunctions1.ts, 0, 0)) + + x; // Unreachable +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 117, 13)) + } + finally { + x; +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 117, 13)) + + fail(); +>fail : Symbol(fail, Decl(neverReturningFunctions1.ts, 0, 0)) + + x; // Unreachable +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 117, 13)) + } + x; // Unreachable +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 117, 13)) +} + +function f41(x: number) { +>f41 : Symbol(f41, Decl(neverReturningFunctions1.ts, 129, 1)) +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 131, 13)) + + try { + x; +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 131, 13)) + } + finally { + x; +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 131, 13)) + + fail(); +>fail : Symbol(fail, Decl(neverReturningFunctions1.ts, 0, 0)) + + x; // Unreachable +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 131, 13)) + } + x; // Unreachable +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 131, 13)) +} + +function f42(x: number) { +>f42 : Symbol(f42, Decl(neverReturningFunctions1.ts, 141, 1)) +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 143, 13)) + + try { + x; +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 143, 13)) + + fail(); +>fail : Symbol(fail, Decl(neverReturningFunctions1.ts, 0, 0)) + + x; // Unreachable +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 143, 13)) + } + finally { + x; +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 143, 13)) + } + x; // Unreachable +>x : Symbol(x, Decl(neverReturningFunctions1.ts, 143, 13)) +} + +// Repro from #33582 + +export interface Component { +>Component : Symbol(Component, Decl(neverReturningFunctions1.ts, 153, 1)) +>T : Symbol(T, Decl(neverReturningFunctions1.ts, 157, 27)) + + attrName?: string; +>attrName : Symbol(Component.attrName, Decl(neverReturningFunctions1.ts, 157, 52)) + + data: T; +>data : Symbol(Component.data, Decl(neverReturningFunctions1.ts, 158, 19)) +>T : Symbol(T, Decl(neverReturningFunctions1.ts, 157, 27)) + + dependencies?: string[]; +>dependencies : Symbol(Component.dependencies, Decl(neverReturningFunctions1.ts, 159, 9)) + + el: any; +>el : Symbol(Component.el, Decl(neverReturningFunctions1.ts, 160, 25)) + + id: string; +>id : Symbol(Component.id, Decl(neverReturningFunctions1.ts, 161, 9)) + + multiple?: boolean; +>multiple : Symbol(Component.multiple, Decl(neverReturningFunctions1.ts, 162, 12)) + + name: string; +>name : Symbol(Component.name, Decl(neverReturningFunctions1.ts, 163, 20)) + + schema: unknown; +>schema : Symbol(Component.schema, Decl(neverReturningFunctions1.ts, 164, 14)) + + system: any; +>system : Symbol(Component.system, Decl(neverReturningFunctions1.ts, 165, 17)) + + init(data?: T): void; +>init : Symbol(Component.init, Decl(neverReturningFunctions1.ts, 166, 13)) +>data : Symbol(data, Decl(neverReturningFunctions1.ts, 168, 6)) +>T : Symbol(T, Decl(neverReturningFunctions1.ts, 157, 27)) + + pause(): void; +>pause : Symbol(Component.pause, Decl(neverReturningFunctions1.ts, 168, 22)) + + play(): void; +>play : Symbol(Component.play, Decl(neverReturningFunctions1.ts, 169, 15)) + + remove(): void; +>remove : Symbol(Component.remove, Decl(neverReturningFunctions1.ts, 170, 14)) + + tick?(time: number, timeDelta: number): void; +>tick : Symbol(Component.tick, Decl(neverReturningFunctions1.ts, 171, 16)) +>time : Symbol(time, Decl(neverReturningFunctions1.ts, 172, 7)) +>timeDelta : Symbol(timeDelta, Decl(neverReturningFunctions1.ts, 172, 20)) + + update(oldData: T): void; +>update : Symbol(Component.update, Decl(neverReturningFunctions1.ts, 172, 46)) +>oldData : Symbol(oldData, Decl(neverReturningFunctions1.ts, 173, 8)) +>T : Symbol(T, Decl(neverReturningFunctions1.ts, 157, 27)) + + updateSchema?(): void; +>updateSchema : Symbol(Component.updateSchema, Decl(neverReturningFunctions1.ts, 173, 26)) + + extendSchema(update: unknown): void; +>extendSchema : Symbol(Component.extendSchema, Decl(neverReturningFunctions1.ts, 174, 23)) +>update : Symbol(update, Decl(neverReturningFunctions1.ts, 176, 14)) + + flushToDOM(): void; +>flushToDOM : Symbol(Component.flushToDOM, Decl(neverReturningFunctions1.ts, 176, 37)) +} + +export interface ComponentConstructor { +>ComponentConstructor : Symbol(ComponentConstructor, Decl(neverReturningFunctions1.ts, 178, 1)) +>T : Symbol(T, Decl(neverReturningFunctions1.ts, 180, 38)) + + new (el: unknown, attrValue: string, id: string): T & Component; +>el : Symbol(el, Decl(neverReturningFunctions1.ts, 181, 6)) +>attrValue : Symbol(attrValue, Decl(neverReturningFunctions1.ts, 181, 18)) +>id : Symbol(id, Decl(neverReturningFunctions1.ts, 181, 37)) +>T : Symbol(T, Decl(neverReturningFunctions1.ts, 180, 38)) +>Component : Symbol(Component, Decl(neverReturningFunctions1.ts, 153, 1)) + + prototype: T & { +>prototype : Symbol(ComponentConstructor.prototype, Decl(neverReturningFunctions1.ts, 181, 65)) +>T : Symbol(T, Decl(neverReturningFunctions1.ts, 180, 38)) + + name: string; +>name : Symbol(name, Decl(neverReturningFunctions1.ts, 182, 17)) + + system: unknown; +>system : Symbol(system, Decl(neverReturningFunctions1.ts, 183, 15)) + + play(): void; +>play : Symbol(play, Decl(neverReturningFunctions1.ts, 184, 18)) + + pause(): void; +>pause : Symbol(pause, Decl(neverReturningFunctions1.ts, 185, 15)) + + }; +} + +declare function registerComponent( +>registerComponent : Symbol(registerComponent, Decl(neverReturningFunctions1.ts, 188, 1)) +>T : Symbol(T, Decl(neverReturningFunctions1.ts, 190, 35)) + + name: string, +>name : Symbol(name, Decl(neverReturningFunctions1.ts, 190, 53)) + + component: ComponentDefinition +>component : Symbol(component, Decl(neverReturningFunctions1.ts, 191, 17)) +>ComponentDefinition : Symbol(ComponentDefinition, Decl(neverReturningFunctions1.ts, 193, 27)) +>T : Symbol(T, Decl(neverReturningFunctions1.ts, 190, 35)) + +): ComponentConstructor; +>ComponentConstructor : Symbol(ComponentConstructor, Decl(neverReturningFunctions1.ts, 178, 1)) +>T : Symbol(T, Decl(neverReturningFunctions1.ts, 190, 35)) + +export type ComponentDefinition = T & Partial & ThisType; +>ComponentDefinition : Symbol(ComponentDefinition, Decl(neverReturningFunctions1.ts, 193, 27)) +>T : Symbol(T, Decl(neverReturningFunctions1.ts, 195, 32)) +>T : Symbol(T, Decl(neverReturningFunctions1.ts, 195, 32)) +>Partial : Symbol(Partial, Decl(lib.es5.d.ts, --, --)) +>Component : Symbol(Component, Decl(neverReturningFunctions1.ts, 153, 1)) +>ThisType : Symbol(ThisType, Decl(lib.es5.d.ts, --, --)) +>T : Symbol(T, Decl(neverReturningFunctions1.ts, 195, 32)) +>Component : Symbol(Component, Decl(neverReturningFunctions1.ts, 153, 1)) + +const Component = registerComponent('test-component', { +>Component : Symbol(Component, Decl(neverReturningFunctions1.ts, 153, 1), Decl(neverReturningFunctions1.ts, 197, 5)) +>registerComponent : Symbol(registerComponent, Decl(neverReturningFunctions1.ts, 188, 1)) + + schema: { +>schema : Symbol(schema, Decl(neverReturningFunctions1.ts, 197, 55)) + + myProperty: { +>myProperty : Symbol(myProperty, Decl(neverReturningFunctions1.ts, 198, 10)) + + default: [], +>default : Symbol(default, Decl(neverReturningFunctions1.ts, 199, 15)) + + parse() { +>parse : Symbol(parse, Decl(neverReturningFunctions1.ts, 200, 15)) + + return [true]; + } + }, + string: { type: 'string' }, +>string : Symbol(string, Decl(neverReturningFunctions1.ts, 204, 4)) +>type : Symbol(type, Decl(neverReturningFunctions1.ts, 205, 11)) + + num: 0 +>num : Symbol(num, Decl(neverReturningFunctions1.ts, 205, 29)) + + }, + init() { +>init : Symbol(init, Decl(neverReturningFunctions1.ts, 207, 3)) + + this.data.num = 0; +>this.data : Symbol(Component.data, Decl(neverReturningFunctions1.ts, 158, 19)) +>data : Symbol(Component.data, Decl(neverReturningFunctions1.ts, 158, 19)) + + this.el.setAttribute('custom-attribute', 'custom-value'); +>this.el : Symbol(Component.el, Decl(neverReturningFunctions1.ts, 160, 25)) +>el : Symbol(Component.el, Decl(neverReturningFunctions1.ts, 160, 25)) + + }, + update() {}, +>update : Symbol(update, Decl(neverReturningFunctions1.ts, 211, 3)) + + tick() {}, +>tick : Symbol(tick, Decl(neverReturningFunctions1.ts, 212, 13)) + + remove() {}, +>remove : Symbol(remove, Decl(neverReturningFunctions1.ts, 213, 11)) + + pause() {}, +>pause : Symbol(pause, Decl(neverReturningFunctions1.ts, 214, 13)) + + play() {}, +>play : Symbol(play, Decl(neverReturningFunctions1.ts, 215, 12)) + + multiply(f: number) { +>multiply : Symbol(multiply, Decl(neverReturningFunctions1.ts, 216, 11)) +>f : Symbol(f, Decl(neverReturningFunctions1.ts, 218, 10)) + + // Reference to system because both were registered with the same name. + return f * this.data.num * this.system!.data.counter; +>f : Symbol(f, Decl(neverReturningFunctions1.ts, 218, 10)) +>this.data : Symbol(Component.data, Decl(neverReturningFunctions1.ts, 158, 19)) +>data : Symbol(Component.data, Decl(neverReturningFunctions1.ts, 158, 19)) +>this.system : Symbol(Component.system, Decl(neverReturningFunctions1.ts, 165, 17)) +>system : Symbol(Component.system, Decl(neverReturningFunctions1.ts, 165, 17)) + } +}); + diff --git a/tests/baselines/reference/neverReturningFunctions1.types b/tests/baselines/reference/neverReturningFunctions1.types new file mode 100644 index 0000000000000..ed49d1841b878 --- /dev/null +++ b/tests/baselines/reference/neverReturningFunctions1.types @@ -0,0 +1,641 @@ +=== tests/cases/conformance/controlFlow/neverReturningFunctions1.ts === +function fail(message?: string): never { +>fail : (message?: string | undefined) => never +>message : string | undefined + + throw new Error(message); +>new Error(message) : Error +>Error : ErrorConstructor +>message : string | undefined +} + +function f01(x: string | undefined) { +>f01 : (x: string | undefined) => void +>x : string | undefined + + if (x === undefined) fail("undefined argument"); +>x === undefined : boolean +>x : string | undefined +>undefined : undefined +>fail("undefined argument") : never +>fail : (message?: string | undefined) => never +>"undefined argument" : "undefined argument" + + x.length; // string +>x.length : number +>x : string +>length : number +} + +function f02(x: number): number { +>f02 : (x: number) => number +>x : number + + if (x >= 0) return x; +>x >= 0 : boolean +>x : number +>0 : 0 +>x : number + + fail("negative number"); +>fail("negative number") : never +>fail : (message?: string | undefined) => never +>"negative number" : "negative number" + + x; // Unreachable +>x : number +} + +function f03(x: string) { +>f03 : (x: string) => void +>x : string + + x; // string +>x : string + + fail(); +>fail() : never +>fail : (message?: string | undefined) => never + + x; // Unreachable +>x : string +} + +function f11(x: string | undefined, fail: (message?: string) => never) { +>f11 : (x: string | undefined, fail: (message?: string | undefined) => never) => void +>x : string | undefined +>fail : (message?: string | undefined) => never +>message : string | undefined + + if (x === undefined) fail("undefined argument"); +>x === undefined : boolean +>x : string | undefined +>undefined : undefined +>fail("undefined argument") : never +>fail : (message?: string | undefined) => never +>"undefined argument" : "undefined argument" + + x.length; // string +>x.length : number +>x : string +>length : number +} + +function f12(x: number, fail: (message?: string) => never): number { +>f12 : (x: number, fail: (message?: string | undefined) => never) => number +>x : number +>fail : (message?: string | undefined) => never +>message : string | undefined + + if (x >= 0) return x; +>x >= 0 : boolean +>x : number +>0 : 0 +>x : number + + fail("negative number"); +>fail("negative number") : never +>fail : (message?: string | undefined) => never +>"negative number" : "negative number" + + x; // Unreachable +>x : number +} + +function f13(x: string, fail: (message?: string) => never) { +>f13 : (x: string, fail: (message?: string | undefined) => never) => void +>x : string +>fail : (message?: string | undefined) => never +>message : string | undefined + + x; // string +>x : string + + fail(); +>fail() : never +>fail : (message?: string | undefined) => never + + x; // Unreachable +>x : string +} + +namespace Debug { +>Debug : typeof Debug + + export declare function fail(message?: string): never; +>fail : (message?: string | undefined) => never +>message : string | undefined +} + +function f21(x: string | undefined) { +>f21 : (x: string | undefined) => void +>x : string | undefined + + if (x === undefined) Debug.fail("undefined argument"); +>x === undefined : boolean +>x : string | undefined +>undefined : undefined +>Debug.fail("undefined argument") : never +>Debug.fail : (message?: string | undefined) => never +>Debug : typeof Debug +>fail : (message?: string | undefined) => never +>"undefined argument" : "undefined argument" + + x.length; // string +>x.length : number +>x : string +>length : number +} + +function f22(x: number): number { +>f22 : (x: number) => number +>x : number + + if (x >= 0) return x; +>x >= 0 : boolean +>x : number +>0 : 0 +>x : number + + Debug.fail("negative number"); +>Debug.fail("negative number") : never +>Debug.fail : (message?: string | undefined) => never +>Debug : typeof Debug +>fail : (message?: string | undefined) => never +>"negative number" : "negative number" + + x; // Unreachable +>x : number +} + +function f23(x: string) { +>f23 : (x: string) => void +>x : string + + x; // string +>x : string + + Debug.fail(); +>Debug.fail() : never +>Debug.fail : (message?: string | undefined) => never +>Debug : typeof Debug +>fail : (message?: string | undefined) => never + + x; // Unreachable +>x : string +} + +function f24(x: string) { +>f24 : (x: string) => void +>x : string + + x; // string +>x : string + + ((Debug).fail)(); +>((Debug).fail)() : never +>((Debug).fail) : (message?: string | undefined) => never +>(Debug).fail : (message?: string | undefined) => never +>(Debug) : typeof Debug +>Debug : typeof Debug +>fail : (message?: string | undefined) => never + + x; // Unreachable +>x : string +} + +class Test { +>Test : Test + + fail(message?: string): never { +>fail : (message?: string | undefined) => never +>message : string | undefined + + throw new Error(message); +>new Error(message) : Error +>Error : ErrorConstructor +>message : string | undefined + } + f1(x: string | undefined) { +>f1 : (x: string | undefined) => void +>x : string | undefined + + if (x === undefined) this.fail("undefined argument"); +>x === undefined : boolean +>x : string | undefined +>undefined : undefined +>this.fail("undefined argument") : never +>this.fail : (message?: string | undefined) => never +>this : this +>fail : (message?: string | undefined) => never +>"undefined argument" : "undefined argument" + + x.length; // string +>x.length : number +>x : string +>length : number + } + f2(x: number): number { +>f2 : (x: number) => number +>x : number + + if (x >= 0) return x; +>x >= 0 : boolean +>x : number +>0 : 0 +>x : number + + this.fail("negative number"); +>this.fail("negative number") : never +>this.fail : (message?: string | undefined) => never +>this : this +>fail : (message?: string | undefined) => never +>"negative number" : "negative number" + + x; // Unreachable +>x : number + } + f3(x: string) { +>f3 : (x: string) => void +>x : string + + x; // string +>x : string + + this.fail(); +>this.fail() : never +>this.fail : (message?: string | undefined) => never +>this : this +>fail : (message?: string | undefined) => never + + x; // Unreachable +>x : string + } +} + +function f30(x: string | number | undefined) { +>f30 : (x: string | number | undefined) => void +>x : string | number | undefined + + if (typeof x === "string") { +>typeof x === "string" : boolean +>typeof x : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" +>x : string | number | undefined +>"string" : "string" + + fail(); +>fail() : never +>fail : (message?: string | undefined) => never + + x; // Unreachable +>x : string | number | undefined + } + else { + x; // number | undefined +>x : number | undefined + + if (x !== undefined) { +>x !== undefined : boolean +>x : number | undefined +>undefined : undefined + + x; // number +>x : number + + fail(); +>fail() : never +>fail : (message?: string | undefined) => never + + x; // Unreachable +>x : string | number | undefined + } + else { + x; // undefined +>x : undefined + + fail(); +>fail() : never +>fail : (message?: string | undefined) => never + + x; // Unreachable +>x : string | number | undefined + } + x; // Unreachable +>x : string | number | undefined + } + x; // Unreachable +>x : string | number | undefined +} + +function f31(x: { a: string | number }) { +>f31 : (x: { a: string | number; }) => void +>x : { a: string | number; } +>a : string | number + + if (typeof x.a === "string") { +>typeof x.a === "string" : boolean +>typeof x.a : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" +>x.a : string | number +>x : { a: string | number; } +>a : string | number +>"string" : "string" + + fail(); +>fail() : never +>fail : (message?: string | undefined) => never + + x; // Unreachable +>x : { a: string | number; } + + x.a; // Unreachable +>x.a : string | number +>x : { a: string | number; } +>a : string | number + } + x; // { a: string | number } +>x : { a: string | number; } + + x.a; // number +>x.a : number +>x : { a: string | number; } +>a : number +} + +function f40(x: number) { +>f40 : (x: number) => void +>x : number + + try { + x; +>x : number + + fail(); +>fail() : never +>fail : (message?: string | undefined) => never + + x; // Unreachable +>x : number + } + finally { + x; +>x : number + + fail(); +>fail() : never +>fail : (message?: string | undefined) => never + + x; // Unreachable +>x : number + } + x; // Unreachable +>x : number +} + +function f41(x: number) { +>f41 : (x: number) => void +>x : number + + try { + x; +>x : number + } + finally { + x; +>x : number + + fail(); +>fail() : never +>fail : (message?: string | undefined) => never + + x; // Unreachable +>x : number + } + x; // Unreachable +>x : number +} + +function f42(x: number) { +>f42 : (x: number) => void +>x : number + + try { + x; +>x : number + + fail(); +>fail() : never +>fail : (message?: string | undefined) => never + + x; // Unreachable +>x : number + } + finally { + x; +>x : number + } + x; // Unreachable +>x : number +} + +// Repro from #33582 + +export interface Component { + attrName?: string; +>attrName : string | undefined + + data: T; +>data : T + + dependencies?: string[]; +>dependencies : string[] | undefined + + el: any; +>el : any + + id: string; +>id : string + + multiple?: boolean; +>multiple : boolean | undefined + + name: string; +>name : string + + schema: unknown; +>schema : unknown + + system: any; +>system : any + + init(data?: T): void; +>init : (data?: T | undefined) => void +>data : T | undefined + + pause(): void; +>pause : () => void + + play(): void; +>play : () => void + + remove(): void; +>remove : () => void + + tick?(time: number, timeDelta: number): void; +>tick : ((time: number, timeDelta: number) => void) | undefined +>time : number +>timeDelta : number + + update(oldData: T): void; +>update : (oldData: T) => void +>oldData : T + + updateSchema?(): void; +>updateSchema : (() => void) | undefined + + extendSchema(update: unknown): void; +>extendSchema : (update: unknown) => void +>update : unknown + + flushToDOM(): void; +>flushToDOM : () => void +} + +export interface ComponentConstructor { + new (el: unknown, attrValue: string, id: string): T & Component; +>el : unknown +>attrValue : string +>id : string + + prototype: T & { +>prototype : T & { name: string; system: unknown; play(): void; pause(): void; } + + name: string; +>name : string + + system: unknown; +>system : unknown + + play(): void; +>play : () => void + + pause(): void; +>pause : () => void + + }; +} + +declare function registerComponent( +>registerComponent : (name: string, component: ComponentDefinition) => ComponentConstructor + + name: string, +>name : string + + component: ComponentDefinition +>component : ComponentDefinition + +): ComponentConstructor; + +export type ComponentDefinition = T & Partial & ThisType; +>ComponentDefinition : ComponentDefinition + +const Component = registerComponent('test-component', { +>Component : ComponentConstructor<{ schema: { myProperty: { default: never[]; parse(): boolean[]; }; string: { type: string; }; num: number; }; init(): void; update(): void; tick(): void; remove(): void; pause(): void; play(): void; multiply(f: number): number; }> +>registerComponent('test-component', { schema: { myProperty: { default: [], parse() { return [true]; } }, string: { type: 'string' }, num: 0 }, init() { this.data.num = 0; this.el.setAttribute('custom-attribute', 'custom-value'); }, update() {}, tick() {}, remove() {}, pause() {}, play() {}, multiply(f: number) { // Reference to system because both were registered with the same name. return f * this.data.num * this.system!.data.counter; }}) : ComponentConstructor<{ schema: { myProperty: { default: never[]; parse(): boolean[]; }; string: { type: string; }; num: number; }; init(): void; update(): void; tick(): void; remove(): void; pause(): void; play(): void; multiply(f: number): number; }> +>registerComponent : (name: string, component: ComponentDefinition) => ComponentConstructor +>'test-component' : "test-component" +>{ schema: { myProperty: { default: [], parse() { return [true]; } }, string: { type: 'string' }, num: 0 }, init() { this.data.num = 0; this.el.setAttribute('custom-attribute', 'custom-value'); }, update() {}, tick() {}, remove() {}, pause() {}, play() {}, multiply(f: number) { // Reference to system because both were registered with the same name. return f * this.data.num * this.system!.data.counter; }} : { schema: { myProperty: { default: never[]; parse(): boolean[]; }; string: { type: string; }; num: number; }; init(): void; update(): void; tick(): void; remove(): void; pause(): void; play(): void; multiply(f: number): number; } + + schema: { +>schema : { myProperty: { default: never[]; parse(): boolean[]; }; string: { type: string; }; num: number; } +>{ myProperty: { default: [], parse() { return [true]; } }, string: { type: 'string' }, num: 0 } : { myProperty: { default: never[]; parse(): boolean[]; }; string: { type: string; }; num: number; } + + myProperty: { +>myProperty : { default: never[]; parse(): boolean[]; } +>{ default: [], parse() { return [true]; } } : { default: never[]; parse(): boolean[]; } + + default: [], +>default : never[] +>[] : never[] + + parse() { +>parse : () => boolean[] + + return [true]; +>[true] : true[] +>true : true + } + }, + string: { type: 'string' }, +>string : { type: string; } +>{ type: 'string' } : { type: string; } +>type : string +>'string' : "string" + + num: 0 +>num : number +>0 : 0 + + }, + init() { +>init : () => void + + this.data.num = 0; +>this.data.num = 0 : 0 +>this.data.num : any +>this.data : any +>this : { schema: { myProperty: { default: never[]; parse(): boolean[]; }; string: { type: string; }; num: number; }; init(): void; update(): void; tick(): void; remove(): void; pause(): void; play(): void; multiply(f: number): number; } & Component +>data : any +>num : any +>0 : 0 + + this.el.setAttribute('custom-attribute', 'custom-value'); +>this.el.setAttribute('custom-attribute', 'custom-value') : any +>this.el.setAttribute : any +>this.el : any +>this : { schema: { myProperty: { default: never[]; parse(): boolean[]; }; string: { type: string; }; num: number; }; init(): void; update(): void; tick(): void; remove(): void; pause(): void; play(): void; multiply(f: number): number; } & Component +>el : any +>setAttribute : any +>'custom-attribute' : "custom-attribute" +>'custom-value' : "custom-value" + + }, + update() {}, +>update : () => void + + tick() {}, +>tick : () => void + + remove() {}, +>remove : () => void + + pause() {}, +>pause : () => void + + play() {}, +>play : () => void + + multiply(f: number) { +>multiply : (f: number) => number +>f : number + + // Reference to system because both were registered with the same name. + return f * this.data.num * this.system!.data.counter; +>f * this.data.num * this.system!.data.counter : number +>f * this.data.num : number +>f : number +>this.data.num : any +>this.data : any +>this : { schema: { myProperty: { default: never[]; parse(): boolean[]; }; string: { type: string; }; num: number; }; init(): void; update(): void; tick(): void; remove(): void; pause(): void; play(): void; multiply(f: number): number; } & Component +>data : any +>num : any +>this.system!.data.counter : any +>this.system!.data : any +>this.system! : any +>this.system : any +>this : { schema: { myProperty: { default: never[]; parse(): boolean[]; }; string: { type: string; }; num: number; }; init(): void; update(): void; tick(): void; remove(): void; pause(): void; play(): void; multiply(f: number): number; } & Component +>system : any +>data : any +>counter : any + } +}); + diff --git a/tests/baselines/reference/objectTypeHidingMembersOfObjectAssignmentCompat.errors.txt b/tests/baselines/reference/objectTypeHidingMembersOfObjectAssignmentCompat.errors.txt index c4ee3ea17b27b..d4afd97723e24 100644 --- a/tests/baselines/reference/objectTypeHidingMembersOfObjectAssignmentCompat.errors.txt +++ b/tests/baselines/reference/objectTypeHidingMembersOfObjectAssignmentCompat.errors.txt @@ -1,15 +1,12 @@ tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentCompat.ts(7,1): error TS2322: Type 'I' is not assignable to type 'Object'. - Types of property 'toString' are incompatible. - Type '() => void' is not assignable to type '() => string'. - Type 'void' is not assignable to type 'string'. + The types returned by 'toString()' are incompatible between these types. + Type 'void' is not assignable to type 'string'. tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentCompat.ts(14,1): error TS2322: Type 'C' is not assignable to type 'Object'. - Types of property 'toString' are incompatible. - Type '() => void' is not assignable to type '() => string'. - Type 'void' is not assignable to type 'string'. + The types returned by 'toString()' are incompatible between these types. + Type 'void' is not assignable to type 'string'. tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentCompat.ts(20,1): error TS2322: Type '{ toString: () => void; }' is not assignable to type 'Object'. - Types of property 'toString' are incompatible. - Type '() => void' is not assignable to type '() => string'. - Type 'void' is not assignable to type 'string'. + The types returned by 'toString()' are incompatible between these types. + Type 'void' is not assignable to type 'string'. ==== tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentCompat.ts (3 errors) ==== @@ -22,9 +19,8 @@ tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentC o = i; // error ~ !!! error TS2322: Type 'I' is not assignable to type 'Object'. -!!! error TS2322: Types of property 'toString' are incompatible. -!!! error TS2322: Type '() => void' is not assignable to type '() => string'. -!!! error TS2322: Type 'void' is not assignable to type 'string'. +!!! error TS2322: The types returned by 'toString()' are incompatible between these types. +!!! error TS2322: Type 'void' is not assignable to type 'string'. i = o; // ok class C { @@ -34,9 +30,8 @@ tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentC o = c; // error ~ !!! error TS2322: Type 'C' is not assignable to type 'Object'. -!!! error TS2322: Types of property 'toString' are incompatible. -!!! error TS2322: Type '() => void' is not assignable to type '() => string'. -!!! error TS2322: Type 'void' is not assignable to type 'string'. +!!! error TS2322: The types returned by 'toString()' are incompatible between these types. +!!! error TS2322: Type 'void' is not assignable to type 'string'. c = o; // ok var a = { @@ -45,7 +40,6 @@ tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentC o = a; // error ~ !!! error TS2322: Type '{ toString: () => void; }' is not assignable to type 'Object'. -!!! error TS2322: Types of property 'toString' are incompatible. -!!! error TS2322: Type '() => void' is not assignable to type '() => string'. -!!! error TS2322: Type 'void' is not assignable to type 'string'. +!!! error TS2322: The types returned by 'toString()' are incompatible between these types. +!!! error TS2322: Type 'void' is not assignable to type 'string'. a = o; // ok \ No newline at end of file diff --git a/tests/baselines/reference/objectTypeHidingMembersOfObjectAssignmentCompat2.errors.txt b/tests/baselines/reference/objectTypeHidingMembersOfObjectAssignmentCompat2.errors.txt index 3e27b22240e6b..28d466457d73f 100644 --- a/tests/baselines/reference/objectTypeHidingMembersOfObjectAssignmentCompat2.errors.txt +++ b/tests/baselines/reference/objectTypeHidingMembersOfObjectAssignmentCompat2.errors.txt @@ -1,25 +1,18 @@ tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentCompat2.ts(7,1): error TS2322: Type 'I' is not assignable to type 'Object'. - Types of property 'toString' are incompatible. - Type '() => number' is not assignable to type '() => string'. - Type 'number' is not assignable to type 'string'. -tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentCompat2.ts(8,1): error TS2322: Type 'Object' is not assignable to type 'I'. - The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? - Types of property 'toString' are incompatible. - Type '() => string' is not assignable to type '() => number'. - Type 'string' is not assignable to type 'number'. + The types returned by 'toString()' are incompatible between these types. + Type 'number' is not assignable to type 'string'. +tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentCompat2.ts(8,1): error TS2696: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? + The types returned by 'toString()' are incompatible between these types. + Type 'string' is not assignable to type 'number'. tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentCompat2.ts(14,1): error TS2322: Type 'C' is not assignable to type 'Object'. - Types of property 'toString' are incompatible. - Type '() => number' is not assignable to type '() => string'. - Type 'number' is not assignable to type 'string'. -tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentCompat2.ts(15,1): error TS2322: Type 'Object' is not assignable to type 'C'. - The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? - Types of property 'toString' are incompatible. - Type '() => string' is not assignable to type '() => number'. - Type 'string' is not assignable to type 'number'. + The types returned by 'toString()' are incompatible between these types. + Type 'number' is not assignable to type 'string'. +tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentCompat2.ts(15,1): error TS2696: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? + The types returned by 'toString()' are incompatible between these types. + Type 'string' is not assignable to type 'number'. tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentCompat2.ts(20,1): error TS2322: Type '{ toString: () => void; }' is not assignable to type 'Object'. - Types of property 'toString' are incompatible. - Type '() => void' is not assignable to type '() => string'. - Type 'void' is not assignable to type 'string'. + The types returned by 'toString()' are incompatible between these types. + Type 'void' is not assignable to type 'string'. ==== tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentCompat2.ts (5 errors) ==== @@ -32,16 +25,13 @@ tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentC o = i; // error ~ !!! error TS2322: Type 'I' is not assignable to type 'Object'. -!!! error TS2322: Types of property 'toString' are incompatible. -!!! error TS2322: Type '() => number' is not assignable to type '() => string'. -!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! error TS2322: The types returned by 'toString()' are incompatible between these types. +!!! error TS2322: Type 'number' is not assignable to type 'string'. i = o; // error ~ -!!! error TS2322: Type 'Object' is not assignable to type 'I'. -!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? -!!! error TS2322: Types of property 'toString' are incompatible. -!!! error TS2322: Type '() => string' is not assignable to type '() => number'. -!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! error TS2696: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? +!!! error TS2696: The types returned by 'toString()' are incompatible between these types. +!!! error TS2696: Type 'string' is not assignable to type 'number'. class C { toString(): number { return 1; } @@ -50,16 +40,13 @@ tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentC o = c; // error ~ !!! error TS2322: Type 'C' is not assignable to type 'Object'. -!!! error TS2322: Types of property 'toString' are incompatible. -!!! error TS2322: Type '() => number' is not assignable to type '() => string'. -!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! error TS2322: The types returned by 'toString()' are incompatible between these types. +!!! error TS2322: Type 'number' is not assignable to type 'string'. c = o; // error ~ -!!! error TS2322: Type 'Object' is not assignable to type 'C'. -!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? -!!! error TS2322: Types of property 'toString' are incompatible. -!!! error TS2322: Type '() => string' is not assignable to type '() => number'. -!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! error TS2696: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? +!!! error TS2696: The types returned by 'toString()' are incompatible between these types. +!!! error TS2696: Type 'string' is not assignable to type 'number'. var a = { toString: () => { } @@ -67,7 +54,6 @@ tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentC o = a; // error ~ !!! error TS2322: Type '{ toString: () => void; }' is not assignable to type 'Object'. -!!! error TS2322: Types of property 'toString' are incompatible. -!!! error TS2322: Type '() => void' is not assignable to type '() => string'. -!!! error TS2322: Type 'void' is not assignable to type 'string'. +!!! error TS2322: The types returned by 'toString()' are incompatible between these types. +!!! error TS2322: Type 'void' is not assignable to type 'string'. a = o; // ok \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName30.errors.txt b/tests/baselines/reference/parserComputedPropertyName30.errors.txt index 94ab013c8be88..cbb4e7c096e05 100644 --- a/tests/baselines/reference/parserComputedPropertyName30.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName30.errors.txt @@ -1,6 +1,6 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName30.ts(3,5): error TS1164: Computed property names are not allowed in enums. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName30.ts(3,11): error TS2304: Cannot find name 'id'. -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName30.ts(4,5): error TS1005: ',' expected. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName30.ts(4,5): error TS1357: An enum member name must be followed by a ',', '=', or '}'. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName30.ts(4,5): error TS1164: Computed property names are not allowed in enums. @@ -14,7 +14,7 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP !!! error TS2304: Cannot find name 'id'. [e2] = 1 ~ -!!! error TS1005: ',' expected. +!!! error TS1357: An enum member name must be followed by a ',', '=', or '}'. ~~~~ !!! error TS1164: Computed property names are not allowed in enums. } \ No newline at end of file diff --git a/tests/baselines/reference/parserEnum5.errors.txt b/tests/baselines/reference/parserEnum5.errors.txt index 6315de88da79b..706cac4af4e77 100644 --- a/tests/baselines/reference/parserEnum5.errors.txt +++ b/tests/baselines/reference/parserEnum5.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnum5.ts(2,12): error TS1005: ',' expected. +tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnum5.ts(2,12): error TS1357: An enum member name must be followed by a ',', '=', or '}'. tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnum5.ts(2,14): error TS2452: An enum member cannot have a numeric name. -tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnum5.ts(3,15): error TS1005: ',' expected. +tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnum5.ts(3,15): error TS1357: An enum member name must be followed by a ',', '=', or '}'. tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnum5.ts(3,17): error TS2452: An enum member cannot have a numeric name. -tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnum5.ts(3,24): error TS1005: ',' expected. +tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnum5.ts(3,24): error TS1357: An enum member name must be followed by a ',', '=', or '}'. tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnum5.ts(3,26): error TS2452: An enum member cannot have a numeric name. @@ -10,15 +10,15 @@ tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnum5.ts(3,26) enum E2 { a, } enum E3 { a: 1, } ~ -!!! error TS1005: ',' expected. +!!! error TS1357: An enum member name must be followed by a ',', '=', or '}'. ~ !!! error TS2452: An enum member cannot have a numeric name. enum E1 { a, b: 1, c, d: 2 = 3 } ~ -!!! error TS1005: ',' expected. +!!! error TS1357: An enum member name must be followed by a ',', '=', or '}'. ~ !!! error TS2452: An enum member cannot have a numeric name. ~ -!!! error TS1005: ',' expected. +!!! error TS1357: An enum member name must be followed by a ',', '=', or '}'. ~ !!! error TS2452: An enum member cannot have a numeric name. \ No newline at end of file diff --git a/tests/baselines/reference/promisePermutations.errors.txt b/tests/baselines/reference/promisePermutations.errors.txt index 3782a5539ff7a..d91f6bcc52fec 100644 --- a/tests/baselines/reference/promisePermutations.errors.txt +++ b/tests/baselines/reference/promisePermutations.errors.txt @@ -122,8 +122,8 @@ tests/cases/compiler/promisePermutations.ts(159,21): error TS2769: No overload m tests/cases/compiler/promisePermutations.ts(160,21): error TS2769: No overload matches this call. The last overload gave the following error. Argument of type '{ (x: number): Promise; (x: string): Promise; }' is not assignable to parameter of type '(value: number) => IPromise'. - Type 'Promise' is not assignable to type 'IPromise'. - Types of property 'then' are incompatible. + Call signature return types 'Promise' and 'IPromise' are incompatible. + The types of 'then' are incompatible between these types. Type '{ (onfulfilled?: (value: number) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: number) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: number) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: number) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; }' is not assignable to type '{ (success?: (value: string) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; }'. Types of parameters 'onfulfilled' and 'success' are incompatible. Types of parameters 'value' and 'value' are incompatible. @@ -481,8 +481,8 @@ tests/cases/compiler/promisePermutations.ts(160,21): error TS2769: No overload m !!! error TS2769: No overload matches this call. !!! error TS2769: The last overload gave the following error. !!! error TS2769: Argument of type '{ (x: number): Promise; (x: string): Promise; }' is not assignable to parameter of type '(value: number) => IPromise'. -!!! error TS2769: Type 'Promise' is not assignable to type 'IPromise'. -!!! error TS2769: Types of property 'then' are incompatible. +!!! error TS2769: Call signature return types 'Promise' and 'IPromise' are incompatible. +!!! error TS2769: The types of 'then' are incompatible between these types. !!! error TS2769: Type '{ (onfulfilled?: (value: number) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: number) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: number) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: number) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; }' is not assignable to type '{ (success?: (value: string) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; }'. !!! error TS2769: Types of parameters 'onfulfilled' and 'success' are incompatible. !!! error TS2769: Types of parameters 'value' and 'value' are incompatible. diff --git a/tests/baselines/reference/promisePermutations2.errors.txt b/tests/baselines/reference/promisePermutations2.errors.txt index ad6eb075ea751..a4fbd3fc00ab2 100644 --- a/tests/baselines/reference/promisePermutations2.errors.txt +++ b/tests/baselines/reference/promisePermutations2.errors.txt @@ -80,8 +80,8 @@ tests/cases/compiler/promisePermutations2.ts(158,21): error TS2345: Argument of Type 'Promise' is not assignable to type 'Promise'. Type 'number' is not assignable to type 'string'. tests/cases/compiler/promisePermutations2.ts(159,21): error TS2345: Argument of type '{ (x: number): Promise; (x: string): Promise; }' is not assignable to parameter of type '(value: number) => IPromise'. - Type 'Promise' is not assignable to type 'IPromise'. - Types of property 'then' are incompatible. + Call signature return types 'Promise' and 'IPromise' are incompatible. + The types of 'then' are incompatible between these types. Type '{ (onfulfilled?: (value: number) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; }' is not assignable to type '{ (success?: (value: string) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; }'. Types of parameters 'onfulfilled' and 'success' are incompatible. Types of parameters 'value' and 'value' are incompatible. @@ -376,8 +376,8 @@ tests/cases/compiler/promisePermutations2.ts(159,21): error TS2345: Argument of var s11c = s11.then(testFunction11P, testFunction11, testFunction11); // ok ~~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '{ (x: number): Promise; (x: string): Promise; }' is not assignable to parameter of type '(value: number) => IPromise'. -!!! error TS2345: Type 'Promise' is not assignable to type 'IPromise'. -!!! error TS2345: Types of property 'then' are incompatible. +!!! error TS2345: Call signature return types 'Promise' and 'IPromise' are incompatible. +!!! error TS2345: The types of 'then' are incompatible between these types. !!! error TS2345: Type '{ (onfulfilled?: (value: number) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; }' is not assignable to type '{ (success?: (value: string) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; }'. !!! error TS2345: Types of parameters 'onfulfilled' and 'success' are incompatible. !!! error TS2345: Types of parameters 'value' and 'value' are incompatible. diff --git a/tests/baselines/reference/promisePermutations3.errors.txt b/tests/baselines/reference/promisePermutations3.errors.txt index 50db86a91ea79..8fb1a16bf0cd6 100644 --- a/tests/baselines/reference/promisePermutations3.errors.txt +++ b/tests/baselines/reference/promisePermutations3.errors.txt @@ -101,8 +101,8 @@ tests/cases/compiler/promisePermutations3.ts(158,21): error TS2769: No overload tests/cases/compiler/promisePermutations3.ts(159,21): error TS2769: No overload matches this call. The last overload gave the following error. Argument of type '{ (x: number): Promise; (x: string): Promise; }' is not assignable to parameter of type '(value: number) => IPromise'. - Type 'Promise' is not assignable to type 'IPromise'. - Types of property 'then' are incompatible. + Call signature return types 'Promise' and 'IPromise' are incompatible. + The types of 'then' are incompatible between these types. Type '{ (onfulfilled?: (value: number) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: number) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: number) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: number) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; }' is not assignable to type '(success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void) => IPromise'. Types of parameters 'onfulfilled' and 'success' are incompatible. Types of parameters 'value' and 'value' are incompatible. @@ -429,8 +429,8 @@ tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of !!! error TS2769: No overload matches this call. !!! error TS2769: The last overload gave the following error. !!! error TS2769: Argument of type '{ (x: number): Promise; (x: string): Promise; }' is not assignable to parameter of type '(value: number) => IPromise'. -!!! error TS2769: Type 'Promise' is not assignable to type 'IPromise'. -!!! error TS2769: Types of property 'then' are incompatible. +!!! error TS2769: Call signature return types 'Promise' and 'IPromise' are incompatible. +!!! error TS2769: The types of 'then' are incompatible between these types. !!! error TS2769: Type '{ (onfulfilled?: (value: number) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: number) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: number) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: number) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; }' is not assignable to type '(success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void) => IPromise'. !!! error TS2769: Types of parameters 'onfulfilled' and 'success' are incompatible. !!! error TS2769: Types of parameters 'value' and 'value' are incompatible. diff --git a/tests/baselines/reference/promiseTypeInference.errors.txt b/tests/baselines/reference/promiseTypeInference.errors.txt index 8d922c2e80779..b04ff6f5cbc8d 100644 --- a/tests/baselines/reference/promiseTypeInference.errors.txt +++ b/tests/baselines/reference/promiseTypeInference.errors.txt @@ -5,10 +5,9 @@ tests/cases/compiler/promiseTypeInference.ts(10,39): error TS2769: No overload m Type 'IPromise' is not assignable to type 'number | PromiseLike'. Type 'IPromise' is not assignable to type 'PromiseLike'. Types of property 'then' are incompatible. - Type '(success?: (value: number) => IPromise) => IPromise' is not assignable to type '(onfulfilled?: (value: number) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => PromiseLike'. - Types of parameters 'success' and 'onfulfilled' are incompatible. - Type 'TResult1 | PromiseLike' is not assignable to type 'IPromise'. - Type 'TResult1' is not assignable to type 'IPromise'. + Types of parameters 'success' and 'onfulfilled' are incompatible. + Type 'TResult1 | PromiseLike' is not assignable to type 'IPromise'. + Type 'TResult1' is not assignable to type 'IPromise'. ==== tests/cases/compiler/promiseTypeInference.ts (1 errors) ==== @@ -30,10 +29,9 @@ tests/cases/compiler/promiseTypeInference.ts(10,39): error TS2769: No overload m !!! error TS2769: Type 'IPromise' is not assignable to type 'number | PromiseLike'. !!! error TS2769: Type 'IPromise' is not assignable to type 'PromiseLike'. !!! error TS2769: Types of property 'then' are incompatible. -!!! error TS2769: Type '(success?: (value: number) => IPromise) => IPromise' is not assignable to type '(onfulfilled?: (value: number) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => PromiseLike'. -!!! error TS2769: Types of parameters 'success' and 'onfulfilled' are incompatible. -!!! error TS2769: Type 'TResult1 | PromiseLike' is not assignable to type 'IPromise'. -!!! error TS2769: Type 'TResult1' is not assignable to type 'IPromise'. +!!! error TS2769: Types of parameters 'success' and 'onfulfilled' are incompatible. +!!! error TS2769: Type 'TResult1 | PromiseLike' is not assignable to type 'IPromise'. +!!! error TS2769: Type 'TResult1' is not assignable to type 'IPromise'. !!! related TS2728 /.ts/lib.es5.d.ts:1418:5: 'catch' is declared here. !!! related TS6502 tests/cases/compiler/promiseTypeInference.ts:2:23: The expected type comes from the return type of this signature. !!! related TS6502 /.ts/lib.es5.d.ts:1411:57: The expected type comes from the return type of this signature. diff --git a/tests/baselines/reference/reverseMappedTypeAssignableToIndex.js b/tests/baselines/reference/reverseMappedTypeAssignableToIndex.js new file mode 100644 index 0000000000000..b3ee2dcda2e8a --- /dev/null +++ b/tests/baselines/reference/reverseMappedTypeAssignableToIndex.js @@ -0,0 +1,22 @@ +//// [reverseMappedTypeAssignableToIndex.ts] +// Simple mapped type and inferrence +type Mapped = { [K in keyof T]: { name: T[K] } }; +type InferFromMapped = T extends Mapped ? R : never; + +// Object literal type and associated mapped type +// Note that in the real code we don't have a direct reference to LiteralType +type LiteralType = { + first: "first"; + second: "second"; +} +type MappedLiteralType = { + first: { name: "first" }, + second: { name: "second" }, +}; + +type Inferred = InferFromMapped; + +// UNEXPECTED resolves to false +type Test1 = Inferred extends Record ? true : false; + +//// [reverseMappedTypeAssignableToIndex.js] diff --git a/tests/baselines/reference/reverseMappedTypeAssignableToIndex.symbols b/tests/baselines/reference/reverseMappedTypeAssignableToIndex.symbols new file mode 100644 index 0000000000000..38ed9ff039f0e --- /dev/null +++ b/tests/baselines/reference/reverseMappedTypeAssignableToIndex.symbols @@ -0,0 +1,54 @@ +=== tests/cases/compiler/reverseMappedTypeAssignableToIndex.ts === +// Simple mapped type and inferrence +type Mapped = { [K in keyof T]: { name: T[K] } }; +>Mapped : Symbol(Mapped, Decl(reverseMappedTypeAssignableToIndex.ts, 0, 0)) +>T : Symbol(T, Decl(reverseMappedTypeAssignableToIndex.ts, 1, 12)) +>K : Symbol(K, Decl(reverseMappedTypeAssignableToIndex.ts, 1, 20)) +>T : Symbol(T, Decl(reverseMappedTypeAssignableToIndex.ts, 1, 12)) +>name : Symbol(name, Decl(reverseMappedTypeAssignableToIndex.ts, 1, 36)) +>T : Symbol(T, Decl(reverseMappedTypeAssignableToIndex.ts, 1, 12)) +>K : Symbol(K, Decl(reverseMappedTypeAssignableToIndex.ts, 1, 20)) + +type InferFromMapped = T extends Mapped ? R : never; +>InferFromMapped : Symbol(InferFromMapped, Decl(reverseMappedTypeAssignableToIndex.ts, 1, 52)) +>T : Symbol(T, Decl(reverseMappedTypeAssignableToIndex.ts, 2, 21)) +>T : Symbol(T, Decl(reverseMappedTypeAssignableToIndex.ts, 2, 21)) +>Mapped : Symbol(Mapped, Decl(reverseMappedTypeAssignableToIndex.ts, 0, 0)) +>R : Symbol(R, Decl(reverseMappedTypeAssignableToIndex.ts, 2, 48)) +>R : Symbol(R, Decl(reverseMappedTypeAssignableToIndex.ts, 2, 48)) + +// Object literal type and associated mapped type +// Note that in the real code we don't have a direct reference to LiteralType +type LiteralType = { +>LiteralType : Symbol(LiteralType, Decl(reverseMappedTypeAssignableToIndex.ts, 2, 64)) + + first: "first"; +>first : Symbol(first, Decl(reverseMappedTypeAssignableToIndex.ts, 6, 20)) + + second: "second"; +>second : Symbol(second, Decl(reverseMappedTypeAssignableToIndex.ts, 7, 16)) +} +type MappedLiteralType = { +>MappedLiteralType : Symbol(MappedLiteralType, Decl(reverseMappedTypeAssignableToIndex.ts, 9, 1)) + + first: { name: "first" }, +>first : Symbol(first, Decl(reverseMappedTypeAssignableToIndex.ts, 10, 26)) +>name : Symbol(name, Decl(reverseMappedTypeAssignableToIndex.ts, 11, 9)) + + second: { name: "second" }, +>second : Symbol(second, Decl(reverseMappedTypeAssignableToIndex.ts, 11, 26)) +>name : Symbol(name, Decl(reverseMappedTypeAssignableToIndex.ts, 12, 10)) + +}; + +type Inferred = InferFromMapped; +>Inferred : Symbol(Inferred, Decl(reverseMappedTypeAssignableToIndex.ts, 13, 2)) +>InferFromMapped : Symbol(InferFromMapped, Decl(reverseMappedTypeAssignableToIndex.ts, 1, 52)) +>MappedLiteralType : Symbol(MappedLiteralType, Decl(reverseMappedTypeAssignableToIndex.ts, 9, 1)) + +// UNEXPECTED resolves to false +type Test1 = Inferred extends Record ? true : false; +>Test1 : Symbol(Test1, Decl(reverseMappedTypeAssignableToIndex.ts, 15, 51)) +>Inferred : Symbol(Inferred, Decl(reverseMappedTypeAssignableToIndex.ts, 13, 2)) +>Record : Symbol(Record, Decl(lib.es5.d.ts, --, --)) + diff --git a/tests/baselines/reference/reverseMappedTypeAssignableToIndex.types b/tests/baselines/reference/reverseMappedTypeAssignableToIndex.types new file mode 100644 index 0000000000000..589e9ff3477a3 --- /dev/null +++ b/tests/baselines/reference/reverseMappedTypeAssignableToIndex.types @@ -0,0 +1,42 @@ +=== tests/cases/compiler/reverseMappedTypeAssignableToIndex.ts === +// Simple mapped type and inferrence +type Mapped = { [K in keyof T]: { name: T[K] } }; +>Mapped : Mapped +>name : T[K] + +type InferFromMapped = T extends Mapped ? R : never; +>InferFromMapped : InferFromMapped + +// Object literal type and associated mapped type +// Note that in the real code we don't have a direct reference to LiteralType +type LiteralType = { +>LiteralType : LiteralType + + first: "first"; +>first : "first" + + second: "second"; +>second : "second" +} +type MappedLiteralType = { +>MappedLiteralType : MappedLiteralType + + first: { name: "first" }, +>first : { name: "first"; } +>name : "first" + + second: { name: "second" }, +>second : { name: "second"; } +>name : "second" + +}; + +type Inferred = InferFromMapped; +>Inferred : { first: "first"; second: "second"; } + +// UNEXPECTED resolves to false +type Test1 = Inferred extends Record ? true : false; +>Test1 : true +>true : true +>false : false + diff --git a/tests/baselines/reference/showConfig/Shows tsconfig for single option/disableSourceOfProjectReferenceRedirect/tsconfig.json b/tests/baselines/reference/showConfig/Shows tsconfig for single option/disableSourceOfProjectReferenceRedirect/tsconfig.json new file mode 100644 index 0000000000000..c8b95e0909d10 --- /dev/null +++ b/tests/baselines/reference/showConfig/Shows tsconfig for single option/disableSourceOfProjectReferenceRedirect/tsconfig.json @@ -0,0 +1,5 @@ +{ + "compilerOptions": { + "disableSourceOfProjectReferenceRedirect": true + } +} diff --git a/tests/baselines/reference/strictFunctionTypesErrors.errors.txt b/tests/baselines/reference/strictFunctionTypesErrors.errors.txt index 3ff04c44fb75b..6f474663dcb5d 100644 --- a/tests/baselines/reference/strictFunctionTypesErrors.errors.txt +++ b/tests/baselines/reference/strictFunctionTypesErrors.errors.txt @@ -69,9 +69,8 @@ tests/cases/compiler/strictFunctionTypesErrors.ts(126,1): error TS2322: Type 'Cr tests/cases/compiler/strictFunctionTypesErrors.ts(127,1): error TS2322: Type 'Crate' is not assignable to type 'Crate'. Types of property 'item' are incompatible. Type 'Animal' is not assignable to type 'Dog'. -tests/cases/compiler/strictFunctionTypesErrors.ts(133,1): error TS2322: Type '(f: (x: Dog) => Dog) => void' is not assignable to type '(f: (x: Animal) => Animal) => void'. - Types of parameters 'f' and 'f' are incompatible. - Type 'Animal' is not assignable to type 'Dog'. +tests/cases/compiler/strictFunctionTypesErrors.ts(133,1): error TS2328: Types of parameters 'f' and 'f' are incompatible. + Type 'Animal' is not assignable to type 'Dog'. tests/cases/compiler/strictFunctionTypesErrors.ts(134,1): error TS2322: Type '(f: (x: Animal) => Animal) => void' is not assignable to type '(f: (x: Dog) => Dog) => void'. Types of parameters 'f' and 'f' are incompatible. Types of parameters 'x' and 'x' are incompatible. @@ -324,9 +323,8 @@ tests/cases/compiler/strictFunctionTypesErrors.ts(155,5): error TS2322: Type '(c declare let fc2: (f: (x: Dog) => Dog) => void; fc1 = fc2; // Error ~~~ -!!! error TS2322: Type '(f: (x: Dog) => Dog) => void' is not assignable to type '(f: (x: Animal) => Animal) => void'. -!!! error TS2322: Types of parameters 'f' and 'f' are incompatible. -!!! error TS2322: Type 'Animal' is not assignable to type 'Dog'. +!!! error TS2328: Types of parameters 'f' and 'f' are incompatible. +!!! error TS2328: Type 'Animal' is not assignable to type 'Dog'. fc2 = fc1; // Error ~~~ !!! error TS2322: Type '(f: (x: Animal) => Animal) => void' is not assignable to type '(f: (x: Dog) => Dog) => void'. diff --git a/tests/baselines/reference/subtypingWithCallSignaturesWithSpecializedSignatures.errors.txt b/tests/baselines/reference/subtypingWithCallSignaturesWithSpecializedSignatures.errors.txt index 7dfb078170a6d..b8bc510040215 100644 --- a/tests/baselines/reference/subtypingWithCallSignaturesWithSpecializedSignatures.errors.txt +++ b/tests/baselines/reference/subtypingWithCallSignaturesWithSpecializedSignatures.errors.txt @@ -1,12 +1,10 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignaturesWithSpecializedSignatures.ts(70,15): error TS2430: Interface 'I2' incorrectly extends interface 'Base2'. - Types of property 'a' are incompatible. - Type '(x: string) => string' is not assignable to type '{ (x: "a"): number; (x: string): number; }'. - Type 'string' is not assignable to type 'number'. + The types returned by 'a(...)' are incompatible between these types. + Type 'string' is not assignable to type 'number'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignaturesWithSpecializedSignatures.ts(76,15): error TS2430: Interface 'I3' incorrectly extends interface 'Base2'. - Types of property 'a2' are incompatible. - Type '(x: T) => string' is not assignable to type '(x: T) => T'. - Type 'string' is not assignable to type 'T'. - 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. + The types returned by 'a2(...)' are incompatible between these types. + Type 'string' is not assignable to type 'T'. + 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignaturesWithSpecializedSignatures.ts (2 errors) ==== @@ -82,9 +80,8 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW interface I2 extends Base2 { ~~ !!! error TS2430: Interface 'I2' incorrectly extends interface 'Base2'. -!!! error TS2430: Types of property 'a' are incompatible. -!!! error TS2430: Type '(x: string) => string' is not assignable to type '{ (x: "a"): number; (x: string): number; }'. -!!! error TS2430: Type 'string' is not assignable to type 'number'. +!!! error TS2430: The types returned by 'a(...)' are incompatible between these types. +!!! error TS2430: Type 'string' is not assignable to type 'number'. // N's a: (x: string) => string; // error because base returns non-void; } @@ -93,10 +90,9 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW interface I3 extends Base2 { ~~ !!! error TS2430: Interface 'I3' incorrectly extends interface 'Base2'. -!!! error TS2430: Types of property 'a2' are incompatible. -!!! error TS2430: Type '(x: T) => string' is not assignable to type '(x: T) => T'. -!!! error TS2430: Type 'string' is not assignable to type 'T'. -!!! error TS2430: 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: The types returned by 'a2(...)' are incompatible between these types. +!!! error TS2430: Type 'string' is not assignable to type 'T'. +!!! error TS2430: 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. // N's a2: (x: T) => string; // error because base returns non-void; } diff --git a/tests/baselines/reference/subtypingWithConstructSignaturesWithSpecializedSignatures.errors.txt b/tests/baselines/reference/subtypingWithConstructSignaturesWithSpecializedSignatures.errors.txt index 8f4a219407ab3..db493045f0966 100644 --- a/tests/baselines/reference/subtypingWithConstructSignaturesWithSpecializedSignatures.errors.txt +++ b/tests/baselines/reference/subtypingWithConstructSignaturesWithSpecializedSignatures.errors.txt @@ -1,12 +1,10 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignaturesWithSpecializedSignatures.ts(70,15): error TS2430: Interface 'I2' incorrectly extends interface 'Base2'. - Types of property 'a' are incompatible. - Type 'new (x: string) => string' is not assignable to type '{ new (x: "a"): number; new (x: string): number; }'. - Type 'string' is not assignable to type 'number'. + The types returned by 'new a(...)' are incompatible between these types. + Type 'string' is not assignable to type 'number'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignaturesWithSpecializedSignatures.ts(76,15): error TS2430: Interface 'I3' incorrectly extends interface 'Base2'. - Types of property 'a2' are incompatible. - Type 'new (x: T) => string' is not assignable to type 'new (x: T) => T'. - Type 'string' is not assignable to type 'T'. - 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. + The types returned by 'new a2(...)' are incompatible between these types. + Type 'string' is not assignable to type 'T'. + 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignaturesWithSpecializedSignatures.ts (2 errors) ==== @@ -82,9 +80,8 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW interface I2 extends Base2 { ~~ !!! error TS2430: Interface 'I2' incorrectly extends interface 'Base2'. -!!! error TS2430: Types of property 'a' are incompatible. -!!! error TS2430: Type 'new (x: string) => string' is not assignable to type '{ new (x: "a"): number; new (x: string): number; }'. -!!! error TS2430: Type 'string' is not assignable to type 'number'. +!!! error TS2430: The types returned by 'new a(...)' are incompatible between these types. +!!! error TS2430: Type 'string' is not assignable to type 'number'. // N's a: new (x: string) => string; // error because base returns non-void; } @@ -93,10 +90,9 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW interface I3 extends Base2 { ~~ !!! error TS2430: Interface 'I3' incorrectly extends interface 'Base2'. -!!! error TS2430: Types of property 'a2' are incompatible. -!!! error TS2430: Type 'new (x: T) => string' is not assignable to type 'new (x: T) => T'. -!!! error TS2430: Type 'string' is not assignable to type 'T'. -!!! error TS2430: 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: The types returned by 'new a2(...)' are incompatible between these types. +!!! error TS2430: Type 'string' is not assignable to type 'T'. +!!! error TS2430: 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. // N's a2: new (x: T) => string; // error because base returns non-void; } diff --git a/tests/baselines/reference/subtypingWithGenericCallSignaturesWithOptionalParameters.errors.txt b/tests/baselines/reference/subtypingWithGenericCallSignaturesWithOptionalParameters.errors.txt index 36380fc97f4f0..4e0ef2113ec7d 100644 --- a/tests/baselines/reference/subtypingWithGenericCallSignaturesWithOptionalParameters.errors.txt +++ b/tests/baselines/reference/subtypingWithGenericCallSignaturesWithOptionalParameters.errors.txt @@ -5,23 +5,20 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW Types of property 'a3' are incompatible. Type '(x: T, y: T) => T' is not assignable to type '(x: T) => T'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericCallSignaturesWithOptionalParameters.ts(100,15): error TS2430: Interface 'I1' incorrectly extends interface 'Base2'. - Types of property 'a' are incompatible. - Type '() => T' is not assignable to type '() => T'. - Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. + The types returned by 'a()' are incompatible between these types. + Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericCallSignaturesWithOptionalParameters.ts(104,15): error TS2430: Interface 'I2' incorrectly extends interface 'Base2'. - Types of property 'a' are incompatible. - Type '(x?: T) => T' is not assignable to type '() => T'. - Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. + The types returned by 'a(...)' are incompatible between these types. + Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericCallSignaturesWithOptionalParameters.ts(108,15): error TS2430: Interface 'I3' incorrectly extends interface 'Base2'. Types of property 'a' are incompatible. Type '(x: T) => T' is not assignable to type '() => T'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericCallSignaturesWithOptionalParameters.ts(113,15): error TS2430: Interface 'I4' incorrectly extends interface 'Base2'. - Types of property 'a2' are incompatible. - Type '() => T' is not assignable to type '(x?: T) => T'. - Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. + The types returned by 'a2(...)' are incompatible between these types. + Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericCallSignaturesWithOptionalParameters.ts(117,15): error TS2430: Interface 'I5' incorrectly extends interface 'Base2'. Types of property 'a2' are incompatible. Type '(x?: T) => T' is not assignable to type '(x?: T) => T'. @@ -35,10 +32,9 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericCallSignaturesWithOptionalParameters.ts(126,15): error TS2430: Interface 'I7' incorrectly extends interface 'Base2'. - Types of property 'a3' are incompatible. - Type '() => T' is not assignable to type '(x: T) => T'. - Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. + The types returned by 'a3(...)' are incompatible between these types. + Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericCallSignaturesWithOptionalParameters.ts(130,15): error TS2430: Interface 'I8' incorrectly extends interface 'Base2'. Types of property 'a3' are incompatible. Type '(x?: T) => T' is not assignable to type '(x: T) => T'. @@ -55,10 +51,9 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW Types of property 'a3' are incompatible. Type '(x: T, y: T) => T' is not assignable to type '(x: T) => T'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericCallSignaturesWithOptionalParameters.ts(143,15): error TS2430: Interface 'I11' incorrectly extends interface 'Base2'. - Types of property 'a4' are incompatible. - Type '() => T' is not assignable to type '(x: T, y?: T) => T'. - Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. + The types returned by 'a4(...)' are incompatible between these types. + Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericCallSignaturesWithOptionalParameters.ts(147,15): error TS2430: Interface 'I12' incorrectly extends interface 'Base2'. Types of property 'a4' are incompatible. Type '(x?: T, y?: T) => T' is not assignable to type '(x: T, y?: T) => T'. @@ -78,10 +73,9 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericCallSignaturesWithOptionalParameters.ts(160,15): error TS2430: Interface 'I15' incorrectly extends interface 'Base2'. - Types of property 'a5' are incompatible. - Type '() => T' is not assignable to type '(x?: T, y?: T) => T'. - Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. + The types returned by 'a5(...)' are incompatible between these types. + Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericCallSignaturesWithOptionalParameters.ts(164,15): error TS2430: Interface 'I16' incorrectly extends interface 'Base2'. Types of property 'a5' are incompatible. Type '(x?: T, y?: T) => T' is not assignable to type '(x?: T, y?: T) => T'. @@ -219,20 +213,18 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW interface I1 extends Base2 { ~~ !!! error TS2430: Interface 'I1' incorrectly extends interface 'Base2'. -!!! error TS2430: Types of property 'a' are incompatible. -!!! error TS2430: Type '() => T' is not assignable to type '() => T'. -!!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: The types returned by 'a()' are incompatible between these types. +!!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a: () => T; } interface I2 extends Base2 { ~~ !!! error TS2430: Interface 'I2' incorrectly extends interface 'Base2'. -!!! error TS2430: Types of property 'a' are incompatible. -!!! error TS2430: Type '(x?: T) => T' is not assignable to type '() => T'. -!!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: The types returned by 'a(...)' are incompatible between these types. +!!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a: (x?: T) => T; } @@ -248,10 +240,9 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW interface I4 extends Base2 { ~~ !!! error TS2430: Interface 'I4' incorrectly extends interface 'Base2'. -!!! error TS2430: Types of property 'a2' are incompatible. -!!! error TS2430: Type '() => T' is not assignable to type '(x?: T) => T'. -!!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: The types returned by 'a2(...)' are incompatible between these types. +!!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a2: () => T; } @@ -281,10 +272,9 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW interface I7 extends Base2 { ~~ !!! error TS2430: Interface 'I7' incorrectly extends interface 'Base2'. -!!! error TS2430: Types of property 'a3' are incompatible. -!!! error TS2430: Type '() => T' is not assignable to type '(x: T) => T'. -!!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: The types returned by 'a3(...)' are incompatible between these types. +!!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a3: () => T; } @@ -322,10 +312,9 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW interface I11 extends Base2 { ~~~ !!! error TS2430: Interface 'I11' incorrectly extends interface 'Base2'. -!!! error TS2430: Types of property 'a4' are incompatible. -!!! error TS2430: Type '() => T' is not assignable to type '(x: T, y?: T) => T'. -!!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: The types returned by 'a4(...)' are incompatible between these types. +!!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a4: () => T; } @@ -366,10 +355,9 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW interface I15 extends Base2 { ~~~ !!! error TS2430: Interface 'I15' incorrectly extends interface 'Base2'. -!!! error TS2430: Types of property 'a5' are incompatible. -!!! error TS2430: Type '() => T' is not assignable to type '(x?: T, y?: T) => T'. -!!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: The types returned by 'a5(...)' are incompatible between these types. +!!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a5: () => T; } diff --git a/tests/baselines/reference/subtypingWithGenericConstructSignaturesWithOptionalParameters.errors.txt b/tests/baselines/reference/subtypingWithGenericConstructSignaturesWithOptionalParameters.errors.txt index 427c7c1f19e8f..7481ba54f1ebb 100644 --- a/tests/baselines/reference/subtypingWithGenericConstructSignaturesWithOptionalParameters.errors.txt +++ b/tests/baselines/reference/subtypingWithGenericConstructSignaturesWithOptionalParameters.errors.txt @@ -5,23 +5,20 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW Types of property 'a3' are incompatible. Type 'new (x: T, y: T) => T' is not assignable to type 'new (x: T) => T'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(100,15): error TS2430: Interface 'I1' incorrectly extends interface 'Base2'. - Types of property 'a' are incompatible. - Type 'new () => T' is not assignable to type 'new () => T'. - Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. + The types returned by 'new a()' are incompatible between these types. + Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(104,15): error TS2430: Interface 'I2' incorrectly extends interface 'Base2'. - Types of property 'a' are incompatible. - Type 'new (x?: T) => T' is not assignable to type 'new () => T'. - Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. + The types returned by 'new a(...)' are incompatible between these types. + Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(108,15): error TS2430: Interface 'I3' incorrectly extends interface 'Base2'. Types of property 'a' are incompatible. Type 'new (x: T) => T' is not assignable to type 'new () => T'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(113,15): error TS2430: Interface 'I4' incorrectly extends interface 'Base2'. - Types of property 'a2' are incompatible. - Type 'new () => T' is not assignable to type 'new (x?: T) => T'. - Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. + The types returned by 'new a2(...)' are incompatible between these types. + Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(117,15): error TS2430: Interface 'I5' incorrectly extends interface 'Base2'. Types of property 'a2' are incompatible. Type 'new (x?: T) => T' is not assignable to type 'new (x?: T) => T'. @@ -35,10 +32,9 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(126,15): error TS2430: Interface 'I7' incorrectly extends interface 'Base2'. - Types of property 'a3' are incompatible. - Type 'new () => T' is not assignable to type 'new (x: T) => T'. - Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. + The types returned by 'new a3(...)' are incompatible between these types. + Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(130,15): error TS2430: Interface 'I8' incorrectly extends interface 'Base2'. Types of property 'a3' are incompatible. Type 'new (x?: T) => T' is not assignable to type 'new (x: T) => T'. @@ -55,10 +51,9 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW Types of property 'a3' are incompatible. Type 'new (x: T, y: T) => T' is not assignable to type 'new (x: T) => T'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(143,15): error TS2430: Interface 'I11' incorrectly extends interface 'Base2'. - Types of property 'a4' are incompatible. - Type 'new () => T' is not assignable to type 'new (x: T, y?: T) => T'. - Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. + The types returned by 'new a4(...)' are incompatible between these types. + Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(147,15): error TS2430: Interface 'I12' incorrectly extends interface 'Base2'. Types of property 'a4' are incompatible. Type 'new (x?: T, y?: T) => T' is not assignable to type 'new (x: T, y?: T) => T'. @@ -78,10 +73,9 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(160,15): error TS2430: Interface 'I15' incorrectly extends interface 'Base2'. - Types of property 'a5' are incompatible. - Type 'new () => T' is not assignable to type 'new (x?: T, y?: T) => T'. - Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. + The types returned by 'new a5(...)' are incompatible between these types. + Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(164,15): error TS2430: Interface 'I16' incorrectly extends interface 'Base2'. Types of property 'a5' are incompatible. Type 'new (x?: T, y?: T) => T' is not assignable to type 'new (x?: T, y?: T) => T'. @@ -219,20 +213,18 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW interface I1 extends Base2 { ~~ !!! error TS2430: Interface 'I1' incorrectly extends interface 'Base2'. -!!! error TS2430: Types of property 'a' are incompatible. -!!! error TS2430: Type 'new () => T' is not assignable to type 'new () => T'. -!!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: The types returned by 'new a()' are incompatible between these types. +!!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a: new () => T; } interface I2 extends Base2 { ~~ !!! error TS2430: Interface 'I2' incorrectly extends interface 'Base2'. -!!! error TS2430: Types of property 'a' are incompatible. -!!! error TS2430: Type 'new (x?: T) => T' is not assignable to type 'new () => T'. -!!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: The types returned by 'new a(...)' are incompatible between these types. +!!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a: new (x?: T) => T; } @@ -248,10 +240,9 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW interface I4 extends Base2 { ~~ !!! error TS2430: Interface 'I4' incorrectly extends interface 'Base2'. -!!! error TS2430: Types of property 'a2' are incompatible. -!!! error TS2430: Type 'new () => T' is not assignable to type 'new (x?: T) => T'. -!!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: The types returned by 'new a2(...)' are incompatible between these types. +!!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a2: new () => T; } @@ -281,10 +272,9 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW interface I7 extends Base2 { ~~ !!! error TS2430: Interface 'I7' incorrectly extends interface 'Base2'. -!!! error TS2430: Types of property 'a3' are incompatible. -!!! error TS2430: Type 'new () => T' is not assignable to type 'new (x: T) => T'. -!!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: The types returned by 'new a3(...)' are incompatible between these types. +!!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a3: new () => T; } @@ -322,10 +312,9 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW interface I11 extends Base2 { ~~~ !!! error TS2430: Interface 'I11' incorrectly extends interface 'Base2'. -!!! error TS2430: Types of property 'a4' are incompatible. -!!! error TS2430: Type 'new () => T' is not assignable to type 'new (x: T, y?: T) => T'. -!!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: The types returned by 'new a4(...)' are incompatible between these types. +!!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a4: new () => T; } @@ -366,10 +355,9 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW interface I15 extends Base2 { ~~~ !!! error TS2430: Interface 'I15' incorrectly extends interface 'Base2'. -!!! error TS2430: Types of property 'a5' are incompatible. -!!! error TS2430: Type 'new () => T' is not assignable to type 'new (x?: T, y?: T) => T'. -!!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: The types returned by 'new a5(...)' are incompatible between these types. +!!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a5: new () => T; } diff --git a/tests/baselines/reference/transformApi/transformsCorrectly.transformParameterProperty.js b/tests/baselines/reference/transformApi/transformsCorrectly.transformParameterProperty.js new file mode 100644 index 0000000000000..d121694872fdd --- /dev/null +++ b/tests/baselines/reference/transformApi/transformsCorrectly.transformParameterProperty.js @@ -0,0 +1,18 @@ +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __param = (this && this.__param) || function (paramIndex, decorator) { + return function (target, key) { decorator(target, key, paramIndex); } +}; +var Foo = /** @class */ (function () { + function Foo(x) { + this.x = x; + } + Foo = __decorate([ + __param(0, Dec) + ], Foo); + return Foo; +}()); diff --git a/tests/baselines/reference/truthinessCallExpressionCoercion.errors.txt b/tests/baselines/reference/truthinessCallExpressionCoercion.errors.txt new file mode 100644 index 0000000000000..1599a70db4eac --- /dev/null +++ b/tests/baselines/reference/truthinessCallExpressionCoercion.errors.txt @@ -0,0 +1,91 @@ +tests/cases/compiler/truthinessCallExpressionCoercion.ts(2,9): error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead? +tests/cases/compiler/truthinessCallExpressionCoercion.ts(18,9): error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead? +tests/cases/compiler/truthinessCallExpressionCoercion.ts(36,9): error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead? +tests/cases/compiler/truthinessCallExpressionCoercion.ts(50,9): error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead? +tests/cases/compiler/truthinessCallExpressionCoercion.ts(66,13): error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead? + + +==== tests/cases/compiler/truthinessCallExpressionCoercion.ts (5 errors) ==== + function onlyErrorsWhenTestingNonNullableFunctionType(required: () => boolean, optional?: () => boolean) { + if (required) { // error + ~~~~~~~~ +!!! error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead? + } + + if (optional) { // ok + } + + if (!!required) { // ok + } + + if (required()) { // ok + } + } + + function onlyErrorsWhenUnusedInBody() { + function test() { return Math.random() > 0.5; } + + if (test) { // error + ~~~~ +!!! error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead? + console.log('test'); + } + + if (test) { // ok + console.log(test); + } + + if (test) { // ok + test(); + } + + if (test) { // ok + [() => null].forEach(() => { + test(); + }); + } + + if (test) { // error + ~~~~ +!!! error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead? + [() => null].forEach(test => { + test(); + }); + } + } + + function checksPropertyAccess() { + const x = { + foo: { + bar() { return true; } + } + } + + if (x.foo.bar) { // error + ~~~~~~~~~ +!!! error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead? + } + + if (x.foo.bar) { // ok + x.foo.bar; + } + } + + class Foo { + maybeIsUser?: () => boolean; + + isUser() { + return true; + } + + test() { + if (this.isUser) { // error + ~~~~~~~~~~~ +!!! error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead? + } + + if (this.maybeIsUser) { // ok + } + } + } + \ No newline at end of file diff --git a/tests/baselines/reference/truthinessCallExpressionCoercion.js b/tests/baselines/reference/truthinessCallExpressionCoercion.js new file mode 100644 index 0000000000000..19ab1722c81cd --- /dev/null +++ b/tests/baselines/reference/truthinessCallExpressionCoercion.js @@ -0,0 +1,134 @@ +//// [truthinessCallExpressionCoercion.ts] +function onlyErrorsWhenTestingNonNullableFunctionType(required: () => boolean, optional?: () => boolean) { + if (required) { // error + } + + if (optional) { // ok + } + + if (!!required) { // ok + } + + if (required()) { // ok + } +} + +function onlyErrorsWhenUnusedInBody() { + function test() { return Math.random() > 0.5; } + + if (test) { // error + console.log('test'); + } + + if (test) { // ok + console.log(test); + } + + if (test) { // ok + test(); + } + + if (test) { // ok + [() => null].forEach(() => { + test(); + }); + } + + if (test) { // error + [() => null].forEach(test => { + test(); + }); + } +} + +function checksPropertyAccess() { + const x = { + foo: { + bar() { return true; } + } + } + + if (x.foo.bar) { // error + } + + if (x.foo.bar) { // ok + x.foo.bar; + } +} + +class Foo { + maybeIsUser?: () => boolean; + + isUser() { + return true; + } + + test() { + if (this.isUser) { // error + } + + if (this.maybeIsUser) { // ok + } + } +} + + +//// [truthinessCallExpressionCoercion.js] +function onlyErrorsWhenTestingNonNullableFunctionType(required, optional) { + if (required) { // error + } + if (optional) { // ok + } + if (!!required) { // ok + } + if (required()) { // ok + } +} +function onlyErrorsWhenUnusedInBody() { + function test() { return Math.random() > 0.5; } + if (test) { // error + console.log('test'); + } + if (test) { // ok + console.log(test); + } + if (test) { // ok + test(); + } + if (test) { // ok + [function () { return null; }].forEach(function () { + test(); + }); + } + if (test) { // error + [function () { return null; }].forEach(function (test) { + test(); + }); + } +} +function checksPropertyAccess() { + var x = { + foo: { + bar: function () { return true; } + } + }; + if (x.foo.bar) { // error + } + if (x.foo.bar) { // ok + x.foo.bar; + } +} +var Foo = /** @class */ (function () { + function Foo() { + } + Foo.prototype.isUser = function () { + return true; + }; + Foo.prototype.test = function () { + if (this.isUser) { // error + } + if (this.maybeIsUser) { // ok + } + }; + return Foo; +}()); diff --git a/tests/baselines/reference/truthinessCallExpressionCoercion.symbols b/tests/baselines/reference/truthinessCallExpressionCoercion.symbols new file mode 100644 index 0000000000000..cbfe456a82ce2 --- /dev/null +++ b/tests/baselines/reference/truthinessCallExpressionCoercion.symbols @@ -0,0 +1,153 @@ +=== tests/cases/compiler/truthinessCallExpressionCoercion.ts === +function onlyErrorsWhenTestingNonNullableFunctionType(required: () => boolean, optional?: () => boolean) { +>onlyErrorsWhenTestingNonNullableFunctionType : Symbol(onlyErrorsWhenTestingNonNullableFunctionType, Decl(truthinessCallExpressionCoercion.ts, 0, 0)) +>required : Symbol(required, Decl(truthinessCallExpressionCoercion.ts, 0, 54)) +>optional : Symbol(optional, Decl(truthinessCallExpressionCoercion.ts, 0, 78)) + + if (required) { // error +>required : Symbol(required, Decl(truthinessCallExpressionCoercion.ts, 0, 54)) + } + + if (optional) { // ok +>optional : Symbol(optional, Decl(truthinessCallExpressionCoercion.ts, 0, 78)) + } + + if (!!required) { // ok +>required : Symbol(required, Decl(truthinessCallExpressionCoercion.ts, 0, 54)) + } + + if (required()) { // ok +>required : Symbol(required, Decl(truthinessCallExpressionCoercion.ts, 0, 54)) + } +} + +function onlyErrorsWhenUnusedInBody() { +>onlyErrorsWhenUnusedInBody : Symbol(onlyErrorsWhenUnusedInBody, Decl(truthinessCallExpressionCoercion.ts, 12, 1)) + + function test() { return Math.random() > 0.5; } +>test : Symbol(test, Decl(truthinessCallExpressionCoercion.ts, 14, 39)) +>Math.random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --)) +>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --)) + + if (test) { // error +>test : Symbol(test, Decl(truthinessCallExpressionCoercion.ts, 14, 39)) + + console.log('test'); +>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>console : Symbol(console, Decl(lib.dom.d.ts, --, --)) +>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) + } + + if (test) { // ok +>test : Symbol(test, Decl(truthinessCallExpressionCoercion.ts, 14, 39)) + + console.log(test); +>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>console : Symbol(console, Decl(lib.dom.d.ts, --, --)) +>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>test : Symbol(test, Decl(truthinessCallExpressionCoercion.ts, 14, 39)) + } + + if (test) { // ok +>test : Symbol(test, Decl(truthinessCallExpressionCoercion.ts, 14, 39)) + + test(); +>test : Symbol(test, Decl(truthinessCallExpressionCoercion.ts, 14, 39)) + } + + if (test) { // ok +>test : Symbol(test, Decl(truthinessCallExpressionCoercion.ts, 14, 39)) + + [() => null].forEach(() => { +>[() => null].forEach : Symbol(Array.forEach, Decl(lib.es5.d.ts, --, --)) +>forEach : Symbol(Array.forEach, Decl(lib.es5.d.ts, --, --)) + + test(); +>test : Symbol(test, Decl(truthinessCallExpressionCoercion.ts, 14, 39)) + + }); + } + + if (test) { // error +>test : Symbol(test, Decl(truthinessCallExpressionCoercion.ts, 14, 39)) + + [() => null].forEach(test => { +>[() => null].forEach : Symbol(Array.forEach, Decl(lib.es5.d.ts, --, --)) +>forEach : Symbol(Array.forEach, Decl(lib.es5.d.ts, --, --)) +>test : Symbol(test, Decl(truthinessCallExpressionCoercion.ts, 36, 29)) + + test(); +>test : Symbol(test, Decl(truthinessCallExpressionCoercion.ts, 36, 29)) + + }); + } +} + +function checksPropertyAccess() { +>checksPropertyAccess : Symbol(checksPropertyAccess, Decl(truthinessCallExpressionCoercion.ts, 40, 1)) + + const x = { +>x : Symbol(x, Decl(truthinessCallExpressionCoercion.ts, 43, 9)) + + foo: { +>foo : Symbol(foo, Decl(truthinessCallExpressionCoercion.ts, 43, 15)) + + bar() { return true; } +>bar : Symbol(bar, Decl(truthinessCallExpressionCoercion.ts, 44, 14)) + } + } + + if (x.foo.bar) { // error +>x.foo.bar : Symbol(bar, Decl(truthinessCallExpressionCoercion.ts, 44, 14)) +>x.foo : Symbol(foo, Decl(truthinessCallExpressionCoercion.ts, 43, 15)) +>x : Symbol(x, Decl(truthinessCallExpressionCoercion.ts, 43, 9)) +>foo : Symbol(foo, Decl(truthinessCallExpressionCoercion.ts, 43, 15)) +>bar : Symbol(bar, Decl(truthinessCallExpressionCoercion.ts, 44, 14)) + } + + if (x.foo.bar) { // ok +>x.foo.bar : Symbol(bar, Decl(truthinessCallExpressionCoercion.ts, 44, 14)) +>x.foo : Symbol(foo, Decl(truthinessCallExpressionCoercion.ts, 43, 15)) +>x : Symbol(x, Decl(truthinessCallExpressionCoercion.ts, 43, 9)) +>foo : Symbol(foo, Decl(truthinessCallExpressionCoercion.ts, 43, 15)) +>bar : Symbol(bar, Decl(truthinessCallExpressionCoercion.ts, 44, 14)) + + x.foo.bar; +>x.foo.bar : Symbol(bar, Decl(truthinessCallExpressionCoercion.ts, 44, 14)) +>x.foo : Symbol(foo, Decl(truthinessCallExpressionCoercion.ts, 43, 15)) +>x : Symbol(x, Decl(truthinessCallExpressionCoercion.ts, 43, 9)) +>foo : Symbol(foo, Decl(truthinessCallExpressionCoercion.ts, 43, 15)) +>bar : Symbol(bar, Decl(truthinessCallExpressionCoercion.ts, 44, 14)) + } +} + +class Foo { +>Foo : Symbol(Foo, Decl(truthinessCallExpressionCoercion.ts, 55, 1)) + + maybeIsUser?: () => boolean; +>maybeIsUser : Symbol(Foo.maybeIsUser, Decl(truthinessCallExpressionCoercion.ts, 57, 11)) + + isUser() { +>isUser : Symbol(Foo.isUser, Decl(truthinessCallExpressionCoercion.ts, 58, 32)) + + return true; + } + + test() { +>test : Symbol(Foo.test, Decl(truthinessCallExpressionCoercion.ts, 62, 5)) + + if (this.isUser) { // error +>this.isUser : Symbol(Foo.isUser, Decl(truthinessCallExpressionCoercion.ts, 58, 32)) +>this : Symbol(Foo, Decl(truthinessCallExpressionCoercion.ts, 55, 1)) +>isUser : Symbol(Foo.isUser, Decl(truthinessCallExpressionCoercion.ts, 58, 32)) + } + + if (this.maybeIsUser) { // ok +>this.maybeIsUser : Symbol(Foo.maybeIsUser, Decl(truthinessCallExpressionCoercion.ts, 57, 11)) +>this : Symbol(Foo, Decl(truthinessCallExpressionCoercion.ts, 55, 1)) +>maybeIsUser : Symbol(Foo.maybeIsUser, Decl(truthinessCallExpressionCoercion.ts, 57, 11)) + } + } +} + diff --git a/tests/baselines/reference/truthinessCallExpressionCoercion.types b/tests/baselines/reference/truthinessCallExpressionCoercion.types new file mode 100644 index 0000000000000..1cbb89c14a3af --- /dev/null +++ b/tests/baselines/reference/truthinessCallExpressionCoercion.types @@ -0,0 +1,179 @@ +=== tests/cases/compiler/truthinessCallExpressionCoercion.ts === +function onlyErrorsWhenTestingNonNullableFunctionType(required: () => boolean, optional?: () => boolean) { +>onlyErrorsWhenTestingNonNullableFunctionType : (required: () => boolean, optional?: (() => boolean) | undefined) => void +>required : () => boolean +>optional : (() => boolean) | undefined + + if (required) { // error +>required : () => boolean + } + + if (optional) { // ok +>optional : (() => boolean) | undefined + } + + if (!!required) { // ok +>!!required : true +>!required : false +>required : () => boolean + } + + if (required()) { // ok +>required() : boolean +>required : () => boolean + } +} + +function onlyErrorsWhenUnusedInBody() { +>onlyErrorsWhenUnusedInBody : () => void + + function test() { return Math.random() > 0.5; } +>test : () => boolean +>Math.random() > 0.5 : boolean +>Math.random() : number +>Math.random : () => number +>Math : Math +>random : () => number +>0.5 : 0.5 + + if (test) { // error +>test : () => boolean + + console.log('test'); +>console.log('test') : void +>console.log : (message?: any, ...optionalParams: any[]) => void +>console : Console +>log : (message?: any, ...optionalParams: any[]) => void +>'test' : "test" + } + + if (test) { // ok +>test : () => boolean + + console.log(test); +>console.log(test) : void +>console.log : (message?: any, ...optionalParams: any[]) => void +>console : Console +>log : (message?: any, ...optionalParams: any[]) => void +>test : () => boolean + } + + if (test) { // ok +>test : () => boolean + + test(); +>test() : boolean +>test : () => boolean + } + + if (test) { // ok +>test : () => boolean + + [() => null].forEach(() => { +>[() => null].forEach(() => { test(); }) : void +>[() => null].forEach : (callbackfn: (value: () => null, index: number, array: (() => null)[]) => void, thisArg?: any) => void +>[() => null] : (() => null)[] +>() => null : () => null +>null : null +>forEach : (callbackfn: (value: () => null, index: number, array: (() => null)[]) => void, thisArg?: any) => void +>() => { test(); } : () => void + + test(); +>test() : boolean +>test : () => boolean + + }); + } + + if (test) { // error +>test : () => boolean + + [() => null].forEach(test => { +>[() => null].forEach(test => { test(); }) : void +>[() => null].forEach : (callbackfn: (value: () => null, index: number, array: (() => null)[]) => void, thisArg?: any) => void +>[() => null] : (() => null)[] +>() => null : () => null +>null : null +>forEach : (callbackfn: (value: () => null, index: number, array: (() => null)[]) => void, thisArg?: any) => void +>test => { test(); } : (test: () => null) => void +>test : () => null + + test(); +>test() : null +>test : () => null + + }); + } +} + +function checksPropertyAccess() { +>checksPropertyAccess : () => void + + const x = { +>x : { foo: { bar(): boolean; }; } +>{ foo: { bar() { return true; } } } : { foo: { bar(): boolean; }; } + + foo: { +>foo : { bar(): boolean; } +>{ bar() { return true; } } : { bar(): boolean; } + + bar() { return true; } +>bar : () => boolean +>true : true + } + } + + if (x.foo.bar) { // error +>x.foo.bar : () => boolean +>x.foo : { bar(): boolean; } +>x : { foo: { bar(): boolean; }; } +>foo : { bar(): boolean; } +>bar : () => boolean + } + + if (x.foo.bar) { // ok +>x.foo.bar : () => boolean +>x.foo : { bar(): boolean; } +>x : { foo: { bar(): boolean; }; } +>foo : { bar(): boolean; } +>bar : () => boolean + + x.foo.bar; +>x.foo.bar : () => boolean +>x.foo : { bar(): boolean; } +>x : { foo: { bar(): boolean; }; } +>foo : { bar(): boolean; } +>bar : () => boolean + } +} + +class Foo { +>Foo : Foo + + maybeIsUser?: () => boolean; +>maybeIsUser : (() => boolean) | undefined + + isUser() { +>isUser : () => boolean + + return true; +>true : true + } + + test() { +>test : () => void + + if (this.isUser) { // error +>this.isUser : () => boolean +>this : this +>isUser : () => boolean + } + + if (this.maybeIsUser) { // ok +>this.maybeIsUser : (() => boolean) | undefined +>this : this +>maybeIsUser : (() => boolean) | undefined + } + } +} + diff --git a/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-declaration-doesnt-change/modules-and-globals-mixed-in-amd.js b/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-declaration-doesnt-change/modules-and-globals-mixed-in-amd.js index e30eed1615a04..156e26088e045 100644 --- a/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-declaration-doesnt-change/modules-and-globals-mixed-in-amd.js +++ b/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-declaration-doesnt-change/modules-and-globals-mixed-in-amd.js @@ -1,3 +1,22 @@ +//// [/lib/incremental-declaration-doesnt-changeOutput.txt] +/lib/tsc --b /src/app --verbose +12:04:00 AM - Projects in this build: + * src/lib/tsconfig.json + * src/app/tsconfig.json + +12:04:00 AM - Project 'src/lib/tsconfig.json' is out of date because oldest output 'src/lib/module.js' is older than newest input 'src/lib/file1.ts' + +12:04:00 AM - Building project '/src/lib/tsconfig.json'... + +12:04:00 AM - Project 'src/app/tsconfig.json' is out of date because output of its dependency 'src/lib' has changed + +12:04:00 AM - Updating output of project '/src/app/tsconfig.json'... + +12:04:00 AM - Updating unchanged output timestamps of project '/src/app/tsconfig.json'... + +exitCode:: 0 + + //// [/src/app/module.js] var myGlob = 20; define("file1", ["require", "exports"], function (require, exports) { @@ -332,6 +351,9 @@ declare const myVar = 30; //// [/src/lib/file1.ts] export const x = 10;console.log(x); +//// [/src/lib/module.d.ts] file written with same contents +//// [/src/lib/module.d.ts.map] file written with same contents +//// [/src/lib/module.d.ts.map.baseline.txt] file written with same contents //// [/src/lib/module.js] var myGlob = 20; define("file1", ["require", "exports"], function (require, exports) { diff --git a/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-declaration-doesnt-change/multiple-emitHelpers-in-all-projects.js b/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-declaration-doesnt-change/multiple-emitHelpers-in-all-projects.js index 6297215f3ca2b..e09e87242a1f9 100644 --- a/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-declaration-doesnt-change/multiple-emitHelpers-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-declaration-doesnt-change/multiple-emitHelpers-in-all-projects.js @@ -1,3 +1,22 @@ +//// [/lib/incremental-declaration-doesnt-changeOutput.txt] +/lib/tsc --b /src/app --verbose +12:04:00 AM - Projects in this build: + * src/lib/tsconfig.json + * src/app/tsconfig.json + +12:04:00 AM - Project 'src/lib/tsconfig.json' is out of date because oldest output 'src/lib/module.js' is older than newest input 'src/lib/file1.ts' + +12:04:00 AM - Building project '/src/lib/tsconfig.json'... + +12:04:00 AM - Project 'src/app/tsconfig.json' is out of date because output of its dependency 'src/lib' has changed + +12:04:00 AM - Updating output of project '/src/app/tsconfig.json'... + +12:04:00 AM - Updating unchanged output timestamps of project '/src/app/tsconfig.json'... + +exitCode:: 0 + + //// [/src/app/module.js] var __read = (this && this.__read) || function (o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; @@ -790,6 +809,9 @@ export const x = 10;function forlibfile1Rest() { const { b, ...rest } = { a: 10, b: 30, yy: 30 }; }console.log(x); +//// [/src/lib/module.d.ts] file written with same contents +//// [/src/lib/module.d.ts.map] file written with same contents +//// [/src/lib/module.d.ts.map.baseline.txt] file written with same contents //// [/src/lib/module.js] var __read = (this && this.__read) || function (o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; diff --git a/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-declaration-doesnt-change/multiple-prologues-in-all-projects.js b/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-declaration-doesnt-change/multiple-prologues-in-all-projects.js index 689dc08570f5f..93a7cbf732608 100644 --- a/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-declaration-doesnt-change/multiple-prologues-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-declaration-doesnt-change/multiple-prologues-in-all-projects.js @@ -1,3 +1,22 @@ +//// [/lib/incremental-declaration-doesnt-changeOutput.txt] +/lib/tsc --b /src/app --verbose +12:04:00 AM - Projects in this build: + * src/lib/tsconfig.json + * src/app/tsconfig.json + +12:04:00 AM - Project 'src/lib/tsconfig.json' is out of date because oldest output 'src/lib/module.js' is older than newest input 'src/lib/file1.ts' + +12:04:00 AM - Building project '/src/lib/tsconfig.json'... + +12:04:00 AM - Project 'src/app/tsconfig.json' is out of date because output of its dependency 'src/lib' has changed + +12:04:00 AM - Updating output of project '/src/app/tsconfig.json'... + +12:04:00 AM - Updating unchanged output timestamps of project '/src/app/tsconfig.json'... + +exitCode:: 0 + + //// [/src/app/module.js] "use strict"; "myPrologue"; @@ -482,6 +501,9 @@ declare const myVar = 30; //// [/src/lib/file1.ts] export const x = 10;console.log(x); +//// [/src/lib/module.d.ts] file written with same contents +//// [/src/lib/module.d.ts.map] file written with same contents +//// [/src/lib/module.d.ts.map.baseline.txt] file written with same contents //// [/src/lib/module.js] "use strict"; "myPrologue"; diff --git a/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-declaration-doesnt-change/shebang-in-all-projects.js b/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-declaration-doesnt-change/shebang-in-all-projects.js index d55f61ae9253e..e3daf15bcacd3 100644 --- a/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-declaration-doesnt-change/shebang-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-declaration-doesnt-change/shebang-in-all-projects.js @@ -1,3 +1,22 @@ +//// [/lib/incremental-declaration-doesnt-changeOutput.txt] +/lib/tsc --b /src/app --verbose +12:04:00 AM - Projects in this build: + * src/lib/tsconfig.json + * src/app/tsconfig.json + +12:04:00 AM - Project 'src/lib/tsconfig.json' is out of date because oldest output 'src/lib/module.js' is older than newest input 'src/lib/file1.ts' + +12:04:00 AM - Building project '/src/lib/tsconfig.json'... + +12:04:00 AM - Project 'src/app/tsconfig.json' is out of date because output of its dependency 'src/lib' has changed + +12:04:00 AM - Updating output of project '/src/app/tsconfig.json'... + +12:04:00 AM - Updating unchanged output timestamps of project '/src/app/tsconfig.json'... + +exitCode:: 0 + + //// [/src/app/module.js] #!someshebang lib file0 var myGlob = 20; @@ -338,6 +357,9 @@ declare const myVar = 30; #!someshebang lib file1 export const x = 10;console.log(x); +//// [/src/lib/module.d.ts] file written with same contents +//// [/src/lib/module.d.ts.map] file written with same contents +//// [/src/lib/module.d.ts.map.baseline.txt] file written with same contents //// [/src/lib/module.js] #!someshebang lib file0 var myGlob = 20; diff --git a/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-declaration-doesnt-change/stripInternal.js b/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-declaration-doesnt-change/stripInternal.js index 16f1d50a224ea..6f6ca38435a80 100644 --- a/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-declaration-doesnt-change/stripInternal.js +++ b/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-declaration-doesnt-change/stripInternal.js @@ -1,3 +1,22 @@ +//// [/lib/incremental-declaration-doesnt-changeOutput.txt] +/lib/tsc --b /src/app --verbose +12:04:00 AM - Projects in this build: + * src/lib/tsconfig.json + * src/app/tsconfig.json + +12:04:00 AM - Project 'src/lib/tsconfig.json' is out of date because oldest output 'src/lib/module.js' is older than newest input 'src/lib/file1.ts' + +12:04:00 AM - Building project '/src/lib/tsconfig.json'... + +12:04:00 AM - Project 'src/app/tsconfig.json' is out of date because output of its dependency 'src/lib' has changed + +12:04:00 AM - Updating output of project '/src/app/tsconfig.json'... + +12:04:00 AM - Updating unchanged output timestamps of project '/src/app/tsconfig.json'... + +exitCode:: 0 + + //// [/src/app/module.js] /*@internal*/ var myGlob = 20; define("file1", ["require", "exports"], function (require, exports) { @@ -1893,6 +1912,9 @@ export namespace normalN { /*@internal*/ export const internalConst = 10; /*@internal*/ export enum internalEnum { a, b, c }console.log(x); +//// [/src/lib/module.d.ts] file written with same contents +//// [/src/lib/module.d.ts.map] file written with same contents +//// [/src/lib/module.d.ts.map.baseline.txt] file written with same contents //// [/src/lib/module.js] /*@internal*/ var myGlob = 20; define("file1", ["require", "exports"], function (require, exports) { diff --git a/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-declaration-doesnt-change/triple-slash-refs-in-all-projects.js b/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-declaration-doesnt-change/triple-slash-refs-in-all-projects.js index ece0a5fc25abf..b07879caae0ce 100644 --- a/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-declaration-doesnt-change/triple-slash-refs-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-declaration-doesnt-change/triple-slash-refs-in-all-projects.js @@ -1,3 +1,22 @@ +//// [/lib/incremental-declaration-doesnt-changeOutput.txt] +/lib/tsc --b /src/app --verbose +12:04:00 AM - Projects in this build: + * src/lib/tsconfig.json + * src/app/tsconfig.json + +12:04:00 AM - Project 'src/lib/tsconfig.json' is out of date because oldest output 'src/lib/module.js' is older than newest input 'src/lib/file1.ts' + +12:04:00 AM - Building project '/src/lib/tsconfig.json'... + +12:04:00 AM - Project 'src/app/tsconfig.json' is out of date because output of its dependency 'src/lib' has changed + +12:04:00 AM - Updating output of project '/src/app/tsconfig.json'... + +12:04:00 AM - Updating unchanged output timestamps of project '/src/app/tsconfig.json'... + +exitCode:: 0 + + //// [/src/app/module.js] /// var file0Const = new libfile0(); @@ -432,6 +451,9 @@ declare const myVar = 30; //// [/src/lib/file1.ts] export const x = 10;console.log(x); +//// [/src/lib/module.d.ts] file written with same contents +//// [/src/lib/module.d.ts.map] file written with same contents +//// [/src/lib/module.d.ts.map.baseline.txt] file written with same contents //// [/src/lib/module.js] /// var file0Const = new libfile0(); diff --git a/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-headers-change-without-dts-changes/multiple-emitHelpers-in-all-projects.js b/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-headers-change-without-dts-changes/multiple-emitHelpers-in-all-projects.js index 6c9be3154a560..27bdfed74214d 100644 --- a/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-headers-change-without-dts-changes/multiple-emitHelpers-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-headers-change-without-dts-changes/multiple-emitHelpers-in-all-projects.js @@ -1,3 +1,22 @@ +//// [/lib/incremental-headers-change-without-dts-changesOutput.txt] +/lib/tsc --b /src/app --verbose +12:08:00 AM - Projects in this build: + * src/lib/tsconfig.json + * src/app/tsconfig.json + +12:08:00 AM - Project 'src/lib/tsconfig.json' is out of date because oldest output 'src/lib/module.js' is older than newest input 'src/lib/file1.ts' + +12:08:00 AM - Building project '/src/lib/tsconfig.json'... + +12:08:00 AM - Project 'src/app/tsconfig.json' is out of date because output of its dependency 'src/lib' has changed + +12:08:00 AM - Updating output of project '/src/app/tsconfig.json'... + +12:08:00 AM - Updating unchanged output timestamps of project '/src/app/tsconfig.json'... + +exitCode:: 0 + + //// [/src/app/module.js] var __read = (this && this.__read) || function (o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; @@ -724,6 +743,9 @@ declare function appfile4Spread(...b: number[]): void; //// [/src/lib/file1.ts] export const x = 10;function forlibfile1Rest() { } +//// [/src/lib/module.d.ts] file written with same contents +//// [/src/lib/module.d.ts.map] file written with same contents +//// [/src/lib/module.d.ts.map.baseline.txt] file written with same contents //// [/src/lib/module.js] var __read = (this && this.__read) || function (o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; diff --git a/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-headers-change-without-dts-changes/multiple-prologues-in-all-projects.js b/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-headers-change-without-dts-changes/multiple-prologues-in-all-projects.js index df3412c267c64..ae8b69e86b920 100644 --- a/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-headers-change-without-dts-changes/multiple-prologues-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-headers-change-without-dts-changes/multiple-prologues-in-all-projects.js @@ -1,3 +1,22 @@ +//// [/lib/incremental-headers-change-without-dts-changesOutput.txt] +/lib/tsc --b /src/app --verbose +12:08:00 AM - Projects in this build: + * src/lib/tsconfig.json + * src/app/tsconfig.json + +12:08:00 AM - Project 'src/lib/tsconfig.json' is out of date because oldest output 'src/lib/module.js' is older than newest input 'src/lib/file1.ts' + +12:08:00 AM - Building project '/src/lib/tsconfig.json'... + +12:08:00 AM - Project 'src/app/tsconfig.json' is out of date because output of its dependency 'src/lib' has changed + +12:08:00 AM - Updating output of project '/src/app/tsconfig.json'... + +12:08:00 AM - Updating unchanged output timestamps of project '/src/app/tsconfig.json'... + +exitCode:: 0 + + //// [/src/app/module.d.ts.map] {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../lib/file0.ts","../lib/file1.ts","../lib/file2.ts","../lib/global.ts","file3.ts","file4.ts"],"names":[],"mappings":"AACA,QAAA,MAAM,MAAM,KAAK,CAAC;;ICAlB,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;;;ICApB,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;;ACApB,QAAA,MAAM,WAAW,KAAK,CAAC;;ICAvB,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;;ACApB,QAAA,MAAM,KAAK,KAAK,CAAC"} @@ -647,6 +666,7 @@ declare const myVar = 30; "myPrologue5" export const x = 10; +//// [/src/lib/module.d.ts] file written with same contents //// [/src/lib/module.d.ts.map] {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["file0.ts","file1.ts","file2.ts","global.ts"],"names":[],"mappings":"AACA,QAAA,MAAM,MAAM,KAAK,CAAC;;ICAlB,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;;;ICApB,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;;ACApB,QAAA,MAAM,WAAW,KAAK,CAAC"} diff --git a/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-headers-change-without-dts-changes/stripInternal.js b/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-headers-change-without-dts-changes/stripInternal.js index 1c8bad6c40a1d..544b25a544dac 100644 --- a/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-headers-change-without-dts-changes/stripInternal.js +++ b/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-headers-change-without-dts-changes/stripInternal.js @@ -1,3 +1,20 @@ +//// [/lib/incremental-headers-change-without-dts-changesOutput.txt] +/lib/tsc --b /src/app --verbose +12:08:00 AM - Projects in this build: + * src/lib/tsconfig.json + * src/app/tsconfig.json + +12:08:00 AM - Project 'src/lib/tsconfig.json' is out of date because oldest output 'src/lib/module.js' is older than newest input 'src/lib/file1.ts' + +12:08:00 AM - Building project '/src/lib/tsconfig.json'... + +12:08:00 AM - Project 'src/app/tsconfig.json' is out of date because output of its dependency 'src/lib' has changed + +12:08:00 AM - Updating output of project '/src/app/tsconfig.json'... + +exitCode:: 0 + + //// [/src/app/module.d.ts] declare module "file1" { export class normalC { @@ -2071,6 +2088,7 @@ export namespace normalN { /*@internal*/ export const internalConst = 10; /*@internal*/ export enum internalEnum { a, b, c } +//// [/src/lib/module.d.ts] file written with same contents //// [/src/lib/module.d.ts.map] {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["file0.ts","file1.ts","file2.ts","global.ts"],"names":[],"mappings":"AAAc,QAAA,MAAM,MAAM,KAAK,CAAC;;ICAlB,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;IAClC,MAAM,OAAO,OAAO;;QAEF,IAAI,EAAE,MAAM,CAAC;QACb,MAAM;sBACF,CAAC,EACM,MAAM;KAClC;IACD,MAAM,WAAW,OAAO,CAAC;QACP,MAAa,CAAC;SAAI;QAClB,SAAgB,GAAG,SAAK;QACxB,UAAiB,aAAa,CAAC;YAAE,MAAa,CAAC;aAAG;SAAE;QACpD,UAAiB,SAAS,CAAC,SAAS,CAAC;YAAE,MAAa,SAAS;aAAG;SAAE;QAClE,MAAM,QAAQ,UAAU,GAAG,aAAa,CAAC,CAAC,CAAC;QAC3C,KAAY,YAAY,GAAG,SAAS,CAAC;QAC9B,MAAM,aAAa,KAAK,CAAC;QAChC,KAAY,YAAY;YAAG,CAAC,IAAA;YAAE,CAAC,IAAA;YAAE,CAAC,IAAA;SAAE;KACrD;IACa,MAAM,OAAO,SAAS;KAAG;IACzB,MAAM,UAAU,WAAW,SAAK;IAChC,MAAM,WAAW,iBAAiB,CAAC;QAAE,MAAa,SAAS;SAAG;KAAE;IAChE,MAAM,WAAW,aAAa,CAAC,SAAS,CAAC;QAAE,MAAa,SAAS;SAAG;KAAE;IACtE,MAAM,QAAQ,cAAc,GAAG,iBAAiB,CAAC,SAAS,CAAC;IAC3D,MAAM,MAAM,YAAY,GAAG,SAAS,CAAC;IACrC,MAAM,CAAC,MAAM,aAAa,KAAK,CAAC;IAChC,MAAM,MAAM,YAAY;QAAG,CAAC,IAAA;QAAE,CAAC,IAAA;QAAE,CAAC,IAAA;KAAE;;;ICzBlD,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;;ACApB,QAAA,MAAM,WAAW,KAAK,CAAC"} diff --git a/tests/baselines/reference/tsbuild/amdModulesWithOut/initial-Build/modules-and-globals-mixed-in-amd.js b/tests/baselines/reference/tsbuild/amdModulesWithOut/initial-build/modules-and-globals-mixed-in-amd.js similarity index 95% rename from tests/baselines/reference/tsbuild/amdModulesWithOut/initial-Build/modules-and-globals-mixed-in-amd.js rename to tests/baselines/reference/tsbuild/amdModulesWithOut/initial-build/modules-and-globals-mixed-in-amd.js index 4106601d1e374..1e6b3c5f9d3bd 100644 --- a/tests/baselines/reference/tsbuild/amdModulesWithOut/initial-Build/modules-and-globals-mixed-in-amd.js +++ b/tests/baselines/reference/tsbuild/amdModulesWithOut/initial-build/modules-and-globals-mixed-in-amd.js @@ -1,3 +1,20 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/app --verbose +12:01:00 AM - Projects in this build: + * src/lib/tsconfig.json + * src/app/tsconfig.json + +12:01:00 AM - Project 'src/lib/tsconfig.json' is out of date because output file 'src/lib/module.js' does not exist + +12:01:00 AM - Building project '/src/lib/tsconfig.json'... + +12:01:00 AM - Project 'src/app/tsconfig.json' is out of date because output file 'src/app/module.js' does not exist + +12:01:00 AM - Building project '/src/app/tsconfig.json'... + +exitCode:: 0 + + //// [/src/app/module.d.ts] declare const myGlob = 20; declare module "file1" { diff --git a/tests/baselines/reference/tsbuild/amdModulesWithOut/initial-Build/multiple-emitHelpers-in-all-projects.js b/tests/baselines/reference/tsbuild/amdModulesWithOut/initial-build/multiple-emitHelpers-in-all-projects.js similarity index 96% rename from tests/baselines/reference/tsbuild/amdModulesWithOut/initial-Build/multiple-emitHelpers-in-all-projects.js rename to tests/baselines/reference/tsbuild/amdModulesWithOut/initial-build/multiple-emitHelpers-in-all-projects.js index eeb57b9cf9e56..4bef255a862de 100644 --- a/tests/baselines/reference/tsbuild/amdModulesWithOut/initial-Build/multiple-emitHelpers-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/amdModulesWithOut/initial-build/multiple-emitHelpers-in-all-projects.js @@ -1,3 +1,20 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/app --verbose +12:01:00 AM - Projects in this build: + * src/lib/tsconfig.json + * src/app/tsconfig.json + +12:01:00 AM - Project 'src/lib/tsconfig.json' is out of date because output file 'src/lib/module.js' does not exist + +12:01:00 AM - Building project '/src/lib/tsconfig.json'... + +12:01:00 AM - Project 'src/app/tsconfig.json' is out of date because output file 'src/app/module.js' does not exist + +12:01:00 AM - Building project '/src/app/tsconfig.json'... + +exitCode:: 0 + + //// [/src/app/file3.ts] export const z = 30; import { x } from "file1";function forappfile3Rest() { diff --git a/tests/baselines/reference/tsbuild/amdModulesWithOut/initial-Build/multiple-prologues-in-all-projects.js b/tests/baselines/reference/tsbuild/amdModulesWithOut/initial-build/multiple-prologues-in-all-projects.js similarity index 95% rename from tests/baselines/reference/tsbuild/amdModulesWithOut/initial-Build/multiple-prologues-in-all-projects.js rename to tests/baselines/reference/tsbuild/amdModulesWithOut/initial-build/multiple-prologues-in-all-projects.js index 4835019b1f977..0a28b0c50032b 100644 --- a/tests/baselines/reference/tsbuild/amdModulesWithOut/initial-Build/multiple-prologues-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/amdModulesWithOut/initial-build/multiple-prologues-in-all-projects.js @@ -1,3 +1,20 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/app --verbose +12:01:00 AM - Projects in this build: + * src/lib/tsconfig.json + * src/app/tsconfig.json + +12:01:00 AM - Project 'src/lib/tsconfig.json' is out of date because output file 'src/lib/module.js' does not exist + +12:01:00 AM - Building project '/src/lib/tsconfig.json'... + +12:01:00 AM - Project 'src/app/tsconfig.json' is out of date because output file 'src/app/module.js' does not exist + +12:01:00 AM - Building project '/src/app/tsconfig.json'... + +exitCode:: 0 + + //// [/src/app/file3.ts] "myPrologue" export const z = 30; diff --git a/tests/baselines/reference/tsbuild/amdModulesWithOut/initial-Build/shebang-in-all-projects.js b/tests/baselines/reference/tsbuild/amdModulesWithOut/initial-build/shebang-in-all-projects.js similarity index 95% rename from tests/baselines/reference/tsbuild/amdModulesWithOut/initial-Build/shebang-in-all-projects.js rename to tests/baselines/reference/tsbuild/amdModulesWithOut/initial-build/shebang-in-all-projects.js index eb0407a5b1766..16c2c89eab939 100644 --- a/tests/baselines/reference/tsbuild/amdModulesWithOut/initial-Build/shebang-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/amdModulesWithOut/initial-build/shebang-in-all-projects.js @@ -1,3 +1,20 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/app --verbose +12:01:00 AM - Projects in this build: + * src/lib/tsconfig.json + * src/app/tsconfig.json + +12:01:00 AM - Project 'src/lib/tsconfig.json' is out of date because output file 'src/lib/module.js' does not exist + +12:01:00 AM - Building project '/src/lib/tsconfig.json'... + +12:01:00 AM - Project 'src/app/tsconfig.json' is out of date because output file 'src/app/module.js' does not exist + +12:01:00 AM - Building project '/src/app/tsconfig.json'... + +exitCode:: 0 + + //// [/src/app/file3.ts] #!someshebang app file3 export const z = 30; diff --git a/tests/baselines/reference/tsbuild/amdModulesWithOut/initial-Build/stripInternal.js b/tests/baselines/reference/tsbuild/amdModulesWithOut/initial-build/stripInternal.js similarity index 97% rename from tests/baselines/reference/tsbuild/amdModulesWithOut/initial-Build/stripInternal.js rename to tests/baselines/reference/tsbuild/amdModulesWithOut/initial-build/stripInternal.js index dcac12cae9f3b..2d2bd9809d628 100644 --- a/tests/baselines/reference/tsbuild/amdModulesWithOut/initial-Build/stripInternal.js +++ b/tests/baselines/reference/tsbuild/amdModulesWithOut/initial-build/stripInternal.js @@ -1,3 +1,20 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/app --verbose +12:01:00 AM - Projects in this build: + * src/lib/tsconfig.json + * src/app/tsconfig.json + +12:01:00 AM - Project 'src/lib/tsconfig.json' is out of date because output file 'src/lib/module.js' does not exist + +12:01:00 AM - Building project '/src/lib/tsconfig.json'... + +12:01:00 AM - Project 'src/app/tsconfig.json' is out of date because output file 'src/app/module.js' does not exist + +12:01:00 AM - Building project '/src/app/tsconfig.json'... + +exitCode:: 0 + + //// [/src/app/module.d.ts] declare module "file1" { export const x = 10; diff --git a/tests/baselines/reference/tsbuild/amdModulesWithOut/initial-Build/triple-slash-refs-in-all-projects.js b/tests/baselines/reference/tsbuild/amdModulesWithOut/initial-build/triple-slash-refs-in-all-projects.js similarity index 95% rename from tests/baselines/reference/tsbuild/amdModulesWithOut/initial-Build/triple-slash-refs-in-all-projects.js rename to tests/baselines/reference/tsbuild/amdModulesWithOut/initial-build/triple-slash-refs-in-all-projects.js index 30f8da909cdc2..50259e2c93d3a 100644 --- a/tests/baselines/reference/tsbuild/amdModulesWithOut/initial-Build/triple-slash-refs-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/amdModulesWithOut/initial-build/triple-slash-refs-in-all-projects.js @@ -1,3 +1,20 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/app --verbose +12:01:00 AM - Projects in this build: + * src/lib/tsconfig.json + * src/app/tsconfig.json + +12:01:00 AM - Project 'src/lib/tsconfig.json' is out of date because output file 'src/lib/module.js' does not exist + +12:01:00 AM - Building project '/src/lib/tsconfig.json'... + +12:01:00 AM - Project 'src/app/tsconfig.json' is out of date because output file 'src/app/module.js' does not exist + +12:01:00 AM - Building project '/src/app/tsconfig.json'... + +exitCode:: 0 + + //// [/src/app/file4.ts] /// const file4Const = new appfile4(); diff --git a/tests/baselines/reference/tsbuild/amdModulesWithOut/initial-Build/when-the-module-resolution-finds-original-source-file.js b/tests/baselines/reference/tsbuild/amdModulesWithOut/initial-build/when-the-module-resolution-finds-original-source-file.js similarity index 64% rename from tests/baselines/reference/tsbuild/amdModulesWithOut/initial-Build/when-the-module-resolution-finds-original-source-file.js rename to tests/baselines/reference/tsbuild/amdModulesWithOut/initial-build/when-the-module-resolution-finds-original-source-file.js index 3fdb37efb3a76..9bc7340630f53 100644 --- a/tests/baselines/reference/tsbuild/amdModulesWithOut/initial-Build/when-the-module-resolution-finds-original-source-file.js +++ b/tests/baselines/reference/tsbuild/amdModulesWithOut/initial-build/when-the-module-resolution-finds-original-source-file.js @@ -1,3 +1,20 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc -b /src/app --verbose +12:00:00 AM - Projects in this build: + * src/lib/tsconfig.json + * src/app/tsconfig.json + +12:00:00 AM - Project 'src/lib/tsconfig.json' is out of date because output file 'src/module.js' does not exist + +12:00:00 AM - Building project '/src/lib/tsconfig.json'... + +12:00:00 AM - Project 'src/app/tsconfig.json' is out of date because output file 'src/app/module.js' does not exist + +12:00:00 AM - Building project '/src/app/tsconfig.json'... + +exitCode:: 0 + + //// [/src/app/file3.ts] export const z = 30; import { x } from "lib/file1"; @@ -521,6 +538,123 @@ declare const globalConst = 10; //// [/src/module.d.ts.map] {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["lib/file0.ts","lib/file1.ts","lib/file2.ts","lib/global.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,MAAM,KAAK,CAAC;;ICAlB,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;;;ICApB,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;;ACApB,QAAA,MAAM,WAAW,KAAK,CAAC"} +//// [/src/module.d.ts.map.baseline.txt] +=================================================================== +JsFile: module.d.ts +mapUrl: module.d.ts.map +sourceRoot: +sources: lib/file0.ts,lib/file1.ts,lib/file2.ts,lib/global.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:/src/module.d.ts +sourceFile:lib/file0.ts +------------------------------------------------------------------- +>>>declare const myGlob = 20; +1 > +2 >^^^^^^^^ +3 > ^^^^^^ +4 > ^^^^^^ +5 > ^^^^^ +6 > ^ +7 > ^^^-> +1 > +2 > +3 > const +4 > myGlob +5 > = 20 +6 > ; +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 9) Source(1, 1) + SourceIndex(0) +3 >Emitted(1, 15) Source(1, 7) + SourceIndex(0) +4 >Emitted(1, 21) Source(1, 13) + SourceIndex(0) +5 >Emitted(1, 26) Source(1, 18) + SourceIndex(0) +6 >Emitted(1, 27) Source(1, 19) + SourceIndex(0) +--- +------------------------------------------------------------------- +emittedFile:/src/module.d.ts +sourceFile:lib/file1.ts +------------------------------------------------------------------- +>>>declare module "lib/file1" { +>>> export const x = 10; +1->^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +1-> +2 > export +3 > +4 > const +5 > x +6 > = 10 +7 > ; +1->Emitted(3, 5) Source(1, 1) + SourceIndex(1) +2 >Emitted(3, 11) Source(1, 7) + SourceIndex(1) +3 >Emitted(3, 12) Source(1, 8) + SourceIndex(1) +4 >Emitted(3, 18) Source(1, 14) + SourceIndex(1) +5 >Emitted(3, 19) Source(1, 15) + SourceIndex(1) +6 >Emitted(3, 24) Source(1, 20) + SourceIndex(1) +7 >Emitted(3, 25) Source(1, 21) + SourceIndex(1) +--- +------------------------------------------------------------------- +emittedFile:/src/module.d.ts +sourceFile:lib/file2.ts +------------------------------------------------------------------- +>>>} +>>>declare module "lib/file2" { +>>> export const y = 20; +1 >^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +1 > +2 > export +3 > +4 > const +5 > y +6 > = 20 +7 > ; +1 >Emitted(6, 5) Source(1, 1) + SourceIndex(2) +2 >Emitted(6, 11) Source(1, 7) + SourceIndex(2) +3 >Emitted(6, 12) Source(1, 8) + SourceIndex(2) +4 >Emitted(6, 18) Source(1, 14) + SourceIndex(2) +5 >Emitted(6, 19) Source(1, 15) + SourceIndex(2) +6 >Emitted(6, 24) Source(1, 20) + SourceIndex(2) +7 >Emitted(6, 25) Source(1, 21) + SourceIndex(2) +--- +------------------------------------------------------------------- +emittedFile:/src/module.d.ts +sourceFile:lib/global.ts +------------------------------------------------------------------- +>>>} +>>>declare const globalConst = 10; +1 > +2 >^^^^^^^^ +3 > ^^^^^^ +4 > ^^^^^^^^^^^ +5 > ^^^^^ +6 > ^ +7 > ^^^^-> +1 > +2 > +3 > const +4 > globalConst +5 > = 10 +6 > ; +1 >Emitted(8, 1) Source(1, 1) + SourceIndex(3) +2 >Emitted(8, 9) Source(1, 1) + SourceIndex(3) +3 >Emitted(8, 15) Source(1, 7) + SourceIndex(3) +4 >Emitted(8, 26) Source(1, 18) + SourceIndex(3) +5 >Emitted(8, 31) Source(1, 23) + SourceIndex(3) +6 >Emitted(8, 32) Source(1, 24) + SourceIndex(3) +--- +>>>//# sourceMappingURL=module.d.ts.map + //// [/src/module.js] var myGlob = 20; define("lib/file1", ["require", "exports"], function (require, exports) { @@ -539,6 +673,121 @@ var globalConst = 10; //// [/src/module.js.map] {"version":3,"file":"module.js","sourceRoot":"","sources":["lib/file0.ts","lib/file1.ts","lib/file2.ts","lib/global.ts"],"names":[],"mappings":"AAAA,IAAM,MAAM,GAAG,EAAE,CAAC;;;;ICAL,QAAA,CAAC,GAAG,EAAE,CAAC;;;;;ICAP,QAAA,CAAC,GAAG,EAAE,CAAC;;ACApB,IAAM,WAAW,GAAG,EAAE,CAAC"} +//// [/src/module.js.map.baseline.txt] +=================================================================== +JsFile: module.js +mapUrl: module.js.map +sourceRoot: +sources: lib/file0.ts,lib/file1.ts,lib/file2.ts,lib/global.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:/src/module.js +sourceFile:lib/file0.ts +------------------------------------------------------------------- +>>>var myGlob = 20; +1 > +2 >^^^^ +3 > ^^^^^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >const +3 > myGlob +4 > = +5 > 20 +6 > ; +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(1, 7) + SourceIndex(0) +3 >Emitted(1, 11) Source(1, 13) + SourceIndex(0) +4 >Emitted(1, 14) Source(1, 16) + SourceIndex(0) +5 >Emitted(1, 16) Source(1, 18) + SourceIndex(0) +6 >Emitted(1, 17) Source(1, 19) + SourceIndex(0) +--- +------------------------------------------------------------------- +emittedFile:/src/module.js +sourceFile:lib/file1.ts +------------------------------------------------------------------- +>>>define("lib/file1", ["require", "exports"], function (require, exports) { +>>> "use strict"; +>>> Object.defineProperty(exports, "__esModule", { value: true }); +>>> exports.x = 10; +1->^^^^ +2 > ^^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^^ +6 > ^ +1->export const +2 > +3 > x +4 > = +5 > 10 +6 > ; +1->Emitted(5, 5) Source(1, 14) + SourceIndex(1) +2 >Emitted(5, 13) Source(1, 14) + SourceIndex(1) +3 >Emitted(5, 14) Source(1, 15) + SourceIndex(1) +4 >Emitted(5, 17) Source(1, 18) + SourceIndex(1) +5 >Emitted(5, 19) Source(1, 20) + SourceIndex(1) +6 >Emitted(5, 20) Source(1, 21) + SourceIndex(1) +--- +------------------------------------------------------------------- +emittedFile:/src/module.js +sourceFile:lib/file2.ts +------------------------------------------------------------------- +>>>}); +>>>define("lib/file2", ["require", "exports"], function (require, exports) { +>>> "use strict"; +>>> Object.defineProperty(exports, "__esModule", { value: true }); +>>> exports.y = 20; +1 >^^^^ +2 > ^^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^^ +6 > ^ +1 >export const +2 > +3 > y +4 > = +5 > 20 +6 > ; +1 >Emitted(10, 5) Source(1, 14) + SourceIndex(2) +2 >Emitted(10, 13) Source(1, 14) + SourceIndex(2) +3 >Emitted(10, 14) Source(1, 15) + SourceIndex(2) +4 >Emitted(10, 17) Source(1, 18) + SourceIndex(2) +5 >Emitted(10, 19) Source(1, 20) + SourceIndex(2) +6 >Emitted(10, 20) Source(1, 21) + SourceIndex(2) +--- +------------------------------------------------------------------- +emittedFile:/src/module.js +sourceFile:lib/global.ts +------------------------------------------------------------------- +>>>}); +>>>var globalConst = 10; +1 > +2 >^^^^ +3 > ^^^^^^^^^^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > +2 >const +3 > globalConst +4 > = +5 > 10 +6 > ; +1 >Emitted(12, 1) Source(1, 1) + SourceIndex(3) +2 >Emitted(12, 5) Source(1, 7) + SourceIndex(3) +3 >Emitted(12, 16) Source(1, 18) + SourceIndex(3) +4 >Emitted(12, 19) Source(1, 21) + SourceIndex(3) +5 >Emitted(12, 21) Source(1, 23) + SourceIndex(3) +6 >Emitted(12, 22) Source(1, 24) + SourceIndex(3) +--- +>>>//# sourceMappingURL=module.js.map + //// [/src/module.tsbuildinfo] { "bundle": { @@ -571,3 +820,37 @@ var globalConst = 10; "version": "FakeTSVersion" } +//// [/src/module.tsbuildinfo.baseline.txt] +====================================================================== +File:: /src/module.js +---------------------------------------------------------------------- +text: (0-417) +var myGlob = 20; +define("lib/file1", ["require", "exports"], function (require, exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.x = 10; +}); +define("lib/file2", ["require", "exports"], function (require, exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.y = 20; +}); +var globalConst = 10; + +====================================================================== +====================================================================== +File:: /src/module.d.ts +---------------------------------------------------------------------- +text: (0-179) +declare const myGlob = 20; +declare module "lib/file1" { + export const x = 10; +} +declare module "lib/file2" { + export const y = 20; +} +declare const globalConst = 10; + +====================================================================== + diff --git a/tests/baselines/reference/tsbuild/emitDeclarationOnly/incremental-declaration-changes/only-dts-output-in-circular-import-project-with-emitDeclarationOnly-and-declarationMap.js b/tests/baselines/reference/tsbuild/emitDeclarationOnly/incremental-declaration-changes/only-dts-output-in-circular-import-project-with-emitDeclarationOnly-and-declarationMap.js index 9a793388ac0ad..d2d70c1b8bef2 100644 --- a/tests/baselines/reference/tsbuild/emitDeclarationOnly/incremental-declaration-changes/only-dts-output-in-circular-import-project-with-emitDeclarationOnly-and-declarationMap.js +++ b/tests/baselines/reference/tsbuild/emitDeclarationOnly/incremental-declaration-changes/only-dts-output-in-circular-import-project-with-emitDeclarationOnly-and-declarationMap.js @@ -1,3 +1,15 @@ +//// [/lib/incremental-declaration-changesOutput.txt] +/lib/tsc --b /src --verbose +12:04:00 AM - Projects in this build: + * src/tsconfig.json + +12:04:00 AM - Project 'src/tsconfig.json' is out of date because oldest output 'src/lib/a.d.ts' is older than newest input 'src/src/a.ts' + +12:04:00 AM - Building project '/src/tsconfig.json'... + +exitCode:: 0 + + //// [/src/lib/a.d.ts] import { B } from "./b"; export interface A { @@ -9,6 +21,12 @@ export interface A { //// [/src/lib/a.d.ts.map] {"version":3,"file":"a.d.ts","sourceRoot":"","sources":["../src/a.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,WAAW,CAAC;IAChB,CAAC,EAAE,CAAC,CAAC;IAAC,GAAG,EAAE,GAAG,CAAC;CAChB"} +//// [/src/lib/b.d.ts] file written with same contents +//// [/src/lib/b.d.ts.map] file written with same contents +//// [/src/lib/c.d.ts] file written with same contents +//// [/src/lib/c.d.ts.map] file written with same contents +//// [/src/lib/index.d.ts] file written with same contents +//// [/src/lib/index.d.ts.map] file written with same contents //// [/src/src/a.ts] import { B } from "./b"; diff --git a/tests/baselines/reference/tsbuild/emitDeclarationOnly/incremental-declaration-changes/only-dts-output-in-circular-import-project-with-emitDeclarationOnly.js b/tests/baselines/reference/tsbuild/emitDeclarationOnly/incremental-declaration-changes/only-dts-output-in-circular-import-project-with-emitDeclarationOnly.js index a86656dbed577..6e6f2bb1805c5 100644 --- a/tests/baselines/reference/tsbuild/emitDeclarationOnly/incremental-declaration-changes/only-dts-output-in-circular-import-project-with-emitDeclarationOnly.js +++ b/tests/baselines/reference/tsbuild/emitDeclarationOnly/incremental-declaration-changes/only-dts-output-in-circular-import-project-with-emitDeclarationOnly.js @@ -1,3 +1,15 @@ +//// [/lib/incremental-declaration-changesOutput.txt] +/lib/tsc --b /src --verbose +12:04:00 AM - Projects in this build: + * src/tsconfig.json + +12:04:00 AM - Project 'src/tsconfig.json' is out of date because oldest output 'src/lib/a.d.ts' is older than newest input 'src/src/a.ts' + +12:04:00 AM - Building project '/src/tsconfig.json'... + +exitCode:: 0 + + //// [/src/lib/a.d.ts] import { B } from "./b"; export interface A { @@ -6,6 +18,9 @@ export interface A { } +//// [/src/lib/b.d.ts] file written with same contents +//// [/src/lib/c.d.ts] file written with same contents +//// [/src/lib/index.d.ts] file written with same contents //// [/src/src/a.ts] import { B } from "./b"; diff --git a/tests/baselines/reference/tsbuild/emitDeclarationOnly/incremental-declaration-changes/only-dts-output-in-non-circular-imports-project-with-emitDeclarationOnly.js b/tests/baselines/reference/tsbuild/emitDeclarationOnly/incremental-declaration-changes/only-dts-output-in-non-circular-imports-project-with-emitDeclarationOnly.js index 8a70278d3159b..8bcb33bced78b 100644 --- a/tests/baselines/reference/tsbuild/emitDeclarationOnly/incremental-declaration-changes/only-dts-output-in-non-circular-imports-project-with-emitDeclarationOnly.js +++ b/tests/baselines/reference/tsbuild/emitDeclarationOnly/incremental-declaration-changes/only-dts-output-in-non-circular-imports-project-with-emitDeclarationOnly.js @@ -1,3 +1,15 @@ +//// [/lib/incremental-declaration-changesOutput.txt] +/lib/tsc --b /src --verbose +12:04:00 AM - Projects in this build: + * src/tsconfig.json + +12:04:00 AM - Project 'src/tsconfig.json' is out of date because oldest output 'src/lib/a.d.ts' is older than newest input 'src/src/a.ts' + +12:04:00 AM - Building project '/src/tsconfig.json'... + +exitCode:: 0 + + //// [/src/lib/a.d.ts] export declare class B { prop: string; @@ -11,6 +23,10 @@ export interface A { //// [/src/lib/a.d.ts.map] {"version":3,"file":"a.d.ts","sourceRoot":"","sources":["../src/a.ts"],"names":[],"mappings":"AAAA,qBAAa,CAAC;IAAG,IAAI,SAAW;CAAE;AAElC,MAAM,WAAW,CAAC;IAChB,CAAC,EAAE,CAAC,CAAC;IAAC,GAAG,EAAE,GAAG,CAAC;CAChB"} +//// [/src/lib/b.d.ts] file written with same contents +//// [/src/lib/b.d.ts.map] file written with same contents +//// [/src/lib/c.d.ts] file written with same contents +//// [/src/lib/c.d.ts.map] file written with same contents //// [/src/src/a.ts] export class B { prop = "hello"; } diff --git a/tests/baselines/reference/tsbuild/emitDeclarationOnly/incremental-declaration-doesnt-change/only-dts-output-in-non-circular-imports-project-with-emitDeclarationOnly.js b/tests/baselines/reference/tsbuild/emitDeclarationOnly/incremental-declaration-doesnt-change/only-dts-output-in-non-circular-imports-project-with-emitDeclarationOnly.js index 7facc60eef507..bdfcb1e826f33 100644 --- a/tests/baselines/reference/tsbuild/emitDeclarationOnly/incremental-declaration-doesnt-change/only-dts-output-in-non-circular-imports-project-with-emitDeclarationOnly.js +++ b/tests/baselines/reference/tsbuild/emitDeclarationOnly/incremental-declaration-doesnt-change/only-dts-output-in-non-circular-imports-project-with-emitDeclarationOnly.js @@ -1,3 +1,18 @@ +//// [/lib/incremental-declaration-doesnt-changeOutput.txt] +/lib/tsc --b /src --verbose +12:08:00 AM - Projects in this build: + * src/tsconfig.json + +12:08:00 AM - Project 'src/tsconfig.json' is out of date because oldest output 'src/lib/a.d.ts' is older than newest input 'src/src/a.ts' + +12:08:00 AM - Building project '/src/tsconfig.json'... + +12:08:00 AM - Updating unchanged output timestamps of project '/src/tsconfig.json'... + +exitCode:: 0 + + +//// [/src/lib/a.d.ts] file written with same contents //// [/src/lib/a.d.ts.map] {"version":3,"file":"a.d.ts","sourceRoot":"","sources":["../src/a.ts"],"names":[],"mappings":"AAAA,qBAAa,CAAC;IAAG,IAAI,SAAW;CAAE;AAGlC,MAAM,WAAW,CAAC;IAChB,CAAC,EAAE,CAAC,CAAC;CACN"} diff --git a/tests/baselines/reference/tsbuild/emitDeclarationOnly/initial-Build/only-dts-output-in-circular-import-project-with-emitDeclarationOnly-and-declarationMap.js b/tests/baselines/reference/tsbuild/emitDeclarationOnly/initial-build/only-dts-output-in-circular-import-project-with-emitDeclarationOnly-and-declarationMap.js similarity index 92% rename from tests/baselines/reference/tsbuild/emitDeclarationOnly/initial-Build/only-dts-output-in-circular-import-project-with-emitDeclarationOnly-and-declarationMap.js rename to tests/baselines/reference/tsbuild/emitDeclarationOnly/initial-build/only-dts-output-in-circular-import-project-with-emitDeclarationOnly-and-declarationMap.js index 838bf28950f66..38d8974e90031 100644 --- a/tests/baselines/reference/tsbuild/emitDeclarationOnly/initial-Build/only-dts-output-in-circular-import-project-with-emitDeclarationOnly-and-declarationMap.js +++ b/tests/baselines/reference/tsbuild/emitDeclarationOnly/initial-build/only-dts-output-in-circular-import-project-with-emitDeclarationOnly-and-declarationMap.js @@ -1,3 +1,15 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src --verbose +12:01:00 AM - Projects in this build: + * src/tsconfig.json + +12:01:00 AM - Project 'src/tsconfig.json' is out of date because output file 'src/lib/a.d.ts' does not exist + +12:01:00 AM - Building project '/src/tsconfig.json'... + +exitCode:: 0 + + //// [/src/lib/a.d.ts] import { B } from "./b"; export interface A { diff --git a/tests/baselines/reference/tsbuild/emitDeclarationOnly/initial-Build/only-dts-output-in-circular-import-project-with-emitDeclarationOnly.js b/tests/baselines/reference/tsbuild/emitDeclarationOnly/initial-build/only-dts-output-in-circular-import-project-with-emitDeclarationOnly.js similarity index 93% rename from tests/baselines/reference/tsbuild/emitDeclarationOnly/initial-Build/only-dts-output-in-circular-import-project-with-emitDeclarationOnly.js rename to tests/baselines/reference/tsbuild/emitDeclarationOnly/initial-build/only-dts-output-in-circular-import-project-with-emitDeclarationOnly.js index d07b0914c3251..6f2bc2632123b 100644 --- a/tests/baselines/reference/tsbuild/emitDeclarationOnly/initial-Build/only-dts-output-in-circular-import-project-with-emitDeclarationOnly.js +++ b/tests/baselines/reference/tsbuild/emitDeclarationOnly/initial-build/only-dts-output-in-circular-import-project-with-emitDeclarationOnly.js @@ -1,3 +1,15 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src --verbose +12:01:00 AM - Projects in this build: + * src/tsconfig.json + +12:01:00 AM - Project 'src/tsconfig.json' is out of date because output file 'src/lib/a.d.ts' does not exist + +12:01:00 AM - Building project '/src/tsconfig.json'... + +exitCode:: 0 + + //// [/src/lib/a.d.ts] import { B } from "./b"; export interface A { diff --git a/tests/baselines/reference/tsbuild/emitDeclarationOnly/initial-Build/only-dts-output-in-non-circular-imports-project-with-emitDeclarationOnly.js b/tests/baselines/reference/tsbuild/emitDeclarationOnly/initial-build/only-dts-output-in-non-circular-imports-project-with-emitDeclarationOnly.js similarity index 91% rename from tests/baselines/reference/tsbuild/emitDeclarationOnly/initial-Build/only-dts-output-in-non-circular-imports-project-with-emitDeclarationOnly.js rename to tests/baselines/reference/tsbuild/emitDeclarationOnly/initial-build/only-dts-output-in-non-circular-imports-project-with-emitDeclarationOnly.js index 86f7dc6e8bc8b..aabaf41d53bb4 100644 --- a/tests/baselines/reference/tsbuild/emitDeclarationOnly/initial-Build/only-dts-output-in-non-circular-imports-project-with-emitDeclarationOnly.js +++ b/tests/baselines/reference/tsbuild/emitDeclarationOnly/initial-build/only-dts-output-in-non-circular-imports-project-with-emitDeclarationOnly.js @@ -1,3 +1,15 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src --verbose +12:01:00 AM - Projects in this build: + * src/tsconfig.json + +12:01:00 AM - Project 'src/tsconfig.json' is out of date because output file 'src/lib/a.d.ts' does not exist + +12:01:00 AM - Building project '/src/tsconfig.json'... + +exitCode:: 0 + + //// [/src/lib/a.d.ts] export declare class B { prop: string; diff --git a/tests/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/incremental-declaration-changes/inferred-type-from-transitive-module-with-isolatedModules.js b/tests/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/incremental-declaration-changes/inferred-type-from-transitive-module-with-isolatedModules.js new file mode 100644 index 0000000000000..a95215cf77fa4 --- /dev/null +++ b/tests/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/incremental-declaration-changes/inferred-type-from-transitive-module-with-isolatedModules.js @@ -0,0 +1,110 @@ +//// [/lib/incremental-declaration-changesOutput.txt] +/lib/tsc --b /src --verbose +12:04:00 AM - Projects in this build: + * src/tsconfig.json + +12:04:00 AM - Project 'src/tsconfig.json' is out of date because oldest output 'src/obj/bar.js' is older than newest input 'src/bar.ts' + +12:04:00 AM - Building project '/src/tsconfig.json'... + +12:04:00 AM - Updating unchanged output timestamps of project '/src/tsconfig.json'... + +exitCode:: 0 + + +//// [/src/bar.ts] +interface RawAction { + (...args: any[]): Promise | void; +} +interface ActionFactory { + (target: T): T; +} +declare function foo(): ActionFactory; +export default foo()(function foobar(): void { +}); + +//// [/src/obj/bar.d.ts] +declare const _default: () => void; +export default _default; + + +//// [/src/obj/bar.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = foo()(function foobar() { +}); + + +//// [/src/obj/index.d.ts] +import { LazyAction } from './bundling'; +export declare const lazyBar: LazyAction<() => void, typeof import("./lazyIndex")>; + + +//// [/src/obj/lazyIndex.d.ts] file written with same contents +//// [/src/obj/tsconfig.tsbuildinfo] +{ + "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; };", + "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; };" + }, + "../bar.ts": { + "version": "747071916-interface RawAction {\r\n (...args: any[]): Promise | void;\r\n}\r\ninterface ActionFactory {\r\n (target: T): T;\r\n}\r\ndeclare function foo(): ActionFactory;\r\nexport default foo()(function foobar(): void {\r\n});", + "signature": "-9232740537-declare const _default: () => void;\r\nexport default _default;\r\n" + }, + "../bundling.ts": { + "version": "-21659820217-export class LazyModule {\r\n constructor(private importCallback: () => Promise) {}\r\n}\r\n\r\nexport class LazyAction<\r\n TAction extends (...args: any[]) => any,\r\n TModule\r\n> {\r\n constructor(_lazyModule: LazyModule, _getter: (module: TModule) => TAction) {\r\n }\r\n}\r\n", + "signature": "-40032907372-export declare class LazyModule {\r\n private importCallback;\r\n constructor(importCallback: () => Promise);\r\n}\r\nexport declare class LazyAction any, TModule> {\r\n constructor(_lazyModule: LazyModule, _getter: (module: TModule) => TAction);\r\n}\r\n" + }, + "../global.d.ts": { + "version": "-9780226215-interface PromiseConstructor {\r\n new (): Promise;\r\n}\r\ndeclare var Promise: PromiseConstructor;\r\ninterface Promise {\r\n}", + "signature": "-9780226215-interface PromiseConstructor {\r\n new (): Promise;\r\n}\r\ndeclare var Promise: PromiseConstructor;\r\ninterface Promise {\r\n}" + }, + "../lazyindex.ts": { + "version": "-6956449754-export { default as bar } from './bar';\n", + "signature": "-6224542381-export { default as bar } from './bar';\r\n" + }, + "../index.ts": { + "version": "-11602502901-import { LazyAction, LazyModule } from './bundling';\r\nconst lazyModule = new LazyModule(() =>\r\n import('./lazyIndex')\r\n);\r\nexport const lazyBar = new LazyAction(lazyModule, m => m.bar);", + "signature": "6256067474-import { LazyAction } from './bundling';\r\nexport declare const lazyBar: LazyAction<() => void, typeof import(\"./lazyIndex\")>;\r\n" + } + }, + "options": { + "target": 1, + "declaration": true, + "outDir": "./", + "incremental": true, + "isolatedModules": true, + "configFilePath": "../tsconfig.json" + }, + "referencedMap": { + "../index.ts": [ + "../bundling.ts", + "../lazyindex.ts" + ], + "../lazyindex.ts": [ + "../bar.ts" + ] + }, + "exportedModulesMap": { + "../index.ts": [ + "../bundling.ts", + "../lazyindex.ts" + ], + "../lazyindex.ts": [ + "../bar.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "../bar.ts", + "../bundling.ts", + "../global.d.ts", + "../index.ts", + "../lazyindex.ts" + ] + }, + "version": "FakeTSVersion" +} + diff --git a/tests/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/incremental-declaration-changes/inferred-type-from-transitive-module.js b/tests/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/incremental-declaration-changes/inferred-type-from-transitive-module.js index 727875a5d40d8..5cd9097a2008c 100644 --- a/tests/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/incremental-declaration-changes/inferred-type-from-transitive-module.js +++ b/tests/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/incremental-declaration-changes/inferred-type-from-transitive-module.js @@ -1,3 +1,17 @@ +//// [/lib/incremental-declaration-changesOutput.txt] +/lib/tsc --b /src --verbose +12:04:00 AM - Projects in this build: + * src/tsconfig.json + +12:04:00 AM - Project 'src/tsconfig.json' is out of date because oldest output 'src/obj/bar.js' is older than newest input 'src/bar.ts' + +12:04:00 AM - Building project '/src/tsconfig.json'... + +12:04:00 AM - Updating unchanged output timestamps of project '/src/tsconfig.json'... + +exitCode:: 0 + + //// [/src/bar.ts] interface RawAction { (...args: any[]): Promise | void; @@ -26,6 +40,8 @@ import { LazyAction } from './bundling'; export declare const lazyBar: LazyAction<() => void, typeof import("./lazyIndex")>; +//// [/src/obj/lazyIndex.d.ts] file written with same contents +//// [/src/obj/lazyIndex.js] file written with same contents //// [/src/obj/tsconfig.tsbuildinfo] { "program": { diff --git a/tests/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/incremental-declaration-changes/reports-errors-in-files-affected-by-change-in-signature-with-isolatedModules.js b/tests/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/incremental-declaration-changes/reports-errors-in-files-affected-by-change-in-signature-with-isolatedModules.js new file mode 100644 index 0000000000000..a00425b57a833 --- /dev/null +++ b/tests/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/incremental-declaration-changes/reports-errors-in-files-affected-by-change-in-signature-with-isolatedModules.js @@ -0,0 +1,24 @@ +//// [/lib/incremental-declaration-changesOutput.txt] +/lib/tsc --b /src --verbose +12:04:00 AM - Projects in this build: + * src/tsconfig.json + +12:04:00 AM - Project 'src/tsconfig.json' is out of date because oldest output 'src/obj/bar.js' is older than newest input 'src/bar.ts' + +12:04:00 AM - Building project '/src/tsconfig.json'... + +src/lazyIndex.ts(4,5): error TS2554: Expected 0 arguments, but got 1. +exitCode:: 1 + + +//// [/src/bar.ts] +interface RawAction { + (...args: any[]): Promise | void; +} +interface ActionFactory { + (target: T): T; +} +declare function foo(): ActionFactory; +export default foo()(function foobar(): void { +}); + diff --git a/tests/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/initial-build/inferred-type-from-transitive-module-with-isolatedModules.js b/tests/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/initial-build/inferred-type-from-transitive-module-with-isolatedModules.js new file mode 100644 index 0000000000000..93a7e2964952b --- /dev/null +++ b/tests/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/initial-build/inferred-type-from-transitive-module-with-isolatedModules.js @@ -0,0 +1,155 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src --verbose +12:01:00 AM - Projects in this build: + * src/tsconfig.json + +12:01:00 AM - Project 'src/tsconfig.json' is out of date because output file 'src/obj/bar.js' does not exist + +12:01:00 AM - Building project '/src/tsconfig.json'... + +exitCode:: 0 + + +//// [/src/obj/bar.d.ts] +declare const _default: (param: string) => void; +export default _default; + + +//// [/src/obj/bar.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = foo()(function foobar(param) { +}); + + +//// [/src/obj/bundling.d.ts] +export declare class LazyModule { + private importCallback; + constructor(importCallback: () => Promise); +} +export declare class LazyAction any, TModule> { + constructor(_lazyModule: LazyModule, _getter: (module: TModule) => TAction); +} + + +//// [/src/obj/bundling.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var LazyModule = /** @class */ (function () { + function LazyModule(importCallback) { + this.importCallback = importCallback; + } + return LazyModule; +}()); +exports.LazyModule = LazyModule; +var LazyAction = /** @class */ (function () { + function LazyAction(_lazyModule, _getter) { + } + return LazyAction; +}()); +exports.LazyAction = LazyAction; + + +//// [/src/obj/index.d.ts] +import { LazyAction } from './bundling'; +export declare const lazyBar: LazyAction<(param: string) => void, typeof import("./lazyIndex")>; + + +//// [/src/obj/index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var bundling_1 = require("./bundling"); +var lazyModule = new bundling_1.LazyModule(function () { + return Promise.resolve().then(function () { return require('./lazyIndex'); }); +}); +exports.lazyBar = new bundling_1.LazyAction(lazyModule, function (m) { return m.bar; }); + + +//// [/src/obj/lazyIndex.d.ts] +export { default as bar } from './bar'; + + +//// [/src/obj/lazyIndex.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var bar_1 = require("./bar"); +exports.bar = bar_1.default; + + +//// [/src/obj/tsconfig.tsbuildinfo] +{ + "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; };", + "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; };" + }, + "../bar.ts": { + "version": "5936740878-interface RawAction {\r\n (...args: any[]): Promise | void;\r\n}\r\ninterface ActionFactory {\r\n (target: T): T;\r\n}\r\ndeclare function foo(): ActionFactory;\r\nexport default foo()(function foobar(param: string): void {\r\n});", + "signature": "11191036521-declare const _default: (param: string) => void;\r\nexport default _default;\r\n" + }, + "../bundling.ts": { + "version": "-21659820217-export class LazyModule {\r\n constructor(private importCallback: () => Promise) {}\r\n}\r\n\r\nexport class LazyAction<\r\n TAction extends (...args: any[]) => any,\r\n TModule\r\n> {\r\n constructor(_lazyModule: LazyModule, _getter: (module: TModule) => TAction) {\r\n }\r\n}\r\n", + "signature": "-40032907372-export declare class LazyModule {\r\n private importCallback;\r\n constructor(importCallback: () => Promise);\r\n}\r\nexport declare class LazyAction any, TModule> {\r\n constructor(_lazyModule: LazyModule, _getter: (module: TModule) => TAction);\r\n}\r\n" + }, + "../global.d.ts": { + "version": "-9780226215-interface PromiseConstructor {\r\n new (): Promise;\r\n}\r\ndeclare var Promise: PromiseConstructor;\r\ninterface Promise {\r\n}", + "signature": "-9780226215-interface PromiseConstructor {\r\n new (): Promise;\r\n}\r\ndeclare var Promise: PromiseConstructor;\r\ninterface Promise {\r\n}" + }, + "../lazyindex.ts": { + "version": "-6956449754-export { default as bar } from './bar';\n", + "signature": "-6224542381-export { default as bar } from './bar';\r\n" + }, + "../index.ts": { + "version": "-11602502901-import { LazyAction, LazyModule } from './bundling';\r\nconst lazyModule = new LazyModule(() =>\r\n import('./lazyIndex')\r\n);\r\nexport const lazyBar = new LazyAction(lazyModule, m => m.bar);", + "signature": "18468008756-import { LazyAction } from './bundling';\r\nexport declare const lazyBar: LazyAction<(param: string) => void, typeof import(\"./lazyIndex\")>;\r\n" + } + }, + "options": { + "target": 1, + "declaration": true, + "outDir": "./", + "incremental": true, + "isolatedModules": true, + "configFilePath": "../tsconfig.json" + }, + "referencedMap": { + "../index.ts": [ + "../bundling.ts", + "../lazyindex.ts" + ], + "../lazyindex.ts": [ + "../bar.ts" + ] + }, + "exportedModulesMap": { + "../index.ts": [ + "../bundling.ts", + "../lazyindex.ts" + ], + "../lazyindex.ts": [ + "../bar.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "../bar.ts", + "../bundling.ts", + "../global.d.ts", + "../index.ts", + "../lazyindex.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/src/tsconfig.json] +{ + "compilerOptions": { + "target": "es5", + "declaration": true, + "outDir": "obj", + "incremental": true, "isolatedModules": true + } +} + diff --git a/tests/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/initial-Build/inferred-type-from-transitive-module.js b/tests/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/initial-build/inferred-type-from-transitive-module.js similarity index 93% rename from tests/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/initial-Build/inferred-type-from-transitive-module.js rename to tests/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/initial-build/inferred-type-from-transitive-module.js index a04669bd97159..45a284dc09cba 100644 --- a/tests/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/initial-Build/inferred-type-from-transitive-module.js +++ b/tests/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/initial-build/inferred-type-from-transitive-module.js @@ -1,3 +1,15 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src --verbose +12:01:00 AM - Projects in this build: + * src/tsconfig.json + +12:01:00 AM - Project 'src/tsconfig.json' is out of date because output file 'src/obj/bar.js' does not exist + +12:01:00 AM - Building project '/src/tsconfig.json'... + +exitCode:: 0 + + //// [/src/obj/bar.d.ts] declare const _default: (param: string) => void; export default _default; diff --git a/tests/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/initial-build/reports-errors-in-files-affected-by-change-in-signature-with-isolatedModules.js b/tests/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/initial-build/reports-errors-in-files-affected-by-change-in-signature-with-isolatedModules.js new file mode 100644 index 0000000000000..39ad2d40a31e2 --- /dev/null +++ b/tests/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/initial-build/reports-errors-in-files-affected-by-change-in-signature-with-isolatedModules.js @@ -0,0 +1,163 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src --verbose +12:01:00 AM - Projects in this build: + * src/tsconfig.json + +12:01:00 AM - Project 'src/tsconfig.json' is out of date because output file 'src/obj/bar.js' does not exist + +12:01:00 AM - Building project '/src/tsconfig.json'... + +exitCode:: 0 + + +//// [/src/lazyIndex.ts] +export { default as bar } from './bar'; + +import { default as bar } from './bar'; +bar("hello"); + +//// [/src/obj/bar.d.ts] +declare const _default: (param: string) => void; +export default _default; + + +//// [/src/obj/bar.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = foo()(function foobar(param) { +}); + + +//// [/src/obj/bundling.d.ts] +export declare class LazyModule { + private importCallback; + constructor(importCallback: () => Promise); +} +export declare class LazyAction any, TModule> { + constructor(_lazyModule: LazyModule, _getter: (module: TModule) => TAction); +} + + +//// [/src/obj/bundling.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var LazyModule = /** @class */ (function () { + function LazyModule(importCallback) { + this.importCallback = importCallback; + } + return LazyModule; +}()); +exports.LazyModule = LazyModule; +var LazyAction = /** @class */ (function () { + function LazyAction(_lazyModule, _getter) { + } + return LazyAction; +}()); +exports.LazyAction = LazyAction; + + +//// [/src/obj/index.d.ts] +import { LazyAction } from './bundling'; +export declare const lazyBar: LazyAction<(param: string) => void, typeof import("./lazyIndex")>; + + +//// [/src/obj/index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var bundling_1 = require("./bundling"); +var lazyModule = new bundling_1.LazyModule(function () { + return Promise.resolve().then(function () { return require('./lazyIndex'); }); +}); +exports.lazyBar = new bundling_1.LazyAction(lazyModule, function (m) { return m.bar; }); + + +//// [/src/obj/lazyIndex.d.ts] +export { default as bar } from './bar'; + + +//// [/src/obj/lazyIndex.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var bar_1 = require("./bar"); +exports.bar = bar_1.default; +var bar_2 = require("./bar"); +bar_2.default("hello"); + + +//// [/src/obj/tsconfig.tsbuildinfo] +{ + "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; };", + "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; };" + }, + "../bar.ts": { + "version": "5936740878-interface RawAction {\r\n (...args: any[]): Promise | void;\r\n}\r\ninterface ActionFactory {\r\n (target: T): T;\r\n}\r\ndeclare function foo(): ActionFactory;\r\nexport default foo()(function foobar(param: string): void {\r\n});", + "signature": "11191036521-declare const _default: (param: string) => void;\r\nexport default _default;\r\n" + }, + "../bundling.ts": { + "version": "-21659820217-export class LazyModule {\r\n constructor(private importCallback: () => Promise) {}\r\n}\r\n\r\nexport class LazyAction<\r\n TAction extends (...args: any[]) => any,\r\n TModule\r\n> {\r\n constructor(_lazyModule: LazyModule, _getter: (module: TModule) => TAction) {\r\n }\r\n}\r\n", + "signature": "-40032907372-export declare class LazyModule {\r\n private importCallback;\r\n constructor(importCallback: () => Promise);\r\n}\r\nexport declare class LazyAction any, TModule> {\r\n constructor(_lazyModule: LazyModule, _getter: (module: TModule) => TAction);\r\n}\r\n" + }, + "../global.d.ts": { + "version": "-9780226215-interface PromiseConstructor {\r\n new (): Promise;\r\n}\r\ndeclare var Promise: PromiseConstructor;\r\ninterface Promise {\r\n}", + "signature": "-9780226215-interface PromiseConstructor {\r\n new (): Promise;\r\n}\r\ndeclare var Promise: PromiseConstructor;\r\ninterface Promise {\r\n}" + }, + "../lazyindex.ts": { + "version": "3017320451-export { default as bar } from './bar';\n\nimport { default as bar } from './bar';\nbar(\"hello\");", + "signature": "-6224542381-export { default as bar } from './bar';\r\n" + }, + "../index.ts": { + "version": "-11602502901-import { LazyAction, LazyModule } from './bundling';\r\nconst lazyModule = new LazyModule(() =>\r\n import('./lazyIndex')\r\n);\r\nexport const lazyBar = new LazyAction(lazyModule, m => m.bar);", + "signature": "18468008756-import { LazyAction } from './bundling';\r\nexport declare const lazyBar: LazyAction<(param: string) => void, typeof import(\"./lazyIndex\")>;\r\n" + } + }, + "options": { + "target": 1, + "declaration": true, + "outDir": "./", + "incremental": true, + "isolatedModules": true, + "configFilePath": "../tsconfig.json" + }, + "referencedMap": { + "../index.ts": [ + "../bundling.ts", + "../lazyindex.ts" + ], + "../lazyindex.ts": [ + "../bar.ts" + ] + }, + "exportedModulesMap": { + "../index.ts": [ + "../bundling.ts", + "../lazyindex.ts" + ], + "../lazyindex.ts": [ + "../bar.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "../bar.ts", + "../bundling.ts", + "../global.d.ts", + "../index.ts", + "../lazyindex.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/src/tsconfig.json] +{ + "compilerOptions": { + "target": "es5", + "declaration": true, + "outDir": "obj", + "incremental": true, "isolatedModules": true + } +} + diff --git a/tests/baselines/reference/tsbuild/lateBoundSymbol/incremental-declaration-doesnt-change/interface-is-merged-and-contains-late-bound-member.js b/tests/baselines/reference/tsbuild/lateBoundSymbol/incremental-declaration-doesnt-change/interface-is-merged-and-contains-late-bound-member.js index bdd697399683f..ffa834ba4679b 100644 --- a/tests/baselines/reference/tsbuild/lateBoundSymbol/incremental-declaration-doesnt-change/interface-is-merged-and-contains-late-bound-member.js +++ b/tests/baselines/reference/tsbuild/lateBoundSymbol/incremental-declaration-doesnt-change/interface-is-merged-and-contains-late-bound-member.js @@ -1,3 +1,17 @@ +//// [/lib/incremental-declaration-doesnt-changeOutput.txt] +/lib/tsc --b /src/tsconfig.json --verbose +12:04:00 AM - Projects in this build: + * src/tsconfig.json + +12:04:00 AM - Project 'src/tsconfig.json' is out of date because oldest output 'src/src/hkt.js' is older than newest input 'src/src/main.ts' + +12:04:00 AM - Building project '/src/tsconfig.json'... + +12:04:00 AM - Updating unchanged output timestamps of project '/src/tsconfig.json'... + +exitCode:: 0 + + //// [/src/src/main.js] "use strict"; exports.__esModule = true; diff --git a/tests/baselines/reference/tsbuild/lateBoundSymbol/initial-Build/interface-is-merged-and-contains-late-bound-member.js b/tests/baselines/reference/tsbuild/lateBoundSymbol/initial-build/interface-is-merged-and-contains-late-bound-member.js similarity index 88% rename from tests/baselines/reference/tsbuild/lateBoundSymbol/initial-Build/interface-is-merged-and-contains-late-bound-member.js rename to tests/baselines/reference/tsbuild/lateBoundSymbol/initial-build/interface-is-merged-and-contains-late-bound-member.js index 949eb773431c5..86d36097454b4 100644 --- a/tests/baselines/reference/tsbuild/lateBoundSymbol/initial-Build/interface-is-merged-and-contains-late-bound-member.js +++ b/tests/baselines/reference/tsbuild/lateBoundSymbol/initial-build/interface-is-merged-and-contains-late-bound-member.js @@ -1,3 +1,15 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/tsconfig.json --verbose +12:01:00 AM - Projects in this build: + * src/tsconfig.json + +12:01:00 AM - Project 'src/tsconfig.json' is out of date because output file 'src/src/hkt.js' does not exist + +12:01:00 AM - Building project '/src/tsconfig.json'... + +exitCode:: 0 + + //// [/src/src/hkt.js] "use strict"; exports.__esModule = true; diff --git a/tests/baselines/reference/tsbuild/moduleSpecifiers/initial-Build/synthesized-module-specifiers-resolve-correctly.js b/tests/baselines/reference/tsbuild/moduleSpecifiers/initial-build/synthesized-module-specifiers-resolve-correctly.js similarity index 73% rename from tests/baselines/reference/tsbuild/moduleSpecifiers/initial-Build/synthesized-module-specifiers-resolve-correctly.js rename to tests/baselines/reference/tsbuild/moduleSpecifiers/initial-build/synthesized-module-specifiers-resolve-correctly.js index cd12638d637c9..fb5eae55d7c39 100644 --- a/tests/baselines/reference/tsbuild/moduleSpecifiers/initial-Build/synthesized-module-specifiers-resolve-correctly.js +++ b/tests/baselines/reference/tsbuild/moduleSpecifiers/initial-build/synthesized-module-specifiers-resolve-correctly.js @@ -1,23 +1,47 @@ -//// [/lib/src/common/nominal.d.ts] +//// [/lib/initial-buildOutput.txt] +/lib/tsc -b /src --verbose +12:00:00 AM - Projects in this build: + * src/solution/common/tsconfig.json + * src/solution/sub-project/tsconfig.json + * src/solution/sub-project-2/tsconfig.json + * src/solution/tsconfig.json + * src/tsconfig.json + +12:00:00 AM - Project 'src/solution/common/tsconfig.json' is out of date because output file 'src/lib/solution/common/nominal.js' does not exist + +12:00:00 AM - Building project '/src/solution/common/tsconfig.json'... + +12:00:00 AM - Project 'src/solution/sub-project/tsconfig.json' is out of date because output file 'src/lib/solution/sub-project/index.js' does not exist + +12:00:00 AM - Building project '/src/solution/sub-project/tsconfig.json'... + +12:00:00 AM - Project 'src/solution/sub-project-2/tsconfig.json' is out of date because output file 'src/lib/solution/sub-project-2/index.js' does not exist + +12:00:00 AM - Building project '/src/solution/sub-project-2/tsconfig.json'... + +exitCode:: 0 + + +//// [/src/lib/solution/common/nominal.d.ts] export declare type Nominal = T & { [Symbol.species]: Name; }; -//// [/lib/src/common/nominal.js] +//// [/src/lib/solution/common/nominal.js] "use strict"; exports.__esModule = true; -//// [/lib/src/common/tsconfig.tsbuildinfo] +//// [/src/lib/solution/common/tsconfig.tsbuildinfo] { "program": { "fileInfos": { - "../../lib.d.ts": { + "../../../../lib/lib.d.ts": { "version": "-32082413277-/// \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; };\ninterface SymbolConstructor {\n readonly species: symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\n", "signature": "-32082413277-/// \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; };\ninterface SymbolConstructor {\n readonly species: symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\n" }, - "../../../src/common/nominal.ts": { + "../../../solution/common/nominal.ts": { "version": "-24498031910-export declare type Nominal = T & {\n [Symbol.species]: Name;\n};\n", "signature": "-9513375615-export declare type Nominal = T & {\r\n [Symbol.species]: Name;\r\n};\r\n" } @@ -27,41 +51,41 @@ exports.__esModule = true; "rootDir": "../../..", "outDir": "../..", "composite": true, - "configFilePath": "../../../src/common/tsconfig.json" + "configFilePath": "../../../solution/common/tsconfig.json" }, "referencedMap": {}, "exportedModulesMap": {}, "semanticDiagnosticsPerFile": [ - "../../../src/common/nominal.ts", - "../../lib.d.ts" + "../../../../lib/lib.d.ts", + "../../../solution/common/nominal.ts" ] }, "version": "FakeTSVersion" } -//// [/lib/src/sub-project/index.d.ts] +//// [/src/lib/solution/sub-project/index.d.ts] import { Nominal } from '../common/nominal'; export declare type MyNominal = Nominal; -//// [/lib/src/sub-project/index.js] +//// [/src/lib/solution/sub-project/index.js] "use strict"; exports.__esModule = true; -//// [/lib/src/sub-project/tsconfig.tsbuildinfo] +//// [/src/lib/solution/sub-project/tsconfig.tsbuildinfo] { "program": { "fileInfos": { - "../../lib.d.ts": { + "../../../../lib/lib.d.ts": { "version": "-32082413277-/// \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; };\ninterface SymbolConstructor {\n readonly species: symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\n", "signature": "-32082413277-/// \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; };\ninterface SymbolConstructor {\n readonly species: symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\n" }, - "../../../src/common/nominal.ts": { + "../../../solution/common/nominal.ts": { "version": "-9513375615-export declare type Nominal = T & {\r\n [Symbol.species]: Name;\r\n};\r\n", "signature": "-9513375615-export declare type Nominal = T & {\r\n [Symbol.species]: Name;\r\n};\r\n" }, - "../../../src/sub-project/index.ts": { + "../../../solution/sub-project/index.ts": { "version": "-22894055505-import { Nominal } from '../common/nominal';\n\nexport type MyNominal = Nominal;\n", "signature": "-21416888433-import { Nominal } from '../common/nominal';\r\nexport declare type MyNominal = Nominal;\r\n" } @@ -71,28 +95,28 @@ exports.__esModule = true; "rootDir": "../../..", "outDir": "../..", "composite": true, - "configFilePath": "../../../src/sub-project/tsconfig.json" + "configFilePath": "../../../solution/sub-project/tsconfig.json" }, "referencedMap": { - "../../../src/sub-project/index.ts": [ + "../../../solution/sub-project/index.ts": [ "../common/nominal.d.ts" ] }, "exportedModulesMap": { - "../../../src/sub-project/index.ts": [ + "../../../solution/sub-project/index.ts": [ "../common/nominal.d.ts" ] }, "semanticDiagnosticsPerFile": [ - "../../../src/common/nominal.ts", - "../../../src/sub-project/index.ts", - "../../lib.d.ts" + "../../../../lib/lib.d.ts", + "../../../solution/common/nominal.ts", + "../../../solution/sub-project/index.ts" ] }, "version": "FakeTSVersion" } -//// [/lib/src/sub-project-2/index.d.ts] +//// [/src/lib/solution/sub-project-2/index.d.ts] declare const variable: { key: import("../common/nominal").Nominal; }; @@ -100,7 +124,7 @@ export declare function getVar(): keyof typeof variable; export {}; -//// [/lib/src/sub-project-2/index.js] +//// [/src/lib/solution/sub-project-2/index.js] "use strict"; exports.__esModule = true; var variable = { @@ -112,23 +136,23 @@ function getVar() { exports.getVar = getVar; -//// [/lib/src/sub-project-2/tsconfig.tsbuildinfo] +//// [/src/lib/solution/sub-project-2/tsconfig.tsbuildinfo] { "program": { "fileInfos": { - "../../lib.d.ts": { + "../../../../lib/lib.d.ts": { "version": "-32082413277-/// \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; };\ninterface SymbolConstructor {\n readonly species: symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\n", "signature": "-32082413277-/// \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; };\ninterface SymbolConstructor {\n readonly species: symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\n" }, - "../../../src/common/nominal.ts": { + "../../../solution/common/nominal.ts": { "version": "-9513375615-export declare type Nominal = T & {\r\n [Symbol.species]: Name;\r\n};\r\n", "signature": "-9513375615-export declare type Nominal = T & {\r\n [Symbol.species]: Name;\r\n};\r\n" }, - "../../../src/sub-project/index.ts": { + "../../../solution/sub-project/index.ts": { "version": "-21416888433-import { Nominal } from '../common/nominal';\r\nexport declare type MyNominal = Nominal;\r\n", "signature": "-21416888433-import { Nominal } from '../common/nominal';\r\nexport declare type MyNominal = Nominal;\r\n" }, - "../../../src/sub-project-2/index.ts": { + "../../../solution/sub-project-2/index.ts": { "version": "-13939373533-import { MyNominal } from '../sub-project/index';\n\nconst variable = {\n key: 'value' as MyNominal,\n};\n\nexport function getVar(): keyof typeof variable {\n return 'key';\n}\n", "signature": "-17233212183-declare const variable: {\r\n key: import(\"../common/nominal\").Nominal;\r\n};\r\nexport declare function getVar(): keyof typeof variable;\r\nexport {};\r\n" } @@ -138,29 +162,29 @@ exports.getVar = getVar; "rootDir": "../../..", "outDir": "../..", "composite": true, - "configFilePath": "../../../src/sub-project-2/tsconfig.json" + "configFilePath": "../../../solution/sub-project-2/tsconfig.json" }, "referencedMap": { - "../../../src/sub-project-2/index.ts": [ + "../../../solution/sub-project-2/index.ts": [ "../sub-project/index.d.ts" ], - "../../../src/sub-project/index.ts": [ + "../../../solution/sub-project/index.ts": [ "../common/nominal.d.ts" ] }, "exportedModulesMap": { - "../../../src/sub-project-2/index.ts": [ + "../../../solution/sub-project-2/index.ts": [ "../common/nominal.d.ts" ], - "../../../src/sub-project/index.ts": [ + "../../../solution/sub-project/index.ts": [ "../common/nominal.d.ts" ] }, "semanticDiagnosticsPerFile": [ - "../../../src/common/nominal.ts", - "../../../src/sub-project-2/index.ts", - "../../../src/sub-project/index.ts", - "../../lib.d.ts" + "../../../../lib/lib.d.ts", + "../../../solution/common/nominal.ts", + "../../../solution/sub-project-2/index.ts", + "../../../solution/sub-project/index.ts" ] }, "version": "FakeTSVersion" diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/baseline-sectioned-sourcemaps.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/baseline-sectioned-sourcemaps.js index b8705b1b03d06..136509b59b89a 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/baseline-sectioned-sourcemaps.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/baseline-sectioned-sourcemaps.js @@ -1,3 +1,42 @@ +//// [/lib/incremental-declaration-changesOutput.txt] +/lib/tsc --b /src/third --verbose +12:04:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:04:00 AM - Project 'src/first/tsconfig.json' is out of date because oldest output 'src/first/bin/first-output.js' is older than newest input 'src/first/first_PART1.ts' + +12:04:00 AM - Building project '/src/first/tsconfig.json'... + +12:04:00 AM - Project 'src/second/tsconfig.json' is up to date because newest input 'src/second/second_part1.ts' is older than oldest output 'src/2/second-output.js' + +12:04:00 AM - Project 'src/third/tsconfig.json' is out of date because oldest output 'src/third/thirdjs/output/third-output.js' is older than newest input 'src/first' + +12:04:00 AM - Building project '/src/third/tsconfig.json'... + +exitCode:: 0 +readFiles:: { + "/src/third/tsconfig.json": 1, + "/src/first/tsconfig.json": 1, + "/src/second/tsconfig.json": 1, + "/src/first/first_PART1.ts": 1, + "/src/first/first_part2.ts": 1, + "/src/first/first_part3.ts": 1, + "/src/first/bin/first-output.d.ts": 2, + "/src/2/second-output.tsbuildinfo": 1, + "/src/2/second-output.d.ts": 1, + "/src/third/third_part1.ts": 1, + "/src/first/bin/first-output.tsbuildinfo": 1, + "/src/first/bin/first-output.js": 1, + "/src/2/second-output.js": 1, + "/src/first/bin/first-output.js.map": 1, + "/src/2/second-output.js.map": 1, + "/src/first/bin/first-output.d.ts.map": 1, + "/src/2/second-output.d.ts.map": 1, + "/src/third/thirdjs/output/third-output.d.ts": 1 +} + //// [/src/first/bin/first-output.d.ts] interface TheFirst { none: any; diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/emitHelpers-in-all-projects.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/emitHelpers-in-all-projects.js index f3a11792c1ff5..605e02ffcc89e 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/emitHelpers-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/emitHelpers-in-all-projects.js @@ -1,3 +1,42 @@ +//// [/lib/incremental-declaration-changesOutput.txt] +/lib/tsc --b /src/third --verbose +12:04:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:04:00 AM - Project 'src/first/tsconfig.json' is out of date because oldest output 'src/first/bin/first-output.js' is older than newest input 'src/first/first_PART1.ts' + +12:04:00 AM - Building project '/src/first/tsconfig.json'... + +12:04:00 AM - Project 'src/second/tsconfig.json' is up to date because newest input 'src/second/second_part1.ts' is older than oldest output 'src/2/second-output.js' + +12:04:00 AM - Project 'src/third/tsconfig.json' is out of date because oldest output 'src/third/thirdjs/output/third-output.js' is older than newest input 'src/first' + +12:04:00 AM - Building project '/src/third/tsconfig.json'... + +exitCode:: 0 +readFiles:: { + "/src/third/tsconfig.json": 1, + "/src/first/tsconfig.json": 1, + "/src/second/tsconfig.json": 1, + "/src/first/first_PART1.ts": 1, + "/src/first/first_part2.ts": 1, + "/src/first/first_part3.ts": 1, + "/src/first/bin/first-output.d.ts": 2, + "/src/2/second-output.tsbuildinfo": 1, + "/src/2/second-output.d.ts": 1, + "/src/third/third_part1.ts": 1, + "/src/first/bin/first-output.tsbuildinfo": 1, + "/src/first/bin/first-output.js": 1, + "/src/2/second-output.js": 1, + "/src/first/bin/first-output.js.map": 1, + "/src/2/second-output.js.map": 1, + "/src/first/bin/first-output.d.ts.map": 1, + "/src/2/second-output.d.ts.map": 1, + "/src/third/thirdjs/output/third-output.d.ts": 1 +} + //// [/src/first/bin/first-output.d.ts] interface TheFirst { none: any; diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/multiple-prologues-in-all-projects.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/multiple-prologues-in-all-projects.js index 3b3e6b136dc24..a10f26edcc33a 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/multiple-prologues-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/multiple-prologues-in-all-projects.js @@ -1,3 +1,42 @@ +//// [/lib/incremental-declaration-changesOutput.txt] +/lib/tsc --b /src/third --verbose +12:04:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:04:00 AM - Project 'src/first/tsconfig.json' is out of date because oldest output 'src/first/bin/first-output.js' is older than newest input 'src/first/first_PART1.ts' + +12:04:00 AM - Building project '/src/first/tsconfig.json'... + +12:04:00 AM - Project 'src/second/tsconfig.json' is up to date because newest input 'src/second/second_part1.ts' is older than oldest output 'src/2/second-output.js' + +12:04:00 AM - Project 'src/third/tsconfig.json' is out of date because oldest output 'src/third/thirdjs/output/third-output.js' is older than newest input 'src/first' + +12:04:00 AM - Building project '/src/third/tsconfig.json'... + +exitCode:: 0 +readFiles:: { + "/src/third/tsconfig.json": 1, + "/src/first/tsconfig.json": 1, + "/src/second/tsconfig.json": 1, + "/src/first/first_PART1.ts": 1, + "/src/first/first_part2.ts": 1, + "/src/first/first_part3.ts": 1, + "/src/first/bin/first-output.d.ts": 2, + "/src/2/second-output.tsbuildinfo": 1, + "/src/2/second-output.d.ts": 1, + "/src/third/third_part1.ts": 1, + "/src/first/bin/first-output.tsbuildinfo": 1, + "/src/first/bin/first-output.js": 1, + "/src/2/second-output.js": 1, + "/src/first/bin/first-output.js.map": 1, + "/src/2/second-output.js.map": 1, + "/src/first/bin/first-output.d.ts.map": 1, + "/src/2/second-output.d.ts.map": 1, + "/src/third/thirdjs/output/third-output.d.ts": 1 +} + //// [/src/first/bin/first-output.d.ts] interface TheFirst { none: any; diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/shebang-in-all-projects.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/shebang-in-all-projects.js index 5dc312d58cebf..874c818de64cf 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/shebang-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/shebang-in-all-projects.js @@ -1,3 +1,42 @@ +//// [/lib/incremental-declaration-changesOutput.txt] +/lib/tsc --b /src/third --verbose +12:04:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:04:00 AM - Project 'src/first/tsconfig.json' is out of date because oldest output 'src/first/bin/first-output.js' is older than newest input 'src/first/first_PART1.ts' + +12:04:00 AM - Building project '/src/first/tsconfig.json'... + +12:04:00 AM - Project 'src/second/tsconfig.json' is up to date because newest input 'src/second/second_part1.ts' is older than oldest output 'src/2/second-output.js' + +12:04:00 AM - Project 'src/third/tsconfig.json' is out of date because oldest output 'src/third/thirdjs/output/third-output.js' is older than newest input 'src/first' + +12:04:00 AM - Building project '/src/third/tsconfig.json'... + +exitCode:: 0 +readFiles:: { + "/src/third/tsconfig.json": 1, + "/src/first/tsconfig.json": 1, + "/src/second/tsconfig.json": 1, + "/src/first/first_PART1.ts": 1, + "/src/first/first_part2.ts": 1, + "/src/first/first_part3.ts": 1, + "/src/first/bin/first-output.d.ts": 2, + "/src/2/second-output.tsbuildinfo": 1, + "/src/2/second-output.d.ts": 1, + "/src/third/third_part1.ts": 1, + "/src/first/bin/first-output.tsbuildinfo": 1, + "/src/first/bin/first-output.js": 1, + "/src/first/bin/first-output.js.map": 1, + "/src/2/second-output.js.map": 1, + "/src/2/second-output.js": 1, + "/src/first/bin/first-output.d.ts.map": 1, + "/src/2/second-output.d.ts.map": 1, + "/src/third/thirdjs/output/third-output.d.ts": 1 +} + //// [/src/first/bin/first-output.d.ts] #!someshebang first first_PART1 interface TheFirst { diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/strict-in-all-projects.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/strict-in-all-projects.js index 84d8de40064be..9d7471bf95cb7 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/strict-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/strict-in-all-projects.js @@ -1,3 +1,42 @@ +//// [/lib/incremental-declaration-changesOutput.txt] +/lib/tsc --b /src/third --verbose +12:04:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:04:00 AM - Project 'src/first/tsconfig.json' is out of date because oldest output 'src/first/bin/first-output.js' is older than newest input 'src/first/first_PART1.ts' + +12:04:00 AM - Building project '/src/first/tsconfig.json'... + +12:04:00 AM - Project 'src/second/tsconfig.json' is up to date because newest input 'src/second/second_part1.ts' is older than oldest output 'src/2/second-output.js' + +12:04:00 AM - Project 'src/third/tsconfig.json' is out of date because oldest output 'src/third/thirdjs/output/third-output.js' is older than newest input 'src/first' + +12:04:00 AM - Building project '/src/third/tsconfig.json'... + +exitCode:: 0 +readFiles:: { + "/src/third/tsconfig.json": 1, + "/src/first/tsconfig.json": 1, + "/src/second/tsconfig.json": 1, + "/src/first/first_PART1.ts": 1, + "/src/first/first_part2.ts": 1, + "/src/first/first_part3.ts": 1, + "/src/first/bin/first-output.d.ts": 2, + "/src/2/second-output.tsbuildinfo": 1, + "/src/2/second-output.d.ts": 1, + "/src/third/third_part1.ts": 1, + "/src/first/bin/first-output.tsbuildinfo": 1, + "/src/first/bin/first-output.js": 1, + "/src/2/second-output.js": 1, + "/src/first/bin/first-output.js.map": 1, + "/src/2/second-output.js.map": 1, + "/src/first/bin/first-output.d.ts.map": 1, + "/src/2/second-output.d.ts.map": 1, + "/src/third/thirdjs/output/third-output.d.ts": 1 +} + //// [/src/first/bin/first-output.d.ts] interface TheFirst { none: any; diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/stripInternal-when-one-two-three-are-prepended-in-order.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/stripInternal-when-one-two-three-are-prepended-in-order.js index 0b7ac11a1009b..c218edfa8a9c1 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/stripInternal-when-one-two-three-are-prepended-in-order.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/stripInternal-when-one-two-three-are-prepended-in-order.js @@ -1,3 +1,46 @@ +//// [/lib/incremental-declaration-changesOutput.txt] +/lib/tsc --b /src/third --verbose +12:04:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:04:00 AM - Project 'src/first/tsconfig.json' is out of date because oldest output 'src/first/bin/first-output.js' is older than newest input 'src/first/first_PART1.ts' + +12:04:00 AM - Building project '/src/first/tsconfig.json'... + +12:04:00 AM - Project 'src/second/tsconfig.json' is out of date because oldest output 'src/2/second-output.js' is older than newest input 'src/first' + +12:04:00 AM - Building project '/src/second/tsconfig.json'... + +12:04:00 AM - Project 'src/third/tsconfig.json' is out of date because oldest output 'src/third/thirdjs/output/third-output.js' is older than newest input 'src/second' + +12:04:00 AM - Building project '/src/third/tsconfig.json'... + +exitCode:: 0 +readFiles:: { + "/src/third/tsconfig.json": 1, + "/src/second/tsconfig.json": 1, + "/src/first/tsconfig.json": 1, + "/src/first/first_PART1.ts": 1, + "/src/first/first_part2.ts": 1, + "/src/first/first_part3.ts": 1, + "/src/first/bin/first-output.d.ts": 2, + "/src/second/second_part1.ts": 1, + "/src/second/second_part2.ts": 1, + "/src/first/bin/first-output.tsbuildinfo": 1, + "/src/first/bin/first-output.js": 1, + "/src/first/bin/first-output.js.map": 1, + "/src/first/bin/first-output.d.ts.map": 1, + "/src/2/second-output.d.ts": 2, + "/src/third/third_part1.ts": 1, + "/src/2/second-output.tsbuildinfo": 1, + "/src/2/second-output.js": 1, + "/src/2/second-output.js.map": 1, + "/src/2/second-output.d.ts.map": 1, + "/src/third/thirdjs/output/third-output.d.ts": 1 +} + //// [/src/2/second-output.d.ts] interface TheFirst { none: any; diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/stripInternal.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/stripInternal.js index 031180b66ce13..397f586217e9e 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/stripInternal.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/stripInternal.js @@ -1,3 +1,42 @@ +//// [/lib/incremental-declaration-changesOutput.txt] +/lib/tsc --b /src/third --verbose +12:04:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:04:00 AM - Project 'src/first/tsconfig.json' is out of date because oldest output 'src/first/bin/first-output.js' is older than newest input 'src/first/first_PART1.ts' + +12:04:00 AM - Building project '/src/first/tsconfig.json'... + +12:04:00 AM - Project 'src/second/tsconfig.json' is up to date because newest input 'src/second/second_part1.ts' is older than oldest output 'src/2/second-output.js' + +12:04:00 AM - Project 'src/third/tsconfig.json' is out of date because oldest output 'src/third/thirdjs/output/third-output.js' is older than newest input 'src/first' + +12:04:00 AM - Building project '/src/third/tsconfig.json'... + +exitCode:: 0 +readFiles:: { + "/src/third/tsconfig.json": 1, + "/src/first/tsconfig.json": 1, + "/src/second/tsconfig.json": 1, + "/src/first/first_PART1.ts": 1, + "/src/first/first_part2.ts": 1, + "/src/first/first_part3.ts": 1, + "/src/first/bin/first-output.d.ts": 2, + "/src/2/second-output.tsbuildinfo": 1, + "/src/2/second-output.d.ts": 1, + "/src/third/third_part1.ts": 1, + "/src/first/bin/first-output.tsbuildinfo": 1, + "/src/first/bin/first-output.js": 1, + "/src/2/second-output.js": 1, + "/src/first/bin/first-output.js.map": 1, + "/src/2/second-output.js.map": 1, + "/src/first/bin/first-output.d.ts.map": 1, + "/src/2/second-output.d.ts.map": 1, + "/src/third/thirdjs/output/third-output.d.ts": 1 +} + //// [/src/first/bin/first-output.d.ts] interface TheFirst { none: any; diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/triple-slash-refs-in-all-projects.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/triple-slash-refs-in-all-projects.js index 837220d8dd11b..25cb88e8ddc04 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/triple-slash-refs-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/triple-slash-refs-in-all-projects.js @@ -1,3 +1,45 @@ +//// [/lib/incremental-declaration-changesOutput.txt] +/lib/tsc --b /src/third --verbose +12:04:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:04:00 AM - Project 'src/first/tsconfig.json' is out of date because oldest output 'src/first/bin/first-output.js' is older than newest input 'src/first/first_PART1.ts' + +12:04:00 AM - Building project '/src/first/tsconfig.json'... + +12:04:00 AM - Project 'src/second/tsconfig.json' is up to date because newest input 'src/second/second_part1.ts' is older than oldest output 'src/2/second-output.js' + +12:04:00 AM - Project 'src/third/tsconfig.json' is out of date because oldest output 'src/third/thirdjs/output/third-output.js' is older than newest input 'src/first' + +12:04:00 AM - Building project '/src/third/tsconfig.json'... + +exitCode:: 0 +readFiles:: { + "/src/third/tsconfig.json": 1, + "/src/first/tsconfig.json": 1, + "/src/second/tsconfig.json": 1, + "/src/first/first_PART1.ts": 1, + "/src/first/first_part2.ts": 1, + "/src/first/tripleRef.d.ts": 1, + "/src/first/first_part3.ts": 1, + "/src/first/bin/first-output.d.ts": 2, + "/src/2/second-output.tsbuildinfo": 1, + "/src/2/second-output.d.ts": 1, + "/src/second/tripleRef.d.ts": 1, + "/src/third/third_part1.ts": 1, + "/src/third/tripleRef.d.ts": 1, + "/src/first/bin/first-output.tsbuildinfo": 1, + "/src/first/bin/first-output.js": 1, + "/src/2/second-output.js": 1, + "/src/first/bin/first-output.js.map": 1, + "/src/2/second-output.js.map": 1, + "/src/first/bin/first-output.d.ts.map": 1, + "/src/2/second-output.d.ts.map": 1, + "/src/third/thirdjs/output/third-output.d.ts": 1 +} + //// [/src/first/bin/first-output.d.ts] /// interface TheFirst { diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/baseline-sectioned-sourcemaps.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/baseline-sectioned-sourcemaps.js index de8f6f9b0dbc2..e0b14d9a65de0 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/baseline-sectioned-sourcemaps.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/baseline-sectioned-sourcemaps.js @@ -1,3 +1,50 @@ +//// [/lib/incremental-declaration-doesnt-changeOutput.txt] +/lib/tsc --b /src/third --verbose +12:08:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:08:00 AM - Project 'src/first/tsconfig.json' is out of date because oldest output 'src/first/bin/first-output.js' is older than newest input 'src/first/first_PART1.ts' + +12:08:00 AM - Building project '/src/first/tsconfig.json'... + +12:08:00 AM - Project 'src/second/tsconfig.json' is up to date because newest input 'src/second/second_part1.ts' is older than oldest output 'src/2/second-output.js' + +12:08:00 AM - Project 'src/third/tsconfig.json' is out of date because output of its dependency 'src/first' has changed + +12:08:00 AM - Updating output of project '/src/third/tsconfig.json'... + +12:08:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... + +exitCode:: 0 +readFiles:: { + "/src/third/tsconfig.json": 1, + "/src/first/tsconfig.json": 1, + "/src/second/tsconfig.json": 1, + "/src/first/first_PART1.ts": 1, + "/src/first/first_part2.ts": 1, + "/src/first/first_part3.ts": 1, + "/src/first/bin/first-output.d.ts": 1, + "/src/2/second-output.tsbuildinfo": 1, + "/src/third/thirdjs/output/third-output.tsbuildinfo": 1, + "/src/third/thirdjs/output/third-output.js": 1, + "/src/third/thirdjs/output/third-output.js.map": 1, + "/src/third/thirdjs/output/third-output.d.ts": 1, + "/src/third/thirdjs/output/third-output.d.ts.map": 1, + "/src/first/bin/first-output.tsbuildinfo": 1, + "/src/first/bin/first-output.js": 1, + "/src/2/second-output.js": 1, + "/src/first/bin/first-output.js.map": 1, + "/src/2/second-output.js.map": 1, + "/src/2/second-output.d.ts": 1, + "/src/first/bin/first-output.d.ts.map": 1, + "/src/2/second-output.d.ts.map": 1 +} + +//// [/src/first/bin/first-output.d.ts] file written with same contents +//// [/src/first/bin/first-output.d.ts.map] file written with same contents +//// [/src/first/bin/first-output.d.ts.map.baseline.txt] file written with same contents //// [/src/first/bin/first-output.js] var s = "Hello, world"; console.log(s); diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/emitHelpers-in-all-projects.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/emitHelpers-in-all-projects.js index 2c8eeceeac3de..cb0c5eb2bc6ed 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/emitHelpers-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/emitHelpers-in-all-projects.js @@ -1,3 +1,50 @@ +//// [/lib/incremental-declaration-doesnt-changeOutput.txt] +/lib/tsc --b /src/third --verbose +12:08:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:08:00 AM - Project 'src/first/tsconfig.json' is out of date because oldest output 'src/first/bin/first-output.js' is older than newest input 'src/first/first_PART1.ts' + +12:08:00 AM - Building project '/src/first/tsconfig.json'... + +12:08:00 AM - Project 'src/second/tsconfig.json' is up to date because newest input 'src/second/second_part1.ts' is older than oldest output 'src/2/second-output.js' + +12:08:00 AM - Project 'src/third/tsconfig.json' is out of date because output of its dependency 'src/first' has changed + +12:08:00 AM - Updating output of project '/src/third/tsconfig.json'... + +12:08:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... + +exitCode:: 0 +readFiles:: { + "/src/third/tsconfig.json": 1, + "/src/first/tsconfig.json": 1, + "/src/second/tsconfig.json": 1, + "/src/first/first_PART1.ts": 1, + "/src/first/first_part2.ts": 1, + "/src/first/first_part3.ts": 1, + "/src/first/bin/first-output.d.ts": 1, + "/src/2/second-output.tsbuildinfo": 1, + "/src/third/thirdjs/output/third-output.tsbuildinfo": 1, + "/src/third/thirdjs/output/third-output.js": 1, + "/src/third/thirdjs/output/third-output.js.map": 1, + "/src/third/thirdjs/output/third-output.d.ts": 1, + "/src/third/thirdjs/output/third-output.d.ts.map": 1, + "/src/first/bin/first-output.tsbuildinfo": 1, + "/src/first/bin/first-output.js": 1, + "/src/2/second-output.js": 1, + "/src/first/bin/first-output.js.map": 1, + "/src/2/second-output.js.map": 1, + "/src/2/second-output.d.ts": 1, + "/src/first/bin/first-output.d.ts.map": 1, + "/src/2/second-output.d.ts.map": 1 +} + +//// [/src/first/bin/first-output.d.ts] file written with same contents +//// [/src/first/bin/first-output.d.ts.map] file written with same contents +//// [/src/first/bin/first-output.d.ts.map.baseline.txt] file written with same contents //// [/src/first/bin/first-output.js] var __rest = (this && this.__rest) || function (s, e) { var t = {}; diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/emitHelpers-in-only-one-dependency-project.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/emitHelpers-in-only-one-dependency-project.js index 80c79449ce1a9..1149786824301 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/emitHelpers-in-only-one-dependency-project.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/emitHelpers-in-only-one-dependency-project.js @@ -1,3 +1,28 @@ +//// [/lib/incremental-declaration-doesnt-changeOutput.txt] +/lib/tsc --b /src/third --verbose +12:04:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:04:00 AM - Project 'src/first/tsconfig.json' is out of date because oldest output 'src/first/bin/first-output.js' is older than newest input 'src/first/first_PART1.ts' + +12:04:00 AM - Building project '/src/first/tsconfig.json'... + +12:04:00 AM - Project 'src/second/tsconfig.json' is up to date because newest input 'src/second/second_part1.ts' is older than oldest output 'src/2/second-output.js' + +12:04:00 AM - Project 'src/third/tsconfig.json' is out of date because output of its dependency 'src/first' has changed + +12:04:00 AM - Updating output of project '/src/third/tsconfig.json'... + +12:04:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... + +exitCode:: 0 + + +//// [/src/first/bin/first-output.d.ts] file written with same contents +//// [/src/first/bin/first-output.d.ts.map] file written with same contents +//// [/src/first/bin/first-output.d.ts.map.baseline.txt] file written with same contents //// [/src/first/bin/first-output.js] var s = "Hello, world"; console.log(s); diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/multiple-emitHelpers-in-all-projects.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/multiple-emitHelpers-in-all-projects.js index 9a1d94824d4fe..d8e06c669bc4a 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/multiple-emitHelpers-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/multiple-emitHelpers-in-all-projects.js @@ -1,3 +1,28 @@ +//// [/lib/incremental-declaration-doesnt-changeOutput.txt] +/lib/tsc --b /src/third --verbose +12:04:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:04:00 AM - Project 'src/first/tsconfig.json' is out of date because oldest output 'src/first/bin/first-output.js' is older than newest input 'src/first/first_PART1.ts' + +12:04:00 AM - Building project '/src/first/tsconfig.json'... + +12:04:00 AM - Project 'src/second/tsconfig.json' is up to date because newest input 'src/second/second_part1.ts' is older than oldest output 'src/2/second-output.js' + +12:04:00 AM - Project 'src/third/tsconfig.json' is out of date because output of its dependency 'src/first' has changed + +12:04:00 AM - Updating output of project '/src/third/tsconfig.json'... + +12:04:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... + +exitCode:: 0 + + +//// [/src/first/bin/first-output.d.ts] file written with same contents +//// [/src/first/bin/first-output.d.ts.map] file written with same contents +//// [/src/first/bin/first-output.d.ts.map.baseline.txt] file written with same contents //// [/src/first/bin/first-output.js] var __rest = (this && this.__rest) || function (s, e) { var t = {}; diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/multiple-emitHelpers-in-different-projects.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/multiple-emitHelpers-in-different-projects.js index 5a6d733931e94..692390e16458f 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/multiple-emitHelpers-in-different-projects.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/multiple-emitHelpers-in-different-projects.js @@ -1,3 +1,28 @@ +//// [/lib/incremental-declaration-doesnt-changeOutput.txt] +/lib/tsc --b /src/third --verbose +12:04:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:04:00 AM - Project 'src/first/tsconfig.json' is out of date because oldest output 'src/first/bin/first-output.js' is older than newest input 'src/first/first_PART1.ts' + +12:04:00 AM - Building project '/src/first/tsconfig.json'... + +12:04:00 AM - Project 'src/second/tsconfig.json' is up to date because newest input 'src/second/second_part1.ts' is older than oldest output 'src/2/second-output.js' + +12:04:00 AM - Project 'src/third/tsconfig.json' is out of date because output of its dependency 'src/first' has changed + +12:04:00 AM - Updating output of project '/src/third/tsconfig.json'... + +12:04:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... + +exitCode:: 0 + + +//// [/src/first/bin/first-output.d.ts] file written with same contents +//// [/src/first/bin/first-output.d.ts.map] file written with same contents +//// [/src/first/bin/first-output.d.ts.map.baseline.txt] file written with same contents //// [/src/first/bin/first-output.js] var __rest = (this && this.__rest) || function (s, e) { var t = {}; diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/multiple-prologues-in-all-projects.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/multiple-prologues-in-all-projects.js index c8eae0ea27277..30075f17e26e0 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/multiple-prologues-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/multiple-prologues-in-all-projects.js @@ -1,3 +1,50 @@ +//// [/lib/incremental-declaration-doesnt-changeOutput.txt] +/lib/tsc --b /src/third --verbose +12:08:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:08:00 AM - Project 'src/first/tsconfig.json' is out of date because oldest output 'src/first/bin/first-output.js' is older than newest input 'src/first/first_PART1.ts' + +12:08:00 AM - Building project '/src/first/tsconfig.json'... + +12:08:00 AM - Project 'src/second/tsconfig.json' is up to date because newest input 'src/second/second_part1.ts' is older than oldest output 'src/2/second-output.js' + +12:08:00 AM - Project 'src/third/tsconfig.json' is out of date because output of its dependency 'src/first' has changed + +12:08:00 AM - Updating output of project '/src/third/tsconfig.json'... + +12:08:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... + +exitCode:: 0 +readFiles:: { + "/src/third/tsconfig.json": 1, + "/src/first/tsconfig.json": 1, + "/src/second/tsconfig.json": 1, + "/src/first/first_PART1.ts": 1, + "/src/first/first_part2.ts": 1, + "/src/first/first_part3.ts": 1, + "/src/first/bin/first-output.d.ts": 1, + "/src/2/second-output.tsbuildinfo": 1, + "/src/third/thirdjs/output/third-output.tsbuildinfo": 1, + "/src/third/thirdjs/output/third-output.js": 1, + "/src/third/thirdjs/output/third-output.js.map": 1, + "/src/third/thirdjs/output/third-output.d.ts": 1, + "/src/third/thirdjs/output/third-output.d.ts.map": 1, + "/src/first/bin/first-output.tsbuildinfo": 1, + "/src/first/bin/first-output.js": 1, + "/src/2/second-output.js": 1, + "/src/first/bin/first-output.js.map": 1, + "/src/2/second-output.js.map": 1, + "/src/2/second-output.d.ts": 1, + "/src/first/bin/first-output.d.ts.map": 1, + "/src/2/second-output.d.ts.map": 1 +} + +//// [/src/first/bin/first-output.d.ts] file written with same contents +//// [/src/first/bin/first-output.d.ts.map] file written with same contents +//// [/src/first/bin/first-output.d.ts.map.baseline.txt] file written with same contents //// [/src/first/bin/first-output.js] "use strict"; "myPrologue"; diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/multiple-prologues-in-different-projects.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/multiple-prologues-in-different-projects.js index cbf38cf064288..ba51e272d7e6a 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/multiple-prologues-in-different-projects.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/multiple-prologues-in-different-projects.js @@ -1,3 +1,28 @@ +//// [/lib/incremental-declaration-doesnt-changeOutput.txt] +/lib/tsc --b /src/third --verbose +12:04:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:04:00 AM - Project 'src/first/tsconfig.json' is out of date because oldest output 'src/first/bin/first-output.js' is older than newest input 'src/first/first_PART1.ts' + +12:04:00 AM - Building project '/src/first/tsconfig.json'... + +12:04:00 AM - Project 'src/second/tsconfig.json' is up to date because newest input 'src/second/second_part1.ts' is older than oldest output 'src/2/second-output.js' + +12:04:00 AM - Project 'src/third/tsconfig.json' is out of date because output of its dependency 'src/first' has changed + +12:04:00 AM - Updating output of project '/src/third/tsconfig.json'... + +12:04:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... + +exitCode:: 0 + + +//// [/src/first/bin/first-output.d.ts] file written with same contents +//// [/src/first/bin/first-output.d.ts.map] file written with same contents +//// [/src/first/bin/first-output.d.ts.map.baseline.txt] file written with same contents //// [/src/first/bin/first-output.js] "use strict"; var s = "Hello, world"; diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/shebang-in-all-projects.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/shebang-in-all-projects.js index b0c4c820ac266..bbddaba06eab1 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/shebang-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/shebang-in-all-projects.js @@ -1,3 +1,50 @@ +//// [/lib/incremental-declaration-doesnt-changeOutput.txt] +/lib/tsc --b /src/third --verbose +12:08:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:08:00 AM - Project 'src/first/tsconfig.json' is out of date because oldest output 'src/first/bin/first-output.js' is older than newest input 'src/first/first_PART1.ts' + +12:08:00 AM - Building project '/src/first/tsconfig.json'... + +12:08:00 AM - Project 'src/second/tsconfig.json' is up to date because newest input 'src/second/second_part1.ts' is older than oldest output 'src/2/second-output.js' + +12:08:00 AM - Project 'src/third/tsconfig.json' is out of date because output of its dependency 'src/first' has changed + +12:08:00 AM - Updating output of project '/src/third/tsconfig.json'... + +12:08:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... + +exitCode:: 0 +readFiles:: { + "/src/third/tsconfig.json": 1, + "/src/first/tsconfig.json": 1, + "/src/second/tsconfig.json": 1, + "/src/first/first_PART1.ts": 1, + "/src/first/first_part2.ts": 1, + "/src/first/first_part3.ts": 1, + "/src/first/bin/first-output.d.ts": 1, + "/src/2/second-output.tsbuildinfo": 1, + "/src/third/thirdjs/output/third-output.tsbuildinfo": 1, + "/src/third/thirdjs/output/third-output.js": 1, + "/src/third/thirdjs/output/third-output.js.map": 1, + "/src/third/thirdjs/output/third-output.d.ts": 1, + "/src/third/thirdjs/output/third-output.d.ts.map": 1, + "/src/first/bin/first-output.tsbuildinfo": 1, + "/src/first/bin/first-output.js": 1, + "/src/first/bin/first-output.js.map": 1, + "/src/2/second-output.js.map": 1, + "/src/2/second-output.js": 1, + "/src/first/bin/first-output.d.ts.map": 1, + "/src/2/second-output.d.ts.map": 1, + "/src/2/second-output.d.ts": 1 +} + +//// [/src/first/bin/first-output.d.ts] file written with same contents +//// [/src/first/bin/first-output.d.ts.map] file written with same contents +//// [/src/first/bin/first-output.d.ts.map.baseline.txt] file written with same contents //// [/src/first/bin/first-output.js] #!someshebang first first_PART1 var s = "Hello, world"; diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/shebang-in-only-one-dependency-project.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/shebang-in-only-one-dependency-project.js index d89f565e37593..8cbabe3c8801d 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/shebang-in-only-one-dependency-project.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/shebang-in-only-one-dependency-project.js @@ -1,3 +1,28 @@ +//// [/lib/incremental-declaration-doesnt-changeOutput.txt] +/lib/tsc --b /src/third --verbose +12:04:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:04:00 AM - Project 'src/first/tsconfig.json' is out of date because oldest output 'src/first/bin/first-output.js' is older than newest input 'src/first/first_PART1.ts' + +12:04:00 AM - Building project '/src/first/tsconfig.json'... + +12:04:00 AM - Project 'src/second/tsconfig.json' is up to date because newest input 'src/second/second_part1.ts' is older than oldest output 'src/2/second-output.js' + +12:04:00 AM - Project 'src/third/tsconfig.json' is out of date because output of its dependency 'src/first' has changed + +12:04:00 AM - Updating output of project '/src/third/tsconfig.json'... + +12:04:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... + +exitCode:: 0 + + +//// [/src/first/bin/first-output.d.ts] file written with same contents +//// [/src/first/bin/first-output.d.ts.map] file written with same contents +//// [/src/first/bin/first-output.d.ts.map.baseline.txt] file written with same contents //// [/src/first/bin/first-output.js] var s = "Hello, world"; console.log(s); diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/strict-in-all-projects.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/strict-in-all-projects.js index 5cf3ea7abd422..a97bd2a2197c3 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/strict-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/strict-in-all-projects.js @@ -1,3 +1,50 @@ +//// [/lib/incremental-declaration-doesnt-changeOutput.txt] +/lib/tsc --b /src/third --verbose +12:08:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:08:00 AM - Project 'src/first/tsconfig.json' is out of date because oldest output 'src/first/bin/first-output.js' is older than newest input 'src/first/first_PART1.ts' + +12:08:00 AM - Building project '/src/first/tsconfig.json'... + +12:08:00 AM - Project 'src/second/tsconfig.json' is up to date because newest input 'src/second/second_part1.ts' is older than oldest output 'src/2/second-output.js' + +12:08:00 AM - Project 'src/third/tsconfig.json' is out of date because output of its dependency 'src/first' has changed + +12:08:00 AM - Updating output of project '/src/third/tsconfig.json'... + +12:08:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... + +exitCode:: 0 +readFiles:: { + "/src/third/tsconfig.json": 1, + "/src/first/tsconfig.json": 1, + "/src/second/tsconfig.json": 1, + "/src/first/first_PART1.ts": 1, + "/src/first/first_part2.ts": 1, + "/src/first/first_part3.ts": 1, + "/src/first/bin/first-output.d.ts": 1, + "/src/2/second-output.tsbuildinfo": 1, + "/src/third/thirdjs/output/third-output.tsbuildinfo": 1, + "/src/third/thirdjs/output/third-output.js": 1, + "/src/third/thirdjs/output/third-output.js.map": 1, + "/src/third/thirdjs/output/third-output.d.ts": 1, + "/src/third/thirdjs/output/third-output.d.ts.map": 1, + "/src/first/bin/first-output.tsbuildinfo": 1, + "/src/first/bin/first-output.js": 1, + "/src/2/second-output.js": 1, + "/src/first/bin/first-output.js.map": 1, + "/src/2/second-output.js.map": 1, + "/src/2/second-output.d.ts": 1, + "/src/first/bin/first-output.d.ts.map": 1, + "/src/2/second-output.d.ts.map": 1 +} + +//// [/src/first/bin/first-output.d.ts] file written with same contents +//// [/src/first/bin/first-output.d.ts.map] file written with same contents +//// [/src/first/bin/first-output.d.ts.map.baseline.txt] file written with same contents //// [/src/first/bin/first-output.js] "use strict"; var s = "Hello, world"; diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/strict-in-one-dependency.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/strict-in-one-dependency.js index 372ef6719104d..9bdfad323e96e 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/strict-in-one-dependency.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/strict-in-one-dependency.js @@ -1,3 +1,28 @@ +//// [/lib/incremental-declaration-doesnt-changeOutput.txt] +/lib/tsc --b /src/third --verbose +12:04:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:04:00 AM - Project 'src/first/tsconfig.json' is out of date because oldest output 'src/first/bin/first-output.js' is older than newest input 'src/first/first_PART1.ts' + +12:04:00 AM - Building project '/src/first/tsconfig.json'... + +12:04:00 AM - Project 'src/second/tsconfig.json' is up to date because newest input 'src/second/second_part1.ts' is older than oldest output 'src/2/second-output.js' + +12:04:00 AM - Project 'src/third/tsconfig.json' is out of date because output of its dependency 'src/first' has changed + +12:04:00 AM - Updating output of project '/src/third/tsconfig.json'... + +12:04:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... + +exitCode:: 0 + + +//// [/src/first/bin/first-output.d.ts] file written with same contents +//// [/src/first/bin/first-output.d.ts.map] file written with same contents +//// [/src/first/bin/first-output.d.ts.map.baseline.txt] file written with same contents //// [/src/first/bin/first-output.js] var s = "Hello, world"; console.log(s); diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/stripInternal-jsdoc-style-comment-when-one-two-three-are-prepended-in-order.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/stripInternal-jsdoc-style-comment-when-one-two-three-are-prepended-in-order.js index d9691fde1a8f6..9c369db811c90 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/stripInternal-jsdoc-style-comment-when-one-two-three-are-prepended-in-order.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/stripInternal-jsdoc-style-comment-when-one-two-three-are-prepended-in-order.js @@ -1,3 +1,29 @@ +//// [/lib/incremental-declaration-doesnt-changeOutput.txt] +/lib/tsc --b /src/third --verbose +12:04:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:04:00 AM - Project 'src/first/tsconfig.json' is out of date because oldest output 'src/first/bin/first-output.js' is older than newest input 'src/first/first_PART1.ts' + +12:04:00 AM - Building project '/src/first/tsconfig.json'... + +12:04:00 AM - Project 'src/second/tsconfig.json' is out of date because output of its dependency 'src/first' has changed + +12:04:00 AM - Updating output of project '/src/second/tsconfig.json'... + +12:04:00 AM - Updating unchanged output timestamps of project '/src/second/tsconfig.json'... + +12:04:00 AM - Project 'src/third/tsconfig.json' is out of date because output of its dependency 'src/second' has changed + +12:04:00 AM - Updating output of project '/src/third/tsconfig.json'... + +12:04:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... + +exitCode:: 0 + + //// [/src/2/second-output.js] var s = "Hello, world"; console.log(s); @@ -2024,6 +2050,9 @@ declare class C { ====================================================================== +//// [/src/first/bin/first-output.d.ts] file written with same contents +//// [/src/first/bin/first-output.d.ts.map] file written with same contents +//// [/src/first/bin/first-output.d.ts.map.baseline.txt] file written with same contents //// [/src/first/bin/first-output.js] var s = "Hello, world"; console.log(s); diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/stripInternal-jsdoc-style-comment.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/stripInternal-jsdoc-style-comment.js index 38403c4693d02..4879065387473 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/stripInternal-jsdoc-style-comment.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/stripInternal-jsdoc-style-comment.js @@ -1,3 +1,28 @@ +//// [/lib/incremental-declaration-doesnt-changeOutput.txt] +/lib/tsc --b /src/third --verbose +12:04:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:04:00 AM - Project 'src/first/tsconfig.json' is out of date because oldest output 'src/first/bin/first-output.js' is older than newest input 'src/first/first_PART1.ts' + +12:04:00 AM - Building project '/src/first/tsconfig.json'... + +12:04:00 AM - Project 'src/second/tsconfig.json' is up to date because newest input 'src/second/second_part1.ts' is older than oldest output 'src/2/second-output.js' + +12:04:00 AM - Project 'src/third/tsconfig.json' is out of date because output of its dependency 'src/first' has changed + +12:04:00 AM - Updating output of project '/src/third/tsconfig.json'... + +12:04:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... + +exitCode:: 0 + + +//// [/src/first/bin/first-output.d.ts] file written with same contents +//// [/src/first/bin/first-output.d.ts.map] file written with same contents +//// [/src/first/bin/first-output.d.ts.map.baseline.txt] file written with same contents //// [/src/first/bin/first-output.js] var s = "Hello, world"; console.log(s); diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/stripInternal-jsdoc-style-with-comments-emit-enabled-when-one-two-three-are-prepended-in-order.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/stripInternal-jsdoc-style-with-comments-emit-enabled-when-one-two-three-are-prepended-in-order.js index a48020f4ba74b..b7ccf17985a32 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/stripInternal-jsdoc-style-with-comments-emit-enabled-when-one-two-three-are-prepended-in-order.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/stripInternal-jsdoc-style-with-comments-emit-enabled-when-one-two-three-are-prepended-in-order.js @@ -1,3 +1,29 @@ +//// [/lib/incremental-declaration-doesnt-changeOutput.txt] +/lib/tsc --b /src/third --verbose +12:04:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:04:00 AM - Project 'src/first/tsconfig.json' is out of date because oldest output 'src/first/bin/first-output.js' is older than newest input 'src/first/first_PART1.ts' + +12:04:00 AM - Building project '/src/first/tsconfig.json'... + +12:04:00 AM - Project 'src/second/tsconfig.json' is out of date because output of its dependency 'src/first' has changed + +12:04:00 AM - Updating output of project '/src/second/tsconfig.json'... + +12:04:00 AM - Updating unchanged output timestamps of project '/src/second/tsconfig.json'... + +12:04:00 AM - Project 'src/third/tsconfig.json' is out of date because output of its dependency 'src/second' has changed + +12:04:00 AM - Updating output of project '/src/third/tsconfig.json'... + +12:04:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... + +exitCode:: 0 + + //// [/src/2/second-output.js] var s = "Hello, world"; console.log(s); @@ -2124,6 +2150,9 @@ declare class C { ====================================================================== +//// [/src/first/bin/first-output.d.ts] file written with same contents +//// [/src/first/bin/first-output.d.ts.map] file written with same contents +//// [/src/first/bin/first-output.d.ts.map.baseline.txt] file written with same contents //// [/src/first/bin/first-output.js] var s = "Hello, world"; console.log(s); diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/stripInternal-jsdoc-style-with-comments-emit-enabled.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/stripInternal-jsdoc-style-with-comments-emit-enabled.js index 29ad265d6ab55..beb8d35124ee2 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/stripInternal-jsdoc-style-with-comments-emit-enabled.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/stripInternal-jsdoc-style-with-comments-emit-enabled.js @@ -1,3 +1,28 @@ +//// [/lib/incremental-declaration-doesnt-changeOutput.txt] +/lib/tsc --b /src/third --verbose +12:04:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:04:00 AM - Project 'src/first/tsconfig.json' is out of date because oldest output 'src/first/bin/first-output.js' is older than newest input 'src/first/first_PART1.ts' + +12:04:00 AM - Building project '/src/first/tsconfig.json'... + +12:04:00 AM - Project 'src/second/tsconfig.json' is up to date because newest input 'src/second/second_part1.ts' is older than oldest output 'src/2/second-output.js' + +12:04:00 AM - Project 'src/third/tsconfig.json' is out of date because output of its dependency 'src/first' has changed + +12:04:00 AM - Updating output of project '/src/third/tsconfig.json'... + +12:04:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... + +exitCode:: 0 + + +//// [/src/first/bin/first-output.d.ts] file written with same contents +//// [/src/first/bin/first-output.d.ts.map] file written with same contents +//// [/src/first/bin/first-output.d.ts.map.baseline.txt] file written with same contents //// [/src/first/bin/first-output.js] var s = "Hello, world"; console.log(s); diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/stripInternal-when-one-two-three-are-prepended-in-order.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/stripInternal-when-one-two-three-are-prepended-in-order.js index 08a0bffd148e2..e670e22aab643 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/stripInternal-when-one-two-three-are-prepended-in-order.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/stripInternal-when-one-two-three-are-prepended-in-order.js @@ -1,3 +1,51 @@ +//// [/lib/incremental-declaration-doesnt-changeOutput.txt] +/lib/tsc --b /src/third --verbose +12:08:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:08:00 AM - Project 'src/first/tsconfig.json' is out of date because oldest output 'src/first/bin/first-output.js' is older than newest input 'src/first/first_PART1.ts' + +12:08:00 AM - Building project '/src/first/tsconfig.json'... + +12:08:00 AM - Project 'src/second/tsconfig.json' is out of date because output of its dependency 'src/first' has changed + +12:08:00 AM - Updating output of project '/src/second/tsconfig.json'... + +12:08:00 AM - Updating unchanged output timestamps of project '/src/second/tsconfig.json'... + +12:08:00 AM - Project 'src/third/tsconfig.json' is out of date because output of its dependency 'src/second' has changed + +12:08:00 AM - Updating output of project '/src/third/tsconfig.json'... + +12:08:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... + +exitCode:: 0 +readFiles:: { + "/src/third/tsconfig.json": 1, + "/src/second/tsconfig.json": 1, + "/src/first/tsconfig.json": 1, + "/src/first/first_PART1.ts": 1, + "/src/first/first_part2.ts": 1, + "/src/first/first_part3.ts": 1, + "/src/first/bin/first-output.d.ts": 1, + "/src/2/second-output.tsbuildinfo": 2, + "/src/2/second-output.js": 2, + "/src/2/second-output.js.map": 2, + "/src/2/second-output.d.ts": 2, + "/src/2/second-output.d.ts.map": 2, + "/src/first/bin/first-output.tsbuildinfo": 1, + "/src/first/bin/first-output.js": 1, + "/src/first/bin/first-output.js.map": 1, + "/src/first/bin/first-output.d.ts.map": 1, + "/src/third/thirdjs/output/third-output.tsbuildinfo": 1, + "/src/third/thirdjs/output/third-output.js": 1, + "/src/third/thirdjs/output/third-output.js.map": 1, + "/src/third/thirdjs/output/third-output.d.ts": 1, + "/src/third/thirdjs/output/third-output.d.ts.map": 1 +} + //// [/src/2/second-output.js] var s = "Hello, world"; console.log(s); @@ -2024,6 +2072,9 @@ declare class C { ====================================================================== +//// [/src/first/bin/first-output.d.ts] file written with same contents +//// [/src/first/bin/first-output.d.ts.map] file written with same contents +//// [/src/first/bin/first-output.d.ts.map.baseline.txt] file written with same contents //// [/src/first/bin/first-output.js] var s = "Hello, world"; console.log(s); diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/stripInternal-with-comments-emit-enabled-when-one-two-three-are-prepended-in-order.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/stripInternal-with-comments-emit-enabled-when-one-two-three-are-prepended-in-order.js index e17e3f05842dd..eb1f081ead5df 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/stripInternal-with-comments-emit-enabled-when-one-two-three-are-prepended-in-order.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/stripInternal-with-comments-emit-enabled-when-one-two-three-are-prepended-in-order.js @@ -1,3 +1,29 @@ +//// [/lib/incremental-declaration-doesnt-changeOutput.txt] +/lib/tsc --b /src/third --verbose +12:04:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:04:00 AM - Project 'src/first/tsconfig.json' is out of date because oldest output 'src/first/bin/first-output.js' is older than newest input 'src/first/first_PART1.ts' + +12:04:00 AM - Building project '/src/first/tsconfig.json'... + +12:04:00 AM - Project 'src/second/tsconfig.json' is out of date because output of its dependency 'src/first' has changed + +12:04:00 AM - Updating output of project '/src/second/tsconfig.json'... + +12:04:00 AM - Updating unchanged output timestamps of project '/src/second/tsconfig.json'... + +12:04:00 AM - Project 'src/third/tsconfig.json' is out of date because output of its dependency 'src/second' has changed + +12:04:00 AM - Updating output of project '/src/third/tsconfig.json'... + +12:04:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... + +exitCode:: 0 + + //// [/src/2/second-output.js] var s = "Hello, world"; console.log(s); @@ -2124,6 +2150,9 @@ declare class C { ====================================================================== +//// [/src/first/bin/first-output.d.ts] file written with same contents +//// [/src/first/bin/first-output.d.ts.map] file written with same contents +//// [/src/first/bin/first-output.d.ts.map.baseline.txt] file written with same contents //// [/src/first/bin/first-output.js] var s = "Hello, world"; console.log(s); diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/stripInternal-with-comments-emit-enabled.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/stripInternal-with-comments-emit-enabled.js index 29c643c43f573..51479fbc65dd0 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/stripInternal-with-comments-emit-enabled.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/stripInternal-with-comments-emit-enabled.js @@ -1,3 +1,28 @@ +//// [/lib/incremental-declaration-doesnt-changeOutput.txt] +/lib/tsc --b /src/third --verbose +12:04:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:04:00 AM - Project 'src/first/tsconfig.json' is out of date because oldest output 'src/first/bin/first-output.js' is older than newest input 'src/first/first_PART1.ts' + +12:04:00 AM - Building project '/src/first/tsconfig.json'... + +12:04:00 AM - Project 'src/second/tsconfig.json' is up to date because newest input 'src/second/second_part1.ts' is older than oldest output 'src/2/second-output.js' + +12:04:00 AM - Project 'src/third/tsconfig.json' is out of date because output of its dependency 'src/first' has changed + +12:04:00 AM - Updating output of project '/src/third/tsconfig.json'... + +12:04:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... + +exitCode:: 0 + + +//// [/src/first/bin/first-output.d.ts] file written with same contents +//// [/src/first/bin/first-output.d.ts.map] file written with same contents +//// [/src/first/bin/first-output.d.ts.map.baseline.txt] file written with same contents //// [/src/first/bin/first-output.js] var s = "Hello, world"; console.log(s); diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/stripInternal.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/stripInternal.js index e91c046c27870..4a70c73124ece 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/stripInternal.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/stripInternal.js @@ -1,3 +1,50 @@ +//// [/lib/incremental-declaration-doesnt-changeOutput.txt] +/lib/tsc --b /src/third --verbose +12:08:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:08:00 AM - Project 'src/first/tsconfig.json' is out of date because oldest output 'src/first/bin/first-output.js' is older than newest input 'src/first/first_PART1.ts' + +12:08:00 AM - Building project '/src/first/tsconfig.json'... + +12:08:00 AM - Project 'src/second/tsconfig.json' is up to date because newest input 'src/second/second_part1.ts' is older than oldest output 'src/2/second-output.js' + +12:08:00 AM - Project 'src/third/tsconfig.json' is out of date because output of its dependency 'src/first' has changed + +12:08:00 AM - Updating output of project '/src/third/tsconfig.json'... + +12:08:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... + +exitCode:: 0 +readFiles:: { + "/src/third/tsconfig.json": 1, + "/src/first/tsconfig.json": 1, + "/src/second/tsconfig.json": 1, + "/src/first/first_PART1.ts": 1, + "/src/first/first_part2.ts": 1, + "/src/first/first_part3.ts": 1, + "/src/first/bin/first-output.d.ts": 1, + "/src/2/second-output.tsbuildinfo": 1, + "/src/third/thirdjs/output/third-output.tsbuildinfo": 1, + "/src/third/thirdjs/output/third-output.js": 1, + "/src/third/thirdjs/output/third-output.js.map": 1, + "/src/third/thirdjs/output/third-output.d.ts": 1, + "/src/third/thirdjs/output/third-output.d.ts.map": 1, + "/src/first/bin/first-output.tsbuildinfo": 1, + "/src/first/bin/first-output.js": 1, + "/src/2/second-output.js": 1, + "/src/first/bin/first-output.js.map": 1, + "/src/2/second-output.js.map": 1, + "/src/2/second-output.d.ts": 1, + "/src/first/bin/first-output.d.ts.map": 1, + "/src/2/second-output.d.ts.map": 1 +} + +//// [/src/first/bin/first-output.d.ts] file written with same contents +//// [/src/first/bin/first-output.d.ts.map] file written with same contents +//// [/src/first/bin/first-output.d.ts.map.baseline.txt] file written with same contents //// [/src/first/bin/first-output.js] var s = "Hello, world"; console.log(s); diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/triple-slash-refs-in-all-projects.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/triple-slash-refs-in-all-projects.js index a7e041fe565eb..b11dc0218e23b 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/triple-slash-refs-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/triple-slash-refs-in-all-projects.js @@ -1,3 +1,51 @@ +//// [/lib/incremental-declaration-doesnt-changeOutput.txt] +/lib/tsc --b /src/third --verbose +12:08:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:08:00 AM - Project 'src/first/tsconfig.json' is out of date because oldest output 'src/first/bin/first-output.js' is older than newest input 'src/first/first_PART1.ts' + +12:08:00 AM - Building project '/src/first/tsconfig.json'... + +12:08:00 AM - Project 'src/second/tsconfig.json' is up to date because newest input 'src/second/second_part1.ts' is older than oldest output 'src/2/second-output.js' + +12:08:00 AM - Project 'src/third/tsconfig.json' is out of date because output of its dependency 'src/first' has changed + +12:08:00 AM - Updating output of project '/src/third/tsconfig.json'... + +12:08:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... + +exitCode:: 0 +readFiles:: { + "/src/third/tsconfig.json": 1, + "/src/first/tsconfig.json": 1, + "/src/second/tsconfig.json": 1, + "/src/first/first_PART1.ts": 1, + "/src/first/first_part2.ts": 1, + "/src/first/tripleRef.d.ts": 1, + "/src/first/first_part3.ts": 1, + "/src/first/bin/first-output.d.ts": 1, + "/src/2/second-output.tsbuildinfo": 1, + "/src/third/thirdjs/output/third-output.tsbuildinfo": 1, + "/src/third/thirdjs/output/third-output.js": 1, + "/src/third/thirdjs/output/third-output.js.map": 1, + "/src/third/thirdjs/output/third-output.d.ts": 1, + "/src/third/thirdjs/output/third-output.d.ts.map": 1, + "/src/first/bin/first-output.tsbuildinfo": 1, + "/src/first/bin/first-output.js": 1, + "/src/2/second-output.js": 1, + "/src/first/bin/first-output.js.map": 1, + "/src/2/second-output.js.map": 1, + "/src/2/second-output.d.ts": 1, + "/src/first/bin/first-output.d.ts.map": 1, + "/src/2/second-output.d.ts.map": 1 +} + +//// [/src/first/bin/first-output.d.ts] file written with same contents +//// [/src/first/bin/first-output.d.ts.map] file written with same contents +//// [/src/first/bin/first-output.d.ts.map.baseline.txt] file written with same contents //// [/src/first/bin/first-output.js] var s = "Hello, world"; console.log(s); diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/triple-slash-refs-in-one-project.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/triple-slash-refs-in-one-project.js index c34e752d8086d..8d9f639e805d3 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/triple-slash-refs-in-one-project.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/triple-slash-refs-in-one-project.js @@ -1,3 +1,28 @@ +//// [/lib/incremental-declaration-doesnt-changeOutput.txt] +/lib/tsc --b /src/third --verbose +12:04:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:04:00 AM - Project 'src/first/tsconfig.json' is out of date because oldest output 'src/first/bin/first-output.js' is older than newest input 'src/first/first_PART1.ts' + +12:04:00 AM - Building project '/src/first/tsconfig.json'... + +12:04:00 AM - Project 'src/second/tsconfig.json' is up to date because newest input 'src/second/second_part1.ts' is older than oldest output 'src/2/second-output.js' + +12:04:00 AM - Project 'src/third/tsconfig.json' is out of date because output of its dependency 'src/first' has changed + +12:04:00 AM - Updating output of project '/src/third/tsconfig.json'... + +12:04:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... + +exitCode:: 0 + + +//// [/src/first/bin/first-output.d.ts] file written with same contents +//// [/src/first/bin/first-output.d.ts.map] file written with same contents +//// [/src/first/bin/first-output.d.ts.map.baseline.txt] file written with same contents //// [/src/first/bin/first-output.js] var s = "Hello, world"; console.log(s); diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/when-final-project-is-not-composite-but-uses-project-references.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/when-final-project-is-not-composite-but-uses-project-references.js index eb117294ec4a2..66e8fed06770d 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/when-final-project-is-not-composite-but-uses-project-references.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/when-final-project-is-not-composite-but-uses-project-references.js @@ -1,3 +1,26 @@ +//// [/lib/incremental-declaration-doesnt-changeOutput.txt] +/lib/tsc --b /src/third --verbose +12:04:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:04:00 AM - Project 'src/first/tsconfig.json' is out of date because oldest output 'src/first/bin/first-output.js' is older than newest input 'src/first/first_PART1.ts' + +12:04:00 AM - Building project '/src/first/tsconfig.json'... + +12:04:00 AM - Project 'src/second/tsconfig.json' is up to date because newest input 'src/second/second_part1.ts' is older than oldest output 'src/2/second-output.js' + +12:04:00 AM - Project 'src/third/tsconfig.json' is out of date because output of its dependency 'src/first' has changed + +12:04:00 AM - Building project '/src/third/tsconfig.json'... + +exitCode:: 0 + + +//// [/src/first/bin/first-output.d.ts] file written with same contents +//// [/src/first/bin/first-output.d.ts.map] file written with same contents +//// [/src/first/bin/first-output.d.ts.map.baseline.txt] file written with same contents //// [/src/first/bin/first-output.js] var s = "Hello, world"; console.log(s); @@ -257,6 +280,9 @@ interface NoJsForHereEither { console.log(s); console.log(s); +//// [/src/third/thirdjs/output/third-output.d.ts] file written with same contents +//// [/src/third/thirdjs/output/third-output.d.ts.map] file written with same contents +//// [/src/third/thirdjs/output/third-output.d.ts.map.baseline.txt] file written with same contents //// [/src/third/thirdjs/output/third-output.js] var s = "Hello, world"; console.log(s); diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/when-source-files-are-empty-in-the-own-file.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/when-source-files-are-empty-in-the-own-file.js index d050ca2dd0c70..c41ea2edc699d 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/when-source-files-are-empty-in-the-own-file.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/when-source-files-are-empty-in-the-own-file.js @@ -1,3 +1,28 @@ +//// [/lib/incremental-declaration-doesnt-changeOutput.txt] +/lib/tsc --b /src/third --verbose +12:04:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:04:00 AM - Project 'src/first/tsconfig.json' is out of date because oldest output 'src/first/bin/first-output.js' is older than newest input 'src/first/first_PART1.ts' + +12:04:00 AM - Building project '/src/first/tsconfig.json'... + +12:04:00 AM - Project 'src/second/tsconfig.json' is up to date because newest input 'src/second/second_part1.ts' is older than oldest output 'src/2/second-output.js' + +12:04:00 AM - Project 'src/third/tsconfig.json' is out of date because output of its dependency 'src/first' has changed + +12:04:00 AM - Updating output of project '/src/third/tsconfig.json'... + +12:04:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... + +exitCode:: 0 + + +//// [/src/first/bin/first-output.d.ts] file written with same contents +//// [/src/first/bin/first-output.d.ts.map] file written with same contents +//// [/src/first/bin/first-output.d.ts.map.baseline.txt] file written with same contents //// [/src/first/bin/first-output.js] var s = "Hello, world"; console.log(s); diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/emitHelpers-in-all-projects.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/emitHelpers-in-all-projects.js index f595aac719300..971adc119ac12 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/emitHelpers-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/emitHelpers-in-all-projects.js @@ -1,3 +1,48 @@ +//// [/lib/incremental-headers-change-without-dts-changesOutput.txt] +/lib/tsc --b /src/third --verbose +12:12:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:12:00 AM - Project 'src/first/tsconfig.json' is out of date because oldest output 'src/first/bin/first-output.js' is older than newest input 'src/first/first_PART1.ts' + +12:12:00 AM - Building project '/src/first/tsconfig.json'... + +12:12:00 AM - Project 'src/second/tsconfig.json' is up to date because newest input 'src/second/second_part1.ts' is older than oldest output 'src/2/second-output.js' + +12:12:00 AM - Project 'src/third/tsconfig.json' is out of date because output of its dependency 'src/first' has changed + +12:12:00 AM - Updating output of project '/src/third/tsconfig.json'... + +12:12:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... + +exitCode:: 0 +readFiles:: { + "/src/third/tsconfig.json": 1, + "/src/first/tsconfig.json": 1, + "/src/second/tsconfig.json": 1, + "/src/first/first_PART1.ts": 1, + "/src/first/first_part2.ts": 1, + "/src/first/first_part3.ts": 1, + "/src/first/bin/first-output.d.ts": 1, + "/src/2/second-output.tsbuildinfo": 1, + "/src/third/thirdjs/output/third-output.tsbuildinfo": 1, + "/src/third/thirdjs/output/third-output.js": 1, + "/src/third/thirdjs/output/third-output.js.map": 1, + "/src/third/thirdjs/output/third-output.d.ts": 1, + "/src/third/thirdjs/output/third-output.d.ts.map": 1, + "/src/first/bin/first-output.tsbuildinfo": 1, + "/src/first/bin/first-output.js": 1, + "/src/2/second-output.js": 1, + "/src/first/bin/first-output.js.map": 1, + "/src/2/second-output.js.map": 1, + "/src/2/second-output.d.ts": 1, + "/src/first/bin/first-output.d.ts.map": 1, + "/src/2/second-output.d.ts.map": 1 +} + +//// [/src/first/bin/first-output.d.ts] file written with same contents //// [/src/first/bin/first-output.d.ts.map] {"version":3,"file":"first-output.d.ts","sourceRoot":"","sources":["../first_PART1.ts","../first_part2.ts","../first_part3.ts"],"names":[],"mappings":"AAAA,UAAU,QAAQ;IACd,IAAI,EAAE,GAAG,CAAC;CACb;AAED,QAAA,MAAM,CAAC,iBAAiB,CAAC;AAEzB,UAAU,iBAAiB;IACvB,IAAI,EAAE,GAAG,CAAC;CACb;AAGD,iBAAS,uBAAuB,SAAM;AEXtC,iBAAS,CAAC,WAET"} diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/emitHelpers-in-only-one-dependency-project.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/emitHelpers-in-only-one-dependency-project.js index 65d56d99c9956..4224fc07853d5 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/emitHelpers-in-only-one-dependency-project.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/emitHelpers-in-only-one-dependency-project.js @@ -1,3 +1,26 @@ +//// [/lib/incremental-headers-change-without-dts-changesOutput.txt] +/lib/tsc --b /src/third --verbose +12:08:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:08:00 AM - Project 'src/first/tsconfig.json' is out of date because oldest output 'src/first/bin/first-output.js' is older than newest input 'src/first/first_PART1.ts' + +12:08:00 AM - Building project '/src/first/tsconfig.json'... + +12:08:00 AM - Project 'src/second/tsconfig.json' is up to date because newest input 'src/second/second_part1.ts' is older than oldest output 'src/2/second-output.js' + +12:08:00 AM - Project 'src/third/tsconfig.json' is out of date because output of its dependency 'src/first' has changed + +12:08:00 AM - Updating output of project '/src/third/tsconfig.json'... + +12:08:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... + +exitCode:: 0 + + +//// [/src/first/bin/first-output.d.ts] file written with same contents //// [/src/first/bin/first-output.d.ts.map] {"version":3,"file":"first-output.d.ts","sourceRoot":"","sources":["../first_PART1.ts","../first_part2.ts","../first_part3.ts"],"names":[],"mappings":"AAAA,UAAU,QAAQ;IACd,IAAI,EAAE,GAAG,CAAC;CACb;AAED,QAAA,MAAM,CAAC,iBAAiB,CAAC;AAEzB,UAAU,iBAAiB;IACvB,IAAI,EAAE,GAAG,CAAC;CACb;AAGD,iBAAS,uBAAuB,SAE/B;AEbD,iBAAS,CAAC,WAET"} diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/multiple-emitHelpers-in-all-projects.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/multiple-emitHelpers-in-all-projects.js index 85a0007b0ffbc..888071398903f 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/multiple-emitHelpers-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/multiple-emitHelpers-in-all-projects.js @@ -1,3 +1,26 @@ +//// [/lib/incremental-headers-change-without-dts-changesOutput.txt] +/lib/tsc --b /src/third --verbose +12:08:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:08:00 AM - Project 'src/first/tsconfig.json' is out of date because oldest output 'src/first/bin/first-output.js' is older than newest input 'src/first/first_PART1.ts' + +12:08:00 AM - Building project '/src/first/tsconfig.json'... + +12:08:00 AM - Project 'src/second/tsconfig.json' is up to date because newest input 'src/second/second_part1.ts' is older than oldest output 'src/2/second-output.js' + +12:08:00 AM - Project 'src/third/tsconfig.json' is out of date because output of its dependency 'src/first' has changed + +12:08:00 AM - Updating output of project '/src/third/tsconfig.json'... + +12:08:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... + +exitCode:: 0 + + +//// [/src/first/bin/first-output.d.ts] file written with same contents //// [/src/first/bin/first-output.d.ts.map] {"version":3,"file":"first-output.d.ts","sourceRoot":"","sources":["../first_PART1.ts","../first_part2.ts","../first_part3.ts"],"names":[],"mappings":"AAAA,UAAU,QAAQ;IACd,IAAI,EAAE,GAAG,CAAC;CACb;AAED,QAAA,MAAM,CAAC,iBAAiB,CAAC;AAEzB,UAAU,iBAAiB;IACvB,IAAI,EAAE,GAAG,CAAC;CACb;AAGD,iBAAS,uBAAuB,SAAM;AEXtC,iBAAS,CAAC,WAET;AACD,iBAAS,sBAAsB,CAAC,GAAG,GAAG,MAAM,EAAE,QAAK"} diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/multiple-emitHelpers-in-different-projects.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/multiple-emitHelpers-in-different-projects.js index ea399602b00c9..2c4350cc261dc 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/multiple-emitHelpers-in-different-projects.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/multiple-emitHelpers-in-different-projects.js @@ -1,3 +1,26 @@ +//// [/lib/incremental-headers-change-without-dts-changesOutput.txt] +/lib/tsc --b /src/third --verbose +12:08:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:08:00 AM - Project 'src/first/tsconfig.json' is out of date because oldest output 'src/first/bin/first-output.js' is older than newest input 'src/first/first_PART1.ts' + +12:08:00 AM - Building project '/src/first/tsconfig.json'... + +12:08:00 AM - Project 'src/second/tsconfig.json' is up to date because newest input 'src/second/second_part1.ts' is older than oldest output 'src/2/second-output.js' + +12:08:00 AM - Project 'src/third/tsconfig.json' is out of date because output of its dependency 'src/first' has changed + +12:08:00 AM - Updating output of project '/src/third/tsconfig.json'... + +12:08:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... + +exitCode:: 0 + + +//// [/src/first/bin/first-output.d.ts] file written with same contents //// [/src/first/bin/first-output.d.ts.map] {"version":3,"file":"first-output.d.ts","sourceRoot":"","sources":["../first_PART1.ts","../first_part2.ts","../first_part3.ts"],"names":[],"mappings":"AAAA,UAAU,QAAQ;IACd,IAAI,EAAE,GAAG,CAAC;CACb;AAED,QAAA,MAAM,CAAC,iBAAiB,CAAC;AAEzB,UAAU,iBAAiB;IACvB,IAAI,EAAE,GAAG,CAAC;CACb;AAGD,iBAAS,uBAAuB,SAAM;AEXtC,iBAAS,CAAC,WAET"} diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/multiple-prologues-in-all-projects.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/multiple-prologues-in-all-projects.js index 948b6e8233a05..b7da2a1ff965f 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/multiple-prologues-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/multiple-prologues-in-all-projects.js @@ -1,3 +1,48 @@ +//// [/lib/incremental-headers-change-without-dts-changesOutput.txt] +/lib/tsc --b /src/third --verbose +12:12:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:12:00 AM - Project 'src/first/tsconfig.json' is out of date because oldest output 'src/first/bin/first-output.js' is older than newest input 'src/first/first_PART1.ts' + +12:12:00 AM - Building project '/src/first/tsconfig.json'... + +12:12:00 AM - Project 'src/second/tsconfig.json' is up to date because newest input 'src/second/second_part1.ts' is older than oldest output 'src/2/second-output.js' + +12:12:00 AM - Project 'src/third/tsconfig.json' is out of date because output of its dependency 'src/first' has changed + +12:12:00 AM - Updating output of project '/src/third/tsconfig.json'... + +12:12:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... + +exitCode:: 0 +readFiles:: { + "/src/third/tsconfig.json": 1, + "/src/first/tsconfig.json": 1, + "/src/second/tsconfig.json": 1, + "/src/first/first_PART1.ts": 1, + "/src/first/first_part2.ts": 1, + "/src/first/first_part3.ts": 1, + "/src/first/bin/first-output.d.ts": 1, + "/src/2/second-output.tsbuildinfo": 1, + "/src/third/thirdjs/output/third-output.tsbuildinfo": 1, + "/src/third/thirdjs/output/third-output.js": 1, + "/src/third/thirdjs/output/third-output.js.map": 1, + "/src/third/thirdjs/output/third-output.d.ts": 1, + "/src/third/thirdjs/output/third-output.d.ts.map": 1, + "/src/first/bin/first-output.tsbuildinfo": 1, + "/src/first/bin/first-output.js": 1, + "/src/2/second-output.js": 1, + "/src/first/bin/first-output.js.map": 1, + "/src/2/second-output.js.map": 1, + "/src/2/second-output.d.ts": 1, + "/src/first/bin/first-output.d.ts.map": 1, + "/src/2/second-output.d.ts.map": 1 +} + +//// [/src/first/bin/first-output.d.ts] file written with same contents //// [/src/first/bin/first-output.d.ts.map] {"version":3,"file":"first-output.d.ts","sourceRoot":"","sources":["../first_PART1.ts","../first_part2.ts","../first_part3.ts"],"names":[],"mappings":"AAEA,UAAU,QAAQ;IACd,IAAI,EAAE,GAAG,CAAC;CACb;AAED,QAAA,MAAM,CAAC,iBAAiB,CAAC;AAEzB,UAAU,iBAAiB;IACvB,IAAI,EAAE,GAAG,CAAC;CACb;AEVD,iBAAS,CAAC,WAET"} diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/multiple-prologues-in-different-projects.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/multiple-prologues-in-different-projects.js index f16a24a3fb838..7b9dc11ca9b51 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/multiple-prologues-in-different-projects.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/multiple-prologues-in-different-projects.js @@ -1,3 +1,26 @@ +//// [/lib/incremental-headers-change-without-dts-changesOutput.txt] +/lib/tsc --b /src/third --verbose +12:08:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:08:00 AM - Project 'src/first/tsconfig.json' is out of date because oldest output 'src/first/bin/first-output.js' is older than newest input 'src/first/first_PART1.ts' + +12:08:00 AM - Building project '/src/first/tsconfig.json'... + +12:08:00 AM - Project 'src/second/tsconfig.json' is up to date because newest input 'src/second/second_part1.ts' is older than oldest output 'src/2/second-output.js' + +12:08:00 AM - Project 'src/third/tsconfig.json' is out of date because output of its dependency 'src/first' has changed + +12:08:00 AM - Updating output of project '/src/third/tsconfig.json'... + +12:08:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... + +exitCode:: 0 + + +//// [/src/first/bin/first-output.d.ts] file written with same contents //// [/src/first/bin/first-output.d.ts.map] {"version":3,"file":"first-output.d.ts","sourceRoot":"","sources":["../first_PART1.ts","../first_part2.ts","../first_part3.ts"],"names":[],"mappings":"AACA,UAAU,QAAQ;IACd,IAAI,EAAE,GAAG,CAAC;CACb;AAED,QAAA,MAAM,CAAC,iBAAiB,CAAC;AAEzB,UAAU,iBAAiB;IACvB,IAAI,EAAE,GAAG,CAAC;CACb;AETD,iBAAS,CAAC,WAET"} diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/strict-in-all-projects.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/strict-in-all-projects.js index 7e96f8915da31..f762fa7ac2949 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/strict-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/strict-in-all-projects.js @@ -1,3 +1,48 @@ +//// [/lib/incremental-headers-change-without-dts-changesOutput.txt] +/lib/tsc --b /src/third --verbose +12:12:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:12:00 AM - Project 'src/first/tsconfig.json' is out of date because oldest output 'src/first/bin/first-output.js' is older than newest input 'src/first/first_PART1.ts' + +12:12:00 AM - Building project '/src/first/tsconfig.json'... + +12:12:00 AM - Project 'src/second/tsconfig.json' is up to date because newest input 'src/second/second_part1.ts' is older than oldest output 'src/2/second-output.js' + +12:12:00 AM - Project 'src/third/tsconfig.json' is out of date because output of its dependency 'src/first' has changed + +12:12:00 AM - Updating output of project '/src/third/tsconfig.json'... + +12:12:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... + +exitCode:: 0 +readFiles:: { + "/src/third/tsconfig.json": 1, + "/src/first/tsconfig.json": 1, + "/src/second/tsconfig.json": 1, + "/src/first/first_PART1.ts": 1, + "/src/first/first_part2.ts": 1, + "/src/first/first_part3.ts": 1, + "/src/first/bin/first-output.d.ts": 1, + "/src/2/second-output.tsbuildinfo": 1, + "/src/third/thirdjs/output/third-output.tsbuildinfo": 1, + "/src/third/thirdjs/output/third-output.js": 1, + "/src/third/thirdjs/output/third-output.js.map": 1, + "/src/third/thirdjs/output/third-output.d.ts": 1, + "/src/third/thirdjs/output/third-output.d.ts.map": 1, + "/src/first/bin/first-output.tsbuildinfo": 1, + "/src/first/bin/first-output.js": 1, + "/src/2/second-output.js": 1, + "/src/first/bin/first-output.js.map": 1, + "/src/2/second-output.js.map": 1, + "/src/2/second-output.d.ts": 1, + "/src/first/bin/first-output.d.ts.map": 1, + "/src/2/second-output.d.ts.map": 1 +} + +//// [/src/first/bin/first-output.d.ts] file written with same contents //// [/src/first/bin/first-output.d.ts.map] {"version":3,"file":"first-output.d.ts","sourceRoot":"","sources":["../first_PART1.ts","../first_part2.ts","../first_part3.ts"],"names":[],"mappings":"AACA,UAAU,QAAQ;IACd,IAAI,EAAE,GAAG,CAAC;CACb;AAED,QAAA,MAAM,CAAC,iBAAiB,CAAC;AAEzB,UAAU,iBAAiB;IACvB,IAAI,EAAE,GAAG,CAAC;CACb;AETD,iBAAS,CAAC,WAET"} diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/strict-in-one-dependency.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/strict-in-one-dependency.js index ebb00b3b84c2f..0e8a092a7d1b4 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/strict-in-one-dependency.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/strict-in-one-dependency.js @@ -1,3 +1,26 @@ +//// [/lib/incremental-headers-change-without-dts-changesOutput.txt] +/lib/tsc --b /src/third --verbose +12:08:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:08:00 AM - Project 'src/first/tsconfig.json' is out of date because oldest output 'src/first/bin/first-output.js' is older than newest input 'src/first/first_PART1.ts' + +12:08:00 AM - Building project '/src/first/tsconfig.json'... + +12:08:00 AM - Project 'src/second/tsconfig.json' is up to date because newest input 'src/second/second_part1.ts' is older than oldest output 'src/2/second-output.js' + +12:08:00 AM - Project 'src/third/tsconfig.json' is out of date because output of its dependency 'src/first' has changed + +12:08:00 AM - Updating output of project '/src/third/tsconfig.json'... + +12:08:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... + +exitCode:: 0 + + +//// [/src/first/bin/first-output.d.ts] file written with same contents //// [/src/first/bin/first-output.d.ts.map] {"version":3,"file":"first-output.d.ts","sourceRoot":"","sources":["../first_PART1.ts","../first_part2.ts","../first_part3.ts"],"names":[],"mappings":"AACA,UAAU,QAAQ;IACd,IAAI,EAAE,GAAG,CAAC;CACb;AAED,QAAA,MAAM,CAAC,iBAAiB,CAAC;AAEzB,UAAU,iBAAiB;IACvB,IAAI,EAAE,GAAG,CAAC;CACb;AETD,iBAAS,CAAC,WAET"} diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/stripInternal-jsdoc-style-comment-when-one-two-three-are-prepended-in-order.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/stripInternal-jsdoc-style-comment-when-one-two-three-are-prepended-in-order.js index 965863d088eef..c4c6dc7ab6db8 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/stripInternal-jsdoc-style-comment-when-one-two-three-are-prepended-in-order.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/stripInternal-jsdoc-style-comment-when-one-two-three-are-prepended-in-order.js @@ -1,3 +1,29 @@ +//// [/lib/incremental-headers-change-without-dts-changesOutput.txt] +/lib/tsc --b /src/third --verbose +12:08:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:08:00 AM - Project 'src/first/tsconfig.json' is out of date because oldest output 'src/first/bin/first-output.js' is older than newest input 'src/first/first_PART1.ts' + +12:08:00 AM - Building project '/src/first/tsconfig.json'... + +12:08:00 AM - Project 'src/second/tsconfig.json' is out of date because output of its dependency 'src/first' has changed + +12:08:00 AM - Updating output of project '/src/second/tsconfig.json'... + +12:08:00 AM - Updating unchanged output timestamps of project '/src/second/tsconfig.json'... + +12:08:00 AM - Project 'src/third/tsconfig.json' is out of date because output of its dependency 'src/second' has changed + +12:08:00 AM - Updating output of project '/src/third/tsconfig.json'... + +12:08:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... + +exitCode:: 0 + + //// [/src/2/second-output.d.ts.map] {"version":3,"file":"second-output.d.ts","sourceRoot":"","sources":["../first/first_PART1.ts","../first/first_part3.ts","../second/second_part1.ts","../second/second_part2.ts"],"names":[],"mappings":"AAAA,UAAU,QAAQ;IACd,IAAI,EAAE,GAAG,CAAC;CACb;AAED,QAAA,MAAM,CAAC,iBAAiB,CAAC;AAEzB,UAAU,iBAAiB;IACvB,IAAI,EAAE,GAAG,CAAC;CACb;ACRD,iBAAS,CAAC,WAET;ACFD,kBAAU,CAAC,CAAC;CAEX;AAED,kBAAU,CAAC,CAAC;CAMX;AAED,cAAM,OAAO;;IAEM,IAAI,EAAE,MAAM,CAAC;IACb,MAAM;IACF,CAAC,EACM,MAAM;CACnC;AACD,kBAAU,OAAO,CAAC;IACC,MAAa,CAAC;KAAI;IAClB,SAAgB,GAAG,SAAK;IACxB,UAAiB,aAAa,CAAC;QAAE,MAAa,CAAC;SAAG;KAAE;IACpD,UAAiB,SAAS,CAAC,SAAS,CAAC;QAAE,MAAa,SAAS;SAAG;KAAE;IAClE,MAAM,QAAQ,UAAU,GAAG,aAAa,CAAC,CAAC,CAAC;IAC3C,KAAY,YAAY,GAAG,SAAS,CAAC;IAC9B,MAAM,aAAa,KAAK,CAAC;IAChC,KAAY,YAAY;QAAG,CAAC,IAAA;QAAE,CAAC,IAAA;QAAE,CAAC,IAAA;KAAE;CACtD;AACc,cAAM,SAAS;CAAG;AAClB,iBAAS,WAAW,SAAK;AACzB,kBAAU,iBAAiB,CAAC;IAAE,MAAa,SAAS;KAAG;CAAE;AACzD,kBAAU,aAAa,CAAC,SAAS,CAAC;IAAE,MAAa,SAAS;KAAG;CAAE;AAC/D,OAAO,cAAc,GAAG,iBAAiB,CAAC,SAAS,CAAC;AACpD,aAAK,YAAY,GAAG,SAAS,CAAC;AAC9B,QAAA,MAAM,aAAa,KAAK,CAAC;AACzB,aAAK,YAAY;IAAG,CAAC,IAAA;IAAE,CAAC,IAAA;IAAE,CAAC,IAAA;CAAE;ACpC5C,cAAM,CAAC;IACH,WAAW;CAGd"} @@ -778,4187 +804,975 @@ sourceFile:../second/second_part2.ts --- >>>//# sourceMappingURL=second-output.d.ts.map -//// [/src/2/second-output.js.map.baseline.txt] -=================================================================== -JsFile: second-output.js -mapUrl: second-output.js.map -sourceRoot: -sources: ../first/first_PART1.ts,../first/first_part2.ts,../first/first_part3.ts,../second/second_part1.ts,../second/second_part2.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:/src/2/second-output.js -sourceFile:../first/first_PART1.ts -------------------------------------------------------------------- ->>>var s = "Hello, world"; -1 > -2 >^^^^ -3 > ^ -4 > ^^^ -5 > ^^^^^^^^^^^^^^ -6 > ^ -1 >interface TheFirst { - > none: any; - >} - > - > -2 >const -3 > s -4 > = -5 > "Hello, world" -6 > ; -1 >Emitted(1, 1) Source(5, 1) + SourceIndex(0) -2 >Emitted(1, 5) Source(5, 7) + SourceIndex(0) -3 >Emitted(1, 6) Source(5, 8) + SourceIndex(0) -4 >Emitted(1, 9) Source(5, 11) + SourceIndex(0) -5 >Emitted(1, 23) Source(5, 25) + SourceIndex(0) -6 >Emitted(1, 24) Source(5, 26) + SourceIndex(0) ---- ->>>console.log(s); -1 > -2 >^^^^^^^ -3 > ^ -4 > ^^^ -5 > ^ -6 > ^ -7 > ^ -8 > ^ -9 > ^^^-> -1 > - > - >interface NoJsForHereEither { - > none: any; - >} - > - > -2 >console -3 > . -4 > log -5 > ( -6 > s -7 > ) -8 > ; -1 >Emitted(2, 1) Source(11, 1) + SourceIndex(0) -2 >Emitted(2, 8) Source(11, 8) + SourceIndex(0) -3 >Emitted(2, 9) Source(11, 9) + SourceIndex(0) -4 >Emitted(2, 12) Source(11, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(11, 13) + SourceIndex(0) -6 >Emitted(2, 14) Source(11, 14) + SourceIndex(0) -7 >Emitted(2, 15) Source(11, 15) + SourceIndex(0) -8 >Emitted(2, 16) Source(11, 16) + SourceIndex(0) ---- -------------------------------------------------------------------- -emittedFile:/src/2/second-output.js -sourceFile:../first/first_part2.ts -------------------------------------------------------------------- ->>>console.log(f()); -1-> -2 >^^^^^^^ -3 > ^ -4 > ^^^ -5 > ^ -6 > ^ -7 > ^^ -8 > ^ -9 > ^ -1-> -2 >console -3 > . -4 > log -5 > ( -6 > f -7 > () -8 > ) -9 > ; -1->Emitted(3, 1) Source(1, 1) + SourceIndex(1) -2 >Emitted(3, 8) Source(1, 8) + SourceIndex(1) -3 >Emitted(3, 9) Source(1, 9) + SourceIndex(1) -4 >Emitted(3, 12) Source(1, 12) + SourceIndex(1) -5 >Emitted(3, 13) Source(1, 13) + SourceIndex(1) -6 >Emitted(3, 14) Source(1, 14) + SourceIndex(1) -7 >Emitted(3, 16) Source(1, 16) + SourceIndex(1) -8 >Emitted(3, 17) Source(1, 17) + SourceIndex(1) -9 >Emitted(3, 18) Source(1, 18) + SourceIndex(1) ---- -------------------------------------------------------------------- -emittedFile:/src/2/second-output.js -sourceFile:../first/first_part3.ts -------------------------------------------------------------------- ->>>function f() { -1 > -2 >^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^-> -1 > -2 >function -3 > f -1 >Emitted(4, 1) Source(1, 1) + SourceIndex(2) -2 >Emitted(4, 10) Source(1, 10) + SourceIndex(2) -3 >Emitted(4, 11) Source(1, 11) + SourceIndex(2) ---- ->>> return "JS does hoists"; -1->^^^^ -2 > ^^^^^^^ -3 > ^^^^^^^^^^^^^^^^ -4 > ^ -1->() { - > -2 > return -3 > "JS does hoists" -4 > ; -1->Emitted(5, 5) Source(2, 5) + SourceIndex(2) -2 >Emitted(5, 12) Source(2, 12) + SourceIndex(2) -3 >Emitted(5, 28) Source(2, 28) + SourceIndex(2) -4 >Emitted(5, 29) Source(2, 29) + SourceIndex(2) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^-> -1 > - > -2 >} -1 >Emitted(6, 1) Source(3, 1) + SourceIndex(2) -2 >Emitted(6, 2) Source(3, 2) + SourceIndex(2) ---- -------------------------------------------------------------------- -emittedFile:/src/2/second-output.js -sourceFile:../second/second_part1.ts -------------------------------------------------------------------- ->>>var N; -1-> -2 >^^^^ -3 > ^ -4 > ^ -5 > ^^^^^^^^^^-> -1->namespace N { - > // Comment text - >} - > - > -2 >namespace -3 > N -4 > { - > function f() { - > console.log('testing'); - > } - > - > f(); - > } -1->Emitted(7, 1) Source(5, 1) + SourceIndex(3) -2 >Emitted(7, 5) Source(5, 11) + SourceIndex(3) -3 >Emitted(7, 6) Source(5, 12) + SourceIndex(3) -4 >Emitted(7, 7) Source(11, 2) + SourceIndex(3) ---- ->>>(function (N) { -1-> -2 >^^^^^^^^^^^ -3 > ^ -4 > ^^^^^^^-> -1-> -2 >namespace -3 > N -1->Emitted(8, 1) Source(5, 1) + SourceIndex(3) -2 >Emitted(8, 12) Source(5, 11) + SourceIndex(3) -3 >Emitted(8, 13) Source(5, 12) + SourceIndex(3) ---- ->>> function f() { -1->^^^^ -2 > ^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^-> -1-> { - > -2 > function -3 > f -1->Emitted(9, 5) Source(6, 5) + SourceIndex(3) -2 >Emitted(9, 14) Source(6, 14) + SourceIndex(3) -3 >Emitted(9, 15) Source(6, 15) + SourceIndex(3) ---- ->>> console.log('testing'); -1->^^^^^^^^ -2 > ^^^^^^^ -3 > ^ -4 > ^^^ -5 > ^ -6 > ^^^^^^^^^ -7 > ^ -8 > ^ -1->() { - > -2 > console -3 > . -4 > log -5 > ( -6 > 'testing' -7 > ) -8 > ; -1->Emitted(10, 9) Source(7, 9) + SourceIndex(3) -2 >Emitted(10, 16) Source(7, 16) + SourceIndex(3) -3 >Emitted(10, 17) Source(7, 17) + SourceIndex(3) -4 >Emitted(10, 20) Source(7, 20) + SourceIndex(3) -5 >Emitted(10, 21) Source(7, 21) + SourceIndex(3) -6 >Emitted(10, 30) Source(7, 30) + SourceIndex(3) -7 >Emitted(10, 31) Source(7, 31) + SourceIndex(3) -8 >Emitted(10, 32) Source(7, 32) + SourceIndex(3) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^-> -1 > - > -2 > } -1 >Emitted(11, 5) Source(8, 5) + SourceIndex(3) -2 >Emitted(11, 6) Source(8, 6) + SourceIndex(3) ---- ->>> f(); -1->^^^^ -2 > ^ -3 > ^^ -4 > ^ -5 > ^^^^^^^^^^^-> -1-> - > - > -2 > f -3 > () -4 > ; -1->Emitted(12, 5) Source(10, 5) + SourceIndex(3) -2 >Emitted(12, 6) Source(10, 6) + SourceIndex(3) -3 >Emitted(12, 8) Source(10, 8) + SourceIndex(3) -4 >Emitted(12, 9) Source(10, 9) + SourceIndex(3) ---- ->>>})(N || (N = {})); -1-> -2 >^ -3 > ^^ -4 > ^ -5 > ^^^^^ -6 > ^ -7 > ^^^^^^^^ -8 > ^^^^^^^^^^^-> -1-> - > -2 >} -3 > -4 > N -5 > -6 > N -7 > { - > function f() { - > console.log('testing'); - > } - > - > f(); - > } -1->Emitted(13, 1) Source(11, 1) + SourceIndex(3) -2 >Emitted(13, 2) Source(11, 2) + SourceIndex(3) -3 >Emitted(13, 4) Source(5, 11) + SourceIndex(3) -4 >Emitted(13, 5) Source(5, 12) + SourceIndex(3) -5 >Emitted(13, 10) Source(5, 11) + SourceIndex(3) -6 >Emitted(13, 11) Source(5, 12) + SourceIndex(3) -7 >Emitted(13, 19) Source(11, 2) + SourceIndex(3) ---- ->>>var normalC = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > - > -1->Emitted(14, 1) Source(13, 1) + SourceIndex(3) ---- ->>> function normalC() { -1->^^^^ -2 > ^^-> -1->class normalC { - > /**@internal*/ -1->Emitted(15, 5) Source(14, 20) + SourceIndex(3) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->constructor() { -2 > } -1->Emitted(16, 5) Source(14, 36) + SourceIndex(3) -2 >Emitted(16, 6) Source(14, 37) + SourceIndex(3) ---- ->>> normalC.prototype.method = function () { }; -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^^^^^^^^^^^ -5 > ^ -6 > ^^^^^^-> -1-> - > /**@internal*/ prop: string; - > /**@internal*/ -2 > method -3 > -4 > method() { -5 > } -1->Emitted(17, 5) Source(16, 20) + SourceIndex(3) -2 >Emitted(17, 29) Source(16, 26) + SourceIndex(3) -3 >Emitted(17, 32) Source(16, 20) + SourceIndex(3) -4 >Emitted(17, 46) Source(16, 31) + SourceIndex(3) -5 >Emitted(17, 47) Source(16, 32) + SourceIndex(3) ---- ->>> Object.defineProperty(normalC.prototype, "c", { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^^^^^^^^^^ -1-> - > /**@internal*/ -2 > get -3 > c -1->Emitted(18, 5) Source(17, 20) + SourceIndex(3) -2 >Emitted(18, 27) Source(17, 24) + SourceIndex(3) -3 >Emitted(18, 49) Source(17, 25) + SourceIndex(3) ---- ->>> get: function () { return 10; }, -1 >^^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^ -3 > ^^^^^^^ -4 > ^^ -5 > ^ -6 > ^ -7 > ^ -1 > -2 > get c() { -3 > return -4 > 10 -5 > ; -6 > -7 > } -1 >Emitted(19, 14) Source(17, 20) + SourceIndex(3) -2 >Emitted(19, 28) Source(17, 30) + SourceIndex(3) -3 >Emitted(19, 35) Source(17, 37) + SourceIndex(3) -4 >Emitted(19, 37) Source(17, 39) + SourceIndex(3) -5 >Emitted(19, 38) Source(17, 40) + SourceIndex(3) -6 >Emitted(19, 39) Source(17, 41) + SourceIndex(3) -7 >Emitted(19, 40) Source(17, 42) + SourceIndex(3) ---- ->>> set: function (val) { }, -1 >^^^^^^^^^^^^^ -2 > ^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^ -1 > - > /**@internal*/ -2 > set c( -3 > val: number -4 > ) { -5 > } -1 >Emitted(20, 14) Source(18, 20) + SourceIndex(3) -2 >Emitted(20, 24) Source(18, 26) + SourceIndex(3) -3 >Emitted(20, 27) Source(18, 37) + SourceIndex(3) -4 >Emitted(20, 31) Source(18, 41) + SourceIndex(3) -5 >Emitted(20, 32) Source(18, 42) + SourceIndex(3) ---- ->>> enumerable: true, ->>> configurable: true ->>> }); -1 >^^^^^^^ -2 > ^^^^^^^^^^^^^-> -1 > -1 >Emitted(23, 8) Source(17, 42) + SourceIndex(3) ---- ->>> return normalC; -1->^^^^ -2 > ^^^^^^^^^^^^^^ -1-> - > /**@internal*/ set c(val: number) { } - > -2 > } -1->Emitted(24, 5) Source(19, 1) + SourceIndex(3) -2 >Emitted(24, 19) Source(19, 2) + SourceIndex(3) ---- ->>>}()); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^-> -1 > -2 >} -3 > -4 > class normalC { - > /**@internal*/ constructor() { } - > /**@internal*/ prop: string; - > /**@internal*/ method() { } - > /**@internal*/ get c() { return 10; } - > /**@internal*/ set c(val: number) { } - > } -1 >Emitted(25, 1) Source(19, 1) + SourceIndex(3) -2 >Emitted(25, 2) Source(19, 2) + SourceIndex(3) -3 >Emitted(25, 2) Source(13, 1) + SourceIndex(3) -4 >Emitted(25, 6) Source(19, 2) + SourceIndex(3) ---- ->>>var normalN; -1-> -2 >^^^^ -3 > ^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^-> -1-> - > -2 >namespace -3 > normalN -4 > { - > /**@internal*/ export class C { } - > /**@internal*/ export function foo() {} - > /**@internal*/ export namespace someNamespace { export class C {} } - > /**@internal*/ export namespace someOther.something { export class someClass {} } - > /**@internal*/ export import someImport = someNamespace.C; - > /**@internal*/ export type internalType = internalC; - > /**@internal*/ export const internalConst = 10; - > /**@internal*/ export enum internalEnum { a, b, c } - > } -1->Emitted(26, 1) Source(20, 1) + SourceIndex(3) -2 >Emitted(26, 5) Source(20, 11) + SourceIndex(3) -3 >Emitted(26, 12) Source(20, 18) + SourceIndex(3) -4 >Emitted(26, 13) Source(29, 2) + SourceIndex(3) ---- ->>>(function (normalN) { -1-> -2 >^^^^^^^^^^^ -3 > ^^^^^^^ -4 > ^^^^^^^^^-> -1-> -2 >namespace -3 > normalN -1->Emitted(27, 1) Source(20, 1) + SourceIndex(3) -2 >Emitted(27, 12) Source(20, 11) + SourceIndex(3) -3 >Emitted(27, 19) Source(20, 18) + SourceIndex(3) ---- ->>> var C = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^-> -1-> { - > /**@internal*/ -1->Emitted(28, 5) Source(21, 20) + SourceIndex(3) ---- ->>> function C() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(29, 9) Source(21, 20) + SourceIndex(3) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^-> -1->export class C { -2 > } -1->Emitted(30, 9) Source(21, 37) + SourceIndex(3) -2 >Emitted(30, 10) Source(21, 38) + SourceIndex(3) ---- ->>> return C; -1->^^^^^^^^ -2 > ^^^^^^^^ -1-> -2 > } -1->Emitted(31, 9) Source(21, 37) + SourceIndex(3) -2 >Emitted(31, 17) Source(21, 38) + SourceIndex(3) ---- ->>> }()); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class C { } -1 >Emitted(32, 5) Source(21, 37) + SourceIndex(3) -2 >Emitted(32, 6) Source(21, 38) + SourceIndex(3) -3 >Emitted(32, 6) Source(21, 20) + SourceIndex(3) -4 >Emitted(32, 10) Source(21, 38) + SourceIndex(3) ---- ->>> normalN.C = C; -1->^^^^ -2 > ^^^^^^^^^ -3 > ^^^^ -4 > ^ -5 > ^^^^^-> -1-> -2 > C -3 > { } -4 > -1->Emitted(33, 5) Source(21, 33) + SourceIndex(3) -2 >Emitted(33, 14) Source(21, 34) + SourceIndex(3) -3 >Emitted(33, 18) Source(21, 38) + SourceIndex(3) -4 >Emitted(33, 19) Source(21, 38) + SourceIndex(3) ---- ->>> function foo() { } -1->^^^^ -2 > ^^^^^^^^^ -3 > ^^^ -4 > ^^^^^ -5 > ^ -6 > ^-> -1-> - > /**@internal*/ -2 > export function -3 > foo -4 > () { -5 > } -1->Emitted(34, 5) Source(22, 20) + SourceIndex(3) -2 >Emitted(34, 14) Source(22, 36) + SourceIndex(3) -3 >Emitted(34, 17) Source(22, 39) + SourceIndex(3) -4 >Emitted(34, 22) Source(22, 43) + SourceIndex(3) -5 >Emitted(34, 23) Source(22, 44) + SourceIndex(3) ---- ->>> normalN.foo = foo; -1->^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^ -4 > ^ -5 > ^-> -1-> -2 > foo -3 > () {} -4 > -1->Emitted(35, 5) Source(22, 36) + SourceIndex(3) -2 >Emitted(35, 16) Source(22, 39) + SourceIndex(3) -3 >Emitted(35, 22) Source(22, 44) + SourceIndex(3) -4 >Emitted(35, 23) Source(22, 44) + SourceIndex(3) ---- ->>> var someNamespace; -1->^^^^ -2 > ^^^^ -3 > ^^^^^^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^-> -1-> - > /**@internal*/ -2 > export namespace -3 > someNamespace -4 > { export class C {} } -1->Emitted(36, 5) Source(23, 20) + SourceIndex(3) -2 >Emitted(36, 9) Source(23, 37) + SourceIndex(3) -3 >Emitted(36, 22) Source(23, 50) + SourceIndex(3) -4 >Emitted(36, 23) Source(23, 72) + SourceIndex(3) ---- ->>> (function (someNamespace) { -1->^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^ -4 > ^^^-> -1-> -2 > export namespace -3 > someNamespace -1->Emitted(37, 5) Source(23, 20) + SourceIndex(3) -2 >Emitted(37, 16) Source(23, 37) + SourceIndex(3) -3 >Emitted(37, 29) Source(23, 50) + SourceIndex(3) ---- ->>> var C = (function () { -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^-> -1-> { -1->Emitted(38, 9) Source(23, 53) + SourceIndex(3) ---- ->>> function C() { -1->^^^^^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(39, 13) Source(23, 53) + SourceIndex(3) ---- ->>> } -1->^^^^^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^-> -1->export class C { -2 > } -1->Emitted(40, 13) Source(23, 69) + SourceIndex(3) -2 >Emitted(40, 14) Source(23, 70) + SourceIndex(3) ---- ->>> return C; -1->^^^^^^^^^^^^ -2 > ^^^^^^^^ -1-> -2 > } -1->Emitted(41, 13) Source(23, 69) + SourceIndex(3) -2 >Emitted(41, 21) Source(23, 70) + SourceIndex(3) ---- ->>> }()); -1 >^^^^^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class C {} -1 >Emitted(42, 9) Source(23, 69) + SourceIndex(3) -2 >Emitted(42, 10) Source(23, 70) + SourceIndex(3) -3 >Emitted(42, 10) Source(23, 53) + SourceIndex(3) -4 >Emitted(42, 14) Source(23, 70) + SourceIndex(3) ---- ->>> someNamespace.C = C; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^ -3 > ^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 > C -3 > {} -4 > -1->Emitted(43, 9) Source(23, 66) + SourceIndex(3) -2 >Emitted(43, 24) Source(23, 67) + SourceIndex(3) -3 >Emitted(43, 28) Source(23, 70) + SourceIndex(3) -4 >Emitted(43, 29) Source(23, 70) + SourceIndex(3) ---- ->>> })(someNamespace = normalN.someNamespace || (normalN.someNamespace = {})); -1->^^^^ -2 > ^ -3 > ^^ -4 > ^^^^^^^^^^^^^ -5 > ^^^ -6 > ^^^^^^^^^^^^^^^^^^^^^ -7 > ^^^^^ -8 > ^^^^^^^^^^^^^^^^^^^^^ -9 > ^^^^^^^^ -1-> -2 > } -3 > -4 > someNamespace -5 > -6 > someNamespace -7 > -8 > someNamespace -9 > { export class C {} } -1->Emitted(44, 5) Source(23, 71) + SourceIndex(3) -2 >Emitted(44, 6) Source(23, 72) + SourceIndex(3) -3 >Emitted(44, 8) Source(23, 37) + SourceIndex(3) -4 >Emitted(44, 21) Source(23, 50) + SourceIndex(3) -5 >Emitted(44, 24) Source(23, 37) + SourceIndex(3) -6 >Emitted(44, 45) Source(23, 50) + SourceIndex(3) -7 >Emitted(44, 50) Source(23, 37) + SourceIndex(3) -8 >Emitted(44, 71) Source(23, 50) + SourceIndex(3) -9 >Emitted(44, 79) Source(23, 72) + SourceIndex(3) ---- ->>> var someOther; -1 >^^^^ -2 > ^^^^ -3 > ^^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^-> -1 > - > /**@internal*/ -2 > export namespace -3 > someOther -4 > .something { export class someClass {} } -1 >Emitted(45, 5) Source(24, 20) + SourceIndex(3) -2 >Emitted(45, 9) Source(24, 37) + SourceIndex(3) -3 >Emitted(45, 18) Source(24, 46) + SourceIndex(3) -4 >Emitted(45, 19) Source(24, 86) + SourceIndex(3) ---- ->>> (function (someOther) { -1->^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^^^^ -1-> -2 > export namespace -3 > someOther -1->Emitted(46, 5) Source(24, 20) + SourceIndex(3) -2 >Emitted(46, 16) Source(24, 37) + SourceIndex(3) -3 >Emitted(46, 25) Source(24, 46) + SourceIndex(3) ---- ->>> var something; -1 >^^^^^^^^ -2 > ^^^^ -3 > ^^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^-> -1 >. -2 > -3 > something -4 > { export class someClass {} } -1 >Emitted(47, 9) Source(24, 47) + SourceIndex(3) -2 >Emitted(47, 13) Source(24, 47) + SourceIndex(3) -3 >Emitted(47, 22) Source(24, 56) + SourceIndex(3) -4 >Emitted(47, 23) Source(24, 86) + SourceIndex(3) ---- ->>> (function (something) { -1->^^^^^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^-> -1-> -2 > -3 > something -1->Emitted(48, 9) Source(24, 47) + SourceIndex(3) -2 >Emitted(48, 20) Source(24, 47) + SourceIndex(3) -3 >Emitted(48, 29) Source(24, 56) + SourceIndex(3) ---- ->>> var someClass = (function () { -1->^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> { -1->Emitted(49, 13) Source(24, 59) + SourceIndex(3) ---- ->>> function someClass() { -1->^^^^^^^^^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(50, 17) Source(24, 59) + SourceIndex(3) ---- ->>> } -1->^^^^^^^^^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^-> -1->export class someClass { -2 > } -1->Emitted(51, 17) Source(24, 83) + SourceIndex(3) -2 >Emitted(51, 18) Source(24, 84) + SourceIndex(3) ---- ->>> return someClass; -1->^^^^^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(52, 17) Source(24, 83) + SourceIndex(3) -2 >Emitted(52, 33) Source(24, 84) + SourceIndex(3) ---- ->>> }()); -1 >^^^^^^^^^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class someClass {} -1 >Emitted(53, 13) Source(24, 83) + SourceIndex(3) -2 >Emitted(53, 14) Source(24, 84) + SourceIndex(3) -3 >Emitted(53, 14) Source(24, 59) + SourceIndex(3) -4 >Emitted(53, 18) Source(24, 84) + SourceIndex(3) ---- ->>> something.someClass = someClass; -1->^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^ -3 > ^^^^^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 > someClass -3 > {} -4 > -1->Emitted(54, 13) Source(24, 72) + SourceIndex(3) -2 >Emitted(54, 32) Source(24, 81) + SourceIndex(3) -3 >Emitted(54, 44) Source(24, 84) + SourceIndex(3) -4 >Emitted(54, 45) Source(24, 84) + SourceIndex(3) ---- ->>> })(something = someOther.something || (someOther.something = {})); -1->^^^^^^^^ -2 > ^ -3 > ^^ -4 > ^^^^^^^^^ -5 > ^^^ -6 > ^^^^^^^^^^^^^^^^^^^ -7 > ^^^^^ -8 > ^^^^^^^^^^^^^^^^^^^ -9 > ^^^^^^^^ -1-> -2 > } -3 > -4 > something -5 > -6 > something -7 > -8 > something -9 > { export class someClass {} } -1->Emitted(55, 9) Source(24, 85) + SourceIndex(3) -2 >Emitted(55, 10) Source(24, 86) + SourceIndex(3) -3 >Emitted(55, 12) Source(24, 47) + SourceIndex(3) -4 >Emitted(55, 21) Source(24, 56) + SourceIndex(3) -5 >Emitted(55, 24) Source(24, 47) + SourceIndex(3) -6 >Emitted(55, 43) Source(24, 56) + SourceIndex(3) -7 >Emitted(55, 48) Source(24, 47) + SourceIndex(3) -8 >Emitted(55, 67) Source(24, 56) + SourceIndex(3) -9 >Emitted(55, 75) Source(24, 86) + SourceIndex(3) ---- ->>> })(someOther = normalN.someOther || (normalN.someOther = {})); -1 >^^^^ -2 > ^ -3 > ^^ -4 > ^^^^^^^^^ -5 > ^^^ -6 > ^^^^^^^^^^^^^^^^^ -7 > ^^^^^ -8 > ^^^^^^^^^^^^^^^^^ -9 > ^^^^^^^^ -1 > -2 > } -3 > -4 > someOther -5 > -6 > someOther -7 > -8 > someOther -9 > .something { export class someClass {} } -1 >Emitted(56, 5) Source(24, 85) + SourceIndex(3) -2 >Emitted(56, 6) Source(24, 86) + SourceIndex(3) -3 >Emitted(56, 8) Source(24, 37) + SourceIndex(3) -4 >Emitted(56, 17) Source(24, 46) + SourceIndex(3) -5 >Emitted(56, 20) Source(24, 37) + SourceIndex(3) -6 >Emitted(56, 37) Source(24, 46) + SourceIndex(3) -7 >Emitted(56, 42) Source(24, 37) + SourceIndex(3) -8 >Emitted(56, 59) Source(24, 46) + SourceIndex(3) -9 >Emitted(56, 67) Source(24, 86) + SourceIndex(3) ---- ->>> normalN.someImport = someNamespace.C; -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^^^^^^^^^^ -5 > ^ -6 > ^ -7 > ^ -1 > - > /**@internal*/ export import -2 > someImport -3 > = -4 > someNamespace -5 > . -6 > C -7 > ; -1 >Emitted(57, 5) Source(25, 34) + SourceIndex(3) -2 >Emitted(57, 23) Source(25, 44) + SourceIndex(3) -3 >Emitted(57, 26) Source(25, 47) + SourceIndex(3) -4 >Emitted(57, 39) Source(25, 60) + SourceIndex(3) -5 >Emitted(57, 40) Source(25, 61) + SourceIndex(3) -6 >Emitted(57, 41) Source(25, 62) + SourceIndex(3) -7 >Emitted(57, 42) Source(25, 63) + SourceIndex(3) ---- ->>> normalN.internalConst = 10; -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -1 > - > /**@internal*/ export type internalType = internalC; - > /**@internal*/ export const -2 > internalConst -3 > = -4 > 10 -5 > ; -1 >Emitted(58, 5) Source(27, 33) + SourceIndex(3) -2 >Emitted(58, 26) Source(27, 46) + SourceIndex(3) -3 >Emitted(58, 29) Source(27, 49) + SourceIndex(3) -4 >Emitted(58, 31) Source(27, 51) + SourceIndex(3) -5 >Emitted(58, 32) Source(27, 52) + SourceIndex(3) ---- ->>> var internalEnum; -1 >^^^^ -2 > ^^^^ -3 > ^^^^^^^^^^^^ -4 > ^^^^^^^^^^^-> -1 > - > /**@internal*/ -2 > export enum -3 > internalEnum { a, b, c } -1 >Emitted(59, 5) Source(28, 20) + SourceIndex(3) -2 >Emitted(59, 9) Source(28, 32) + SourceIndex(3) -3 >Emitted(59, 21) Source(28, 56) + SourceIndex(3) ---- ->>> (function (internalEnum) { -1->^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 > export enum -3 > internalEnum -1->Emitted(60, 5) Source(28, 20) + SourceIndex(3) -2 >Emitted(60, 16) Source(28, 32) + SourceIndex(3) -3 >Emitted(60, 28) Source(28, 44) + SourceIndex(3) ---- ->>> internalEnum[internalEnum["a"] = 0] = "a"; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^-> -1-> { -2 > a -3 > -1->Emitted(61, 9) Source(28, 47) + SourceIndex(3) -2 >Emitted(61, 50) Source(28, 48) + SourceIndex(3) -3 >Emitted(61, 51) Source(28, 48) + SourceIndex(3) ---- ->>> internalEnum[internalEnum["b"] = 1] = "b"; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^-> -1->, -2 > b -3 > -1->Emitted(62, 9) Source(28, 50) + SourceIndex(3) -2 >Emitted(62, 50) Source(28, 51) + SourceIndex(3) -3 >Emitted(62, 51) Source(28, 51) + SourceIndex(3) ---- ->>> internalEnum[internalEnum["c"] = 2] = "c"; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->, -2 > c -3 > -1->Emitted(63, 9) Source(28, 53) + SourceIndex(3) -2 >Emitted(63, 50) Source(28, 54) + SourceIndex(3) -3 >Emitted(63, 51) Source(28, 54) + SourceIndex(3) ---- ->>> })(internalEnum = normalN.internalEnum || (normalN.internalEnum = {})); -1->^^^^ -2 > ^ -3 > ^^ -4 > ^^^^^^^^^^^^ -5 > ^^^ -6 > ^^^^^^^^^^^^^^^^^^^^ -7 > ^^^^^ -8 > ^^^^^^^^^^^^^^^^^^^^ -9 > ^^^^^^^^ -1-> -2 > } -3 > -4 > internalEnum -5 > -6 > internalEnum -7 > -8 > internalEnum -9 > { a, b, c } -1->Emitted(64, 5) Source(28, 55) + SourceIndex(3) -2 >Emitted(64, 6) Source(28, 56) + SourceIndex(3) -3 >Emitted(64, 8) Source(28, 32) + SourceIndex(3) -4 >Emitted(64, 20) Source(28, 44) + SourceIndex(3) -5 >Emitted(64, 23) Source(28, 32) + SourceIndex(3) -6 >Emitted(64, 43) Source(28, 44) + SourceIndex(3) -7 >Emitted(64, 48) Source(28, 32) + SourceIndex(3) -8 >Emitted(64, 68) Source(28, 44) + SourceIndex(3) -9 >Emitted(64, 76) Source(28, 56) + SourceIndex(3) ---- ->>>})(normalN || (normalN = {})); -1 > -2 >^ -3 > ^^ -4 > ^^^^^^^ -5 > ^^^^^ -6 > ^^^^^^^ -7 > ^^^^^^^^ -8 > ^-> -1 > - > -2 >} -3 > -4 > normalN -5 > -6 > normalN -7 > { - > /**@internal*/ export class C { } - > /**@internal*/ export function foo() {} - > /**@internal*/ export namespace someNamespace { export class C {} } - > /**@internal*/ export namespace someOther.something { export class someClass {} } - > /**@internal*/ export import someImport = someNamespace.C; - > /**@internal*/ export type internalType = internalC; - > /**@internal*/ export const internalConst = 10; - > /**@internal*/ export enum internalEnum { a, b, c } - > } -1 >Emitted(65, 1) Source(29, 1) + SourceIndex(3) -2 >Emitted(65, 2) Source(29, 2) + SourceIndex(3) -3 >Emitted(65, 4) Source(20, 11) + SourceIndex(3) -4 >Emitted(65, 11) Source(20, 18) + SourceIndex(3) -5 >Emitted(65, 16) Source(20, 11) + SourceIndex(3) -6 >Emitted(65, 23) Source(20, 18) + SourceIndex(3) -7 >Emitted(65, 31) Source(29, 2) + SourceIndex(3) ---- ->>>var internalC = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - >/**@internal*/ -1->Emitted(66, 1) Source(30, 16) + SourceIndex(3) ---- ->>> function internalC() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(67, 5) Source(30, 16) + SourceIndex(3) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^-> -1->class internalC { -2 > } -1->Emitted(68, 5) Source(30, 33) + SourceIndex(3) -2 >Emitted(68, 6) Source(30, 34) + SourceIndex(3) ---- ->>> return internalC; -1->^^^^ -2 > ^^^^^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(69, 5) Source(30, 33) + SourceIndex(3) -2 >Emitted(69, 21) Source(30, 34) + SourceIndex(3) ---- ->>>}()); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > class internalC {} -1 >Emitted(70, 1) Source(30, 33) + SourceIndex(3) -2 >Emitted(70, 2) Source(30, 34) + SourceIndex(3) -3 >Emitted(70, 2) Source(30, 16) + SourceIndex(3) -4 >Emitted(70, 6) Source(30, 34) + SourceIndex(3) ---- ->>>function internalfoo() { } -1-> -2 >^^^^^^^^^ -3 > ^^^^^^^^^^^ -4 > ^^^^^ -5 > ^ -1-> - >/**@internal*/ -2 >function -3 > internalfoo -4 > () { -5 > } -1->Emitted(71, 1) Source(31, 16) + SourceIndex(3) -2 >Emitted(71, 10) Source(31, 25) + SourceIndex(3) -3 >Emitted(71, 21) Source(31, 36) + SourceIndex(3) -4 >Emitted(71, 26) Source(31, 40) + SourceIndex(3) -5 >Emitted(71, 27) Source(31, 41) + SourceIndex(3) ---- ->>>var internalNamespace; -1 > -2 >^^^^ -3 > ^^^^^^^^^^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^-> -1 > - >/**@internal*/ -2 >namespace -3 > internalNamespace -4 > { export class someClass {} } -1 >Emitted(72, 1) Source(32, 16) + SourceIndex(3) -2 >Emitted(72, 5) Source(32, 26) + SourceIndex(3) -3 >Emitted(72, 22) Source(32, 43) + SourceIndex(3) -4 >Emitted(72, 23) Source(32, 73) + SourceIndex(3) ---- ->>>(function (internalNamespace) { -1-> -2 >^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^-> -1-> -2 >namespace -3 > internalNamespace -1->Emitted(73, 1) Source(32, 16) + SourceIndex(3) -2 >Emitted(73, 12) Source(32, 26) + SourceIndex(3) -3 >Emitted(73, 29) Source(32, 43) + SourceIndex(3) ---- ->>> var someClass = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> { -1->Emitted(74, 5) Source(32, 46) + SourceIndex(3) ---- ->>> function someClass() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(75, 9) Source(32, 46) + SourceIndex(3) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^-> -1->export class someClass { -2 > } -1->Emitted(76, 9) Source(32, 70) + SourceIndex(3) -2 >Emitted(76, 10) Source(32, 71) + SourceIndex(3) ---- ->>> return someClass; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(77, 9) Source(32, 70) + SourceIndex(3) -2 >Emitted(77, 25) Source(32, 71) + SourceIndex(3) ---- ->>> }()); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class someClass {} -1 >Emitted(78, 5) Source(32, 70) + SourceIndex(3) -2 >Emitted(78, 6) Source(32, 71) + SourceIndex(3) -3 >Emitted(78, 6) Source(32, 46) + SourceIndex(3) -4 >Emitted(78, 10) Source(32, 71) + SourceIndex(3) ---- ->>> internalNamespace.someClass = someClass; -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^^^^^^^^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 > someClass -3 > {} -4 > -1->Emitted(79, 5) Source(32, 59) + SourceIndex(3) -2 >Emitted(79, 32) Source(32, 68) + SourceIndex(3) -3 >Emitted(79, 44) Source(32, 71) + SourceIndex(3) -4 >Emitted(79, 45) Source(32, 71) + SourceIndex(3) ---- ->>>})(internalNamespace || (internalNamespace = {})); -1-> -2 >^ -3 > ^^ -4 > ^^^^^^^^^^^^^^^^^ -5 > ^^^^^ -6 > ^^^^^^^^^^^^^^^^^ -7 > ^^^^^^^^ -1-> -2 >} -3 > -4 > internalNamespace -5 > -6 > internalNamespace -7 > { export class someClass {} } -1->Emitted(80, 1) Source(32, 72) + SourceIndex(3) -2 >Emitted(80, 2) Source(32, 73) + SourceIndex(3) -3 >Emitted(80, 4) Source(32, 26) + SourceIndex(3) -4 >Emitted(80, 21) Source(32, 43) + SourceIndex(3) -5 >Emitted(80, 26) Source(32, 26) + SourceIndex(3) -6 >Emitted(80, 43) Source(32, 43) + SourceIndex(3) -7 >Emitted(80, 51) Source(32, 73) + SourceIndex(3) ---- ->>>var internalOther; -1 > -2 >^^^^ -3 > ^^^^^^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^-> -1 > - >/**@internal*/ -2 >namespace -3 > internalOther -4 > .something { export class someClass {} } -1 >Emitted(81, 1) Source(33, 16) + SourceIndex(3) -2 >Emitted(81, 5) Source(33, 26) + SourceIndex(3) -3 >Emitted(81, 18) Source(33, 39) + SourceIndex(3) -4 >Emitted(81, 19) Source(33, 79) + SourceIndex(3) ---- ->>>(function (internalOther) { -1-> -2 >^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^ -1-> -2 >namespace -3 > internalOther -1->Emitted(82, 1) Source(33, 16) + SourceIndex(3) -2 >Emitted(82, 12) Source(33, 26) + SourceIndex(3) -3 >Emitted(82, 25) Source(33, 39) + SourceIndex(3) ---- ->>> var something; -1 >^^^^ -2 > ^^^^ -3 > ^^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^-> -1 >. -2 > -3 > something -4 > { export class someClass {} } -1 >Emitted(83, 5) Source(33, 40) + SourceIndex(3) -2 >Emitted(83, 9) Source(33, 40) + SourceIndex(3) -3 >Emitted(83, 18) Source(33, 49) + SourceIndex(3) -4 >Emitted(83, 19) Source(33, 79) + SourceIndex(3) ---- ->>> (function (something) { -1->^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^-> -1-> -2 > -3 > something -1->Emitted(84, 5) Source(33, 40) + SourceIndex(3) -2 >Emitted(84, 16) Source(33, 40) + SourceIndex(3) -3 >Emitted(84, 25) Source(33, 49) + SourceIndex(3) ---- ->>> var someClass = (function () { -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> { -1->Emitted(85, 9) Source(33, 52) + SourceIndex(3) ---- ->>> function someClass() { -1->^^^^^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(86, 13) Source(33, 52) + SourceIndex(3) ---- ->>> } -1->^^^^^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^-> -1->export class someClass { -2 > } -1->Emitted(87, 13) Source(33, 76) + SourceIndex(3) -2 >Emitted(87, 14) Source(33, 77) + SourceIndex(3) ---- ->>> return someClass; -1->^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(88, 13) Source(33, 76) + SourceIndex(3) -2 >Emitted(88, 29) Source(33, 77) + SourceIndex(3) ---- ->>> }()); -1 >^^^^^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class someClass {} -1 >Emitted(89, 9) Source(33, 76) + SourceIndex(3) -2 >Emitted(89, 10) Source(33, 77) + SourceIndex(3) -3 >Emitted(89, 10) Source(33, 52) + SourceIndex(3) -4 >Emitted(89, 14) Source(33, 77) + SourceIndex(3) ---- ->>> something.someClass = someClass; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^ -3 > ^^^^^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 > someClass -3 > {} -4 > -1->Emitted(90, 9) Source(33, 65) + SourceIndex(3) -2 >Emitted(90, 28) Source(33, 74) + SourceIndex(3) -3 >Emitted(90, 40) Source(33, 77) + SourceIndex(3) -4 >Emitted(90, 41) Source(33, 77) + SourceIndex(3) ---- ->>> })(something = internalOther.something || (internalOther.something = {})); -1->^^^^ -2 > ^ -3 > ^^ -4 > ^^^^^^^^^ -5 > ^^^ -6 > ^^^^^^^^^^^^^^^^^^^^^^^ -7 > ^^^^^ -8 > ^^^^^^^^^^^^^^^^^^^^^^^ -9 > ^^^^^^^^ -1-> -2 > } -3 > -4 > something -5 > -6 > something -7 > -8 > something -9 > { export class someClass {} } -1->Emitted(91, 5) Source(33, 78) + SourceIndex(3) -2 >Emitted(91, 6) Source(33, 79) + SourceIndex(3) -3 >Emitted(91, 8) Source(33, 40) + SourceIndex(3) -4 >Emitted(91, 17) Source(33, 49) + SourceIndex(3) -5 >Emitted(91, 20) Source(33, 40) + SourceIndex(3) -6 >Emitted(91, 43) Source(33, 49) + SourceIndex(3) -7 >Emitted(91, 48) Source(33, 40) + SourceIndex(3) -8 >Emitted(91, 71) Source(33, 49) + SourceIndex(3) -9 >Emitted(91, 79) Source(33, 79) + SourceIndex(3) ---- ->>>})(internalOther || (internalOther = {})); -1 > -2 >^ -3 > ^^ -4 > ^^^^^^^^^^^^^ -5 > ^^^^^ -6 > ^^^^^^^^^^^^^ -7 > ^^^^^^^^ -8 > ^^^^^^^^-> -1 > -2 >} -3 > -4 > internalOther -5 > -6 > internalOther -7 > .something { export class someClass {} } -1 >Emitted(92, 1) Source(33, 78) + SourceIndex(3) -2 >Emitted(92, 2) Source(33, 79) + SourceIndex(3) -3 >Emitted(92, 4) Source(33, 26) + SourceIndex(3) -4 >Emitted(92, 17) Source(33, 39) + SourceIndex(3) -5 >Emitted(92, 22) Source(33, 26) + SourceIndex(3) -6 >Emitted(92, 35) Source(33, 39) + SourceIndex(3) -7 >Emitted(92, 43) Source(33, 79) + SourceIndex(3) ---- ->>>var internalImport = internalNamespace.someClass; -1-> -2 >^^^^ -3 > ^^^^^^^^^^^^^^ -4 > ^^^ -5 > ^^^^^^^^^^^^^^^^^ -6 > ^ -7 > ^^^^^^^^^ -8 > ^ -1-> - >/**@internal*/ -2 >import -3 > internalImport -4 > = -5 > internalNamespace -6 > . -7 > someClass -8 > ; -1->Emitted(93, 1) Source(34, 16) + SourceIndex(3) -2 >Emitted(93, 5) Source(34, 23) + SourceIndex(3) -3 >Emitted(93, 19) Source(34, 37) + SourceIndex(3) -4 >Emitted(93, 22) Source(34, 40) + SourceIndex(3) -5 >Emitted(93, 39) Source(34, 57) + SourceIndex(3) -6 >Emitted(93, 40) Source(34, 58) + SourceIndex(3) -7 >Emitted(93, 49) Source(34, 67) + SourceIndex(3) -8 >Emitted(93, 50) Source(34, 68) + SourceIndex(3) ---- ->>>var internalConst = 10; -1 > -2 >^^^^ -3 > ^^^^^^^^^^^^^ -4 > ^^^ -5 > ^^ -6 > ^ -1 > - >/**@internal*/ type internalType = internalC; - >/**@internal*/ -2 >const -3 > internalConst -4 > = -5 > 10 -6 > ; -1 >Emitted(94, 1) Source(36, 16) + SourceIndex(3) -2 >Emitted(94, 5) Source(36, 22) + SourceIndex(3) -3 >Emitted(94, 18) Source(36, 35) + SourceIndex(3) -4 >Emitted(94, 21) Source(36, 38) + SourceIndex(3) -5 >Emitted(94, 23) Source(36, 40) + SourceIndex(3) -6 >Emitted(94, 24) Source(36, 41) + SourceIndex(3) ---- ->>>var internalEnum; -1 > -2 >^^^^ -3 > ^^^^^^^^^^^^ -4 > ^^^^^^^^^^^-> -1 > - >/**@internal*/ -2 >enum -3 > internalEnum { a, b, c } -1 >Emitted(95, 1) Source(37, 16) + SourceIndex(3) -2 >Emitted(95, 5) Source(37, 21) + SourceIndex(3) -3 >Emitted(95, 17) Source(37, 45) + SourceIndex(3) ---- ->>>(function (internalEnum) { -1-> -2 >^^^^^^^^^^^ -3 > ^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 >enum -3 > internalEnum -1->Emitted(96, 1) Source(37, 16) + SourceIndex(3) -2 >Emitted(96, 12) Source(37, 21) + SourceIndex(3) -3 >Emitted(96, 24) Source(37, 33) + SourceIndex(3) ---- ->>> internalEnum[internalEnum["a"] = 0] = "a"; -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^-> -1-> { -2 > a -3 > -1->Emitted(97, 5) Source(37, 36) + SourceIndex(3) -2 >Emitted(97, 46) Source(37, 37) + SourceIndex(3) -3 >Emitted(97, 47) Source(37, 37) + SourceIndex(3) ---- ->>> internalEnum[internalEnum["b"] = 1] = "b"; -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^-> -1->, -2 > b -3 > -1->Emitted(98, 5) Source(37, 39) + SourceIndex(3) -2 >Emitted(98, 46) Source(37, 40) + SourceIndex(3) -3 >Emitted(98, 47) Source(37, 40) + SourceIndex(3) ---- ->>> internalEnum[internalEnum["c"] = 2] = "c"; -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -1->, -2 > c -3 > -1->Emitted(99, 5) Source(37, 42) + SourceIndex(3) -2 >Emitted(99, 46) Source(37, 43) + SourceIndex(3) -3 >Emitted(99, 47) Source(37, 43) + SourceIndex(3) ---- ->>>})(internalEnum || (internalEnum = {})); -1 > -2 >^ -3 > ^^ -4 > ^^^^^^^^^^^^ -5 > ^^^^^ -6 > ^^^^^^^^^^^^ -7 > ^^^^^^^^ -1 > -2 >} -3 > -4 > internalEnum -5 > -6 > internalEnum -7 > { a, b, c } -1 >Emitted(100, 1) Source(37, 44) + SourceIndex(3) -2 >Emitted(100, 2) Source(37, 45) + SourceIndex(3) -3 >Emitted(100, 4) Source(37, 21) + SourceIndex(3) -4 >Emitted(100, 16) Source(37, 33) + SourceIndex(3) -5 >Emitted(100, 21) Source(37, 21) + SourceIndex(3) -6 >Emitted(100, 33) Source(37, 33) + SourceIndex(3) -7 >Emitted(100, 41) Source(37, 45) + SourceIndex(3) ---- -------------------------------------------------------------------- -emittedFile:/src/2/second-output.js -sourceFile:../second/second_part2.ts -------------------------------------------------------------------- ->>>var C = (function () { -1 > -2 >^^^^^^^^^^^^^^^^^^^-> -1 > -1 >Emitted(101, 1) Source(1, 1) + SourceIndex(4) ---- ->>> function C() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(102, 5) Source(1, 1) + SourceIndex(4) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->class C { - > doSomething() { - > console.log("something got done"); - > } - > -2 > } -1->Emitted(103, 5) Source(5, 1) + SourceIndex(4) -2 >Emitted(103, 6) Source(5, 2) + SourceIndex(4) ---- ->>> C.prototype.doSomething = function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^^^^^^^^^^-> -1-> -2 > doSomething -3 > -1->Emitted(104, 5) Source(2, 5) + SourceIndex(4) -2 >Emitted(104, 28) Source(2, 16) + SourceIndex(4) -3 >Emitted(104, 31) Source(2, 5) + SourceIndex(4) ---- ->>> console.log("something got done"); -1->^^^^^^^^ -2 > ^^^^^^^ -3 > ^ -4 > ^^^ -5 > ^ -6 > ^^^^^^^^^^^^^^^^^^^^ -7 > ^ -8 > ^ -1->doSomething() { - > -2 > console -3 > . -4 > log -5 > ( -6 > "something got done" -7 > ) -8 > ; -1->Emitted(105, 9) Source(3, 9) + SourceIndex(4) -2 >Emitted(105, 16) Source(3, 16) + SourceIndex(4) -3 >Emitted(105, 17) Source(3, 17) + SourceIndex(4) -4 >Emitted(105, 20) Source(3, 20) + SourceIndex(4) -5 >Emitted(105, 21) Source(3, 21) + SourceIndex(4) -6 >Emitted(105, 41) Source(3, 41) + SourceIndex(4) -7 >Emitted(105, 42) Source(3, 42) + SourceIndex(4) -8 >Emitted(105, 43) Source(3, 43) + SourceIndex(4) ---- ->>> }; -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(106, 5) Source(4, 5) + SourceIndex(4) -2 >Emitted(106, 6) Source(4, 6) + SourceIndex(4) ---- ->>> return C; -1->^^^^ -2 > ^^^^^^^^ -1-> - > -2 > } -1->Emitted(107, 5) Source(5, 1) + SourceIndex(4) -2 >Emitted(107, 13) Source(5, 2) + SourceIndex(4) ---- ->>>}()); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > class C { - > doSomething() { - > console.log("something got done"); - > } - > } -1 >Emitted(108, 1) Source(5, 1) + SourceIndex(4) -2 >Emitted(108, 2) Source(5, 2) + SourceIndex(4) -3 >Emitted(108, 2) Source(1, 1) + SourceIndex(4) -4 >Emitted(108, 6) Source(5, 2) + SourceIndex(4) ---- ->>>//# sourceMappingURL=second-output.js.map - -//// [/src/2/second-output.tsbuildinfo] -{ - "bundle": { - "commonSourceDirectory": "../second", - "sourceFiles": [ - "../second/second_part1.ts", - "../second/second_part2.ts" - ], - "js": { - "sections": [ - { - "pos": 0, - "end": 110, - "kind": "prepend", - "data": "../first/bin/first-output.js", - "texts": [ - { - "pos": 0, - "end": 110, - "kind": "text" - } - ] - }, - { - "pos": 110, - "end": 3162, - "kind": "text" - } - ] - }, - "dts": { - "sections": [ - { - "pos": 0, - "end": 157, - "kind": "prepend", - "data": "../first/bin/first-output.d.ts", - "texts": [ - { - "pos": 0, - "end": 157, - "kind": "text" - } - ] - }, - { - "pos": 157, - "end": 234, - "kind": "text" - }, - { - "pos": 234, - "end": 308, - "kind": "internal" - }, - { - "pos": 310, - "end": 342, - "kind": "text" - }, - { - "pos": 342, - "end": 734, - "kind": "internal" - }, - { - "pos": 736, - "end": 739, - "kind": "text" - }, - { - "pos": 739, - "end": 1152, - "kind": "internal" - }, - { - "pos": 1154, - "end": 1202, - "kind": "text" - } - ] - } - }, - "version": "FakeTSVersion" -} - -//// [/src/2/second-output.tsbuildinfo.baseline.txt] -====================================================================== -File:: /src/2/second-output.js ----------------------------------------------------------------------- -prepend: (0-110):: ../first/bin/first-output.js texts:: 1 ->>-------------------------------------------------------------------- -text: (0-110) -var s = "Hello, world"; -console.log(s); -console.log(f()); -function f() { - return "JS does hoists"; -} - ----------------------------------------------------------------------- -text: (110-3162) -var N; -(function (N) { - function f() { - console.log('testing'); - } - f(); -})(N || (N = {})); -var normalC = (function () { - function normalC() { - } - normalC.prototype.method = function () { }; - Object.defineProperty(normalC.prototype, "c", { - get: function () { return 10; }, - set: function (val) { }, - enumerable: true, - configurable: true - }); - return normalC; -}()); -var normalN; -(function (normalN) { - var C = (function () { - function C() { - } - return C; - }()); - normalN.C = C; - function foo() { } - normalN.foo = foo; - var someNamespace; - (function (someNamespace) { - var C = (function () { - function C() { - } - return C; - }()); - someNamespace.C = C; - })(someNamespace = normalN.someNamespace || (normalN.someNamespace = {})); - var someOther; - (function (someOther) { - var something; - (function (something) { - var someClass = (function () { - function someClass() { - } - return someClass; - }()); - something.someClass = someClass; - })(something = someOther.something || (someOther.something = {})); - })(someOther = normalN.someOther || (normalN.someOther = {})); - normalN.someImport = someNamespace.C; - normalN.internalConst = 10; - var internalEnum; - (function (internalEnum) { - internalEnum[internalEnum["a"] = 0] = "a"; - internalEnum[internalEnum["b"] = 1] = "b"; - internalEnum[internalEnum["c"] = 2] = "c"; - })(internalEnum = normalN.internalEnum || (normalN.internalEnum = {})); -})(normalN || (normalN = {})); -var internalC = (function () { - function internalC() { - } - return internalC; -}()); -function internalfoo() { } -var internalNamespace; -(function (internalNamespace) { - var someClass = (function () { - function someClass() { - } - return someClass; - }()); - internalNamespace.someClass = someClass; -})(internalNamespace || (internalNamespace = {})); -var internalOther; -(function (internalOther) { - var something; - (function (something) { - var someClass = (function () { - function someClass() { - } - return someClass; - }()); - something.someClass = someClass; - })(something = internalOther.something || (internalOther.something = {})); -})(internalOther || (internalOther = {})); -var internalImport = internalNamespace.someClass; -var internalConst = 10; -var internalEnum; -(function (internalEnum) { - internalEnum[internalEnum["a"] = 0] = "a"; - internalEnum[internalEnum["b"] = 1] = "b"; - internalEnum[internalEnum["c"] = 2] = "c"; -})(internalEnum || (internalEnum = {})); -var C = (function () { - function C() { - } - C.prototype.doSomething = function () { - console.log("something got done"); - }; - return C; -}()); - -====================================================================== -====================================================================== -File:: /src/2/second-output.d.ts ----------------------------------------------------------------------- -prepend: (0-157):: ../first/bin/first-output.d.ts texts:: 1 ->>-------------------------------------------------------------------- -text: (0-157) -interface TheFirst { - none: any; -} -declare const s = "Hello, world"; -interface NoJsForHereEither { - none: any; -} -declare function f(): string; - ----------------------------------------------------------------------- -text: (157-234) -declare namespace N { -} -declare namespace N { -} -declare class normalC { - ----------------------------------------------------------------------- -internal: (234-308) - constructor(); - prop: string; - method(): void; - c: number; ----------------------------------------------------------------------- -text: (310-342) -} -declare namespace normalN { - ----------------------------------------------------------------------- -internal: (342-734) - class C { - } - function foo(): void; - namespace someNamespace { - class C { - } - } - namespace someOther.something { - class someClass { - } - } - export import someImport = someNamespace.C; - type internalType = internalC; - const internalConst = 10; - enum internalEnum { - a = 0, - b = 1, - c = 2 - } ----------------------------------------------------------------------- -text: (736-739) -} - ----------------------------------------------------------------------- -internal: (739-1152) -declare class internalC { -} -declare function internalfoo(): void; -declare namespace internalNamespace { - class someClass { - } -} -declare namespace internalOther.something { - class someClass { - } -} -import internalImport = internalNamespace.someClass; -declare type internalType = internalC; -declare const internalConst = 10; -declare enum internalEnum { - a = 0, - b = 1, - c = 2 -} ----------------------------------------------------------------------- -text: (1154-1202) -declare class C { - doSomething(): void; -} - -====================================================================== - -//// [/src/first/bin/first-output.d.ts.map] -{"version":3,"file":"first-output.d.ts","sourceRoot":"","sources":["../first_PART1.ts","../first_part2.ts","../first_part3.ts"],"names":[],"mappings":"AAAA,UAAU,QAAQ;IACd,IAAI,EAAE,GAAG,CAAC;CACb;AAED,QAAA,MAAM,CAAC,iBAAiB,CAAC;AAEzB,UAAU,iBAAiB;IACvB,IAAI,EAAE,GAAG,CAAC;CACb;AERD,iBAAS,CAAC,WAET"} - -//// [/src/first/bin/first-output.d.ts.map.baseline.txt] -=================================================================== -JsFile: first-output.d.ts -mapUrl: first-output.d.ts.map -sourceRoot: -sources: ../first_PART1.ts,../first_part2.ts,../first_part3.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:/src/first/bin/first-output.d.ts -sourceFile:../first_PART1.ts -------------------------------------------------------------------- ->>>interface TheFirst { -1 > -2 >^^^^^^^^^^ -3 > ^^^^^^^^ -1 > -2 >interface -3 > TheFirst -1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -2 >Emitted(1, 11) Source(1, 11) + SourceIndex(0) -3 >Emitted(1, 19) Source(1, 19) + SourceIndex(0) ---- ->>> none: any; -1 >^^^^ -2 > ^^^^ -3 > ^^ -4 > ^^^ -5 > ^ -1 > { - > -2 > none -3 > : -4 > any -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 9) Source(2, 9) + SourceIndex(0) -3 >Emitted(2, 11) Source(2, 11) + SourceIndex(0) -4 >Emitted(2, 14) Source(2, 14) + SourceIndex(0) -5 >Emitted(2, 15) Source(2, 15) + SourceIndex(0) ---- ->>>} -1 >^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - >} -1 >Emitted(3, 2) Source(3, 2) + SourceIndex(0) ---- ->>>declare const s = "Hello, world"; -1-> -2 >^^^^^^^^ -3 > ^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^^^^ -6 > ^ -1-> - > - > -2 > -3 > const -4 > s -5 > = "Hello, world" -6 > ; -1->Emitted(4, 1) Source(5, 1) + SourceIndex(0) -2 >Emitted(4, 9) Source(5, 1) + SourceIndex(0) -3 >Emitted(4, 15) Source(5, 7) + SourceIndex(0) -4 >Emitted(4, 16) Source(5, 8) + SourceIndex(0) -5 >Emitted(4, 33) Source(5, 25) + SourceIndex(0) -6 >Emitted(4, 34) Source(5, 26) + SourceIndex(0) ---- ->>>interface NoJsForHereEither { -1 > -2 >^^^^^^^^^^ -3 > ^^^^^^^^^^^^^^^^^ -1 > - > - > -2 >interface -3 > NoJsForHereEither -1 >Emitted(5, 1) Source(7, 1) + SourceIndex(0) -2 >Emitted(5, 11) Source(7, 11) + SourceIndex(0) -3 >Emitted(5, 28) Source(7, 28) + SourceIndex(0) ---- ->>> none: any; -1 >^^^^ -2 > ^^^^ -3 > ^^ -4 > ^^^ -5 > ^ -1 > { - > -2 > none -3 > : -4 > any -5 > ; -1 >Emitted(6, 5) Source(8, 5) + SourceIndex(0) -2 >Emitted(6, 9) Source(8, 9) + SourceIndex(0) -3 >Emitted(6, 11) Source(8, 11) + SourceIndex(0) -4 >Emitted(6, 14) Source(8, 14) + SourceIndex(0) -5 >Emitted(6, 15) Source(8, 15) + SourceIndex(0) ---- ->>>} -1 >^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - >} -1 >Emitted(7, 2) Source(9, 2) + SourceIndex(0) ---- -------------------------------------------------------------------- -emittedFile:/src/first/bin/first-output.d.ts -sourceFile:../first_part3.ts -------------------------------------------------------------------- ->>>declare function f(): string; -1-> -2 >^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^ -5 > ^^^^^^^^^^^^-> -1-> -2 >function -3 > f -4 > () { - > return "JS does hoists"; - > } -1->Emitted(8, 1) Source(1, 1) + SourceIndex(2) -2 >Emitted(8, 18) Source(1, 10) + SourceIndex(2) -3 >Emitted(8, 19) Source(1, 11) + SourceIndex(2) -4 >Emitted(8, 30) Source(3, 2) + SourceIndex(2) ---- ->>>//# sourceMappingURL=first-output.d.ts.map - -//// [/src/first/bin/first-output.js.map.baseline.txt] -=================================================================== -JsFile: first-output.js -mapUrl: first-output.js.map -sourceRoot: -sources: ../first_PART1.ts,../first_part2.ts,../first_part3.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:/src/first/bin/first-output.js -sourceFile:../first_PART1.ts -------------------------------------------------------------------- ->>>var s = "Hello, world"; -1 > -2 >^^^^ -3 > ^ -4 > ^^^ -5 > ^^^^^^^^^^^^^^ -6 > ^ -1 >interface TheFirst { - > none: any; - >} - > - > -2 >const -3 > s -4 > = -5 > "Hello, world" -6 > ; -1 >Emitted(1, 1) Source(5, 1) + SourceIndex(0) -2 >Emitted(1, 5) Source(5, 7) + SourceIndex(0) -3 >Emitted(1, 6) Source(5, 8) + SourceIndex(0) -4 >Emitted(1, 9) Source(5, 11) + SourceIndex(0) -5 >Emitted(1, 23) Source(5, 25) + SourceIndex(0) -6 >Emitted(1, 24) Source(5, 26) + SourceIndex(0) ---- ->>>console.log(s); -1 > -2 >^^^^^^^ -3 > ^ -4 > ^^^ -5 > ^ -6 > ^ -7 > ^ -8 > ^ -9 > ^^^-> -1 > - > - >interface NoJsForHereEither { - > none: any; - >} - > - > -2 >console -3 > . -4 > log -5 > ( -6 > s -7 > ) -8 > ; -1 >Emitted(2, 1) Source(11, 1) + SourceIndex(0) -2 >Emitted(2, 8) Source(11, 8) + SourceIndex(0) -3 >Emitted(2, 9) Source(11, 9) + SourceIndex(0) -4 >Emitted(2, 12) Source(11, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(11, 13) + SourceIndex(0) -6 >Emitted(2, 14) Source(11, 14) + SourceIndex(0) -7 >Emitted(2, 15) Source(11, 15) + SourceIndex(0) -8 >Emitted(2, 16) Source(11, 16) + SourceIndex(0) ---- -------------------------------------------------------------------- -emittedFile:/src/first/bin/first-output.js -sourceFile:../first_part2.ts -------------------------------------------------------------------- ->>>console.log(f()); -1-> -2 >^^^^^^^ -3 > ^ -4 > ^^^ -5 > ^ -6 > ^ -7 > ^^ -8 > ^ -9 > ^ -1-> -2 >console -3 > . -4 > log -5 > ( -6 > f -7 > () -8 > ) -9 > ; -1->Emitted(3, 1) Source(1, 1) + SourceIndex(1) -2 >Emitted(3, 8) Source(1, 8) + SourceIndex(1) -3 >Emitted(3, 9) Source(1, 9) + SourceIndex(1) -4 >Emitted(3, 12) Source(1, 12) + SourceIndex(1) -5 >Emitted(3, 13) Source(1, 13) + SourceIndex(1) -6 >Emitted(3, 14) Source(1, 14) + SourceIndex(1) -7 >Emitted(3, 16) Source(1, 16) + SourceIndex(1) -8 >Emitted(3, 17) Source(1, 17) + SourceIndex(1) -9 >Emitted(3, 18) Source(1, 18) + SourceIndex(1) ---- -------------------------------------------------------------------- -emittedFile:/src/first/bin/first-output.js -sourceFile:../first_part3.ts -------------------------------------------------------------------- ->>>function f() { -1 > -2 >^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^-> -1 > -2 >function -3 > f -1 >Emitted(4, 1) Source(1, 1) + SourceIndex(2) -2 >Emitted(4, 10) Source(1, 10) + SourceIndex(2) -3 >Emitted(4, 11) Source(1, 11) + SourceIndex(2) ---- ->>> return "JS does hoists"; -1->^^^^ -2 > ^^^^^^^ -3 > ^^^^^^^^^^^^^^^^ -4 > ^ -1->() { - > -2 > return -3 > "JS does hoists" -4 > ; -1->Emitted(5, 5) Source(2, 5) + SourceIndex(2) -2 >Emitted(5, 12) Source(2, 12) + SourceIndex(2) -3 >Emitted(5, 28) Source(2, 28) + SourceIndex(2) -4 >Emitted(5, 29) Source(2, 29) + SourceIndex(2) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(6, 1) Source(3, 1) + SourceIndex(2) -2 >Emitted(6, 2) Source(3, 2) + SourceIndex(2) ---- ->>>//# sourceMappingURL=first-output.js.map - -//// [/src/first/bin/first-output.tsbuildinfo] -{ - "bundle": { - "commonSourceDirectory": "..", - "sourceFiles": [ - "../first_PART1.ts", - "../first_part2.ts", - "../first_part3.ts" - ], - "js": { - "sections": [ - { - "pos": 0, - "end": 110, - "kind": "text" - } - ] - }, - "dts": { - "sections": [ - { - "pos": 0, - "end": 157, - "kind": "text" - } - ] - } - }, - "version": "FakeTSVersion" -} - -//// [/src/first/bin/first-output.tsbuildinfo.baseline.txt] -====================================================================== -File:: /src/first/bin/first-output.js ----------------------------------------------------------------------- -text: (0-110) -var s = "Hello, world"; -console.log(s); -console.log(f()); -function f() { - return "JS does hoists"; -} - -====================================================================== -====================================================================== -File:: /src/first/bin/first-output.d.ts ----------------------------------------------------------------------- -text: (0-157) -interface TheFirst { - none: any; -} -declare const s = "Hello, world"; -interface NoJsForHereEither { - none: any; -} -declare function f(): string; - -====================================================================== - -//// [/src/first/first_PART1.ts] -interface TheFirst { - none: any; -} - -const s = "Hello, world"; - -interface NoJsForHereEither { - none: any; -} - -console.log(s); - - -//// [/src/third/thirdjs/output/third-output.d.ts] -interface TheFirst { - none: any; -} -declare const s = "Hello, world"; -interface NoJsForHereEither { - none: any; -} -declare function f(): string; -declare namespace N { -} -declare namespace N { -} -declare class normalC { -} -declare namespace normalN { -} -declare class C { - doSomething(): void; -} -declare var c: C; -//# sourceMappingURL=third-output.d.ts.map - -//// [/src/third/thirdjs/output/third-output.d.ts.map] -{"version":3,"file":"third-output.d.ts","sourceRoot":"","sources":["../../../first/first_PART1.ts","../../../first/first_part3.ts","../../../second/second_part1.ts","../../../second/second_part2.ts","../../third_part1.ts"],"names":[],"mappings":"AAAA,UAAU,QAAQ;IACd,IAAI,EAAE,GAAG,CAAC;CACb;AAED,QAAA,MAAM,CAAC,iBAAiB,CAAC;AAEzB,UAAU,iBAAiB;IACvB,IAAI,EAAE,GAAG,CAAC;CACb;ACRD,iBAAS,CAAC,WAET;ACFD,kBAAU,CAAC,CAAC;CAEX;AAED,kBAAU,CAAC,CAAC;CAMX;AAED,cAAM,OAAO;CAMZ;AACD,kBAAU,OAAO,CAAC;CASjB;AC5BD,cAAM,CAAC;IACH,WAAW;CAGd;ACJD,QAAA,IAAI,CAAC,GAAU,CAAC"} - -//// [/src/third/thirdjs/output/third-output.d.ts.map.baseline.txt] -=================================================================== -JsFile: third-output.d.ts -mapUrl: third-output.d.ts.map -sourceRoot: -sources: ../../../first/first_PART1.ts,../../../first/first_part3.ts,../../../second/second_part1.ts,../../../second/second_part2.ts,../../third_part1.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:/src/third/thirdjs/output/third-output.d.ts -sourceFile:../../../first/first_PART1.ts -------------------------------------------------------------------- ->>>interface TheFirst { -1 > -2 >^^^^^^^^^^ -3 > ^^^^^^^^ -1 > -2 >interface -3 > TheFirst -1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -2 >Emitted(1, 11) Source(1, 11) + SourceIndex(0) -3 >Emitted(1, 19) Source(1, 19) + SourceIndex(0) ---- ->>> none: any; -1 >^^^^ -2 > ^^^^ -3 > ^^ -4 > ^^^ -5 > ^ -1 > { - > -2 > none -3 > : -4 > any -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 9) Source(2, 9) + SourceIndex(0) -3 >Emitted(2, 11) Source(2, 11) + SourceIndex(0) -4 >Emitted(2, 14) Source(2, 14) + SourceIndex(0) -5 >Emitted(2, 15) Source(2, 15) + SourceIndex(0) ---- ->>>} -1 >^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - >} -1 >Emitted(3, 2) Source(3, 2) + SourceIndex(0) ---- ->>>declare const s = "Hello, world"; -1-> -2 >^^^^^^^^ -3 > ^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^^^^ -6 > ^ -1-> - > - > -2 > -3 > const -4 > s -5 > = "Hello, world" -6 > ; -1->Emitted(4, 1) Source(5, 1) + SourceIndex(0) -2 >Emitted(4, 9) Source(5, 1) + SourceIndex(0) -3 >Emitted(4, 15) Source(5, 7) + SourceIndex(0) -4 >Emitted(4, 16) Source(5, 8) + SourceIndex(0) -5 >Emitted(4, 33) Source(5, 25) + SourceIndex(0) -6 >Emitted(4, 34) Source(5, 26) + SourceIndex(0) ---- ->>>interface NoJsForHereEither { -1 > -2 >^^^^^^^^^^ -3 > ^^^^^^^^^^^^^^^^^ -1 > - > - > -2 >interface -3 > NoJsForHereEither -1 >Emitted(5, 1) Source(7, 1) + SourceIndex(0) -2 >Emitted(5, 11) Source(7, 11) + SourceIndex(0) -3 >Emitted(5, 28) Source(7, 28) + SourceIndex(0) ---- ->>> none: any; -1 >^^^^ -2 > ^^^^ -3 > ^^ -4 > ^^^ -5 > ^ -1 > { - > -2 > none -3 > : -4 > any -5 > ; -1 >Emitted(6, 5) Source(8, 5) + SourceIndex(0) -2 >Emitted(6, 9) Source(8, 9) + SourceIndex(0) -3 >Emitted(6, 11) Source(8, 11) + SourceIndex(0) -4 >Emitted(6, 14) Source(8, 14) + SourceIndex(0) -5 >Emitted(6, 15) Source(8, 15) + SourceIndex(0) ---- ->>>} -1 >^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - >} -1 >Emitted(7, 2) Source(9, 2) + SourceIndex(0) ---- -------------------------------------------------------------------- -emittedFile:/src/third/thirdjs/output/third-output.d.ts -sourceFile:../../../first/first_part3.ts -------------------------------------------------------------------- ->>>declare function f(): string; -1-> -2 >^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^ -1-> -2 >function -3 > f -4 > () { - > return "JS does hoists"; - > } -1->Emitted(8, 1) Source(1, 1) + SourceIndex(1) -2 >Emitted(8, 18) Source(1, 10) + SourceIndex(1) -3 >Emitted(8, 19) Source(1, 11) + SourceIndex(1) -4 >Emitted(8, 30) Source(3, 2) + SourceIndex(1) ---- -------------------------------------------------------------------- -emittedFile:/src/third/thirdjs/output/third-output.d.ts -sourceFile:../../../second/second_part1.ts -------------------------------------------------------------------- ->>>declare namespace N { -1 > -2 >^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^ -1 > -2 >namespace -3 > N -4 > -1 >Emitted(9, 1) Source(1, 1) + SourceIndex(2) -2 >Emitted(9, 19) Source(1, 11) + SourceIndex(2) -3 >Emitted(9, 20) Source(1, 12) + SourceIndex(2) -4 >Emitted(9, 21) Source(1, 13) + SourceIndex(2) ---- ->>>} -1 >^ -2 > ^^^^^^^^^^^^^^^^^^^^^-> -1 >{ - > // Comment text - >} -1 >Emitted(10, 2) Source(3, 2) + SourceIndex(2) ---- ->>>declare namespace N { -1-> -2 >^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^ -1-> - > - > -2 >namespace -3 > N -4 > -1->Emitted(11, 1) Source(5, 1) + SourceIndex(2) -2 >Emitted(11, 19) Source(5, 11) + SourceIndex(2) -3 >Emitted(11, 20) Source(5, 12) + SourceIndex(2) -4 >Emitted(11, 21) Source(5, 13) + SourceIndex(2) ---- ->>>} -1 >^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^-> -1 >{ - > function f() { - > console.log('testing'); - > } - > - > f(); - >} -1 >Emitted(12, 2) Source(11, 2) + SourceIndex(2) ---- ->>>declare class normalC { -1-> -2 >^^^^^^^^^^^^^^ -3 > ^^^^^^^ -1-> - > - > -2 >class -3 > normalC -1->Emitted(13, 1) Source(13, 1) + SourceIndex(2) -2 >Emitted(13, 15) Source(13, 7) + SourceIndex(2) -3 >Emitted(13, 22) Source(13, 14) + SourceIndex(2) ---- ->>>} -1 >^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > { - > /**@internal*/ constructor() { } - > /**@internal*/ prop: string; - > /**@internal*/ method() { } - > /**@internal*/ get c() { return 10; } - > /**@internal*/ set c(val: number) { } - >} -1 >Emitted(14, 2) Source(19, 2) + SourceIndex(2) ---- ->>>declare namespace normalN { -1-> -2 >^^^^^^^^^^^^^^^^^^ -3 > ^^^^^^^ -4 > ^ -1-> - > -2 >namespace -3 > normalN -4 > -1->Emitted(15, 1) Source(20, 1) + SourceIndex(2) -2 >Emitted(15, 19) Source(20, 11) + SourceIndex(2) -3 >Emitted(15, 26) Source(20, 18) + SourceIndex(2) -4 >Emitted(15, 27) Source(20, 19) + SourceIndex(2) ---- ->>>} -1 >^ -2 > ^^^^^^^^^^^^^^^^^-> -1 >{ - > /**@internal*/ export class C { } - > /**@internal*/ export function foo() {} - > /**@internal*/ export namespace someNamespace { export class C {} } - > /**@internal*/ export namespace someOther.something { export class someClass {} } - > /**@internal*/ export import someImport = someNamespace.C; - > /**@internal*/ export type internalType = internalC; - > /**@internal*/ export const internalConst = 10; - > /**@internal*/ export enum internalEnum { a, b, c } - >} -1 >Emitted(16, 2) Source(29, 2) + SourceIndex(2) ---- -------------------------------------------------------------------- -emittedFile:/src/third/thirdjs/output/third-output.d.ts -sourceFile:../../../second/second_part2.ts -------------------------------------------------------------------- ->>>declare class C { -1-> -2 >^^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^-> -1-> -2 >class -3 > C -1->Emitted(17, 1) Source(1, 1) + SourceIndex(3) -2 >Emitted(17, 15) Source(1, 7) + SourceIndex(3) -3 >Emitted(17, 16) Source(1, 8) + SourceIndex(3) ---- ->>> doSomething(): void; -1->^^^^ -2 > ^^^^^^^^^^^ -1-> { - > -2 > doSomething -1->Emitted(18, 5) Source(2, 5) + SourceIndex(3) -2 >Emitted(18, 16) Source(2, 16) + SourceIndex(3) ---- ->>>} -1 >^ -2 > ^^^^^^^^^^^^^^^^^-> -1 >() { - > console.log("something got done"); - > } - >} -1 >Emitted(19, 2) Source(5, 2) + SourceIndex(3) ---- -------------------------------------------------------------------- -emittedFile:/src/third/thirdjs/output/third-output.d.ts -sourceFile:../../third_part1.ts -------------------------------------------------------------------- ->>>declare var c: C; -1-> -2 >^^^^^^^^ -3 > ^^^^ -4 > ^ -5 > ^^^ -6 > ^ -7 > ^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 > -3 > var -4 > c -5 > = new C() -6 > ; -1->Emitted(20, 1) Source(1, 1) + SourceIndex(4) -2 >Emitted(20, 9) Source(1, 1) + SourceIndex(4) -3 >Emitted(20, 13) Source(1, 5) + SourceIndex(4) -4 >Emitted(20, 14) Source(1, 6) + SourceIndex(4) -5 >Emitted(20, 17) Source(1, 16) + SourceIndex(4) -6 >Emitted(20, 18) Source(1, 17) + SourceIndex(4) ---- ->>>//# sourceMappingURL=third-output.d.ts.map +//// [/src/2/second-output.tsbuildinfo] +{ + "bundle": { + "commonSourceDirectory": "../second", + "sourceFiles": [ + "../second/second_part1.ts", + "../second/second_part2.ts" + ], + "js": { + "sections": [ + { + "pos": 0, + "end": 110, + "kind": "prepend", + "data": "../first/bin/first-output.js", + "texts": [ + { + "pos": 0, + "end": 110, + "kind": "text" + } + ] + }, + { + "pos": 110, + "end": 3162, + "kind": "text" + } + ] + }, + "dts": { + "sections": [ + { + "pos": 0, + "end": 157, + "kind": "prepend", + "data": "../first/bin/first-output.d.ts", + "texts": [ + { + "pos": 0, + "end": 157, + "kind": "text" + } + ] + }, + { + "pos": 157, + "end": 234, + "kind": "text" + }, + { + "pos": 234, + "end": 308, + "kind": "internal" + }, + { + "pos": 310, + "end": 342, + "kind": "text" + }, + { + "pos": 342, + "end": 734, + "kind": "internal" + }, + { + "pos": 736, + "end": 739, + "kind": "text" + }, + { + "pos": 739, + "end": 1152, + "kind": "internal" + }, + { + "pos": 1154, + "end": 1202, + "kind": "text" + } + ] + } + }, + "version": "FakeTSVersion" +} + +//// [/src/2/second-output.tsbuildinfo.baseline.txt] +====================================================================== +File:: /src/2/second-output.js +---------------------------------------------------------------------- +prepend: (0-110):: ../first/bin/first-output.js texts:: 1 +>>-------------------------------------------------------------------- +text: (0-110) +var s = "Hello, world"; +console.log(s); +console.log(f()); +function f() { + return "JS does hoists"; +} -//// [/src/third/thirdjs/output/third-output.js.map.baseline.txt] -=================================================================== -JsFile: third-output.js -mapUrl: third-output.js.map -sourceRoot: -sources: ../../../first/first_PART1.ts,../../../first/first_part2.ts,../../../first/first_part3.ts,../../../second/second_part1.ts,../../../second/second_part2.ts,../../third_part1.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:/src/third/thirdjs/output/third-output.js -sourceFile:../../../first/first_PART1.ts -------------------------------------------------------------------- ->>>var s = "Hello, world"; -1 > -2 >^^^^ -3 > ^ -4 > ^^^ -5 > ^^^^^^^^^^^^^^ -6 > ^ -1 >interface TheFirst { - > none: any; - >} - > - > -2 >const -3 > s -4 > = -5 > "Hello, world" -6 > ; -1 >Emitted(1, 1) Source(5, 1) + SourceIndex(0) -2 >Emitted(1, 5) Source(5, 7) + SourceIndex(0) -3 >Emitted(1, 6) Source(5, 8) + SourceIndex(0) -4 >Emitted(1, 9) Source(5, 11) + SourceIndex(0) -5 >Emitted(1, 23) Source(5, 25) + SourceIndex(0) -6 >Emitted(1, 24) Source(5, 26) + SourceIndex(0) ---- ->>>console.log(s); -1 > -2 >^^^^^^^ -3 > ^ -4 > ^^^ -5 > ^ -6 > ^ -7 > ^ -8 > ^ -9 > ^^^-> -1 > - > - >interface NoJsForHereEither { - > none: any; - >} - > - > -2 >console -3 > . -4 > log -5 > ( -6 > s -7 > ) -8 > ; -1 >Emitted(2, 1) Source(11, 1) + SourceIndex(0) -2 >Emitted(2, 8) Source(11, 8) + SourceIndex(0) -3 >Emitted(2, 9) Source(11, 9) + SourceIndex(0) -4 >Emitted(2, 12) Source(11, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(11, 13) + SourceIndex(0) -6 >Emitted(2, 14) Source(11, 14) + SourceIndex(0) -7 >Emitted(2, 15) Source(11, 15) + SourceIndex(0) -8 >Emitted(2, 16) Source(11, 16) + SourceIndex(0) ---- -------------------------------------------------------------------- -emittedFile:/src/third/thirdjs/output/third-output.js -sourceFile:../../../first/first_part2.ts -------------------------------------------------------------------- ->>>console.log(f()); -1-> -2 >^^^^^^^ -3 > ^ -4 > ^^^ -5 > ^ -6 > ^ -7 > ^^ -8 > ^ -9 > ^ -1-> -2 >console -3 > . -4 > log -5 > ( -6 > f -7 > () -8 > ) -9 > ; -1->Emitted(3, 1) Source(1, 1) + SourceIndex(1) -2 >Emitted(3, 8) Source(1, 8) + SourceIndex(1) -3 >Emitted(3, 9) Source(1, 9) + SourceIndex(1) -4 >Emitted(3, 12) Source(1, 12) + SourceIndex(1) -5 >Emitted(3, 13) Source(1, 13) + SourceIndex(1) -6 >Emitted(3, 14) Source(1, 14) + SourceIndex(1) -7 >Emitted(3, 16) Source(1, 16) + SourceIndex(1) -8 >Emitted(3, 17) Source(1, 17) + SourceIndex(1) -9 >Emitted(3, 18) Source(1, 18) + SourceIndex(1) ---- -------------------------------------------------------------------- -emittedFile:/src/third/thirdjs/output/third-output.js -sourceFile:../../../first/first_part3.ts -------------------------------------------------------------------- ->>>function f() { -1 > -2 >^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^-> -1 > -2 >function -3 > f -1 >Emitted(4, 1) Source(1, 1) + SourceIndex(2) -2 >Emitted(4, 10) Source(1, 10) + SourceIndex(2) -3 >Emitted(4, 11) Source(1, 11) + SourceIndex(2) ---- ->>> return "JS does hoists"; -1->^^^^ -2 > ^^^^^^^ -3 > ^^^^^^^^^^^^^^^^ -4 > ^ -1->() { - > -2 > return -3 > "JS does hoists" -4 > ; -1->Emitted(5, 5) Source(2, 5) + SourceIndex(2) -2 >Emitted(5, 12) Source(2, 12) + SourceIndex(2) -3 >Emitted(5, 28) Source(2, 28) + SourceIndex(2) -4 >Emitted(5, 29) Source(2, 29) + SourceIndex(2) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^-> -1 > - > -2 >} -1 >Emitted(6, 1) Source(3, 1) + SourceIndex(2) -2 >Emitted(6, 2) Source(3, 2) + SourceIndex(2) ---- +---------------------------------------------------------------------- +text: (110-3162) +var N; +(function (N) { + function f() { + console.log('testing'); + } + f(); +})(N || (N = {})); +var normalC = (function () { + function normalC() { + } + normalC.prototype.method = function () { }; + Object.defineProperty(normalC.prototype, "c", { + get: function () { return 10; }, + set: function (val) { }, + enumerable: true, + configurable: true + }); + return normalC; +}()); +var normalN; +(function (normalN) { + var C = (function () { + function C() { + } + return C; + }()); + normalN.C = C; + function foo() { } + normalN.foo = foo; + var someNamespace; + (function (someNamespace) { + var C = (function () { + function C() { + } + return C; + }()); + someNamespace.C = C; + })(someNamespace = normalN.someNamespace || (normalN.someNamespace = {})); + var someOther; + (function (someOther) { + var something; + (function (something) { + var someClass = (function () { + function someClass() { + } + return someClass; + }()); + something.someClass = someClass; + })(something = someOther.something || (someOther.something = {})); + })(someOther = normalN.someOther || (normalN.someOther = {})); + normalN.someImport = someNamespace.C; + normalN.internalConst = 10; + var internalEnum; + (function (internalEnum) { + internalEnum[internalEnum["a"] = 0] = "a"; + internalEnum[internalEnum["b"] = 1] = "b"; + internalEnum[internalEnum["c"] = 2] = "c"; + })(internalEnum = normalN.internalEnum || (normalN.internalEnum = {})); +})(normalN || (normalN = {})); +var internalC = (function () { + function internalC() { + } + return internalC; +}()); +function internalfoo() { } +var internalNamespace; +(function (internalNamespace) { + var someClass = (function () { + function someClass() { + } + return someClass; + }()); + internalNamespace.someClass = someClass; +})(internalNamespace || (internalNamespace = {})); +var internalOther; +(function (internalOther) { + var something; + (function (something) { + var someClass = (function () { + function someClass() { + } + return someClass; + }()); + something.someClass = someClass; + })(something = internalOther.something || (internalOther.something = {})); +})(internalOther || (internalOther = {})); +var internalImport = internalNamespace.someClass; +var internalConst = 10; +var internalEnum; +(function (internalEnum) { + internalEnum[internalEnum["a"] = 0] = "a"; + internalEnum[internalEnum["b"] = 1] = "b"; + internalEnum[internalEnum["c"] = 2] = "c"; +})(internalEnum || (internalEnum = {})); +var C = (function () { + function C() { + } + C.prototype.doSomething = function () { + console.log("something got done"); + }; + return C; +}()); + +====================================================================== +====================================================================== +File:: /src/2/second-output.d.ts +---------------------------------------------------------------------- +prepend: (0-157):: ../first/bin/first-output.d.ts texts:: 1 +>>-------------------------------------------------------------------- +text: (0-157) +interface TheFirst { + none: any; +} +declare const s = "Hello, world"; +interface NoJsForHereEither { + none: any; +} +declare function f(): string; + +---------------------------------------------------------------------- +text: (157-234) +declare namespace N { +} +declare namespace N { +} +declare class normalC { + +---------------------------------------------------------------------- +internal: (234-308) + constructor(); + prop: string; + method(): void; + c: number; +---------------------------------------------------------------------- +text: (310-342) +} +declare namespace normalN { + +---------------------------------------------------------------------- +internal: (342-734) + class C { + } + function foo(): void; + namespace someNamespace { + class C { + } + } + namespace someOther.something { + class someClass { + } + } + export import someImport = someNamespace.C; + type internalType = internalC; + const internalConst = 10; + enum internalEnum { + a = 0, + b = 1, + c = 2 + } +---------------------------------------------------------------------- +text: (736-739) +} + +---------------------------------------------------------------------- +internal: (739-1152) +declare class internalC { +} +declare function internalfoo(): void; +declare namespace internalNamespace { + class someClass { + } +} +declare namespace internalOther.something { + class someClass { + } +} +import internalImport = internalNamespace.someClass; +declare type internalType = internalC; +declare const internalConst = 10; +declare enum internalEnum { + a = 0, + b = 1, + c = 2 +} +---------------------------------------------------------------------- +text: (1154-1202) +declare class C { + doSomething(): void; +} + +====================================================================== + +//// [/src/first/bin/first-output.d.ts] file written with same contents +//// [/src/first/bin/first-output.d.ts.map] +{"version":3,"file":"first-output.d.ts","sourceRoot":"","sources":["../first_PART1.ts","../first_part2.ts","../first_part3.ts"],"names":[],"mappings":"AAAA,UAAU,QAAQ;IACd,IAAI,EAAE,GAAG,CAAC;CACb;AAED,QAAA,MAAM,CAAC,iBAAiB,CAAC;AAEzB,UAAU,iBAAiB;IACvB,IAAI,EAAE,GAAG,CAAC;CACb;AERD,iBAAS,CAAC,WAET"} + +//// [/src/first/bin/first-output.d.ts.map.baseline.txt] +=================================================================== +JsFile: first-output.d.ts +mapUrl: first-output.d.ts.map +sourceRoot: +sources: ../first_PART1.ts,../first_part2.ts,../first_part3.ts +=================================================================== ------------------------------------------------------------------- -emittedFile:/src/third/thirdjs/output/third-output.js -sourceFile:../../../second/second_part1.ts +emittedFile:/src/first/bin/first-output.d.ts +sourceFile:../first_PART1.ts ------------------------------------------------------------------- ->>>var N; -1-> -2 >^^^^ -3 > ^ -4 > ^ -5 > ^^^^^^^^^^-> -1->namespace N { - > // Comment text - >} - > - > -2 >namespace -3 > N -4 > { - > function f() { - > console.log('testing'); - > } - > - > f(); - > } -1->Emitted(7, 1) Source(5, 1) + SourceIndex(3) -2 >Emitted(7, 5) Source(5, 11) + SourceIndex(3) -3 >Emitted(7, 6) Source(5, 12) + SourceIndex(3) -4 >Emitted(7, 7) Source(11, 2) + SourceIndex(3) ---- ->>>(function (N) { -1-> -2 >^^^^^^^^^^^ -3 > ^ -4 > ^^^^^^^-> -1-> -2 >namespace -3 > N -1->Emitted(8, 1) Source(5, 1) + SourceIndex(3) -2 >Emitted(8, 12) Source(5, 11) + SourceIndex(3) -3 >Emitted(8, 13) Source(5, 12) + SourceIndex(3) ---- ->>> function f() { -1->^^^^ -2 > ^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^-> -1-> { - > -2 > function -3 > f -1->Emitted(9, 5) Source(6, 5) + SourceIndex(3) -2 >Emitted(9, 14) Source(6, 14) + SourceIndex(3) -3 >Emitted(9, 15) Source(6, 15) + SourceIndex(3) ---- ->>> console.log('testing'); -1->^^^^^^^^ -2 > ^^^^^^^ -3 > ^ -4 > ^^^ -5 > ^ -6 > ^^^^^^^^^ -7 > ^ -8 > ^ -1->() { - > -2 > console -3 > . -4 > log -5 > ( -6 > 'testing' -7 > ) -8 > ; -1->Emitted(10, 9) Source(7, 9) + SourceIndex(3) -2 >Emitted(10, 16) Source(7, 16) + SourceIndex(3) -3 >Emitted(10, 17) Source(7, 17) + SourceIndex(3) -4 >Emitted(10, 20) Source(7, 20) + SourceIndex(3) -5 >Emitted(10, 21) Source(7, 21) + SourceIndex(3) -6 >Emitted(10, 30) Source(7, 30) + SourceIndex(3) -7 >Emitted(10, 31) Source(7, 31) + SourceIndex(3) -8 >Emitted(10, 32) Source(7, 32) + SourceIndex(3) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^-> -1 > - > -2 > } -1 >Emitted(11, 5) Source(8, 5) + SourceIndex(3) -2 >Emitted(11, 6) Source(8, 6) + SourceIndex(3) ---- ->>> f(); -1->^^^^ -2 > ^ -3 > ^^ -4 > ^ -5 > ^^^^^^^^^^^-> -1-> - > - > -2 > f -3 > () -4 > ; -1->Emitted(12, 5) Source(10, 5) + SourceIndex(3) -2 >Emitted(12, 6) Source(10, 6) + SourceIndex(3) -3 >Emitted(12, 8) Source(10, 8) + SourceIndex(3) -4 >Emitted(12, 9) Source(10, 9) + SourceIndex(3) ---- ->>>})(N || (N = {})); -1-> -2 >^ -3 > ^^ -4 > ^ -5 > ^^^^^ -6 > ^ -7 > ^^^^^^^^ -8 > ^^^^^^^^^^^-> -1-> - > -2 >} -3 > -4 > N -5 > -6 > N -7 > { - > function f() { - > console.log('testing'); - > } - > - > f(); - > } -1->Emitted(13, 1) Source(11, 1) + SourceIndex(3) -2 >Emitted(13, 2) Source(11, 2) + SourceIndex(3) -3 >Emitted(13, 4) Source(5, 11) + SourceIndex(3) -4 >Emitted(13, 5) Source(5, 12) + SourceIndex(3) -5 >Emitted(13, 10) Source(5, 11) + SourceIndex(3) -6 >Emitted(13, 11) Source(5, 12) + SourceIndex(3) -7 >Emitted(13, 19) Source(11, 2) + SourceIndex(3) ---- ->>>var normalC = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > - > -1->Emitted(14, 1) Source(13, 1) + SourceIndex(3) ---- ->>> function normalC() { -1->^^^^ -2 > ^^-> -1->class normalC { - > /**@internal*/ -1->Emitted(15, 5) Source(14, 20) + SourceIndex(3) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->constructor() { -2 > } -1->Emitted(16, 5) Source(14, 36) + SourceIndex(3) -2 >Emitted(16, 6) Source(14, 37) + SourceIndex(3) ---- ->>> normalC.prototype.method = function () { }; -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^^^^^^^^^^^ -5 > ^ -6 > ^^^^^^-> -1-> - > /**@internal*/ prop: string; - > /**@internal*/ -2 > method -3 > -4 > method() { -5 > } -1->Emitted(17, 5) Source(16, 20) + SourceIndex(3) -2 >Emitted(17, 29) Source(16, 26) + SourceIndex(3) -3 >Emitted(17, 32) Source(16, 20) + SourceIndex(3) -4 >Emitted(17, 46) Source(16, 31) + SourceIndex(3) -5 >Emitted(17, 47) Source(16, 32) + SourceIndex(3) ---- ->>> Object.defineProperty(normalC.prototype, "c", { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^^^^^^^^^^ -1-> - > /**@internal*/ -2 > get -3 > c -1->Emitted(18, 5) Source(17, 20) + SourceIndex(3) -2 >Emitted(18, 27) Source(17, 24) + SourceIndex(3) -3 >Emitted(18, 49) Source(17, 25) + SourceIndex(3) ---- ->>> get: function () { return 10; }, -1 >^^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^ -3 > ^^^^^^^ -4 > ^^ -5 > ^ -6 > ^ -7 > ^ -1 > -2 > get c() { -3 > return -4 > 10 -5 > ; -6 > -7 > } -1 >Emitted(19, 14) Source(17, 20) + SourceIndex(3) -2 >Emitted(19, 28) Source(17, 30) + SourceIndex(3) -3 >Emitted(19, 35) Source(17, 37) + SourceIndex(3) -4 >Emitted(19, 37) Source(17, 39) + SourceIndex(3) -5 >Emitted(19, 38) Source(17, 40) + SourceIndex(3) -6 >Emitted(19, 39) Source(17, 41) + SourceIndex(3) -7 >Emitted(19, 40) Source(17, 42) + SourceIndex(3) ---- ->>> set: function (val) { }, -1 >^^^^^^^^^^^^^ -2 > ^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^ -1 > - > /**@internal*/ -2 > set c( -3 > val: number -4 > ) { -5 > } -1 >Emitted(20, 14) Source(18, 20) + SourceIndex(3) -2 >Emitted(20, 24) Source(18, 26) + SourceIndex(3) -3 >Emitted(20, 27) Source(18, 37) + SourceIndex(3) -4 >Emitted(20, 31) Source(18, 41) + SourceIndex(3) -5 >Emitted(20, 32) Source(18, 42) + SourceIndex(3) ---- ->>> enumerable: true, ->>> configurable: true ->>> }); -1 >^^^^^^^ -2 > ^^^^^^^^^^^^^-> -1 > -1 >Emitted(23, 8) Source(17, 42) + SourceIndex(3) ---- ->>> return normalC; -1->^^^^ -2 > ^^^^^^^^^^^^^^ -1-> - > /**@internal*/ set c(val: number) { } - > -2 > } -1->Emitted(24, 5) Source(19, 1) + SourceIndex(3) -2 >Emitted(24, 19) Source(19, 2) + SourceIndex(3) ---- ->>>}()); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^-> -1 > -2 >} -3 > -4 > class normalC { - > /**@internal*/ constructor() { } - > /**@internal*/ prop: string; - > /**@internal*/ method() { } - > /**@internal*/ get c() { return 10; } - > /**@internal*/ set c(val: number) { } - > } -1 >Emitted(25, 1) Source(19, 1) + SourceIndex(3) -2 >Emitted(25, 2) Source(19, 2) + SourceIndex(3) -3 >Emitted(25, 2) Source(13, 1) + SourceIndex(3) -4 >Emitted(25, 6) Source(19, 2) + SourceIndex(3) ---- ->>>var normalN; -1-> -2 >^^^^ -3 > ^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^-> -1-> - > -2 >namespace -3 > normalN -4 > { - > /**@internal*/ export class C { } - > /**@internal*/ export function foo() {} - > /**@internal*/ export namespace someNamespace { export class C {} } - > /**@internal*/ export namespace someOther.something { export class someClass {} } - > /**@internal*/ export import someImport = someNamespace.C; - > /**@internal*/ export type internalType = internalC; - > /**@internal*/ export const internalConst = 10; - > /**@internal*/ export enum internalEnum { a, b, c } - > } -1->Emitted(26, 1) Source(20, 1) + SourceIndex(3) -2 >Emitted(26, 5) Source(20, 11) + SourceIndex(3) -3 >Emitted(26, 12) Source(20, 18) + SourceIndex(3) -4 >Emitted(26, 13) Source(29, 2) + SourceIndex(3) ---- ->>>(function (normalN) { -1-> -2 >^^^^^^^^^^^ -3 > ^^^^^^^ -4 > ^^^^^^^^^-> -1-> -2 >namespace -3 > normalN -1->Emitted(27, 1) Source(20, 1) + SourceIndex(3) -2 >Emitted(27, 12) Source(20, 11) + SourceIndex(3) -3 >Emitted(27, 19) Source(20, 18) + SourceIndex(3) ---- ->>> var C = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^-> -1-> { - > /**@internal*/ -1->Emitted(28, 5) Source(21, 20) + SourceIndex(3) ---- ->>> function C() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(29, 9) Source(21, 20) + SourceIndex(3) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^-> -1->export class C { -2 > } -1->Emitted(30, 9) Source(21, 37) + SourceIndex(3) -2 >Emitted(30, 10) Source(21, 38) + SourceIndex(3) ---- ->>> return C; -1->^^^^^^^^ -2 > ^^^^^^^^ -1-> -2 > } -1->Emitted(31, 9) Source(21, 37) + SourceIndex(3) -2 >Emitted(31, 17) Source(21, 38) + SourceIndex(3) ---- ->>> }()); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^-> +>>>interface TheFirst { 1 > -2 > } -3 > -4 > export class C { } -1 >Emitted(32, 5) Source(21, 37) + SourceIndex(3) -2 >Emitted(32, 6) Source(21, 38) + SourceIndex(3) -3 >Emitted(32, 6) Source(21, 20) + SourceIndex(3) -4 >Emitted(32, 10) Source(21, 38) + SourceIndex(3) ---- ->>> normalN.C = C; -1->^^^^ -2 > ^^^^^^^^^ -3 > ^^^^ -4 > ^ -5 > ^^^^^-> -1-> -2 > C -3 > { } -4 > -1->Emitted(33, 5) Source(21, 33) + SourceIndex(3) -2 >Emitted(33, 14) Source(21, 34) + SourceIndex(3) -3 >Emitted(33, 18) Source(21, 38) + SourceIndex(3) -4 >Emitted(33, 19) Source(21, 38) + SourceIndex(3) ---- ->>> function foo() { } -1->^^^^ -2 > ^^^^^^^^^ -3 > ^^^ -4 > ^^^^^ -5 > ^ -6 > ^-> -1-> - > /**@internal*/ -2 > export function -3 > foo -4 > () { -5 > } -1->Emitted(34, 5) Source(22, 20) + SourceIndex(3) -2 >Emitted(34, 14) Source(22, 36) + SourceIndex(3) -3 >Emitted(34, 17) Source(22, 39) + SourceIndex(3) -4 >Emitted(34, 22) Source(22, 43) + SourceIndex(3) -5 >Emitted(34, 23) Source(22, 44) + SourceIndex(3) ---- ->>> normalN.foo = foo; -1->^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^ -4 > ^ -5 > ^-> -1-> -2 > foo -3 > () {} -4 > -1->Emitted(35, 5) Source(22, 36) + SourceIndex(3) -2 >Emitted(35, 16) Source(22, 39) + SourceIndex(3) -3 >Emitted(35, 22) Source(22, 44) + SourceIndex(3) -4 >Emitted(35, 23) Source(22, 44) + SourceIndex(3) ---- ->>> var someNamespace; -1->^^^^ -2 > ^^^^ -3 > ^^^^^^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^-> -1-> - > /**@internal*/ -2 > export namespace -3 > someNamespace -4 > { export class C {} } -1->Emitted(36, 5) Source(23, 20) + SourceIndex(3) -2 >Emitted(36, 9) Source(23, 37) + SourceIndex(3) -3 >Emitted(36, 22) Source(23, 50) + SourceIndex(3) -4 >Emitted(36, 23) Source(23, 72) + SourceIndex(3) ---- ->>> (function (someNamespace) { -1->^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^ -4 > ^^^-> -1-> -2 > export namespace -3 > someNamespace -1->Emitted(37, 5) Source(23, 20) + SourceIndex(3) -2 >Emitted(37, 16) Source(23, 37) + SourceIndex(3) -3 >Emitted(37, 29) Source(23, 50) + SourceIndex(3) ---- ->>> var C = (function () { -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^-> -1-> { -1->Emitted(38, 9) Source(23, 53) + SourceIndex(3) ---- ->>> function C() { -1->^^^^^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(39, 13) Source(23, 53) + SourceIndex(3) ---- ->>> } -1->^^^^^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^-> -1->export class C { -2 > } -1->Emitted(40, 13) Source(23, 69) + SourceIndex(3) -2 >Emitted(40, 14) Source(23, 70) + SourceIndex(3) ---- ->>> return C; -1->^^^^^^^^^^^^ -2 > ^^^^^^^^ -1-> -2 > } -1->Emitted(41, 13) Source(23, 69) + SourceIndex(3) -2 >Emitted(41, 21) Source(23, 70) + SourceIndex(3) ---- ->>> }()); -1 >^^^^^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^-> +2 >^^^^^^^^^^ +3 > ^^^^^^^^ 1 > -2 > } -3 > -4 > export class C {} -1 >Emitted(42, 9) Source(23, 69) + SourceIndex(3) -2 >Emitted(42, 10) Source(23, 70) + SourceIndex(3) -3 >Emitted(42, 10) Source(23, 53) + SourceIndex(3) -4 >Emitted(42, 14) Source(23, 70) + SourceIndex(3) ---- ->>> someNamespace.C = C; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^ -3 > ^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 > C -3 > {} -4 > -1->Emitted(43, 9) Source(23, 66) + SourceIndex(3) -2 >Emitted(43, 24) Source(23, 67) + SourceIndex(3) -3 >Emitted(43, 28) Source(23, 70) + SourceIndex(3) -4 >Emitted(43, 29) Source(23, 70) + SourceIndex(3) ---- ->>> })(someNamespace = normalN.someNamespace || (normalN.someNamespace = {})); -1->^^^^ -2 > ^ -3 > ^^ -4 > ^^^^^^^^^^^^^ -5 > ^^^ -6 > ^^^^^^^^^^^^^^^^^^^^^ -7 > ^^^^^ -8 > ^^^^^^^^^^^^^^^^^^^^^ -9 > ^^^^^^^^ -1-> -2 > } -3 > -4 > someNamespace -5 > -6 > someNamespace -7 > -8 > someNamespace -9 > { export class C {} } -1->Emitted(44, 5) Source(23, 71) + SourceIndex(3) -2 >Emitted(44, 6) Source(23, 72) + SourceIndex(3) -3 >Emitted(44, 8) Source(23, 37) + SourceIndex(3) -4 >Emitted(44, 21) Source(23, 50) + SourceIndex(3) -5 >Emitted(44, 24) Source(23, 37) + SourceIndex(3) -6 >Emitted(44, 45) Source(23, 50) + SourceIndex(3) -7 >Emitted(44, 50) Source(23, 37) + SourceIndex(3) -8 >Emitted(44, 71) Source(23, 50) + SourceIndex(3) -9 >Emitted(44, 79) Source(23, 72) + SourceIndex(3) ---- ->>> var someOther; -1 >^^^^ -2 > ^^^^ -3 > ^^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^-> -1 > - > /**@internal*/ -2 > export namespace -3 > someOther -4 > .something { export class someClass {} } -1 >Emitted(45, 5) Source(24, 20) + SourceIndex(3) -2 >Emitted(45, 9) Source(24, 37) + SourceIndex(3) -3 >Emitted(45, 18) Source(24, 46) + SourceIndex(3) -4 >Emitted(45, 19) Source(24, 86) + SourceIndex(3) ---- ->>> (function (someOther) { -1->^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^^^^ -1-> -2 > export namespace -3 > someOther -1->Emitted(46, 5) Source(24, 20) + SourceIndex(3) -2 >Emitted(46, 16) Source(24, 37) + SourceIndex(3) -3 >Emitted(46, 25) Source(24, 46) + SourceIndex(3) ---- ->>> var something; -1 >^^^^^^^^ -2 > ^^^^ -3 > ^^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^-> -1 >. -2 > -3 > something -4 > { export class someClass {} } -1 >Emitted(47, 9) Source(24, 47) + SourceIndex(3) -2 >Emitted(47, 13) Source(24, 47) + SourceIndex(3) -3 >Emitted(47, 22) Source(24, 56) + SourceIndex(3) -4 >Emitted(47, 23) Source(24, 86) + SourceIndex(3) +2 >interface +3 > TheFirst +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 11) Source(1, 11) + SourceIndex(0) +3 >Emitted(1, 19) Source(1, 19) + SourceIndex(0) --- ->>> (function (something) { -1->^^^^^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^-> -1-> -2 > -3 > something -1->Emitted(48, 9) Source(24, 47) + SourceIndex(3) -2 >Emitted(48, 20) Source(24, 47) + SourceIndex(3) -3 >Emitted(48, 29) Source(24, 56) + SourceIndex(3) +>>> none: any; +1 >^^^^ +2 > ^^^^ +3 > ^^ +4 > ^^^ +5 > ^ +1 > { + > +2 > none +3 > : +4 > any +5 > ; +1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +2 >Emitted(2, 9) Source(2, 9) + SourceIndex(0) +3 >Emitted(2, 11) Source(2, 11) + SourceIndex(0) +4 >Emitted(2, 14) Source(2, 14) + SourceIndex(0) +5 >Emitted(2, 15) Source(2, 15) + SourceIndex(0) --- ->>> var someClass = (function () { -1->^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> { -1->Emitted(49, 13) Source(24, 59) + SourceIndex(3) +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(3, 2) Source(3, 2) + SourceIndex(0) --- ->>> function someClass() { -1->^^^^^^^^^^^^^^^^ -2 > ^^-> +>>>declare const s = "Hello, world"; 1-> -1->Emitted(50, 17) Source(24, 59) + SourceIndex(3) ---- ->>> } -1->^^^^^^^^^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^-> -1->export class someClass { -2 > } -1->Emitted(51, 17) Source(24, 83) + SourceIndex(3) -2 >Emitted(51, 18) Source(24, 84) + SourceIndex(3) ---- ->>> return someClass; -1->^^^^^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^ +2 >^^^^^^^^ +3 > ^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^ +6 > ^ 1-> -2 > } -1->Emitted(52, 17) Source(24, 83) + SourceIndex(3) -2 >Emitted(52, 33) Source(24, 84) + SourceIndex(3) + > + > +2 > +3 > const +4 > s +5 > = "Hello, world" +6 > ; +1->Emitted(4, 1) Source(5, 1) + SourceIndex(0) +2 >Emitted(4, 9) Source(5, 1) + SourceIndex(0) +3 >Emitted(4, 15) Source(5, 7) + SourceIndex(0) +4 >Emitted(4, 16) Source(5, 8) + SourceIndex(0) +5 >Emitted(4, 33) Source(5, 25) + SourceIndex(0) +6 >Emitted(4, 34) Source(5, 26) + SourceIndex(0) --- ->>> }()); -1 >^^^^^^^^^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +>>>interface NoJsForHereEither { 1 > -2 > } -3 > -4 > export class someClass {} -1 >Emitted(53, 13) Source(24, 83) + SourceIndex(3) -2 >Emitted(53, 14) Source(24, 84) + SourceIndex(3) -3 >Emitted(53, 14) Source(24, 59) + SourceIndex(3) -4 >Emitted(53, 18) Source(24, 84) + SourceIndex(3) ---- ->>> something.someClass = someClass; -1->^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^ -3 > ^^^^^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 > someClass -3 > {} -4 > -1->Emitted(54, 13) Source(24, 72) + SourceIndex(3) -2 >Emitted(54, 32) Source(24, 81) + SourceIndex(3) -3 >Emitted(54, 44) Source(24, 84) + SourceIndex(3) -4 >Emitted(54, 45) Source(24, 84) + SourceIndex(3) ---- ->>> })(something = someOther.something || (someOther.something = {})); -1->^^^^^^^^ -2 > ^ -3 > ^^ -4 > ^^^^^^^^^ -5 > ^^^ -6 > ^^^^^^^^^^^^^^^^^^^ -7 > ^^^^^ -8 > ^^^^^^^^^^^^^^^^^^^ -9 > ^^^^^^^^ -1-> -2 > } -3 > -4 > something -5 > -6 > something -7 > -8 > something -9 > { export class someClass {} } -1->Emitted(55, 9) Source(24, 85) + SourceIndex(3) -2 >Emitted(55, 10) Source(24, 86) + SourceIndex(3) -3 >Emitted(55, 12) Source(24, 47) + SourceIndex(3) -4 >Emitted(55, 21) Source(24, 56) + SourceIndex(3) -5 >Emitted(55, 24) Source(24, 47) + SourceIndex(3) -6 >Emitted(55, 43) Source(24, 56) + SourceIndex(3) -7 >Emitted(55, 48) Source(24, 47) + SourceIndex(3) -8 >Emitted(55, 67) Source(24, 56) + SourceIndex(3) -9 >Emitted(55, 75) Source(24, 86) + SourceIndex(3) ---- ->>> })(someOther = normalN.someOther || (normalN.someOther = {})); -1 >^^^^ -2 > ^ -3 > ^^ -4 > ^^^^^^^^^ -5 > ^^^ -6 > ^^^^^^^^^^^^^^^^^ -7 > ^^^^^ -8 > ^^^^^^^^^^^^^^^^^ -9 > ^^^^^^^^ +2 >^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^ 1 > -2 > } -3 > -4 > someOther -5 > -6 > someOther -7 > -8 > someOther -9 > .something { export class someClass {} } -1 >Emitted(56, 5) Source(24, 85) + SourceIndex(3) -2 >Emitted(56, 6) Source(24, 86) + SourceIndex(3) -3 >Emitted(56, 8) Source(24, 37) + SourceIndex(3) -4 >Emitted(56, 17) Source(24, 46) + SourceIndex(3) -5 >Emitted(56, 20) Source(24, 37) + SourceIndex(3) -6 >Emitted(56, 37) Source(24, 46) + SourceIndex(3) -7 >Emitted(56, 42) Source(24, 37) + SourceIndex(3) -8 >Emitted(56, 59) Source(24, 46) + SourceIndex(3) -9 >Emitted(56, 67) Source(24, 86) + SourceIndex(3) ---- ->>> normalN.someImport = someNamespace.C; -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^^^^^^^^^^ -5 > ^ -6 > ^ -7 > ^ -1 > - > /**@internal*/ export import -2 > someImport -3 > = -4 > someNamespace -5 > . -6 > C -7 > ; -1 >Emitted(57, 5) Source(25, 34) + SourceIndex(3) -2 >Emitted(57, 23) Source(25, 44) + SourceIndex(3) -3 >Emitted(57, 26) Source(25, 47) + SourceIndex(3) -4 >Emitted(57, 39) Source(25, 60) + SourceIndex(3) -5 >Emitted(57, 40) Source(25, 61) + SourceIndex(3) -6 >Emitted(57, 41) Source(25, 62) + SourceIndex(3) -7 >Emitted(57, 42) Source(25, 63) + SourceIndex(3) ---- ->>> normalN.internalConst = 10; -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -1 > - > /**@internal*/ export type internalType = internalC; - > /**@internal*/ export const -2 > internalConst -3 > = -4 > 10 -5 > ; -1 >Emitted(58, 5) Source(27, 33) + SourceIndex(3) -2 >Emitted(58, 26) Source(27, 46) + SourceIndex(3) -3 >Emitted(58, 29) Source(27, 49) + SourceIndex(3) -4 >Emitted(58, 31) Source(27, 51) + SourceIndex(3) -5 >Emitted(58, 32) Source(27, 52) + SourceIndex(3) + > + > +2 >interface +3 > NoJsForHereEither +1 >Emitted(5, 1) Source(7, 1) + SourceIndex(0) +2 >Emitted(5, 11) Source(7, 11) + SourceIndex(0) +3 >Emitted(5, 28) Source(7, 28) + SourceIndex(0) --- ->>> var internalEnum; +>>> none: any; 1 >^^^^ 2 > ^^^^ -3 > ^^^^^^^^^^^^ -4 > ^^^^^^^^^^^-> -1 > - > /**@internal*/ -2 > export enum -3 > internalEnum { a, b, c } -1 >Emitted(59, 5) Source(28, 20) + SourceIndex(3) -2 >Emitted(59, 9) Source(28, 32) + SourceIndex(3) -3 >Emitted(59, 21) Source(28, 56) + SourceIndex(3) ---- ->>> (function (internalEnum) { -1->^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 > export enum -3 > internalEnum -1->Emitted(60, 5) Source(28, 20) + SourceIndex(3) -2 >Emitted(60, 16) Source(28, 32) + SourceIndex(3) -3 >Emitted(60, 28) Source(28, 44) + SourceIndex(3) ---- ->>> internalEnum[internalEnum["a"] = 0] = "a"; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^-> -1-> { -2 > a -3 > -1->Emitted(61, 9) Source(28, 47) + SourceIndex(3) -2 >Emitted(61, 50) Source(28, 48) + SourceIndex(3) -3 >Emitted(61, 51) Source(28, 48) + SourceIndex(3) ---- ->>> internalEnum[internalEnum["b"] = 1] = "b"; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^-> -1->, -2 > b -3 > -1->Emitted(62, 9) Source(28, 50) + SourceIndex(3) -2 >Emitted(62, 50) Source(28, 51) + SourceIndex(3) -3 >Emitted(62, 51) Source(28, 51) + SourceIndex(3) +3 > ^^ +4 > ^^^ +5 > ^ +1 > { + > +2 > none +3 > : +4 > any +5 > ; +1 >Emitted(6, 5) Source(8, 5) + SourceIndex(0) +2 >Emitted(6, 9) Source(8, 9) + SourceIndex(0) +3 >Emitted(6, 11) Source(8, 11) + SourceIndex(0) +4 >Emitted(6, 14) Source(8, 14) + SourceIndex(0) +5 >Emitted(6, 15) Source(8, 15) + SourceIndex(0) --- ->>> internalEnum[internalEnum["c"] = 2] = "c"; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->, -2 > c -3 > -1->Emitted(63, 9) Source(28, 53) + SourceIndex(3) -2 >Emitted(63, 50) Source(28, 54) + SourceIndex(3) -3 >Emitted(63, 51) Source(28, 54) + SourceIndex(3) +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(7, 2) Source(9, 2) + SourceIndex(0) --- ->>> })(internalEnum = normalN.internalEnum || (normalN.internalEnum = {})); -1->^^^^ -2 > ^ -3 > ^^ -4 > ^^^^^^^^^^^^ -5 > ^^^ -6 > ^^^^^^^^^^^^^^^^^^^^ -7 > ^^^^^ -8 > ^^^^^^^^^^^^^^^^^^^^ -9 > ^^^^^^^^ -1-> -2 > } -3 > -4 > internalEnum -5 > -6 > internalEnum -7 > -8 > internalEnum -9 > { a, b, c } -1->Emitted(64, 5) Source(28, 55) + SourceIndex(3) -2 >Emitted(64, 6) Source(28, 56) + SourceIndex(3) -3 >Emitted(64, 8) Source(28, 32) + SourceIndex(3) -4 >Emitted(64, 20) Source(28, 44) + SourceIndex(3) -5 >Emitted(64, 23) Source(28, 32) + SourceIndex(3) -6 >Emitted(64, 43) Source(28, 44) + SourceIndex(3) -7 >Emitted(64, 48) Source(28, 32) + SourceIndex(3) -8 >Emitted(64, 68) Source(28, 44) + SourceIndex(3) -9 >Emitted(64, 76) Source(28, 56) + SourceIndex(3) +------------------------------------------------------------------- +emittedFile:/src/first/bin/first-output.d.ts +sourceFile:../first_part3.ts +------------------------------------------------------------------- +>>>declare function f(): string; +1-> +2 >^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^ +5 > ^^^^^^^^^^^^-> +1-> +2 >function +3 > f +4 > () { + > return "JS does hoists"; + > } +1->Emitted(8, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(8, 18) Source(1, 10) + SourceIndex(2) +3 >Emitted(8, 19) Source(1, 11) + SourceIndex(2) +4 >Emitted(8, 30) Source(3, 2) + SourceIndex(2) --- ->>>})(normalN || (normalN = {})); +>>>//# sourceMappingURL=first-output.d.ts.map + +//// [/src/first/bin/first-output.js] file written with same contents +//// [/src/first/bin/first-output.js.map] file written with same contents +//// [/src/first/bin/first-output.js.map.baseline.txt] +=================================================================== +JsFile: first-output.js +mapUrl: first-output.js.map +sourceRoot: +sources: ../first_PART1.ts,../first_part2.ts,../first_part3.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:/src/first/bin/first-output.js +sourceFile:../first_PART1.ts +------------------------------------------------------------------- +>>>var s = "Hello, world"; 1 > -2 >^ -3 > ^^ -4 > ^^^^^^^ -5 > ^^^^^ -6 > ^^^^^^^ -7 > ^^^^^^^^ -8 > ^-> -1 > +2 >^^^^ +3 > ^ +4 > ^^^ +5 > ^^^^^^^^^^^^^^ +6 > ^ +1 >interface TheFirst { + > none: any; + >} > -2 >} -3 > -4 > normalN -5 > -6 > normalN -7 > { - > /**@internal*/ export class C { } - > /**@internal*/ export function foo() {} - > /**@internal*/ export namespace someNamespace { export class C {} } - > /**@internal*/ export namespace someOther.something { export class someClass {} } - > /**@internal*/ export import someImport = someNamespace.C; - > /**@internal*/ export type internalType = internalC; - > /**@internal*/ export const internalConst = 10; - > /**@internal*/ export enum internalEnum { a, b, c } - > } -1 >Emitted(65, 1) Source(29, 1) + SourceIndex(3) -2 >Emitted(65, 2) Source(29, 2) + SourceIndex(3) -3 >Emitted(65, 4) Source(20, 11) + SourceIndex(3) -4 >Emitted(65, 11) Source(20, 18) + SourceIndex(3) -5 >Emitted(65, 16) Source(20, 11) + SourceIndex(3) -6 >Emitted(65, 23) Source(20, 18) + SourceIndex(3) -7 >Emitted(65, 31) Source(29, 2) + SourceIndex(3) + > +2 >const +3 > s +4 > = +5 > "Hello, world" +6 > ; +1 >Emitted(1, 1) Source(5, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(5, 7) + SourceIndex(0) +3 >Emitted(1, 6) Source(5, 8) + SourceIndex(0) +4 >Emitted(1, 9) Source(5, 11) + SourceIndex(0) +5 >Emitted(1, 23) Source(5, 25) + SourceIndex(0) +6 >Emitted(1, 24) Source(5, 26) + SourceIndex(0) --- ->>>var internalC = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - >/**@internal*/ -1->Emitted(66, 1) Source(30, 16) + SourceIndex(3) +>>>console.log(s); +1 > +2 >^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^ +7 > ^ +8 > ^ +9 > ^^^-> +1 > + > + >interface NoJsForHereEither { + > none: any; + >} + > + > +2 >console +3 > . +4 > log +5 > ( +6 > s +7 > ) +8 > ; +1 >Emitted(2, 1) Source(11, 1) + SourceIndex(0) +2 >Emitted(2, 8) Source(11, 8) + SourceIndex(0) +3 >Emitted(2, 9) Source(11, 9) + SourceIndex(0) +4 >Emitted(2, 12) Source(11, 12) + SourceIndex(0) +5 >Emitted(2, 13) Source(11, 13) + SourceIndex(0) +6 >Emitted(2, 14) Source(11, 14) + SourceIndex(0) +7 >Emitted(2, 15) Source(11, 15) + SourceIndex(0) +8 >Emitted(2, 16) Source(11, 16) + SourceIndex(0) --- ->>> function internalC() { -1->^^^^ -2 > ^^-> +------------------------------------------------------------------- +emittedFile:/src/first/bin/first-output.js +sourceFile:../first_part2.ts +------------------------------------------------------------------- +>>>console.log(f()); 1-> -1->Emitted(67, 5) Source(30, 16) + SourceIndex(3) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^-> -1->class internalC { -2 > } -1->Emitted(68, 5) Source(30, 33) + SourceIndex(3) -2 >Emitted(68, 6) Source(30, 34) + SourceIndex(3) ---- ->>> return internalC; -1->^^^^ -2 > ^^^^^^^^^^^^^^^^ +2 >^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^ +7 > ^^ +8 > ^ +9 > ^ 1-> -2 > } -1->Emitted(69, 5) Source(30, 33) + SourceIndex(3) -2 >Emitted(69, 21) Source(30, 34) + SourceIndex(3) +2 >console +3 > . +4 > log +5 > ( +6 > f +7 > () +8 > ) +9 > ; +1->Emitted(3, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(3, 8) Source(1, 8) + SourceIndex(1) +3 >Emitted(3, 9) Source(1, 9) + SourceIndex(1) +4 >Emitted(3, 12) Source(1, 12) + SourceIndex(1) +5 >Emitted(3, 13) Source(1, 13) + SourceIndex(1) +6 >Emitted(3, 14) Source(1, 14) + SourceIndex(1) +7 >Emitted(3, 16) Source(1, 16) + SourceIndex(1) +8 >Emitted(3, 17) Source(1, 17) + SourceIndex(1) +9 >Emitted(3, 18) Source(1, 18) + SourceIndex(1) --- ->>>}()); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^-> +------------------------------------------------------------------- +emittedFile:/src/first/bin/first-output.js +sourceFile:../first_part3.ts +------------------------------------------------------------------- +>>>function f() { 1 > -2 >} -3 > -4 > class internalC {} -1 >Emitted(70, 1) Source(30, 33) + SourceIndex(3) -2 >Emitted(70, 2) Source(30, 34) + SourceIndex(3) -3 >Emitted(70, 2) Source(30, 16) + SourceIndex(3) -4 >Emitted(70, 6) Source(30, 34) + SourceIndex(3) ---- ->>>function internalfoo() { } -1-> 2 >^^^^^^^^^ -3 > ^^^^^^^^^^^ -4 > ^^^^^ -5 > ^ -1-> - >/**@internal*/ -2 >function -3 > internalfoo -4 > () { -5 > } -1->Emitted(71, 1) Source(31, 16) + SourceIndex(3) -2 >Emitted(71, 10) Source(31, 25) + SourceIndex(3) -3 >Emitted(71, 21) Source(31, 36) + SourceIndex(3) -4 >Emitted(71, 26) Source(31, 40) + SourceIndex(3) -5 >Emitted(71, 27) Source(31, 41) + SourceIndex(3) ---- ->>>var internalNamespace; +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^-> 1 > -2 >^^^^ -3 > ^^^^^^^^^^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^-> -1 > - >/**@internal*/ -2 >namespace -3 > internalNamespace -4 > { export class someClass {} } -1 >Emitted(72, 1) Source(32, 16) + SourceIndex(3) -2 >Emitted(72, 5) Source(32, 26) + SourceIndex(3) -3 >Emitted(72, 22) Source(32, 43) + SourceIndex(3) -4 >Emitted(72, 23) Source(32, 73) + SourceIndex(3) ---- ->>>(function (internalNamespace) { -1-> -2 >^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^-> -1-> -2 >namespace -3 > internalNamespace -1->Emitted(73, 1) Source(32, 16) + SourceIndex(3) -2 >Emitted(73, 12) Source(32, 26) + SourceIndex(3) -3 >Emitted(73, 29) Source(32, 43) + SourceIndex(3) +2 >function +3 > f +1 >Emitted(4, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(4, 10) Source(1, 10) + SourceIndex(2) +3 >Emitted(4, 11) Source(1, 11) + SourceIndex(2) --- ->>> var someClass = (function () { +>>> return "JS does hoists"; 1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> { -1->Emitted(74, 5) Source(32, 46) + SourceIndex(3) ---- ->>> function someClass() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(75, 9) Source(32, 46) + SourceIndex(3) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^-> -1->export class someClass { -2 > } -1->Emitted(76, 9) Source(32, 70) + SourceIndex(3) -2 >Emitted(76, 10) Source(32, 71) + SourceIndex(3) ---- ->>> return someClass; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(77, 9) Source(32, 70) + SourceIndex(3) -2 >Emitted(77, 25) Source(32, 71) + SourceIndex(3) +2 > ^^^^^^^ +3 > ^^^^^^^^^^^^^^^^ +4 > ^ +1->() { + > +2 > return +3 > "JS does hoists" +4 > ; +1->Emitted(5, 5) Source(2, 5) + SourceIndex(2) +2 >Emitted(5, 12) Source(2, 12) + SourceIndex(2) +3 >Emitted(5, 28) Source(2, 28) + SourceIndex(2) +4 >Emitted(5, 29) Source(2, 29) + SourceIndex(2) --- ->>> }()); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +>>>} 1 > -2 > } -3 > -4 > export class someClass {} -1 >Emitted(78, 5) Source(32, 70) + SourceIndex(3) -2 >Emitted(78, 6) Source(32, 71) + SourceIndex(3) -3 >Emitted(78, 6) Source(32, 46) + SourceIndex(3) -4 >Emitted(78, 10) Source(32, 71) + SourceIndex(3) ---- ->>> internalNamespace.someClass = someClass; -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^^^^^^^^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 > someClass -3 > {} -4 > -1->Emitted(79, 5) Source(32, 59) + SourceIndex(3) -2 >Emitted(79, 32) Source(32, 68) + SourceIndex(3) -3 >Emitted(79, 44) Source(32, 71) + SourceIndex(3) -4 >Emitted(79, 45) Source(32, 71) + SourceIndex(3) ---- ->>>})(internalNamespace || (internalNamespace = {})); -1-> 2 >^ -3 > ^^ -4 > ^^^^^^^^^^^^^^^^^ -5 > ^^^^^ -6 > ^^^^^^^^^^^^^^^^^ -7 > ^^^^^^^^ -1-> +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > 2 >} -3 > -4 > internalNamespace -5 > -6 > internalNamespace -7 > { export class someClass {} } -1->Emitted(80, 1) Source(32, 72) + SourceIndex(3) -2 >Emitted(80, 2) Source(32, 73) + SourceIndex(3) -3 >Emitted(80, 4) Source(32, 26) + SourceIndex(3) -4 >Emitted(80, 21) Source(32, 43) + SourceIndex(3) -5 >Emitted(80, 26) Source(32, 26) + SourceIndex(3) -6 >Emitted(80, 43) Source(32, 43) + SourceIndex(3) -7 >Emitted(80, 51) Source(32, 73) + SourceIndex(3) +1 >Emitted(6, 1) Source(3, 1) + SourceIndex(2) +2 >Emitted(6, 2) Source(3, 2) + SourceIndex(2) --- ->>>var internalOther; +>>>//# sourceMappingURL=first-output.js.map + +//// [/src/first/bin/first-output.tsbuildinfo] +{ + "bundle": { + "commonSourceDirectory": "..", + "sourceFiles": [ + "../first_PART1.ts", + "../first_part2.ts", + "../first_part3.ts" + ], + "js": { + "sections": [ + { + "pos": 0, + "end": 110, + "kind": "text" + } + ] + }, + "dts": { + "sections": [ + { + "pos": 0, + "end": 157, + "kind": "text" + } + ] + } + }, + "version": "FakeTSVersion" +} + +//// [/src/first/bin/first-output.tsbuildinfo.baseline.txt] +====================================================================== +File:: /src/first/bin/first-output.js +---------------------------------------------------------------------- +text: (0-110) +var s = "Hello, world"; +console.log(s); +console.log(f()); +function f() { + return "JS does hoists"; +} + +====================================================================== +====================================================================== +File:: /src/first/bin/first-output.d.ts +---------------------------------------------------------------------- +text: (0-157) +interface TheFirst { + none: any; +} +declare const s = "Hello, world"; +interface NoJsForHereEither { + none: any; +} +declare function f(): string; + +====================================================================== + +//// [/src/first/first_PART1.ts] +interface TheFirst { + none: any; +} + +const s = "Hello, world"; + +interface NoJsForHereEither { + none: any; +} + +console.log(s); + + +//// [/src/third/thirdjs/output/third-output.d.ts] +interface TheFirst { + none: any; +} +declare const s = "Hello, world"; +interface NoJsForHereEither { + none: any; +} +declare function f(): string; +declare namespace N { +} +declare namespace N { +} +declare class normalC { +} +declare namespace normalN { +} +declare class C { + doSomething(): void; +} +declare var c: C; +//# sourceMappingURL=third-output.d.ts.map + +//// [/src/third/thirdjs/output/third-output.d.ts.map] +{"version":3,"file":"third-output.d.ts","sourceRoot":"","sources":["../../../first/first_PART1.ts","../../../first/first_part3.ts","../../../second/second_part1.ts","../../../second/second_part2.ts","../../third_part1.ts"],"names":[],"mappings":"AAAA,UAAU,QAAQ;IACd,IAAI,EAAE,GAAG,CAAC;CACb;AAED,QAAA,MAAM,CAAC,iBAAiB,CAAC;AAEzB,UAAU,iBAAiB;IACvB,IAAI,EAAE,GAAG,CAAC;CACb;ACRD,iBAAS,CAAC,WAET;ACFD,kBAAU,CAAC,CAAC;CAEX;AAED,kBAAU,CAAC,CAAC;CAMX;AAED,cAAM,OAAO;CAMZ;AACD,kBAAU,OAAO,CAAC;CASjB;AC5BD,cAAM,CAAC;IACH,WAAW;CAGd;ACJD,QAAA,IAAI,CAAC,GAAU,CAAC"} + +//// [/src/third/thirdjs/output/third-output.d.ts.map.baseline.txt] +=================================================================== +JsFile: third-output.d.ts +mapUrl: third-output.d.ts.map +sourceRoot: +sources: ../../../first/first_PART1.ts,../../../first/first_part3.ts,../../../second/second_part1.ts,../../../second/second_part2.ts,../../third_part1.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:/src/third/thirdjs/output/third-output.d.ts +sourceFile:../../../first/first_PART1.ts +------------------------------------------------------------------- +>>>interface TheFirst { 1 > -2 >^^^^ -3 > ^^^^^^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^-> -1 > - >/**@internal*/ -2 >namespace -3 > internalOther -4 > .something { export class someClass {} } -1 >Emitted(81, 1) Source(33, 16) + SourceIndex(3) -2 >Emitted(81, 5) Source(33, 26) + SourceIndex(3) -3 >Emitted(81, 18) Source(33, 39) + SourceIndex(3) -4 >Emitted(81, 19) Source(33, 79) + SourceIndex(3) ---- ->>>(function (internalOther) { -1-> -2 >^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^ -1-> -2 >namespace -3 > internalOther -1->Emitted(82, 1) Source(33, 16) + SourceIndex(3) -2 >Emitted(82, 12) Source(33, 26) + SourceIndex(3) -3 >Emitted(82, 25) Source(33, 39) + SourceIndex(3) +2 >^^^^^^^^^^ +3 > ^^^^^^^^ +1 > +2 >interface +3 > TheFirst +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 11) Source(1, 11) + SourceIndex(0) +3 >Emitted(1, 19) Source(1, 19) + SourceIndex(0) --- ->>> var something; +>>> none: any; 1 >^^^^ 2 > ^^^^ -3 > ^^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^-> -1 >. -2 > -3 > something -4 > { export class someClass {} } -1 >Emitted(83, 5) Source(33, 40) + SourceIndex(3) -2 >Emitted(83, 9) Source(33, 40) + SourceIndex(3) -3 >Emitted(83, 18) Source(33, 49) + SourceIndex(3) -4 >Emitted(83, 19) Source(33, 79) + SourceIndex(3) ---- ->>> (function (something) { -1->^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^-> -1-> -2 > -3 > something -1->Emitted(84, 5) Source(33, 40) + SourceIndex(3) -2 >Emitted(84, 16) Source(33, 40) + SourceIndex(3) -3 >Emitted(84, 25) Source(33, 49) + SourceIndex(3) ---- ->>> var someClass = (function () { -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> { -1->Emitted(85, 9) Source(33, 52) + SourceIndex(3) ---- ->>> function someClass() { -1->^^^^^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(86, 13) Source(33, 52) + SourceIndex(3) ---- ->>> } -1->^^^^^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^-> -1->export class someClass { -2 > } -1->Emitted(87, 13) Source(33, 76) + SourceIndex(3) -2 >Emitted(87, 14) Source(33, 77) + SourceIndex(3) ---- ->>> return someClass; -1->^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(88, 13) Source(33, 76) + SourceIndex(3) -2 >Emitted(88, 29) Source(33, 77) + SourceIndex(3) +3 > ^^ +4 > ^^^ +5 > ^ +1 > { + > +2 > none +3 > : +4 > any +5 > ; +1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +2 >Emitted(2, 9) Source(2, 9) + SourceIndex(0) +3 >Emitted(2, 11) Source(2, 11) + SourceIndex(0) +4 >Emitted(2, 14) Source(2, 14) + SourceIndex(0) +5 >Emitted(2, 15) Source(2, 15) + SourceIndex(0) --- ->>> }()); -1 >^^^^^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > -2 > } -3 > -4 > export class someClass {} -1 >Emitted(89, 9) Source(33, 76) + SourceIndex(3) -2 >Emitted(89, 10) Source(33, 77) + SourceIndex(3) -3 >Emitted(89, 10) Source(33, 52) + SourceIndex(3) -4 >Emitted(89, 14) Source(33, 77) + SourceIndex(3) + >} +1 >Emitted(3, 2) Source(3, 2) + SourceIndex(0) --- ->>> something.someClass = someClass; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^ -3 > ^^^^^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +>>>declare const s = "Hello, world"; 1-> -2 > someClass -3 > {} -4 > -1->Emitted(90, 9) Source(33, 65) + SourceIndex(3) -2 >Emitted(90, 28) Source(33, 74) + SourceIndex(3) -3 >Emitted(90, 40) Source(33, 77) + SourceIndex(3) -4 >Emitted(90, 41) Source(33, 77) + SourceIndex(3) ---- ->>> })(something = internalOther.something || (internalOther.something = {})); -1->^^^^ -2 > ^ -3 > ^^ -4 > ^^^^^^^^^ -5 > ^^^ -6 > ^^^^^^^^^^^^^^^^^^^^^^^ -7 > ^^^^^ -8 > ^^^^^^^^^^^^^^^^^^^^^^^ -9 > ^^^^^^^^ -1-> -2 > } -3 > -4 > something -5 > -6 > something -7 > -8 > something -9 > { export class someClass {} } -1->Emitted(91, 5) Source(33, 78) + SourceIndex(3) -2 >Emitted(91, 6) Source(33, 79) + SourceIndex(3) -3 >Emitted(91, 8) Source(33, 40) + SourceIndex(3) -4 >Emitted(91, 17) Source(33, 49) + SourceIndex(3) -5 >Emitted(91, 20) Source(33, 40) + SourceIndex(3) -6 >Emitted(91, 43) Source(33, 49) + SourceIndex(3) -7 >Emitted(91, 48) Source(33, 40) + SourceIndex(3) -8 >Emitted(91, 71) Source(33, 49) + SourceIndex(3) -9 >Emitted(91, 79) Source(33, 79) + SourceIndex(3) ---- ->>>})(internalOther || (internalOther = {})); -1 > -2 >^ -3 > ^^ -4 > ^^^^^^^^^^^^^ -5 > ^^^^^ -6 > ^^^^^^^^^^^^^ -7 > ^^^^^^^^ -8 > ^^^^^^^^-> -1 > -2 >} -3 > -4 > internalOther -5 > -6 > internalOther -7 > .something { export class someClass {} } -1 >Emitted(92, 1) Source(33, 78) + SourceIndex(3) -2 >Emitted(92, 2) Source(33, 79) + SourceIndex(3) -3 >Emitted(92, 4) Source(33, 26) + SourceIndex(3) -4 >Emitted(92, 17) Source(33, 39) + SourceIndex(3) -5 >Emitted(92, 22) Source(33, 26) + SourceIndex(3) -6 >Emitted(92, 35) Source(33, 39) + SourceIndex(3) -7 >Emitted(92, 43) Source(33, 79) + SourceIndex(3) ---- ->>>var internalImport = internalNamespace.someClass; +2 >^^^^^^^^ +3 > ^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^ +6 > ^ 1-> -2 >^^^^ -3 > ^^^^^^^^^^^^^^ -4 > ^^^ -5 > ^^^^^^^^^^^^^^^^^ -6 > ^ -7 > ^^^^^^^^^ -8 > ^ -1-> - >/**@internal*/ -2 >import -3 > internalImport -4 > = -5 > internalNamespace -6 > . -7 > someClass -8 > ; -1->Emitted(93, 1) Source(34, 16) + SourceIndex(3) -2 >Emitted(93, 5) Source(34, 23) + SourceIndex(3) -3 >Emitted(93, 19) Source(34, 37) + SourceIndex(3) -4 >Emitted(93, 22) Source(34, 40) + SourceIndex(3) -5 >Emitted(93, 39) Source(34, 57) + SourceIndex(3) -6 >Emitted(93, 40) Source(34, 58) + SourceIndex(3) -7 >Emitted(93, 49) Source(34, 67) + SourceIndex(3) -8 >Emitted(93, 50) Source(34, 68) + SourceIndex(3) + > + > +2 > +3 > const +4 > s +5 > = "Hello, world" +6 > ; +1->Emitted(4, 1) Source(5, 1) + SourceIndex(0) +2 >Emitted(4, 9) Source(5, 1) + SourceIndex(0) +3 >Emitted(4, 15) Source(5, 7) + SourceIndex(0) +4 >Emitted(4, 16) Source(5, 8) + SourceIndex(0) +5 >Emitted(4, 33) Source(5, 25) + SourceIndex(0) +6 >Emitted(4, 34) Source(5, 26) + SourceIndex(0) --- ->>>var internalConst = 10; +>>>interface NoJsForHereEither { 1 > -2 >^^^^ -3 > ^^^^^^^^^^^^^ -4 > ^^^ -5 > ^^ -6 > ^ -1 > - >/**@internal*/ type internalType = internalC; - >/**@internal*/ -2 >const -3 > internalConst -4 > = -5 > 10 -6 > ; -1 >Emitted(94, 1) Source(36, 16) + SourceIndex(3) -2 >Emitted(94, 5) Source(36, 22) + SourceIndex(3) -3 >Emitted(94, 18) Source(36, 35) + SourceIndex(3) -4 >Emitted(94, 21) Source(36, 38) + SourceIndex(3) -5 >Emitted(94, 23) Source(36, 40) + SourceIndex(3) -6 >Emitted(94, 24) Source(36, 41) + SourceIndex(3) +2 >^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^ +1 > + > + > +2 >interface +3 > NoJsForHereEither +1 >Emitted(5, 1) Source(7, 1) + SourceIndex(0) +2 >Emitted(5, 11) Source(7, 11) + SourceIndex(0) +3 >Emitted(5, 28) Source(7, 28) + SourceIndex(0) +--- +>>> none: any; +1 >^^^^ +2 > ^^^^ +3 > ^^ +4 > ^^^ +5 > ^ +1 > { + > +2 > none +3 > : +4 > any +5 > ; +1 >Emitted(6, 5) Source(8, 5) + SourceIndex(0) +2 >Emitted(6, 9) Source(8, 9) + SourceIndex(0) +3 >Emitted(6, 11) Source(8, 11) + SourceIndex(0) +4 >Emitted(6, 14) Source(8, 14) + SourceIndex(0) +5 >Emitted(6, 15) Source(8, 15) + SourceIndex(0) --- ->>>var internalEnum; +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > -2 >^^^^ -3 > ^^^^^^^^^^^^ -4 > ^^^^^^^^^^^-> -1 > - >/**@internal*/ -2 >enum -3 > internalEnum { a, b, c } -1 >Emitted(95, 1) Source(37, 16) + SourceIndex(3) -2 >Emitted(95, 5) Source(37, 21) + SourceIndex(3) -3 >Emitted(95, 17) Source(37, 45) + SourceIndex(3) + >} +1 >Emitted(7, 2) Source(9, 2) + SourceIndex(0) --- ->>>(function (internalEnum) { +------------------------------------------------------------------- +emittedFile:/src/third/thirdjs/output/third-output.d.ts +sourceFile:../../../first/first_part3.ts +------------------------------------------------------------------- +>>>declare function f(): string; 1-> -2 >^^^^^^^^^^^ -3 > ^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^-> +2 >^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^ 1-> -2 >enum -3 > internalEnum -1->Emitted(96, 1) Source(37, 16) + SourceIndex(3) -2 >Emitted(96, 12) Source(37, 21) + SourceIndex(3) -3 >Emitted(96, 24) Source(37, 33) + SourceIndex(3) ---- ->>> internalEnum[internalEnum["a"] = 0] = "a"; -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^-> -1-> { -2 > a -3 > -1->Emitted(97, 5) Source(37, 36) + SourceIndex(3) -2 >Emitted(97, 46) Source(37, 37) + SourceIndex(3) -3 >Emitted(97, 47) Source(37, 37) + SourceIndex(3) ---- ->>> internalEnum[internalEnum["b"] = 1] = "b"; -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^-> -1->, -2 > b -3 > -1->Emitted(98, 5) Source(37, 39) + SourceIndex(3) -2 >Emitted(98, 46) Source(37, 40) + SourceIndex(3) -3 >Emitted(98, 47) Source(37, 40) + SourceIndex(3) ---- ->>> internalEnum[internalEnum["c"] = 2] = "c"; -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -1->, -2 > c -3 > -1->Emitted(99, 5) Source(37, 42) + SourceIndex(3) -2 >Emitted(99, 46) Source(37, 43) + SourceIndex(3) -3 >Emitted(99, 47) Source(37, 43) + SourceIndex(3) ---- ->>>})(internalEnum || (internalEnum = {})); -1 > -2 >^ -3 > ^^ -4 > ^^^^^^^^^^^^ -5 > ^^^^^ -6 > ^^^^^^^^^^^^ -7 > ^^^^^^^^ -1 > -2 >} -3 > -4 > internalEnum -5 > -6 > internalEnum -7 > { a, b, c } -1 >Emitted(100, 1) Source(37, 44) + SourceIndex(3) -2 >Emitted(100, 2) Source(37, 45) + SourceIndex(3) -3 >Emitted(100, 4) Source(37, 21) + SourceIndex(3) -4 >Emitted(100, 16) Source(37, 33) + SourceIndex(3) -5 >Emitted(100, 21) Source(37, 21) + SourceIndex(3) -6 >Emitted(100, 33) Source(37, 33) + SourceIndex(3) -7 >Emitted(100, 41) Source(37, 45) + SourceIndex(3) +2 >function +3 > f +4 > () { + > return "JS does hoists"; + > } +1->Emitted(8, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(8, 18) Source(1, 10) + SourceIndex(1) +3 >Emitted(8, 19) Source(1, 11) + SourceIndex(1) +4 >Emitted(8, 30) Source(3, 2) + SourceIndex(1) --- ------------------------------------------------------------------- -emittedFile:/src/third/thirdjs/output/third-output.js -sourceFile:../../../second/second_part2.ts +emittedFile:/src/third/thirdjs/output/third-output.d.ts +sourceFile:../../../second/second_part1.ts ------------------------------------------------------------------- ->>>var C = (function () { +>>>declare namespace N { 1 > -2 >^^^^^^^^^^^^^^^^^^^-> +2 >^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^ 1 > -1 >Emitted(101, 1) Source(1, 1) + SourceIndex(4) +2 >namespace +3 > N +4 > +1 >Emitted(9, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(9, 19) Source(1, 11) + SourceIndex(2) +3 >Emitted(9, 20) Source(1, 12) + SourceIndex(2) +4 >Emitted(9, 21) Source(1, 13) + SourceIndex(2) --- ->>> function C() { -1->^^^^ -2 > ^^-> +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^-> +1 >{ + > // Comment text + >} +1 >Emitted(10, 2) Source(3, 2) + SourceIndex(2) +--- +>>>declare namespace N { +1-> +2 >^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^ 1-> -1->Emitted(102, 5) Source(1, 1) + SourceIndex(4) + > + > +2 >namespace +3 > N +4 > +1->Emitted(11, 1) Source(5, 1) + SourceIndex(2) +2 >Emitted(11, 19) Source(5, 11) + SourceIndex(2) +3 >Emitted(11, 20) Source(5, 12) + SourceIndex(2) +4 >Emitted(11, 21) Source(5, 13) + SourceIndex(2) --- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->class C { - > doSomething() { - > console.log("something got done"); +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1 >{ + > function f() { + > console.log('testing'); > } > -2 > } -1->Emitted(103, 5) Source(5, 1) + SourceIndex(4) -2 >Emitted(103, 6) Source(5, 2) + SourceIndex(4) + > f(); + >} +1 >Emitted(12, 2) Source(11, 2) + SourceIndex(2) --- ->>> C.prototype.doSomething = function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^^^^^^^^^^-> +>>>declare class normalC { 1-> -2 > doSomething -3 > -1->Emitted(104, 5) Source(2, 5) + SourceIndex(4) -2 >Emitted(104, 28) Source(2, 16) + SourceIndex(4) -3 >Emitted(104, 31) Source(2, 5) + SourceIndex(4) ---- ->>> console.log("something got done"); -1->^^^^^^^^ -2 > ^^^^^^^ -3 > ^ -4 > ^^^ -5 > ^ -6 > ^^^^^^^^^^^^^^^^^^^^ -7 > ^ -8 > ^ -1->doSomething() { - > -2 > console -3 > . -4 > log -5 > ( -6 > "something got done" -7 > ) -8 > ; -1->Emitted(105, 9) Source(3, 9) + SourceIndex(4) -2 >Emitted(105, 16) Source(3, 16) + SourceIndex(4) -3 >Emitted(105, 17) Source(3, 17) + SourceIndex(4) -4 >Emitted(105, 20) Source(3, 20) + SourceIndex(4) -5 >Emitted(105, 21) Source(3, 21) + SourceIndex(4) -6 >Emitted(105, 41) Source(3, 41) + SourceIndex(4) -7 >Emitted(105, 42) Source(3, 42) + SourceIndex(4) -8 >Emitted(105, 43) Source(3, 43) + SourceIndex(4) +2 >^^^^^^^^^^^^^^ +3 > ^^^^^^^ +1-> + > + > +2 >class +3 > normalC +1->Emitted(13, 1) Source(13, 1) + SourceIndex(2) +2 >Emitted(13, 15) Source(13, 7) + SourceIndex(2) +3 >Emitted(13, 22) Source(13, 14) + SourceIndex(2) --- ->>> }; -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(106, 5) Source(4, 5) + SourceIndex(4) -2 >Emitted(106, 6) Source(4, 6) + SourceIndex(4) +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > { + > /**@internal*/ constructor() { } + > /**@internal*/ prop: string; + > /**@internal*/ method() { } + > /**@internal*/ get c() { return 10; } + > /**@internal*/ set c(val: number) { } + >} +1 >Emitted(14, 2) Source(19, 2) + SourceIndex(2) --- ->>> return C; -1->^^^^ -2 > ^^^^^^^^ +>>>declare namespace normalN { 1-> +2 >^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^ +4 > ^ +1-> > -2 > } -1->Emitted(107, 5) Source(5, 1) + SourceIndex(4) -2 >Emitted(107, 13) Source(5, 2) + SourceIndex(4) +2 >namespace +3 > normalN +4 > +1->Emitted(15, 1) Source(20, 1) + SourceIndex(2) +2 >Emitted(15, 19) Source(20, 11) + SourceIndex(2) +3 >Emitted(15, 26) Source(20, 18) + SourceIndex(2) +4 >Emitted(15, 27) Source(20, 19) + SourceIndex(2) --- ->>>}()); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > class C { - > doSomething() { - > console.log("something got done"); - > } - > } -1 >Emitted(108, 1) Source(5, 1) + SourceIndex(4) -2 >Emitted(108, 2) Source(5, 2) + SourceIndex(4) -3 >Emitted(108, 2) Source(1, 1) + SourceIndex(4) -4 >Emitted(108, 6) Source(5, 2) + SourceIndex(4) +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^-> +1 >{ + > /**@internal*/ export class C { } + > /**@internal*/ export function foo() {} + > /**@internal*/ export namespace someNamespace { export class C {} } + > /**@internal*/ export namespace someOther.something { export class someClass {} } + > /**@internal*/ export import someImport = someNamespace.C; + > /**@internal*/ export type internalType = internalC; + > /**@internal*/ export const internalConst = 10; + > /**@internal*/ export enum internalEnum { a, b, c } + >} +1 >Emitted(16, 2) Source(29, 2) + SourceIndex(2) --- ------------------------------------------------------------------- -emittedFile:/src/third/thirdjs/output/third-output.js -sourceFile:../../third_part1.ts +emittedFile:/src/third/thirdjs/output/third-output.d.ts +sourceFile:../../../second/second_part2.ts ------------------------------------------------------------------- ->>>var c = new C(); +>>>declare class C { 1-> -2 >^^^^ -3 > ^ -4 > ^^^ -5 > ^^^^ -6 > ^ -7 > ^^ -8 > ^ -9 > ^-> +2 >^^^^^^^^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^-> 1-> -2 >var -3 > c -4 > = -5 > new -6 > C -7 > () -8 > ; -1->Emitted(109, 1) Source(1, 1) + SourceIndex(5) -2 >Emitted(109, 5) Source(1, 5) + SourceIndex(5) -3 >Emitted(109, 6) Source(1, 6) + SourceIndex(5) -4 >Emitted(109, 9) Source(1, 9) + SourceIndex(5) -5 >Emitted(109, 13) Source(1, 13) + SourceIndex(5) -6 >Emitted(109, 14) Source(1, 14) + SourceIndex(5) -7 >Emitted(109, 16) Source(1, 16) + SourceIndex(5) -8 >Emitted(109, 17) Source(1, 17) + SourceIndex(5) +2 >class +3 > C +1->Emitted(17, 1) Source(1, 1) + SourceIndex(3) +2 >Emitted(17, 15) Source(1, 7) + SourceIndex(3) +3 >Emitted(17, 16) Source(1, 8) + SourceIndex(3) +--- +>>> doSomething(): void; +1->^^^^ +2 > ^^^^^^^^^^^ +1-> { + > +2 > doSomething +1->Emitted(18, 5) Source(2, 5) + SourceIndex(3) +2 >Emitted(18, 16) Source(2, 16) + SourceIndex(3) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^-> +1 >() { + > console.log("something got done"); + > } + >} +1 >Emitted(19, 2) Source(5, 2) + SourceIndex(3) --- ->>>c.doSomething(); +------------------------------------------------------------------- +emittedFile:/src/third/thirdjs/output/third-output.d.ts +sourceFile:../../third_part1.ts +------------------------------------------------------------------- +>>>declare var c: C; 1-> -2 >^ -3 > ^ -4 > ^^^^^^^^^^^ -5 > ^^ -6 > ^ -7 > ^^^^^^^^^^^^^^^^^^^^^^^-> +2 >^^^^^^^^ +3 > ^^^^ +4 > ^ +5 > ^^^ +6 > ^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> - > -2 >c -3 > . -4 > doSomething -5 > () -6 > ; -1->Emitted(110, 1) Source(2, 1) + SourceIndex(5) -2 >Emitted(110, 2) Source(2, 2) + SourceIndex(5) -3 >Emitted(110, 3) Source(2, 3) + SourceIndex(5) -4 >Emitted(110, 14) Source(2, 14) + SourceIndex(5) -5 >Emitted(110, 16) Source(2, 16) + SourceIndex(5) -6 >Emitted(110, 17) Source(2, 17) + SourceIndex(5) +2 > +3 > var +4 > c +5 > = new C() +6 > ; +1->Emitted(20, 1) Source(1, 1) + SourceIndex(4) +2 >Emitted(20, 9) Source(1, 1) + SourceIndex(4) +3 >Emitted(20, 13) Source(1, 5) + SourceIndex(4) +4 >Emitted(20, 14) Source(1, 6) + SourceIndex(4) +5 >Emitted(20, 17) Source(1, 16) + SourceIndex(4) +6 >Emitted(20, 18) Source(1, 17) + SourceIndex(4) --- ->>>//# sourceMappingURL=third-output.js.map +>>>//# sourceMappingURL=third-output.d.ts.map //// [/src/third/thirdjs/output/third-output.tsbuildinfo] { diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/stripInternal-jsdoc-style-comment.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/stripInternal-jsdoc-style-comment.js index e57ae860e8868..44b2e3afe3f08 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/stripInternal-jsdoc-style-comment.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/stripInternal-jsdoc-style-comment.js @@ -1,3 +1,26 @@ +//// [/lib/incremental-headers-change-without-dts-changesOutput.txt] +/lib/tsc --b /src/third --verbose +12:08:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:08:00 AM - Project 'src/first/tsconfig.json' is out of date because oldest output 'src/first/bin/first-output.js' is older than newest input 'src/first/first_PART1.ts' + +12:08:00 AM - Building project '/src/first/tsconfig.json'... + +12:08:00 AM - Project 'src/second/tsconfig.json' is up to date because newest input 'src/second/second_part1.ts' is older than oldest output 'src/2/second-output.js' + +12:08:00 AM - Project 'src/third/tsconfig.json' is out of date because output of its dependency 'src/first' has changed + +12:08:00 AM - Updating output of project '/src/third/tsconfig.json'... + +12:08:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... + +exitCode:: 0 + + +//// [/src/first/bin/first-output.d.ts] file written with same contents //// [/src/first/bin/first-output.d.ts.map] {"version":3,"file":"first-output.d.ts","sourceRoot":"","sources":["../first_PART1.ts","../first_part2.ts","../first_part3.ts"],"names":[],"mappings":"AAAA,UAAU,QAAQ;IACd,IAAI,EAAE,GAAG,CAAC;CACb;AAED,QAAA,MAAM,CAAC,iBAAiB,CAAC;AAEzB,UAAU,iBAAiB;IACvB,IAAI,EAAE,GAAG,CAAC;CACb;AERD,iBAAS,CAAC,WAET"} @@ -131,6 +154,8 @@ sourceFile:../first_part3.ts --- >>>//# sourceMappingURL=first-output.d.ts.map +//// [/src/first/bin/first-output.js] file written with same contents +//// [/src/first/bin/first-output.js.map] file written with same contents //// [/src/first/bin/first-output.js.map.baseline.txt] =================================================================== JsFile: first-output.js @@ -671,1640 +696,6 @@ sourceFile:../../third_part1.ts --- >>>//# sourceMappingURL=third-output.d.ts.map -//// [/src/third/thirdjs/output/third-output.js.map.baseline.txt] -=================================================================== -JsFile: third-output.js -mapUrl: third-output.js.map -sourceRoot: -sources: ../../../first/first_PART1.ts,../../../first/first_part2.ts,../../../first/first_part3.ts,../../../second/second_part1.ts,../../../second/second_part2.ts,../../third_part1.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:/src/third/thirdjs/output/third-output.js -sourceFile:../../../first/first_PART1.ts -------------------------------------------------------------------- ->>>var s = "Hello, world"; -1 > -2 >^^^^ -3 > ^ -4 > ^^^ -5 > ^^^^^^^^^^^^^^ -6 > ^ -1 >interface TheFirst { - > none: any; - >} - > - > -2 >const -3 > s -4 > = -5 > "Hello, world" -6 > ; -1 >Emitted(1, 1) Source(5, 1) + SourceIndex(0) -2 >Emitted(1, 5) Source(5, 7) + SourceIndex(0) -3 >Emitted(1, 6) Source(5, 8) + SourceIndex(0) -4 >Emitted(1, 9) Source(5, 11) + SourceIndex(0) -5 >Emitted(1, 23) Source(5, 25) + SourceIndex(0) -6 >Emitted(1, 24) Source(5, 26) + SourceIndex(0) ---- ->>>console.log(s); -1 > -2 >^^^^^^^ -3 > ^ -4 > ^^^ -5 > ^ -6 > ^ -7 > ^ -8 > ^ -9 > ^^^-> -1 > - > - >interface NoJsForHereEither { - > none: any; - >} - > - > -2 >console -3 > . -4 > log -5 > ( -6 > s -7 > ) -8 > ; -1 >Emitted(2, 1) Source(11, 1) + SourceIndex(0) -2 >Emitted(2, 8) Source(11, 8) + SourceIndex(0) -3 >Emitted(2, 9) Source(11, 9) + SourceIndex(0) -4 >Emitted(2, 12) Source(11, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(11, 13) + SourceIndex(0) -6 >Emitted(2, 14) Source(11, 14) + SourceIndex(0) -7 >Emitted(2, 15) Source(11, 15) + SourceIndex(0) -8 >Emitted(2, 16) Source(11, 16) + SourceIndex(0) ---- -------------------------------------------------------------------- -emittedFile:/src/third/thirdjs/output/third-output.js -sourceFile:../../../first/first_part2.ts -------------------------------------------------------------------- ->>>console.log(f()); -1-> -2 >^^^^^^^ -3 > ^ -4 > ^^^ -5 > ^ -6 > ^ -7 > ^^ -8 > ^ -9 > ^ -1-> -2 >console -3 > . -4 > log -5 > ( -6 > f -7 > () -8 > ) -9 > ; -1->Emitted(3, 1) Source(1, 1) + SourceIndex(1) -2 >Emitted(3, 8) Source(1, 8) + SourceIndex(1) -3 >Emitted(3, 9) Source(1, 9) + SourceIndex(1) -4 >Emitted(3, 12) Source(1, 12) + SourceIndex(1) -5 >Emitted(3, 13) Source(1, 13) + SourceIndex(1) -6 >Emitted(3, 14) Source(1, 14) + SourceIndex(1) -7 >Emitted(3, 16) Source(1, 16) + SourceIndex(1) -8 >Emitted(3, 17) Source(1, 17) + SourceIndex(1) -9 >Emitted(3, 18) Source(1, 18) + SourceIndex(1) ---- -------------------------------------------------------------------- -emittedFile:/src/third/thirdjs/output/third-output.js -sourceFile:../../../first/first_part3.ts -------------------------------------------------------------------- ->>>function f() { -1 > -2 >^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^-> -1 > -2 >function -3 > f -1 >Emitted(4, 1) Source(1, 1) + SourceIndex(2) -2 >Emitted(4, 10) Source(1, 10) + SourceIndex(2) -3 >Emitted(4, 11) Source(1, 11) + SourceIndex(2) ---- ->>> return "JS does hoists"; -1->^^^^ -2 > ^^^^^^^ -3 > ^^^^^^^^^^^^^^^^ -4 > ^ -1->() { - > -2 > return -3 > "JS does hoists" -4 > ; -1->Emitted(5, 5) Source(2, 5) + SourceIndex(2) -2 >Emitted(5, 12) Source(2, 12) + SourceIndex(2) -3 >Emitted(5, 28) Source(2, 28) + SourceIndex(2) -4 >Emitted(5, 29) Source(2, 29) + SourceIndex(2) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^-> -1 > - > -2 >} -1 >Emitted(6, 1) Source(3, 1) + SourceIndex(2) -2 >Emitted(6, 2) Source(3, 2) + SourceIndex(2) ---- -------------------------------------------------------------------- -emittedFile:/src/third/thirdjs/output/third-output.js -sourceFile:../../../second/second_part1.ts -------------------------------------------------------------------- ->>>var N; -1-> -2 >^^^^ -3 > ^ -4 > ^ -5 > ^^^^^^^^^^-> -1->namespace N { - > // Comment text - >} - > - > -2 >namespace -3 > N -4 > { - > function f() { - > console.log('testing'); - > } - > - > f(); - > } -1->Emitted(7, 1) Source(5, 1) + SourceIndex(3) -2 >Emitted(7, 5) Source(5, 11) + SourceIndex(3) -3 >Emitted(7, 6) Source(5, 12) + SourceIndex(3) -4 >Emitted(7, 7) Source(11, 2) + SourceIndex(3) ---- ->>>(function (N) { -1-> -2 >^^^^^^^^^^^ -3 > ^ -4 > ^^^^^^^-> -1-> -2 >namespace -3 > N -1->Emitted(8, 1) Source(5, 1) + SourceIndex(3) -2 >Emitted(8, 12) Source(5, 11) + SourceIndex(3) -3 >Emitted(8, 13) Source(5, 12) + SourceIndex(3) ---- ->>> function f() { -1->^^^^ -2 > ^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^-> -1-> { - > -2 > function -3 > f -1->Emitted(9, 5) Source(6, 5) + SourceIndex(3) -2 >Emitted(9, 14) Source(6, 14) + SourceIndex(3) -3 >Emitted(9, 15) Source(6, 15) + SourceIndex(3) ---- ->>> console.log('testing'); -1->^^^^^^^^ -2 > ^^^^^^^ -3 > ^ -4 > ^^^ -5 > ^ -6 > ^^^^^^^^^ -7 > ^ -8 > ^ -1->() { - > -2 > console -3 > . -4 > log -5 > ( -6 > 'testing' -7 > ) -8 > ; -1->Emitted(10, 9) Source(7, 9) + SourceIndex(3) -2 >Emitted(10, 16) Source(7, 16) + SourceIndex(3) -3 >Emitted(10, 17) Source(7, 17) + SourceIndex(3) -4 >Emitted(10, 20) Source(7, 20) + SourceIndex(3) -5 >Emitted(10, 21) Source(7, 21) + SourceIndex(3) -6 >Emitted(10, 30) Source(7, 30) + SourceIndex(3) -7 >Emitted(10, 31) Source(7, 31) + SourceIndex(3) -8 >Emitted(10, 32) Source(7, 32) + SourceIndex(3) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^-> -1 > - > -2 > } -1 >Emitted(11, 5) Source(8, 5) + SourceIndex(3) -2 >Emitted(11, 6) Source(8, 6) + SourceIndex(3) ---- ->>> f(); -1->^^^^ -2 > ^ -3 > ^^ -4 > ^ -5 > ^^^^^^^^^^^-> -1-> - > - > -2 > f -3 > () -4 > ; -1->Emitted(12, 5) Source(10, 5) + SourceIndex(3) -2 >Emitted(12, 6) Source(10, 6) + SourceIndex(3) -3 >Emitted(12, 8) Source(10, 8) + SourceIndex(3) -4 >Emitted(12, 9) Source(10, 9) + SourceIndex(3) ---- ->>>})(N || (N = {})); -1-> -2 >^ -3 > ^^ -4 > ^ -5 > ^^^^^ -6 > ^ -7 > ^^^^^^^^ -8 > ^^^^^^^^^^^-> -1-> - > -2 >} -3 > -4 > N -5 > -6 > N -7 > { - > function f() { - > console.log('testing'); - > } - > - > f(); - > } -1->Emitted(13, 1) Source(11, 1) + SourceIndex(3) -2 >Emitted(13, 2) Source(11, 2) + SourceIndex(3) -3 >Emitted(13, 4) Source(5, 11) + SourceIndex(3) -4 >Emitted(13, 5) Source(5, 12) + SourceIndex(3) -5 >Emitted(13, 10) Source(5, 11) + SourceIndex(3) -6 >Emitted(13, 11) Source(5, 12) + SourceIndex(3) -7 >Emitted(13, 19) Source(11, 2) + SourceIndex(3) ---- ->>>var normalC = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > - > -1->Emitted(14, 1) Source(13, 1) + SourceIndex(3) ---- ->>> function normalC() { -1->^^^^ -2 > ^^-> -1->class normalC { - > /**@internal*/ -1->Emitted(15, 5) Source(14, 20) + SourceIndex(3) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->constructor() { -2 > } -1->Emitted(16, 5) Source(14, 36) + SourceIndex(3) -2 >Emitted(16, 6) Source(14, 37) + SourceIndex(3) ---- ->>> normalC.prototype.method = function () { }; -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^^^^^^^^^^^ -5 > ^ -6 > ^^^^^^-> -1-> - > /**@internal*/ prop: string; - > /**@internal*/ -2 > method -3 > -4 > method() { -5 > } -1->Emitted(17, 5) Source(16, 20) + SourceIndex(3) -2 >Emitted(17, 29) Source(16, 26) + SourceIndex(3) -3 >Emitted(17, 32) Source(16, 20) + SourceIndex(3) -4 >Emitted(17, 46) Source(16, 31) + SourceIndex(3) -5 >Emitted(17, 47) Source(16, 32) + SourceIndex(3) ---- ->>> Object.defineProperty(normalC.prototype, "c", { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^^^^^^^^^^ -1-> - > /**@internal*/ -2 > get -3 > c -1->Emitted(18, 5) Source(17, 20) + SourceIndex(3) -2 >Emitted(18, 27) Source(17, 24) + SourceIndex(3) -3 >Emitted(18, 49) Source(17, 25) + SourceIndex(3) ---- ->>> get: function () { return 10; }, -1 >^^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^ -3 > ^^^^^^^ -4 > ^^ -5 > ^ -6 > ^ -7 > ^ -1 > -2 > get c() { -3 > return -4 > 10 -5 > ; -6 > -7 > } -1 >Emitted(19, 14) Source(17, 20) + SourceIndex(3) -2 >Emitted(19, 28) Source(17, 30) + SourceIndex(3) -3 >Emitted(19, 35) Source(17, 37) + SourceIndex(3) -4 >Emitted(19, 37) Source(17, 39) + SourceIndex(3) -5 >Emitted(19, 38) Source(17, 40) + SourceIndex(3) -6 >Emitted(19, 39) Source(17, 41) + SourceIndex(3) -7 >Emitted(19, 40) Source(17, 42) + SourceIndex(3) ---- ->>> set: function (val) { }, -1 >^^^^^^^^^^^^^ -2 > ^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^ -1 > - > /**@internal*/ -2 > set c( -3 > val: number -4 > ) { -5 > } -1 >Emitted(20, 14) Source(18, 20) + SourceIndex(3) -2 >Emitted(20, 24) Source(18, 26) + SourceIndex(3) -3 >Emitted(20, 27) Source(18, 37) + SourceIndex(3) -4 >Emitted(20, 31) Source(18, 41) + SourceIndex(3) -5 >Emitted(20, 32) Source(18, 42) + SourceIndex(3) ---- ->>> enumerable: true, ->>> configurable: true ->>> }); -1 >^^^^^^^ -2 > ^^^^^^^^^^^^^-> -1 > -1 >Emitted(23, 8) Source(17, 42) + SourceIndex(3) ---- ->>> return normalC; -1->^^^^ -2 > ^^^^^^^^^^^^^^ -1-> - > /**@internal*/ set c(val: number) { } - > -2 > } -1->Emitted(24, 5) Source(19, 1) + SourceIndex(3) -2 >Emitted(24, 19) Source(19, 2) + SourceIndex(3) ---- ->>>}()); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^-> -1 > -2 >} -3 > -4 > class normalC { - > /**@internal*/ constructor() { } - > /**@internal*/ prop: string; - > /**@internal*/ method() { } - > /**@internal*/ get c() { return 10; } - > /**@internal*/ set c(val: number) { } - > } -1 >Emitted(25, 1) Source(19, 1) + SourceIndex(3) -2 >Emitted(25, 2) Source(19, 2) + SourceIndex(3) -3 >Emitted(25, 2) Source(13, 1) + SourceIndex(3) -4 >Emitted(25, 6) Source(19, 2) + SourceIndex(3) ---- ->>>var normalN; -1-> -2 >^^^^ -3 > ^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^-> -1-> - > -2 >namespace -3 > normalN -4 > { - > /**@internal*/ export class C { } - > /**@internal*/ export function foo() {} - > /**@internal*/ export namespace someNamespace { export class C {} } - > /**@internal*/ export namespace someOther.something { export class someClass {} } - > /**@internal*/ export import someImport = someNamespace.C; - > /**@internal*/ export type internalType = internalC; - > /**@internal*/ export const internalConst = 10; - > /**@internal*/ export enum internalEnum { a, b, c } - > } -1->Emitted(26, 1) Source(20, 1) + SourceIndex(3) -2 >Emitted(26, 5) Source(20, 11) + SourceIndex(3) -3 >Emitted(26, 12) Source(20, 18) + SourceIndex(3) -4 >Emitted(26, 13) Source(29, 2) + SourceIndex(3) ---- ->>>(function (normalN) { -1-> -2 >^^^^^^^^^^^ -3 > ^^^^^^^ -4 > ^^^^^^^^^-> -1-> -2 >namespace -3 > normalN -1->Emitted(27, 1) Source(20, 1) + SourceIndex(3) -2 >Emitted(27, 12) Source(20, 11) + SourceIndex(3) -3 >Emitted(27, 19) Source(20, 18) + SourceIndex(3) ---- ->>> var C = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^-> -1-> { - > /**@internal*/ -1->Emitted(28, 5) Source(21, 20) + SourceIndex(3) ---- ->>> function C() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(29, 9) Source(21, 20) + SourceIndex(3) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^-> -1->export class C { -2 > } -1->Emitted(30, 9) Source(21, 37) + SourceIndex(3) -2 >Emitted(30, 10) Source(21, 38) + SourceIndex(3) ---- ->>> return C; -1->^^^^^^^^ -2 > ^^^^^^^^ -1-> -2 > } -1->Emitted(31, 9) Source(21, 37) + SourceIndex(3) -2 >Emitted(31, 17) Source(21, 38) + SourceIndex(3) ---- ->>> }()); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class C { } -1 >Emitted(32, 5) Source(21, 37) + SourceIndex(3) -2 >Emitted(32, 6) Source(21, 38) + SourceIndex(3) -3 >Emitted(32, 6) Source(21, 20) + SourceIndex(3) -4 >Emitted(32, 10) Source(21, 38) + SourceIndex(3) ---- ->>> normalN.C = C; -1->^^^^ -2 > ^^^^^^^^^ -3 > ^^^^ -4 > ^ -5 > ^^^^^-> -1-> -2 > C -3 > { } -4 > -1->Emitted(33, 5) Source(21, 33) + SourceIndex(3) -2 >Emitted(33, 14) Source(21, 34) + SourceIndex(3) -3 >Emitted(33, 18) Source(21, 38) + SourceIndex(3) -4 >Emitted(33, 19) Source(21, 38) + SourceIndex(3) ---- ->>> function foo() { } -1->^^^^ -2 > ^^^^^^^^^ -3 > ^^^ -4 > ^^^^^ -5 > ^ -6 > ^-> -1-> - > /**@internal*/ -2 > export function -3 > foo -4 > () { -5 > } -1->Emitted(34, 5) Source(22, 20) + SourceIndex(3) -2 >Emitted(34, 14) Source(22, 36) + SourceIndex(3) -3 >Emitted(34, 17) Source(22, 39) + SourceIndex(3) -4 >Emitted(34, 22) Source(22, 43) + SourceIndex(3) -5 >Emitted(34, 23) Source(22, 44) + SourceIndex(3) ---- ->>> normalN.foo = foo; -1->^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^ -4 > ^ -5 > ^-> -1-> -2 > foo -3 > () {} -4 > -1->Emitted(35, 5) Source(22, 36) + SourceIndex(3) -2 >Emitted(35, 16) Source(22, 39) + SourceIndex(3) -3 >Emitted(35, 22) Source(22, 44) + SourceIndex(3) -4 >Emitted(35, 23) Source(22, 44) + SourceIndex(3) ---- ->>> var someNamespace; -1->^^^^ -2 > ^^^^ -3 > ^^^^^^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^-> -1-> - > /**@internal*/ -2 > export namespace -3 > someNamespace -4 > { export class C {} } -1->Emitted(36, 5) Source(23, 20) + SourceIndex(3) -2 >Emitted(36, 9) Source(23, 37) + SourceIndex(3) -3 >Emitted(36, 22) Source(23, 50) + SourceIndex(3) -4 >Emitted(36, 23) Source(23, 72) + SourceIndex(3) ---- ->>> (function (someNamespace) { -1->^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^ -4 > ^^^-> -1-> -2 > export namespace -3 > someNamespace -1->Emitted(37, 5) Source(23, 20) + SourceIndex(3) -2 >Emitted(37, 16) Source(23, 37) + SourceIndex(3) -3 >Emitted(37, 29) Source(23, 50) + SourceIndex(3) ---- ->>> var C = (function () { -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^-> -1-> { -1->Emitted(38, 9) Source(23, 53) + SourceIndex(3) ---- ->>> function C() { -1->^^^^^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(39, 13) Source(23, 53) + SourceIndex(3) ---- ->>> } -1->^^^^^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^-> -1->export class C { -2 > } -1->Emitted(40, 13) Source(23, 69) + SourceIndex(3) -2 >Emitted(40, 14) Source(23, 70) + SourceIndex(3) ---- ->>> return C; -1->^^^^^^^^^^^^ -2 > ^^^^^^^^ -1-> -2 > } -1->Emitted(41, 13) Source(23, 69) + SourceIndex(3) -2 >Emitted(41, 21) Source(23, 70) + SourceIndex(3) ---- ->>> }()); -1 >^^^^^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class C {} -1 >Emitted(42, 9) Source(23, 69) + SourceIndex(3) -2 >Emitted(42, 10) Source(23, 70) + SourceIndex(3) -3 >Emitted(42, 10) Source(23, 53) + SourceIndex(3) -4 >Emitted(42, 14) Source(23, 70) + SourceIndex(3) ---- ->>> someNamespace.C = C; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^ -3 > ^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 > C -3 > {} -4 > -1->Emitted(43, 9) Source(23, 66) + SourceIndex(3) -2 >Emitted(43, 24) Source(23, 67) + SourceIndex(3) -3 >Emitted(43, 28) Source(23, 70) + SourceIndex(3) -4 >Emitted(43, 29) Source(23, 70) + SourceIndex(3) ---- ->>> })(someNamespace = normalN.someNamespace || (normalN.someNamespace = {})); -1->^^^^ -2 > ^ -3 > ^^ -4 > ^^^^^^^^^^^^^ -5 > ^^^ -6 > ^^^^^^^^^^^^^^^^^^^^^ -7 > ^^^^^ -8 > ^^^^^^^^^^^^^^^^^^^^^ -9 > ^^^^^^^^ -1-> -2 > } -3 > -4 > someNamespace -5 > -6 > someNamespace -7 > -8 > someNamespace -9 > { export class C {} } -1->Emitted(44, 5) Source(23, 71) + SourceIndex(3) -2 >Emitted(44, 6) Source(23, 72) + SourceIndex(3) -3 >Emitted(44, 8) Source(23, 37) + SourceIndex(3) -4 >Emitted(44, 21) Source(23, 50) + SourceIndex(3) -5 >Emitted(44, 24) Source(23, 37) + SourceIndex(3) -6 >Emitted(44, 45) Source(23, 50) + SourceIndex(3) -7 >Emitted(44, 50) Source(23, 37) + SourceIndex(3) -8 >Emitted(44, 71) Source(23, 50) + SourceIndex(3) -9 >Emitted(44, 79) Source(23, 72) + SourceIndex(3) ---- ->>> var someOther; -1 >^^^^ -2 > ^^^^ -3 > ^^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^-> -1 > - > /**@internal*/ -2 > export namespace -3 > someOther -4 > .something { export class someClass {} } -1 >Emitted(45, 5) Source(24, 20) + SourceIndex(3) -2 >Emitted(45, 9) Source(24, 37) + SourceIndex(3) -3 >Emitted(45, 18) Source(24, 46) + SourceIndex(3) -4 >Emitted(45, 19) Source(24, 86) + SourceIndex(3) ---- ->>> (function (someOther) { -1->^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^^^^ -1-> -2 > export namespace -3 > someOther -1->Emitted(46, 5) Source(24, 20) + SourceIndex(3) -2 >Emitted(46, 16) Source(24, 37) + SourceIndex(3) -3 >Emitted(46, 25) Source(24, 46) + SourceIndex(3) ---- ->>> var something; -1 >^^^^^^^^ -2 > ^^^^ -3 > ^^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^-> -1 >. -2 > -3 > something -4 > { export class someClass {} } -1 >Emitted(47, 9) Source(24, 47) + SourceIndex(3) -2 >Emitted(47, 13) Source(24, 47) + SourceIndex(3) -3 >Emitted(47, 22) Source(24, 56) + SourceIndex(3) -4 >Emitted(47, 23) Source(24, 86) + SourceIndex(3) ---- ->>> (function (something) { -1->^^^^^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^-> -1-> -2 > -3 > something -1->Emitted(48, 9) Source(24, 47) + SourceIndex(3) -2 >Emitted(48, 20) Source(24, 47) + SourceIndex(3) -3 >Emitted(48, 29) Source(24, 56) + SourceIndex(3) ---- ->>> var someClass = (function () { -1->^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> { -1->Emitted(49, 13) Source(24, 59) + SourceIndex(3) ---- ->>> function someClass() { -1->^^^^^^^^^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(50, 17) Source(24, 59) + SourceIndex(3) ---- ->>> } -1->^^^^^^^^^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^-> -1->export class someClass { -2 > } -1->Emitted(51, 17) Source(24, 83) + SourceIndex(3) -2 >Emitted(51, 18) Source(24, 84) + SourceIndex(3) ---- ->>> return someClass; -1->^^^^^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(52, 17) Source(24, 83) + SourceIndex(3) -2 >Emitted(52, 33) Source(24, 84) + SourceIndex(3) ---- ->>> }()); -1 >^^^^^^^^^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class someClass {} -1 >Emitted(53, 13) Source(24, 83) + SourceIndex(3) -2 >Emitted(53, 14) Source(24, 84) + SourceIndex(3) -3 >Emitted(53, 14) Source(24, 59) + SourceIndex(3) -4 >Emitted(53, 18) Source(24, 84) + SourceIndex(3) ---- ->>> something.someClass = someClass; -1->^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^ -3 > ^^^^^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 > someClass -3 > {} -4 > -1->Emitted(54, 13) Source(24, 72) + SourceIndex(3) -2 >Emitted(54, 32) Source(24, 81) + SourceIndex(3) -3 >Emitted(54, 44) Source(24, 84) + SourceIndex(3) -4 >Emitted(54, 45) Source(24, 84) + SourceIndex(3) ---- ->>> })(something = someOther.something || (someOther.something = {})); -1->^^^^^^^^ -2 > ^ -3 > ^^ -4 > ^^^^^^^^^ -5 > ^^^ -6 > ^^^^^^^^^^^^^^^^^^^ -7 > ^^^^^ -8 > ^^^^^^^^^^^^^^^^^^^ -9 > ^^^^^^^^ -1-> -2 > } -3 > -4 > something -5 > -6 > something -7 > -8 > something -9 > { export class someClass {} } -1->Emitted(55, 9) Source(24, 85) + SourceIndex(3) -2 >Emitted(55, 10) Source(24, 86) + SourceIndex(3) -3 >Emitted(55, 12) Source(24, 47) + SourceIndex(3) -4 >Emitted(55, 21) Source(24, 56) + SourceIndex(3) -5 >Emitted(55, 24) Source(24, 47) + SourceIndex(3) -6 >Emitted(55, 43) Source(24, 56) + SourceIndex(3) -7 >Emitted(55, 48) Source(24, 47) + SourceIndex(3) -8 >Emitted(55, 67) Source(24, 56) + SourceIndex(3) -9 >Emitted(55, 75) Source(24, 86) + SourceIndex(3) ---- ->>> })(someOther = normalN.someOther || (normalN.someOther = {})); -1 >^^^^ -2 > ^ -3 > ^^ -4 > ^^^^^^^^^ -5 > ^^^ -6 > ^^^^^^^^^^^^^^^^^ -7 > ^^^^^ -8 > ^^^^^^^^^^^^^^^^^ -9 > ^^^^^^^^ -1 > -2 > } -3 > -4 > someOther -5 > -6 > someOther -7 > -8 > someOther -9 > .something { export class someClass {} } -1 >Emitted(56, 5) Source(24, 85) + SourceIndex(3) -2 >Emitted(56, 6) Source(24, 86) + SourceIndex(3) -3 >Emitted(56, 8) Source(24, 37) + SourceIndex(3) -4 >Emitted(56, 17) Source(24, 46) + SourceIndex(3) -5 >Emitted(56, 20) Source(24, 37) + SourceIndex(3) -6 >Emitted(56, 37) Source(24, 46) + SourceIndex(3) -7 >Emitted(56, 42) Source(24, 37) + SourceIndex(3) -8 >Emitted(56, 59) Source(24, 46) + SourceIndex(3) -9 >Emitted(56, 67) Source(24, 86) + SourceIndex(3) ---- ->>> normalN.someImport = someNamespace.C; -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^^^^^^^^^^ -5 > ^ -6 > ^ -7 > ^ -1 > - > /**@internal*/ export import -2 > someImport -3 > = -4 > someNamespace -5 > . -6 > C -7 > ; -1 >Emitted(57, 5) Source(25, 34) + SourceIndex(3) -2 >Emitted(57, 23) Source(25, 44) + SourceIndex(3) -3 >Emitted(57, 26) Source(25, 47) + SourceIndex(3) -4 >Emitted(57, 39) Source(25, 60) + SourceIndex(3) -5 >Emitted(57, 40) Source(25, 61) + SourceIndex(3) -6 >Emitted(57, 41) Source(25, 62) + SourceIndex(3) -7 >Emitted(57, 42) Source(25, 63) + SourceIndex(3) ---- ->>> normalN.internalConst = 10; -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -1 > - > /**@internal*/ export type internalType = internalC; - > /**@internal*/ export const -2 > internalConst -3 > = -4 > 10 -5 > ; -1 >Emitted(58, 5) Source(27, 33) + SourceIndex(3) -2 >Emitted(58, 26) Source(27, 46) + SourceIndex(3) -3 >Emitted(58, 29) Source(27, 49) + SourceIndex(3) -4 >Emitted(58, 31) Source(27, 51) + SourceIndex(3) -5 >Emitted(58, 32) Source(27, 52) + SourceIndex(3) ---- ->>> var internalEnum; -1 >^^^^ -2 > ^^^^ -3 > ^^^^^^^^^^^^ -4 > ^^^^^^^^^^^-> -1 > - > /**@internal*/ -2 > export enum -3 > internalEnum { a, b, c } -1 >Emitted(59, 5) Source(28, 20) + SourceIndex(3) -2 >Emitted(59, 9) Source(28, 32) + SourceIndex(3) -3 >Emitted(59, 21) Source(28, 56) + SourceIndex(3) ---- ->>> (function (internalEnum) { -1->^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 > export enum -3 > internalEnum -1->Emitted(60, 5) Source(28, 20) + SourceIndex(3) -2 >Emitted(60, 16) Source(28, 32) + SourceIndex(3) -3 >Emitted(60, 28) Source(28, 44) + SourceIndex(3) ---- ->>> internalEnum[internalEnum["a"] = 0] = "a"; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^-> -1-> { -2 > a -3 > -1->Emitted(61, 9) Source(28, 47) + SourceIndex(3) -2 >Emitted(61, 50) Source(28, 48) + SourceIndex(3) -3 >Emitted(61, 51) Source(28, 48) + SourceIndex(3) ---- ->>> internalEnum[internalEnum["b"] = 1] = "b"; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^-> -1->, -2 > b -3 > -1->Emitted(62, 9) Source(28, 50) + SourceIndex(3) -2 >Emitted(62, 50) Source(28, 51) + SourceIndex(3) -3 >Emitted(62, 51) Source(28, 51) + SourceIndex(3) ---- ->>> internalEnum[internalEnum["c"] = 2] = "c"; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->, -2 > c -3 > -1->Emitted(63, 9) Source(28, 53) + SourceIndex(3) -2 >Emitted(63, 50) Source(28, 54) + SourceIndex(3) -3 >Emitted(63, 51) Source(28, 54) + SourceIndex(3) ---- ->>> })(internalEnum = normalN.internalEnum || (normalN.internalEnum = {})); -1->^^^^ -2 > ^ -3 > ^^ -4 > ^^^^^^^^^^^^ -5 > ^^^ -6 > ^^^^^^^^^^^^^^^^^^^^ -7 > ^^^^^ -8 > ^^^^^^^^^^^^^^^^^^^^ -9 > ^^^^^^^^ -1-> -2 > } -3 > -4 > internalEnum -5 > -6 > internalEnum -7 > -8 > internalEnum -9 > { a, b, c } -1->Emitted(64, 5) Source(28, 55) + SourceIndex(3) -2 >Emitted(64, 6) Source(28, 56) + SourceIndex(3) -3 >Emitted(64, 8) Source(28, 32) + SourceIndex(3) -4 >Emitted(64, 20) Source(28, 44) + SourceIndex(3) -5 >Emitted(64, 23) Source(28, 32) + SourceIndex(3) -6 >Emitted(64, 43) Source(28, 44) + SourceIndex(3) -7 >Emitted(64, 48) Source(28, 32) + SourceIndex(3) -8 >Emitted(64, 68) Source(28, 44) + SourceIndex(3) -9 >Emitted(64, 76) Source(28, 56) + SourceIndex(3) ---- ->>>})(normalN || (normalN = {})); -1 > -2 >^ -3 > ^^ -4 > ^^^^^^^ -5 > ^^^^^ -6 > ^^^^^^^ -7 > ^^^^^^^^ -8 > ^-> -1 > - > -2 >} -3 > -4 > normalN -5 > -6 > normalN -7 > { - > /**@internal*/ export class C { } - > /**@internal*/ export function foo() {} - > /**@internal*/ export namespace someNamespace { export class C {} } - > /**@internal*/ export namespace someOther.something { export class someClass {} } - > /**@internal*/ export import someImport = someNamespace.C; - > /**@internal*/ export type internalType = internalC; - > /**@internal*/ export const internalConst = 10; - > /**@internal*/ export enum internalEnum { a, b, c } - > } -1 >Emitted(65, 1) Source(29, 1) + SourceIndex(3) -2 >Emitted(65, 2) Source(29, 2) + SourceIndex(3) -3 >Emitted(65, 4) Source(20, 11) + SourceIndex(3) -4 >Emitted(65, 11) Source(20, 18) + SourceIndex(3) -5 >Emitted(65, 16) Source(20, 11) + SourceIndex(3) -6 >Emitted(65, 23) Source(20, 18) + SourceIndex(3) -7 >Emitted(65, 31) Source(29, 2) + SourceIndex(3) ---- ->>>var internalC = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - >/**@internal*/ -1->Emitted(66, 1) Source(30, 16) + SourceIndex(3) ---- ->>> function internalC() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(67, 5) Source(30, 16) + SourceIndex(3) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^-> -1->class internalC { -2 > } -1->Emitted(68, 5) Source(30, 33) + SourceIndex(3) -2 >Emitted(68, 6) Source(30, 34) + SourceIndex(3) ---- ->>> return internalC; -1->^^^^ -2 > ^^^^^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(69, 5) Source(30, 33) + SourceIndex(3) -2 >Emitted(69, 21) Source(30, 34) + SourceIndex(3) ---- ->>>}()); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > class internalC {} -1 >Emitted(70, 1) Source(30, 33) + SourceIndex(3) -2 >Emitted(70, 2) Source(30, 34) + SourceIndex(3) -3 >Emitted(70, 2) Source(30, 16) + SourceIndex(3) -4 >Emitted(70, 6) Source(30, 34) + SourceIndex(3) ---- ->>>function internalfoo() { } -1-> -2 >^^^^^^^^^ -3 > ^^^^^^^^^^^ -4 > ^^^^^ -5 > ^ -1-> - >/**@internal*/ -2 >function -3 > internalfoo -4 > () { -5 > } -1->Emitted(71, 1) Source(31, 16) + SourceIndex(3) -2 >Emitted(71, 10) Source(31, 25) + SourceIndex(3) -3 >Emitted(71, 21) Source(31, 36) + SourceIndex(3) -4 >Emitted(71, 26) Source(31, 40) + SourceIndex(3) -5 >Emitted(71, 27) Source(31, 41) + SourceIndex(3) ---- ->>>var internalNamespace; -1 > -2 >^^^^ -3 > ^^^^^^^^^^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^-> -1 > - >/**@internal*/ -2 >namespace -3 > internalNamespace -4 > { export class someClass {} } -1 >Emitted(72, 1) Source(32, 16) + SourceIndex(3) -2 >Emitted(72, 5) Source(32, 26) + SourceIndex(3) -3 >Emitted(72, 22) Source(32, 43) + SourceIndex(3) -4 >Emitted(72, 23) Source(32, 73) + SourceIndex(3) ---- ->>>(function (internalNamespace) { -1-> -2 >^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^-> -1-> -2 >namespace -3 > internalNamespace -1->Emitted(73, 1) Source(32, 16) + SourceIndex(3) -2 >Emitted(73, 12) Source(32, 26) + SourceIndex(3) -3 >Emitted(73, 29) Source(32, 43) + SourceIndex(3) ---- ->>> var someClass = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> { -1->Emitted(74, 5) Source(32, 46) + SourceIndex(3) ---- ->>> function someClass() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(75, 9) Source(32, 46) + SourceIndex(3) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^-> -1->export class someClass { -2 > } -1->Emitted(76, 9) Source(32, 70) + SourceIndex(3) -2 >Emitted(76, 10) Source(32, 71) + SourceIndex(3) ---- ->>> return someClass; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(77, 9) Source(32, 70) + SourceIndex(3) -2 >Emitted(77, 25) Source(32, 71) + SourceIndex(3) ---- ->>> }()); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class someClass {} -1 >Emitted(78, 5) Source(32, 70) + SourceIndex(3) -2 >Emitted(78, 6) Source(32, 71) + SourceIndex(3) -3 >Emitted(78, 6) Source(32, 46) + SourceIndex(3) -4 >Emitted(78, 10) Source(32, 71) + SourceIndex(3) ---- ->>> internalNamespace.someClass = someClass; -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^^^^^^^^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 > someClass -3 > {} -4 > -1->Emitted(79, 5) Source(32, 59) + SourceIndex(3) -2 >Emitted(79, 32) Source(32, 68) + SourceIndex(3) -3 >Emitted(79, 44) Source(32, 71) + SourceIndex(3) -4 >Emitted(79, 45) Source(32, 71) + SourceIndex(3) ---- ->>>})(internalNamespace || (internalNamespace = {})); -1-> -2 >^ -3 > ^^ -4 > ^^^^^^^^^^^^^^^^^ -5 > ^^^^^ -6 > ^^^^^^^^^^^^^^^^^ -7 > ^^^^^^^^ -1-> -2 >} -3 > -4 > internalNamespace -5 > -6 > internalNamespace -7 > { export class someClass {} } -1->Emitted(80, 1) Source(32, 72) + SourceIndex(3) -2 >Emitted(80, 2) Source(32, 73) + SourceIndex(3) -3 >Emitted(80, 4) Source(32, 26) + SourceIndex(3) -4 >Emitted(80, 21) Source(32, 43) + SourceIndex(3) -5 >Emitted(80, 26) Source(32, 26) + SourceIndex(3) -6 >Emitted(80, 43) Source(32, 43) + SourceIndex(3) -7 >Emitted(80, 51) Source(32, 73) + SourceIndex(3) ---- ->>>var internalOther; -1 > -2 >^^^^ -3 > ^^^^^^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^-> -1 > - >/**@internal*/ -2 >namespace -3 > internalOther -4 > .something { export class someClass {} } -1 >Emitted(81, 1) Source(33, 16) + SourceIndex(3) -2 >Emitted(81, 5) Source(33, 26) + SourceIndex(3) -3 >Emitted(81, 18) Source(33, 39) + SourceIndex(3) -4 >Emitted(81, 19) Source(33, 79) + SourceIndex(3) ---- ->>>(function (internalOther) { -1-> -2 >^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^ -1-> -2 >namespace -3 > internalOther -1->Emitted(82, 1) Source(33, 16) + SourceIndex(3) -2 >Emitted(82, 12) Source(33, 26) + SourceIndex(3) -3 >Emitted(82, 25) Source(33, 39) + SourceIndex(3) ---- ->>> var something; -1 >^^^^ -2 > ^^^^ -3 > ^^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^-> -1 >. -2 > -3 > something -4 > { export class someClass {} } -1 >Emitted(83, 5) Source(33, 40) + SourceIndex(3) -2 >Emitted(83, 9) Source(33, 40) + SourceIndex(3) -3 >Emitted(83, 18) Source(33, 49) + SourceIndex(3) -4 >Emitted(83, 19) Source(33, 79) + SourceIndex(3) ---- ->>> (function (something) { -1->^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^-> -1-> -2 > -3 > something -1->Emitted(84, 5) Source(33, 40) + SourceIndex(3) -2 >Emitted(84, 16) Source(33, 40) + SourceIndex(3) -3 >Emitted(84, 25) Source(33, 49) + SourceIndex(3) ---- ->>> var someClass = (function () { -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> { -1->Emitted(85, 9) Source(33, 52) + SourceIndex(3) ---- ->>> function someClass() { -1->^^^^^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(86, 13) Source(33, 52) + SourceIndex(3) ---- ->>> } -1->^^^^^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^-> -1->export class someClass { -2 > } -1->Emitted(87, 13) Source(33, 76) + SourceIndex(3) -2 >Emitted(87, 14) Source(33, 77) + SourceIndex(3) ---- ->>> return someClass; -1->^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(88, 13) Source(33, 76) + SourceIndex(3) -2 >Emitted(88, 29) Source(33, 77) + SourceIndex(3) ---- ->>> }()); -1 >^^^^^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class someClass {} -1 >Emitted(89, 9) Source(33, 76) + SourceIndex(3) -2 >Emitted(89, 10) Source(33, 77) + SourceIndex(3) -3 >Emitted(89, 10) Source(33, 52) + SourceIndex(3) -4 >Emitted(89, 14) Source(33, 77) + SourceIndex(3) ---- ->>> something.someClass = someClass; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^ -3 > ^^^^^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 > someClass -3 > {} -4 > -1->Emitted(90, 9) Source(33, 65) + SourceIndex(3) -2 >Emitted(90, 28) Source(33, 74) + SourceIndex(3) -3 >Emitted(90, 40) Source(33, 77) + SourceIndex(3) -4 >Emitted(90, 41) Source(33, 77) + SourceIndex(3) ---- ->>> })(something = internalOther.something || (internalOther.something = {})); -1->^^^^ -2 > ^ -3 > ^^ -4 > ^^^^^^^^^ -5 > ^^^ -6 > ^^^^^^^^^^^^^^^^^^^^^^^ -7 > ^^^^^ -8 > ^^^^^^^^^^^^^^^^^^^^^^^ -9 > ^^^^^^^^ -1-> -2 > } -3 > -4 > something -5 > -6 > something -7 > -8 > something -9 > { export class someClass {} } -1->Emitted(91, 5) Source(33, 78) + SourceIndex(3) -2 >Emitted(91, 6) Source(33, 79) + SourceIndex(3) -3 >Emitted(91, 8) Source(33, 40) + SourceIndex(3) -4 >Emitted(91, 17) Source(33, 49) + SourceIndex(3) -5 >Emitted(91, 20) Source(33, 40) + SourceIndex(3) -6 >Emitted(91, 43) Source(33, 49) + SourceIndex(3) -7 >Emitted(91, 48) Source(33, 40) + SourceIndex(3) -8 >Emitted(91, 71) Source(33, 49) + SourceIndex(3) -9 >Emitted(91, 79) Source(33, 79) + SourceIndex(3) ---- ->>>})(internalOther || (internalOther = {})); -1 > -2 >^ -3 > ^^ -4 > ^^^^^^^^^^^^^ -5 > ^^^^^ -6 > ^^^^^^^^^^^^^ -7 > ^^^^^^^^ -8 > ^^^^^^^^-> -1 > -2 >} -3 > -4 > internalOther -5 > -6 > internalOther -7 > .something { export class someClass {} } -1 >Emitted(92, 1) Source(33, 78) + SourceIndex(3) -2 >Emitted(92, 2) Source(33, 79) + SourceIndex(3) -3 >Emitted(92, 4) Source(33, 26) + SourceIndex(3) -4 >Emitted(92, 17) Source(33, 39) + SourceIndex(3) -5 >Emitted(92, 22) Source(33, 26) + SourceIndex(3) -6 >Emitted(92, 35) Source(33, 39) + SourceIndex(3) -7 >Emitted(92, 43) Source(33, 79) + SourceIndex(3) ---- ->>>var internalImport = internalNamespace.someClass; -1-> -2 >^^^^ -3 > ^^^^^^^^^^^^^^ -4 > ^^^ -5 > ^^^^^^^^^^^^^^^^^ -6 > ^ -7 > ^^^^^^^^^ -8 > ^ -1-> - >/**@internal*/ -2 >import -3 > internalImport -4 > = -5 > internalNamespace -6 > . -7 > someClass -8 > ; -1->Emitted(93, 1) Source(34, 16) + SourceIndex(3) -2 >Emitted(93, 5) Source(34, 23) + SourceIndex(3) -3 >Emitted(93, 19) Source(34, 37) + SourceIndex(3) -4 >Emitted(93, 22) Source(34, 40) + SourceIndex(3) -5 >Emitted(93, 39) Source(34, 57) + SourceIndex(3) -6 >Emitted(93, 40) Source(34, 58) + SourceIndex(3) -7 >Emitted(93, 49) Source(34, 67) + SourceIndex(3) -8 >Emitted(93, 50) Source(34, 68) + SourceIndex(3) ---- ->>>var internalConst = 10; -1 > -2 >^^^^ -3 > ^^^^^^^^^^^^^ -4 > ^^^ -5 > ^^ -6 > ^ -1 > - >/**@internal*/ type internalType = internalC; - >/**@internal*/ -2 >const -3 > internalConst -4 > = -5 > 10 -6 > ; -1 >Emitted(94, 1) Source(36, 16) + SourceIndex(3) -2 >Emitted(94, 5) Source(36, 22) + SourceIndex(3) -3 >Emitted(94, 18) Source(36, 35) + SourceIndex(3) -4 >Emitted(94, 21) Source(36, 38) + SourceIndex(3) -5 >Emitted(94, 23) Source(36, 40) + SourceIndex(3) -6 >Emitted(94, 24) Source(36, 41) + SourceIndex(3) ---- ->>>var internalEnum; -1 > -2 >^^^^ -3 > ^^^^^^^^^^^^ -4 > ^^^^^^^^^^^-> -1 > - >/**@internal*/ -2 >enum -3 > internalEnum { a, b, c } -1 >Emitted(95, 1) Source(37, 16) + SourceIndex(3) -2 >Emitted(95, 5) Source(37, 21) + SourceIndex(3) -3 >Emitted(95, 17) Source(37, 45) + SourceIndex(3) ---- ->>>(function (internalEnum) { -1-> -2 >^^^^^^^^^^^ -3 > ^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 >enum -3 > internalEnum -1->Emitted(96, 1) Source(37, 16) + SourceIndex(3) -2 >Emitted(96, 12) Source(37, 21) + SourceIndex(3) -3 >Emitted(96, 24) Source(37, 33) + SourceIndex(3) ---- ->>> internalEnum[internalEnum["a"] = 0] = "a"; -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^-> -1-> { -2 > a -3 > -1->Emitted(97, 5) Source(37, 36) + SourceIndex(3) -2 >Emitted(97, 46) Source(37, 37) + SourceIndex(3) -3 >Emitted(97, 47) Source(37, 37) + SourceIndex(3) ---- ->>> internalEnum[internalEnum["b"] = 1] = "b"; -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^-> -1->, -2 > b -3 > -1->Emitted(98, 5) Source(37, 39) + SourceIndex(3) -2 >Emitted(98, 46) Source(37, 40) + SourceIndex(3) -3 >Emitted(98, 47) Source(37, 40) + SourceIndex(3) ---- ->>> internalEnum[internalEnum["c"] = 2] = "c"; -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -1->, -2 > c -3 > -1->Emitted(99, 5) Source(37, 42) + SourceIndex(3) -2 >Emitted(99, 46) Source(37, 43) + SourceIndex(3) -3 >Emitted(99, 47) Source(37, 43) + SourceIndex(3) ---- ->>>})(internalEnum || (internalEnum = {})); -1 > -2 >^ -3 > ^^ -4 > ^^^^^^^^^^^^ -5 > ^^^^^ -6 > ^^^^^^^^^^^^ -7 > ^^^^^^^^ -1 > -2 >} -3 > -4 > internalEnum -5 > -6 > internalEnum -7 > { a, b, c } -1 >Emitted(100, 1) Source(37, 44) + SourceIndex(3) -2 >Emitted(100, 2) Source(37, 45) + SourceIndex(3) -3 >Emitted(100, 4) Source(37, 21) + SourceIndex(3) -4 >Emitted(100, 16) Source(37, 33) + SourceIndex(3) -5 >Emitted(100, 21) Source(37, 21) + SourceIndex(3) -6 >Emitted(100, 33) Source(37, 33) + SourceIndex(3) -7 >Emitted(100, 41) Source(37, 45) + SourceIndex(3) ---- -------------------------------------------------------------------- -emittedFile:/src/third/thirdjs/output/third-output.js -sourceFile:../../../second/second_part2.ts -------------------------------------------------------------------- ->>>var C = (function () { -1 > -2 >^^^^^^^^^^^^^^^^^^^-> -1 > -1 >Emitted(101, 1) Source(1, 1) + SourceIndex(4) ---- ->>> function C() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(102, 5) Source(1, 1) + SourceIndex(4) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->class C { - > doSomething() { - > console.log("something got done"); - > } - > -2 > } -1->Emitted(103, 5) Source(5, 1) + SourceIndex(4) -2 >Emitted(103, 6) Source(5, 2) + SourceIndex(4) ---- ->>> C.prototype.doSomething = function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^^^^^^^^^^-> -1-> -2 > doSomething -3 > -1->Emitted(104, 5) Source(2, 5) + SourceIndex(4) -2 >Emitted(104, 28) Source(2, 16) + SourceIndex(4) -3 >Emitted(104, 31) Source(2, 5) + SourceIndex(4) ---- ->>> console.log("something got done"); -1->^^^^^^^^ -2 > ^^^^^^^ -3 > ^ -4 > ^^^ -5 > ^ -6 > ^^^^^^^^^^^^^^^^^^^^ -7 > ^ -8 > ^ -1->doSomething() { - > -2 > console -3 > . -4 > log -5 > ( -6 > "something got done" -7 > ) -8 > ; -1->Emitted(105, 9) Source(3, 9) + SourceIndex(4) -2 >Emitted(105, 16) Source(3, 16) + SourceIndex(4) -3 >Emitted(105, 17) Source(3, 17) + SourceIndex(4) -4 >Emitted(105, 20) Source(3, 20) + SourceIndex(4) -5 >Emitted(105, 21) Source(3, 21) + SourceIndex(4) -6 >Emitted(105, 41) Source(3, 41) + SourceIndex(4) -7 >Emitted(105, 42) Source(3, 42) + SourceIndex(4) -8 >Emitted(105, 43) Source(3, 43) + SourceIndex(4) ---- ->>> }; -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(106, 5) Source(4, 5) + SourceIndex(4) -2 >Emitted(106, 6) Source(4, 6) + SourceIndex(4) ---- ->>> return C; -1->^^^^ -2 > ^^^^^^^^ -1-> - > -2 > } -1->Emitted(107, 5) Source(5, 1) + SourceIndex(4) -2 >Emitted(107, 13) Source(5, 2) + SourceIndex(4) ---- ->>>}()); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > class C { - > doSomething() { - > console.log("something got done"); - > } - > } -1 >Emitted(108, 1) Source(5, 1) + SourceIndex(4) -2 >Emitted(108, 2) Source(5, 2) + SourceIndex(4) -3 >Emitted(108, 2) Source(1, 1) + SourceIndex(4) -4 >Emitted(108, 6) Source(5, 2) + SourceIndex(4) ---- -------------------------------------------------------------------- -emittedFile:/src/third/thirdjs/output/third-output.js -sourceFile:../../third_part1.ts -------------------------------------------------------------------- ->>>var c = new C(); -1-> -2 >^^^^ -3 > ^ -4 > ^^^ -5 > ^^^^ -6 > ^ -7 > ^^ -8 > ^ -9 > ^-> -1-> -2 >var -3 > c -4 > = -5 > new -6 > C -7 > () -8 > ; -1->Emitted(109, 1) Source(1, 1) + SourceIndex(5) -2 >Emitted(109, 5) Source(1, 5) + SourceIndex(5) -3 >Emitted(109, 6) Source(1, 6) + SourceIndex(5) -4 >Emitted(109, 9) Source(1, 9) + SourceIndex(5) -5 >Emitted(109, 13) Source(1, 13) + SourceIndex(5) -6 >Emitted(109, 14) Source(1, 14) + SourceIndex(5) -7 >Emitted(109, 16) Source(1, 16) + SourceIndex(5) -8 >Emitted(109, 17) Source(1, 17) + SourceIndex(5) ---- ->>>c.doSomething(); -1-> -2 >^ -3 > ^ -4 > ^^^^^^^^^^^ -5 > ^^ -6 > ^ -7 > ^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -2 >c -3 > . -4 > doSomething -5 > () -6 > ; -1->Emitted(110, 1) Source(2, 1) + SourceIndex(5) -2 >Emitted(110, 2) Source(2, 2) + SourceIndex(5) -3 >Emitted(110, 3) Source(2, 3) + SourceIndex(5) -4 >Emitted(110, 14) Source(2, 14) + SourceIndex(5) -5 >Emitted(110, 16) Source(2, 16) + SourceIndex(5) -6 >Emitted(110, 17) Source(2, 17) + SourceIndex(5) ---- ->>>//# sourceMappingURL=third-output.js.map - //// [/src/third/thirdjs/output/third-output.tsbuildinfo] { "bundle": { diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/stripInternal-when-one-two-three-are-prepended-in-order.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/stripInternal-when-one-two-three-are-prepended-in-order.js index 8330077b7b9b7..a157ee39fc996 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/stripInternal-when-one-two-three-are-prepended-in-order.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/stripInternal-when-one-two-three-are-prepended-in-order.js @@ -1,3 +1,51 @@ +//// [/lib/incremental-headers-change-without-dts-changesOutput.txt] +/lib/tsc --b /src/third --verbose +12:12:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:12:00 AM - Project 'src/first/tsconfig.json' is out of date because oldest output 'src/first/bin/first-output.js' is older than newest input 'src/first/first_PART1.ts' + +12:12:00 AM - Building project '/src/first/tsconfig.json'... + +12:12:00 AM - Project 'src/second/tsconfig.json' is out of date because output of its dependency 'src/first' has changed + +12:12:00 AM - Updating output of project '/src/second/tsconfig.json'... + +12:12:00 AM - Updating unchanged output timestamps of project '/src/second/tsconfig.json'... + +12:12:00 AM - Project 'src/third/tsconfig.json' is out of date because output of its dependency 'src/second' has changed + +12:12:00 AM - Updating output of project '/src/third/tsconfig.json'... + +12:12:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... + +exitCode:: 0 +readFiles:: { + "/src/third/tsconfig.json": 1, + "/src/second/tsconfig.json": 1, + "/src/first/tsconfig.json": 1, + "/src/first/first_PART1.ts": 1, + "/src/first/first_part2.ts": 1, + "/src/first/first_part3.ts": 1, + "/src/first/bin/first-output.d.ts": 1, + "/src/2/second-output.tsbuildinfo": 2, + "/src/2/second-output.js": 2, + "/src/2/second-output.js.map": 2, + "/src/2/second-output.d.ts": 2, + "/src/2/second-output.d.ts.map": 2, + "/src/first/bin/first-output.tsbuildinfo": 1, + "/src/first/bin/first-output.js": 1, + "/src/first/bin/first-output.js.map": 1, + "/src/first/bin/first-output.d.ts.map": 1, + "/src/third/thirdjs/output/third-output.tsbuildinfo": 1, + "/src/third/thirdjs/output/third-output.js": 1, + "/src/third/thirdjs/output/third-output.js.map": 1, + "/src/third/thirdjs/output/third-output.d.ts": 1, + "/src/third/thirdjs/output/third-output.d.ts.map": 1 +} + //// [/src/2/second-output.d.ts.map] {"version":3,"file":"second-output.d.ts","sourceRoot":"","sources":["../first/first_PART1.ts","../first/first_part3.ts","../second/second_part1.ts","../second/second_part2.ts"],"names":[],"mappings":"AAAA,UAAU,QAAQ;IACd,IAAI,EAAE,GAAG,CAAC;CACb;AAED,QAAA,MAAM,CAAC,iBAAiB,CAAC;AAEzB,UAAU,iBAAiB;IACvB,IAAI,EAAE,GAAG,CAAC;CACb;ACRD,iBAAS,CAAC,WAET;ACFD,kBAAU,CAAC,CAAC;CAEX;AAED,kBAAU,CAAC,CAAC;CAMX;AAED,cAAM,OAAO;;IAEK,IAAI,EAAE,MAAM,CAAC;IACb,MAAM;IACF,CAAC,EACM,MAAM;CAClC;AACD,kBAAU,OAAO,CAAC;IACA,MAAa,CAAC;KAAI;IAClB,SAAgB,GAAG,SAAK;IACxB,UAAiB,aAAa,CAAC;QAAE,MAAa,CAAC;SAAG;KAAE;IACpD,UAAiB,SAAS,CAAC,SAAS,CAAC;QAAE,MAAa,SAAS;SAAG;KAAE;IAClE,MAAM,QAAQ,UAAU,GAAG,aAAa,CAAC,CAAC,CAAC;IAC3C,KAAY,YAAY,GAAG,SAAS,CAAC;IAC9B,MAAM,aAAa,KAAK,CAAC;IAChC,KAAY,YAAY;QAAG,CAAC,IAAA;QAAE,CAAC,IAAA;QAAE,CAAC,IAAA;KAAE;CACrD;AACa,cAAM,SAAS;CAAG;AAClB,iBAAS,WAAW,SAAK;AACzB,kBAAU,iBAAiB,CAAC;IAAE,MAAa,SAAS;KAAG;CAAE;AACzD,kBAAU,aAAa,CAAC,SAAS,CAAC;IAAE,MAAa,SAAS;KAAG;CAAE;AAC/D,OAAO,cAAc,GAAG,iBAAiB,CAAC,SAAS,CAAC;AACpD,aAAK,YAAY,GAAG,SAAS,CAAC;AAC9B,QAAA,MAAM,aAAa,KAAK,CAAC;AACzB,aAAK,YAAY;IAAG,CAAC,IAAA;IAAE,CAAC,IAAA;IAAE,CAAC,IAAA;CAAE;ACpC3C,cAAM,CAAC;IACH,WAAW;CAGd"} @@ -778,4187 +826,975 @@ sourceFile:../second/second_part2.ts --- >>>//# sourceMappingURL=second-output.d.ts.map -//// [/src/2/second-output.js.map.baseline.txt] -=================================================================== -JsFile: second-output.js -mapUrl: second-output.js.map -sourceRoot: -sources: ../first/first_PART1.ts,../first/first_part2.ts,../first/first_part3.ts,../second/second_part1.ts,../second/second_part2.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:/src/2/second-output.js -sourceFile:../first/first_PART1.ts -------------------------------------------------------------------- ->>>var s = "Hello, world"; -1 > -2 >^^^^ -3 > ^ -4 > ^^^ -5 > ^^^^^^^^^^^^^^ -6 > ^ -1 >interface TheFirst { - > none: any; - >} - > - > -2 >const -3 > s -4 > = -5 > "Hello, world" -6 > ; -1 >Emitted(1, 1) Source(5, 1) + SourceIndex(0) -2 >Emitted(1, 5) Source(5, 7) + SourceIndex(0) -3 >Emitted(1, 6) Source(5, 8) + SourceIndex(0) -4 >Emitted(1, 9) Source(5, 11) + SourceIndex(0) -5 >Emitted(1, 23) Source(5, 25) + SourceIndex(0) -6 >Emitted(1, 24) Source(5, 26) + SourceIndex(0) ---- ->>>console.log(s); -1 > -2 >^^^^^^^ -3 > ^ -4 > ^^^ -5 > ^ -6 > ^ -7 > ^ -8 > ^ -9 > ^^^-> -1 > - > - >interface NoJsForHereEither { - > none: any; - >} - > - > -2 >console -3 > . -4 > log -5 > ( -6 > s -7 > ) -8 > ; -1 >Emitted(2, 1) Source(11, 1) + SourceIndex(0) -2 >Emitted(2, 8) Source(11, 8) + SourceIndex(0) -3 >Emitted(2, 9) Source(11, 9) + SourceIndex(0) -4 >Emitted(2, 12) Source(11, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(11, 13) + SourceIndex(0) -6 >Emitted(2, 14) Source(11, 14) + SourceIndex(0) -7 >Emitted(2, 15) Source(11, 15) + SourceIndex(0) -8 >Emitted(2, 16) Source(11, 16) + SourceIndex(0) ---- -------------------------------------------------------------------- -emittedFile:/src/2/second-output.js -sourceFile:../first/first_part2.ts -------------------------------------------------------------------- ->>>console.log(f()); -1-> -2 >^^^^^^^ -3 > ^ -4 > ^^^ -5 > ^ -6 > ^ -7 > ^^ -8 > ^ -9 > ^ -1-> -2 >console -3 > . -4 > log -5 > ( -6 > f -7 > () -8 > ) -9 > ; -1->Emitted(3, 1) Source(1, 1) + SourceIndex(1) -2 >Emitted(3, 8) Source(1, 8) + SourceIndex(1) -3 >Emitted(3, 9) Source(1, 9) + SourceIndex(1) -4 >Emitted(3, 12) Source(1, 12) + SourceIndex(1) -5 >Emitted(3, 13) Source(1, 13) + SourceIndex(1) -6 >Emitted(3, 14) Source(1, 14) + SourceIndex(1) -7 >Emitted(3, 16) Source(1, 16) + SourceIndex(1) -8 >Emitted(3, 17) Source(1, 17) + SourceIndex(1) -9 >Emitted(3, 18) Source(1, 18) + SourceIndex(1) ---- -------------------------------------------------------------------- -emittedFile:/src/2/second-output.js -sourceFile:../first/first_part3.ts -------------------------------------------------------------------- ->>>function f() { -1 > -2 >^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^-> -1 > -2 >function -3 > f -1 >Emitted(4, 1) Source(1, 1) + SourceIndex(2) -2 >Emitted(4, 10) Source(1, 10) + SourceIndex(2) -3 >Emitted(4, 11) Source(1, 11) + SourceIndex(2) ---- ->>> return "JS does hoists"; -1->^^^^ -2 > ^^^^^^^ -3 > ^^^^^^^^^^^^^^^^ -4 > ^ -1->() { - > -2 > return -3 > "JS does hoists" -4 > ; -1->Emitted(5, 5) Source(2, 5) + SourceIndex(2) -2 >Emitted(5, 12) Source(2, 12) + SourceIndex(2) -3 >Emitted(5, 28) Source(2, 28) + SourceIndex(2) -4 >Emitted(5, 29) Source(2, 29) + SourceIndex(2) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^-> -1 > - > -2 >} -1 >Emitted(6, 1) Source(3, 1) + SourceIndex(2) -2 >Emitted(6, 2) Source(3, 2) + SourceIndex(2) ---- -------------------------------------------------------------------- -emittedFile:/src/2/second-output.js -sourceFile:../second/second_part1.ts -------------------------------------------------------------------- ->>>var N; -1-> -2 >^^^^ -3 > ^ -4 > ^ -5 > ^^^^^^^^^^-> -1->namespace N { - > // Comment text - >} - > - > -2 >namespace -3 > N -4 > { - > function f() { - > console.log('testing'); - > } - > - > f(); - > } -1->Emitted(7, 1) Source(5, 1) + SourceIndex(3) -2 >Emitted(7, 5) Source(5, 11) + SourceIndex(3) -3 >Emitted(7, 6) Source(5, 12) + SourceIndex(3) -4 >Emitted(7, 7) Source(11, 2) + SourceIndex(3) ---- ->>>(function (N) { -1-> -2 >^^^^^^^^^^^ -3 > ^ -4 > ^^^^^^^-> -1-> -2 >namespace -3 > N -1->Emitted(8, 1) Source(5, 1) + SourceIndex(3) -2 >Emitted(8, 12) Source(5, 11) + SourceIndex(3) -3 >Emitted(8, 13) Source(5, 12) + SourceIndex(3) ---- ->>> function f() { -1->^^^^ -2 > ^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^-> -1-> { - > -2 > function -3 > f -1->Emitted(9, 5) Source(6, 5) + SourceIndex(3) -2 >Emitted(9, 14) Source(6, 14) + SourceIndex(3) -3 >Emitted(9, 15) Source(6, 15) + SourceIndex(3) ---- ->>> console.log('testing'); -1->^^^^^^^^ -2 > ^^^^^^^ -3 > ^ -4 > ^^^ -5 > ^ -6 > ^^^^^^^^^ -7 > ^ -8 > ^ -1->() { - > -2 > console -3 > . -4 > log -5 > ( -6 > 'testing' -7 > ) -8 > ; -1->Emitted(10, 9) Source(7, 9) + SourceIndex(3) -2 >Emitted(10, 16) Source(7, 16) + SourceIndex(3) -3 >Emitted(10, 17) Source(7, 17) + SourceIndex(3) -4 >Emitted(10, 20) Source(7, 20) + SourceIndex(3) -5 >Emitted(10, 21) Source(7, 21) + SourceIndex(3) -6 >Emitted(10, 30) Source(7, 30) + SourceIndex(3) -7 >Emitted(10, 31) Source(7, 31) + SourceIndex(3) -8 >Emitted(10, 32) Source(7, 32) + SourceIndex(3) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^-> -1 > - > -2 > } -1 >Emitted(11, 5) Source(8, 5) + SourceIndex(3) -2 >Emitted(11, 6) Source(8, 6) + SourceIndex(3) ---- ->>> f(); -1->^^^^ -2 > ^ -3 > ^^ -4 > ^ -5 > ^^^^^^^^^^^-> -1-> - > - > -2 > f -3 > () -4 > ; -1->Emitted(12, 5) Source(10, 5) + SourceIndex(3) -2 >Emitted(12, 6) Source(10, 6) + SourceIndex(3) -3 >Emitted(12, 8) Source(10, 8) + SourceIndex(3) -4 >Emitted(12, 9) Source(10, 9) + SourceIndex(3) ---- ->>>})(N || (N = {})); -1-> -2 >^ -3 > ^^ -4 > ^ -5 > ^^^^^ -6 > ^ -7 > ^^^^^^^^ -8 > ^^^^^^^^^^^-> -1-> - > -2 >} -3 > -4 > N -5 > -6 > N -7 > { - > function f() { - > console.log('testing'); - > } - > - > f(); - > } -1->Emitted(13, 1) Source(11, 1) + SourceIndex(3) -2 >Emitted(13, 2) Source(11, 2) + SourceIndex(3) -3 >Emitted(13, 4) Source(5, 11) + SourceIndex(3) -4 >Emitted(13, 5) Source(5, 12) + SourceIndex(3) -5 >Emitted(13, 10) Source(5, 11) + SourceIndex(3) -6 >Emitted(13, 11) Source(5, 12) + SourceIndex(3) -7 >Emitted(13, 19) Source(11, 2) + SourceIndex(3) ---- ->>>var normalC = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > - > -1->Emitted(14, 1) Source(13, 1) + SourceIndex(3) ---- ->>> function normalC() { -1->^^^^ -2 > ^^-> -1->class normalC { - > /*@internal*/ -1->Emitted(15, 5) Source(14, 19) + SourceIndex(3) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->constructor() { -2 > } -1->Emitted(16, 5) Source(14, 35) + SourceIndex(3) -2 >Emitted(16, 6) Source(14, 36) + SourceIndex(3) ---- ->>> normalC.prototype.method = function () { }; -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^^^^^^^^^^^ -5 > ^ -6 > ^^^^^^-> -1-> - > /*@internal*/ prop: string; - > /*@internal*/ -2 > method -3 > -4 > method() { -5 > } -1->Emitted(17, 5) Source(16, 19) + SourceIndex(3) -2 >Emitted(17, 29) Source(16, 25) + SourceIndex(3) -3 >Emitted(17, 32) Source(16, 19) + SourceIndex(3) -4 >Emitted(17, 46) Source(16, 30) + SourceIndex(3) -5 >Emitted(17, 47) Source(16, 31) + SourceIndex(3) ---- ->>> Object.defineProperty(normalC.prototype, "c", { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^^^^^^^^^^ -1-> - > /*@internal*/ -2 > get -3 > c -1->Emitted(18, 5) Source(17, 19) + SourceIndex(3) -2 >Emitted(18, 27) Source(17, 23) + SourceIndex(3) -3 >Emitted(18, 49) Source(17, 24) + SourceIndex(3) ---- ->>> get: function () { return 10; }, -1 >^^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^ -3 > ^^^^^^^ -4 > ^^ -5 > ^ -6 > ^ -7 > ^ -1 > -2 > get c() { -3 > return -4 > 10 -5 > ; -6 > -7 > } -1 >Emitted(19, 14) Source(17, 19) + SourceIndex(3) -2 >Emitted(19, 28) Source(17, 29) + SourceIndex(3) -3 >Emitted(19, 35) Source(17, 36) + SourceIndex(3) -4 >Emitted(19, 37) Source(17, 38) + SourceIndex(3) -5 >Emitted(19, 38) Source(17, 39) + SourceIndex(3) -6 >Emitted(19, 39) Source(17, 40) + SourceIndex(3) -7 >Emitted(19, 40) Source(17, 41) + SourceIndex(3) ---- ->>> set: function (val) { }, -1 >^^^^^^^^^^^^^ -2 > ^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^ -1 > - > /*@internal*/ -2 > set c( -3 > val: number -4 > ) { -5 > } -1 >Emitted(20, 14) Source(18, 19) + SourceIndex(3) -2 >Emitted(20, 24) Source(18, 25) + SourceIndex(3) -3 >Emitted(20, 27) Source(18, 36) + SourceIndex(3) -4 >Emitted(20, 31) Source(18, 40) + SourceIndex(3) -5 >Emitted(20, 32) Source(18, 41) + SourceIndex(3) ---- ->>> enumerable: true, ->>> configurable: true ->>> }); -1 >^^^^^^^ -2 > ^^^^^^^^^^^^^-> -1 > -1 >Emitted(23, 8) Source(17, 41) + SourceIndex(3) ---- ->>> return normalC; -1->^^^^ -2 > ^^^^^^^^^^^^^^ -1-> - > /*@internal*/ set c(val: number) { } - > -2 > } -1->Emitted(24, 5) Source(19, 1) + SourceIndex(3) -2 >Emitted(24, 19) Source(19, 2) + SourceIndex(3) ---- ->>>}()); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^-> -1 > -2 >} -3 > -4 > class normalC { - > /*@internal*/ constructor() { } - > /*@internal*/ prop: string; - > /*@internal*/ method() { } - > /*@internal*/ get c() { return 10; } - > /*@internal*/ set c(val: number) { } - > } -1 >Emitted(25, 1) Source(19, 1) + SourceIndex(3) -2 >Emitted(25, 2) Source(19, 2) + SourceIndex(3) -3 >Emitted(25, 2) Source(13, 1) + SourceIndex(3) -4 >Emitted(25, 6) Source(19, 2) + SourceIndex(3) ---- ->>>var normalN; -1-> -2 >^^^^ -3 > ^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^-> -1-> - > -2 >namespace -3 > normalN -4 > { - > /*@internal*/ export class C { } - > /*@internal*/ export function foo() {} - > /*@internal*/ export namespace someNamespace { export class C {} } - > /*@internal*/ export namespace someOther.something { export class someClass {} } - > /*@internal*/ export import someImport = someNamespace.C; - > /*@internal*/ export type internalType = internalC; - > /*@internal*/ export const internalConst = 10; - > /*@internal*/ export enum internalEnum { a, b, c } - > } -1->Emitted(26, 1) Source(20, 1) + SourceIndex(3) -2 >Emitted(26, 5) Source(20, 11) + SourceIndex(3) -3 >Emitted(26, 12) Source(20, 18) + SourceIndex(3) -4 >Emitted(26, 13) Source(29, 2) + SourceIndex(3) ---- ->>>(function (normalN) { -1-> -2 >^^^^^^^^^^^ -3 > ^^^^^^^ -4 > ^^^^^^^^^-> -1-> -2 >namespace -3 > normalN -1->Emitted(27, 1) Source(20, 1) + SourceIndex(3) -2 >Emitted(27, 12) Source(20, 11) + SourceIndex(3) -3 >Emitted(27, 19) Source(20, 18) + SourceIndex(3) ---- ->>> var C = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^-> -1-> { - > /*@internal*/ -1->Emitted(28, 5) Source(21, 19) + SourceIndex(3) ---- ->>> function C() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(29, 9) Source(21, 19) + SourceIndex(3) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^-> -1->export class C { -2 > } -1->Emitted(30, 9) Source(21, 36) + SourceIndex(3) -2 >Emitted(30, 10) Source(21, 37) + SourceIndex(3) ---- ->>> return C; -1->^^^^^^^^ -2 > ^^^^^^^^ -1-> -2 > } -1->Emitted(31, 9) Source(21, 36) + SourceIndex(3) -2 >Emitted(31, 17) Source(21, 37) + SourceIndex(3) ---- ->>> }()); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class C { } -1 >Emitted(32, 5) Source(21, 36) + SourceIndex(3) -2 >Emitted(32, 6) Source(21, 37) + SourceIndex(3) -3 >Emitted(32, 6) Source(21, 19) + SourceIndex(3) -4 >Emitted(32, 10) Source(21, 37) + SourceIndex(3) ---- ->>> normalN.C = C; -1->^^^^ -2 > ^^^^^^^^^ -3 > ^^^^ -4 > ^ -5 > ^^^^^-> -1-> -2 > C -3 > { } -4 > -1->Emitted(33, 5) Source(21, 32) + SourceIndex(3) -2 >Emitted(33, 14) Source(21, 33) + SourceIndex(3) -3 >Emitted(33, 18) Source(21, 37) + SourceIndex(3) -4 >Emitted(33, 19) Source(21, 37) + SourceIndex(3) ---- ->>> function foo() { } -1->^^^^ -2 > ^^^^^^^^^ -3 > ^^^ -4 > ^^^^^ -5 > ^ -6 > ^-> -1-> - > /*@internal*/ -2 > export function -3 > foo -4 > () { -5 > } -1->Emitted(34, 5) Source(22, 19) + SourceIndex(3) -2 >Emitted(34, 14) Source(22, 35) + SourceIndex(3) -3 >Emitted(34, 17) Source(22, 38) + SourceIndex(3) -4 >Emitted(34, 22) Source(22, 42) + SourceIndex(3) -5 >Emitted(34, 23) Source(22, 43) + SourceIndex(3) ---- ->>> normalN.foo = foo; -1->^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^ -4 > ^ -5 > ^-> -1-> -2 > foo -3 > () {} -4 > -1->Emitted(35, 5) Source(22, 35) + SourceIndex(3) -2 >Emitted(35, 16) Source(22, 38) + SourceIndex(3) -3 >Emitted(35, 22) Source(22, 43) + SourceIndex(3) -4 >Emitted(35, 23) Source(22, 43) + SourceIndex(3) ---- ->>> var someNamespace; -1->^^^^ -2 > ^^^^ -3 > ^^^^^^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^-> -1-> - > /*@internal*/ -2 > export namespace -3 > someNamespace -4 > { export class C {} } -1->Emitted(36, 5) Source(23, 19) + SourceIndex(3) -2 >Emitted(36, 9) Source(23, 36) + SourceIndex(3) -3 >Emitted(36, 22) Source(23, 49) + SourceIndex(3) -4 >Emitted(36, 23) Source(23, 71) + SourceIndex(3) ---- ->>> (function (someNamespace) { -1->^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^ -4 > ^^^-> -1-> -2 > export namespace -3 > someNamespace -1->Emitted(37, 5) Source(23, 19) + SourceIndex(3) -2 >Emitted(37, 16) Source(23, 36) + SourceIndex(3) -3 >Emitted(37, 29) Source(23, 49) + SourceIndex(3) ---- ->>> var C = (function () { -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^-> -1-> { -1->Emitted(38, 9) Source(23, 52) + SourceIndex(3) ---- ->>> function C() { -1->^^^^^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(39, 13) Source(23, 52) + SourceIndex(3) ---- ->>> } -1->^^^^^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^-> -1->export class C { -2 > } -1->Emitted(40, 13) Source(23, 68) + SourceIndex(3) -2 >Emitted(40, 14) Source(23, 69) + SourceIndex(3) ---- ->>> return C; -1->^^^^^^^^^^^^ -2 > ^^^^^^^^ -1-> -2 > } -1->Emitted(41, 13) Source(23, 68) + SourceIndex(3) -2 >Emitted(41, 21) Source(23, 69) + SourceIndex(3) ---- ->>> }()); -1 >^^^^^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class C {} -1 >Emitted(42, 9) Source(23, 68) + SourceIndex(3) -2 >Emitted(42, 10) Source(23, 69) + SourceIndex(3) -3 >Emitted(42, 10) Source(23, 52) + SourceIndex(3) -4 >Emitted(42, 14) Source(23, 69) + SourceIndex(3) ---- ->>> someNamespace.C = C; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^ -3 > ^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 > C -3 > {} -4 > -1->Emitted(43, 9) Source(23, 65) + SourceIndex(3) -2 >Emitted(43, 24) Source(23, 66) + SourceIndex(3) -3 >Emitted(43, 28) Source(23, 69) + SourceIndex(3) -4 >Emitted(43, 29) Source(23, 69) + SourceIndex(3) ---- ->>> })(someNamespace = normalN.someNamespace || (normalN.someNamespace = {})); -1->^^^^ -2 > ^ -3 > ^^ -4 > ^^^^^^^^^^^^^ -5 > ^^^ -6 > ^^^^^^^^^^^^^^^^^^^^^ -7 > ^^^^^ -8 > ^^^^^^^^^^^^^^^^^^^^^ -9 > ^^^^^^^^ -1-> -2 > } -3 > -4 > someNamespace -5 > -6 > someNamespace -7 > -8 > someNamespace -9 > { export class C {} } -1->Emitted(44, 5) Source(23, 70) + SourceIndex(3) -2 >Emitted(44, 6) Source(23, 71) + SourceIndex(3) -3 >Emitted(44, 8) Source(23, 36) + SourceIndex(3) -4 >Emitted(44, 21) Source(23, 49) + SourceIndex(3) -5 >Emitted(44, 24) Source(23, 36) + SourceIndex(3) -6 >Emitted(44, 45) Source(23, 49) + SourceIndex(3) -7 >Emitted(44, 50) Source(23, 36) + SourceIndex(3) -8 >Emitted(44, 71) Source(23, 49) + SourceIndex(3) -9 >Emitted(44, 79) Source(23, 71) + SourceIndex(3) ---- ->>> var someOther; -1 >^^^^ -2 > ^^^^ -3 > ^^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^-> -1 > - > /*@internal*/ -2 > export namespace -3 > someOther -4 > .something { export class someClass {} } -1 >Emitted(45, 5) Source(24, 19) + SourceIndex(3) -2 >Emitted(45, 9) Source(24, 36) + SourceIndex(3) -3 >Emitted(45, 18) Source(24, 45) + SourceIndex(3) -4 >Emitted(45, 19) Source(24, 85) + SourceIndex(3) ---- ->>> (function (someOther) { -1->^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^^^^ -1-> -2 > export namespace -3 > someOther -1->Emitted(46, 5) Source(24, 19) + SourceIndex(3) -2 >Emitted(46, 16) Source(24, 36) + SourceIndex(3) -3 >Emitted(46, 25) Source(24, 45) + SourceIndex(3) ---- ->>> var something; -1 >^^^^^^^^ -2 > ^^^^ -3 > ^^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^-> -1 >. -2 > -3 > something -4 > { export class someClass {} } -1 >Emitted(47, 9) Source(24, 46) + SourceIndex(3) -2 >Emitted(47, 13) Source(24, 46) + SourceIndex(3) -3 >Emitted(47, 22) Source(24, 55) + SourceIndex(3) -4 >Emitted(47, 23) Source(24, 85) + SourceIndex(3) ---- ->>> (function (something) { -1->^^^^^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^-> -1-> -2 > -3 > something -1->Emitted(48, 9) Source(24, 46) + SourceIndex(3) -2 >Emitted(48, 20) Source(24, 46) + SourceIndex(3) -3 >Emitted(48, 29) Source(24, 55) + SourceIndex(3) ---- ->>> var someClass = (function () { -1->^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> { -1->Emitted(49, 13) Source(24, 58) + SourceIndex(3) ---- ->>> function someClass() { -1->^^^^^^^^^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(50, 17) Source(24, 58) + SourceIndex(3) ---- ->>> } -1->^^^^^^^^^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^-> -1->export class someClass { -2 > } -1->Emitted(51, 17) Source(24, 82) + SourceIndex(3) -2 >Emitted(51, 18) Source(24, 83) + SourceIndex(3) ---- ->>> return someClass; -1->^^^^^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(52, 17) Source(24, 82) + SourceIndex(3) -2 >Emitted(52, 33) Source(24, 83) + SourceIndex(3) ---- ->>> }()); -1 >^^^^^^^^^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class someClass {} -1 >Emitted(53, 13) Source(24, 82) + SourceIndex(3) -2 >Emitted(53, 14) Source(24, 83) + SourceIndex(3) -3 >Emitted(53, 14) Source(24, 58) + SourceIndex(3) -4 >Emitted(53, 18) Source(24, 83) + SourceIndex(3) ---- ->>> something.someClass = someClass; -1->^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^ -3 > ^^^^^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 > someClass -3 > {} -4 > -1->Emitted(54, 13) Source(24, 71) + SourceIndex(3) -2 >Emitted(54, 32) Source(24, 80) + SourceIndex(3) -3 >Emitted(54, 44) Source(24, 83) + SourceIndex(3) -4 >Emitted(54, 45) Source(24, 83) + SourceIndex(3) ---- ->>> })(something = someOther.something || (someOther.something = {})); -1->^^^^^^^^ -2 > ^ -3 > ^^ -4 > ^^^^^^^^^ -5 > ^^^ -6 > ^^^^^^^^^^^^^^^^^^^ -7 > ^^^^^ -8 > ^^^^^^^^^^^^^^^^^^^ -9 > ^^^^^^^^ -1-> -2 > } -3 > -4 > something -5 > -6 > something -7 > -8 > something -9 > { export class someClass {} } -1->Emitted(55, 9) Source(24, 84) + SourceIndex(3) -2 >Emitted(55, 10) Source(24, 85) + SourceIndex(3) -3 >Emitted(55, 12) Source(24, 46) + SourceIndex(3) -4 >Emitted(55, 21) Source(24, 55) + SourceIndex(3) -5 >Emitted(55, 24) Source(24, 46) + SourceIndex(3) -6 >Emitted(55, 43) Source(24, 55) + SourceIndex(3) -7 >Emitted(55, 48) Source(24, 46) + SourceIndex(3) -8 >Emitted(55, 67) Source(24, 55) + SourceIndex(3) -9 >Emitted(55, 75) Source(24, 85) + SourceIndex(3) ---- ->>> })(someOther = normalN.someOther || (normalN.someOther = {})); -1 >^^^^ -2 > ^ -3 > ^^ -4 > ^^^^^^^^^ -5 > ^^^ -6 > ^^^^^^^^^^^^^^^^^ -7 > ^^^^^ -8 > ^^^^^^^^^^^^^^^^^ -9 > ^^^^^^^^ -1 > -2 > } -3 > -4 > someOther -5 > -6 > someOther -7 > -8 > someOther -9 > .something { export class someClass {} } -1 >Emitted(56, 5) Source(24, 84) + SourceIndex(3) -2 >Emitted(56, 6) Source(24, 85) + SourceIndex(3) -3 >Emitted(56, 8) Source(24, 36) + SourceIndex(3) -4 >Emitted(56, 17) Source(24, 45) + SourceIndex(3) -5 >Emitted(56, 20) Source(24, 36) + SourceIndex(3) -6 >Emitted(56, 37) Source(24, 45) + SourceIndex(3) -7 >Emitted(56, 42) Source(24, 36) + SourceIndex(3) -8 >Emitted(56, 59) Source(24, 45) + SourceIndex(3) -9 >Emitted(56, 67) Source(24, 85) + SourceIndex(3) ---- ->>> normalN.someImport = someNamespace.C; -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^^^^^^^^^^ -5 > ^ -6 > ^ -7 > ^ -1 > - > /*@internal*/ export import -2 > someImport -3 > = -4 > someNamespace -5 > . -6 > C -7 > ; -1 >Emitted(57, 5) Source(25, 33) + SourceIndex(3) -2 >Emitted(57, 23) Source(25, 43) + SourceIndex(3) -3 >Emitted(57, 26) Source(25, 46) + SourceIndex(3) -4 >Emitted(57, 39) Source(25, 59) + SourceIndex(3) -5 >Emitted(57, 40) Source(25, 60) + SourceIndex(3) -6 >Emitted(57, 41) Source(25, 61) + SourceIndex(3) -7 >Emitted(57, 42) Source(25, 62) + SourceIndex(3) ---- ->>> normalN.internalConst = 10; -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -1 > - > /*@internal*/ export type internalType = internalC; - > /*@internal*/ export const -2 > internalConst -3 > = -4 > 10 -5 > ; -1 >Emitted(58, 5) Source(27, 32) + SourceIndex(3) -2 >Emitted(58, 26) Source(27, 45) + SourceIndex(3) -3 >Emitted(58, 29) Source(27, 48) + SourceIndex(3) -4 >Emitted(58, 31) Source(27, 50) + SourceIndex(3) -5 >Emitted(58, 32) Source(27, 51) + SourceIndex(3) ---- ->>> var internalEnum; -1 >^^^^ -2 > ^^^^ -3 > ^^^^^^^^^^^^ -4 > ^^^^^^^^^^^-> -1 > - > /*@internal*/ -2 > export enum -3 > internalEnum { a, b, c } -1 >Emitted(59, 5) Source(28, 19) + SourceIndex(3) -2 >Emitted(59, 9) Source(28, 31) + SourceIndex(3) -3 >Emitted(59, 21) Source(28, 55) + SourceIndex(3) ---- ->>> (function (internalEnum) { -1->^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 > export enum -3 > internalEnum -1->Emitted(60, 5) Source(28, 19) + SourceIndex(3) -2 >Emitted(60, 16) Source(28, 31) + SourceIndex(3) -3 >Emitted(60, 28) Source(28, 43) + SourceIndex(3) ---- ->>> internalEnum[internalEnum["a"] = 0] = "a"; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^-> -1-> { -2 > a -3 > -1->Emitted(61, 9) Source(28, 46) + SourceIndex(3) -2 >Emitted(61, 50) Source(28, 47) + SourceIndex(3) -3 >Emitted(61, 51) Source(28, 47) + SourceIndex(3) ---- ->>> internalEnum[internalEnum["b"] = 1] = "b"; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^-> -1->, -2 > b -3 > -1->Emitted(62, 9) Source(28, 49) + SourceIndex(3) -2 >Emitted(62, 50) Source(28, 50) + SourceIndex(3) -3 >Emitted(62, 51) Source(28, 50) + SourceIndex(3) ---- ->>> internalEnum[internalEnum["c"] = 2] = "c"; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->, -2 > c -3 > -1->Emitted(63, 9) Source(28, 52) + SourceIndex(3) -2 >Emitted(63, 50) Source(28, 53) + SourceIndex(3) -3 >Emitted(63, 51) Source(28, 53) + SourceIndex(3) ---- ->>> })(internalEnum = normalN.internalEnum || (normalN.internalEnum = {})); -1->^^^^ -2 > ^ -3 > ^^ -4 > ^^^^^^^^^^^^ -5 > ^^^ -6 > ^^^^^^^^^^^^^^^^^^^^ -7 > ^^^^^ -8 > ^^^^^^^^^^^^^^^^^^^^ -9 > ^^^^^^^^ -1-> -2 > } -3 > -4 > internalEnum -5 > -6 > internalEnum -7 > -8 > internalEnum -9 > { a, b, c } -1->Emitted(64, 5) Source(28, 54) + SourceIndex(3) -2 >Emitted(64, 6) Source(28, 55) + SourceIndex(3) -3 >Emitted(64, 8) Source(28, 31) + SourceIndex(3) -4 >Emitted(64, 20) Source(28, 43) + SourceIndex(3) -5 >Emitted(64, 23) Source(28, 31) + SourceIndex(3) -6 >Emitted(64, 43) Source(28, 43) + SourceIndex(3) -7 >Emitted(64, 48) Source(28, 31) + SourceIndex(3) -8 >Emitted(64, 68) Source(28, 43) + SourceIndex(3) -9 >Emitted(64, 76) Source(28, 55) + SourceIndex(3) ---- ->>>})(normalN || (normalN = {})); -1 > -2 >^ -3 > ^^ -4 > ^^^^^^^ -5 > ^^^^^ -6 > ^^^^^^^ -7 > ^^^^^^^^ -8 > ^-> -1 > - > -2 >} -3 > -4 > normalN -5 > -6 > normalN -7 > { - > /*@internal*/ export class C { } - > /*@internal*/ export function foo() {} - > /*@internal*/ export namespace someNamespace { export class C {} } - > /*@internal*/ export namespace someOther.something { export class someClass {} } - > /*@internal*/ export import someImport = someNamespace.C; - > /*@internal*/ export type internalType = internalC; - > /*@internal*/ export const internalConst = 10; - > /*@internal*/ export enum internalEnum { a, b, c } - > } -1 >Emitted(65, 1) Source(29, 1) + SourceIndex(3) -2 >Emitted(65, 2) Source(29, 2) + SourceIndex(3) -3 >Emitted(65, 4) Source(20, 11) + SourceIndex(3) -4 >Emitted(65, 11) Source(20, 18) + SourceIndex(3) -5 >Emitted(65, 16) Source(20, 11) + SourceIndex(3) -6 >Emitted(65, 23) Source(20, 18) + SourceIndex(3) -7 >Emitted(65, 31) Source(29, 2) + SourceIndex(3) ---- ->>>var internalC = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - >/*@internal*/ -1->Emitted(66, 1) Source(30, 15) + SourceIndex(3) ---- ->>> function internalC() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(67, 5) Source(30, 15) + SourceIndex(3) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^-> -1->class internalC { -2 > } -1->Emitted(68, 5) Source(30, 32) + SourceIndex(3) -2 >Emitted(68, 6) Source(30, 33) + SourceIndex(3) ---- ->>> return internalC; -1->^^^^ -2 > ^^^^^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(69, 5) Source(30, 32) + SourceIndex(3) -2 >Emitted(69, 21) Source(30, 33) + SourceIndex(3) ---- ->>>}()); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > class internalC {} -1 >Emitted(70, 1) Source(30, 32) + SourceIndex(3) -2 >Emitted(70, 2) Source(30, 33) + SourceIndex(3) -3 >Emitted(70, 2) Source(30, 15) + SourceIndex(3) -4 >Emitted(70, 6) Source(30, 33) + SourceIndex(3) ---- ->>>function internalfoo() { } -1-> -2 >^^^^^^^^^ -3 > ^^^^^^^^^^^ -4 > ^^^^^ -5 > ^ -1-> - >/*@internal*/ -2 >function -3 > internalfoo -4 > () { -5 > } -1->Emitted(71, 1) Source(31, 15) + SourceIndex(3) -2 >Emitted(71, 10) Source(31, 24) + SourceIndex(3) -3 >Emitted(71, 21) Source(31, 35) + SourceIndex(3) -4 >Emitted(71, 26) Source(31, 39) + SourceIndex(3) -5 >Emitted(71, 27) Source(31, 40) + SourceIndex(3) ---- ->>>var internalNamespace; -1 > -2 >^^^^ -3 > ^^^^^^^^^^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^-> -1 > - >/*@internal*/ -2 >namespace -3 > internalNamespace -4 > { export class someClass {} } -1 >Emitted(72, 1) Source(32, 15) + SourceIndex(3) -2 >Emitted(72, 5) Source(32, 25) + SourceIndex(3) -3 >Emitted(72, 22) Source(32, 42) + SourceIndex(3) -4 >Emitted(72, 23) Source(32, 72) + SourceIndex(3) ---- ->>>(function (internalNamespace) { -1-> -2 >^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^-> -1-> -2 >namespace -3 > internalNamespace -1->Emitted(73, 1) Source(32, 15) + SourceIndex(3) -2 >Emitted(73, 12) Source(32, 25) + SourceIndex(3) -3 >Emitted(73, 29) Source(32, 42) + SourceIndex(3) ---- ->>> var someClass = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> { -1->Emitted(74, 5) Source(32, 45) + SourceIndex(3) ---- ->>> function someClass() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(75, 9) Source(32, 45) + SourceIndex(3) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^-> -1->export class someClass { -2 > } -1->Emitted(76, 9) Source(32, 69) + SourceIndex(3) -2 >Emitted(76, 10) Source(32, 70) + SourceIndex(3) ---- ->>> return someClass; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(77, 9) Source(32, 69) + SourceIndex(3) -2 >Emitted(77, 25) Source(32, 70) + SourceIndex(3) ---- ->>> }()); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class someClass {} -1 >Emitted(78, 5) Source(32, 69) + SourceIndex(3) -2 >Emitted(78, 6) Source(32, 70) + SourceIndex(3) -3 >Emitted(78, 6) Source(32, 45) + SourceIndex(3) -4 >Emitted(78, 10) Source(32, 70) + SourceIndex(3) ---- ->>> internalNamespace.someClass = someClass; -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^^^^^^^^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 > someClass -3 > {} -4 > -1->Emitted(79, 5) Source(32, 58) + SourceIndex(3) -2 >Emitted(79, 32) Source(32, 67) + SourceIndex(3) -3 >Emitted(79, 44) Source(32, 70) + SourceIndex(3) -4 >Emitted(79, 45) Source(32, 70) + SourceIndex(3) ---- ->>>})(internalNamespace || (internalNamespace = {})); -1-> -2 >^ -3 > ^^ -4 > ^^^^^^^^^^^^^^^^^ -5 > ^^^^^ -6 > ^^^^^^^^^^^^^^^^^ -7 > ^^^^^^^^ -1-> -2 >} -3 > -4 > internalNamespace -5 > -6 > internalNamespace -7 > { export class someClass {} } -1->Emitted(80, 1) Source(32, 71) + SourceIndex(3) -2 >Emitted(80, 2) Source(32, 72) + SourceIndex(3) -3 >Emitted(80, 4) Source(32, 25) + SourceIndex(3) -4 >Emitted(80, 21) Source(32, 42) + SourceIndex(3) -5 >Emitted(80, 26) Source(32, 25) + SourceIndex(3) -6 >Emitted(80, 43) Source(32, 42) + SourceIndex(3) -7 >Emitted(80, 51) Source(32, 72) + SourceIndex(3) ---- ->>>var internalOther; -1 > -2 >^^^^ -3 > ^^^^^^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^-> -1 > - >/*@internal*/ -2 >namespace -3 > internalOther -4 > .something { export class someClass {} } -1 >Emitted(81, 1) Source(33, 15) + SourceIndex(3) -2 >Emitted(81, 5) Source(33, 25) + SourceIndex(3) -3 >Emitted(81, 18) Source(33, 38) + SourceIndex(3) -4 >Emitted(81, 19) Source(33, 78) + SourceIndex(3) ---- ->>>(function (internalOther) { -1-> -2 >^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^ -1-> -2 >namespace -3 > internalOther -1->Emitted(82, 1) Source(33, 15) + SourceIndex(3) -2 >Emitted(82, 12) Source(33, 25) + SourceIndex(3) -3 >Emitted(82, 25) Source(33, 38) + SourceIndex(3) ---- ->>> var something; -1 >^^^^ -2 > ^^^^ -3 > ^^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^-> -1 >. -2 > -3 > something -4 > { export class someClass {} } -1 >Emitted(83, 5) Source(33, 39) + SourceIndex(3) -2 >Emitted(83, 9) Source(33, 39) + SourceIndex(3) -3 >Emitted(83, 18) Source(33, 48) + SourceIndex(3) -4 >Emitted(83, 19) Source(33, 78) + SourceIndex(3) ---- ->>> (function (something) { -1->^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^-> -1-> -2 > -3 > something -1->Emitted(84, 5) Source(33, 39) + SourceIndex(3) -2 >Emitted(84, 16) Source(33, 39) + SourceIndex(3) -3 >Emitted(84, 25) Source(33, 48) + SourceIndex(3) ---- ->>> var someClass = (function () { -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> { -1->Emitted(85, 9) Source(33, 51) + SourceIndex(3) ---- ->>> function someClass() { -1->^^^^^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(86, 13) Source(33, 51) + SourceIndex(3) ---- ->>> } -1->^^^^^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^-> -1->export class someClass { -2 > } -1->Emitted(87, 13) Source(33, 75) + SourceIndex(3) -2 >Emitted(87, 14) Source(33, 76) + SourceIndex(3) ---- ->>> return someClass; -1->^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(88, 13) Source(33, 75) + SourceIndex(3) -2 >Emitted(88, 29) Source(33, 76) + SourceIndex(3) ---- ->>> }()); -1 >^^^^^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class someClass {} -1 >Emitted(89, 9) Source(33, 75) + SourceIndex(3) -2 >Emitted(89, 10) Source(33, 76) + SourceIndex(3) -3 >Emitted(89, 10) Source(33, 51) + SourceIndex(3) -4 >Emitted(89, 14) Source(33, 76) + SourceIndex(3) ---- ->>> something.someClass = someClass; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^ -3 > ^^^^^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 > someClass -3 > {} -4 > -1->Emitted(90, 9) Source(33, 64) + SourceIndex(3) -2 >Emitted(90, 28) Source(33, 73) + SourceIndex(3) -3 >Emitted(90, 40) Source(33, 76) + SourceIndex(3) -4 >Emitted(90, 41) Source(33, 76) + SourceIndex(3) ---- ->>> })(something = internalOther.something || (internalOther.something = {})); -1->^^^^ -2 > ^ -3 > ^^ -4 > ^^^^^^^^^ -5 > ^^^ -6 > ^^^^^^^^^^^^^^^^^^^^^^^ -7 > ^^^^^ -8 > ^^^^^^^^^^^^^^^^^^^^^^^ -9 > ^^^^^^^^ -1-> -2 > } -3 > -4 > something -5 > -6 > something -7 > -8 > something -9 > { export class someClass {} } -1->Emitted(91, 5) Source(33, 77) + SourceIndex(3) -2 >Emitted(91, 6) Source(33, 78) + SourceIndex(3) -3 >Emitted(91, 8) Source(33, 39) + SourceIndex(3) -4 >Emitted(91, 17) Source(33, 48) + SourceIndex(3) -5 >Emitted(91, 20) Source(33, 39) + SourceIndex(3) -6 >Emitted(91, 43) Source(33, 48) + SourceIndex(3) -7 >Emitted(91, 48) Source(33, 39) + SourceIndex(3) -8 >Emitted(91, 71) Source(33, 48) + SourceIndex(3) -9 >Emitted(91, 79) Source(33, 78) + SourceIndex(3) ---- ->>>})(internalOther || (internalOther = {})); -1 > -2 >^ -3 > ^^ -4 > ^^^^^^^^^^^^^ -5 > ^^^^^ -6 > ^^^^^^^^^^^^^ -7 > ^^^^^^^^ -8 > ^^^^^^^^-> -1 > -2 >} -3 > -4 > internalOther -5 > -6 > internalOther -7 > .something { export class someClass {} } -1 >Emitted(92, 1) Source(33, 77) + SourceIndex(3) -2 >Emitted(92, 2) Source(33, 78) + SourceIndex(3) -3 >Emitted(92, 4) Source(33, 25) + SourceIndex(3) -4 >Emitted(92, 17) Source(33, 38) + SourceIndex(3) -5 >Emitted(92, 22) Source(33, 25) + SourceIndex(3) -6 >Emitted(92, 35) Source(33, 38) + SourceIndex(3) -7 >Emitted(92, 43) Source(33, 78) + SourceIndex(3) ---- ->>>var internalImport = internalNamespace.someClass; -1-> -2 >^^^^ -3 > ^^^^^^^^^^^^^^ -4 > ^^^ -5 > ^^^^^^^^^^^^^^^^^ -6 > ^ -7 > ^^^^^^^^^ -8 > ^ -1-> - >/*@internal*/ -2 >import -3 > internalImport -4 > = -5 > internalNamespace -6 > . -7 > someClass -8 > ; -1->Emitted(93, 1) Source(34, 15) + SourceIndex(3) -2 >Emitted(93, 5) Source(34, 22) + SourceIndex(3) -3 >Emitted(93, 19) Source(34, 36) + SourceIndex(3) -4 >Emitted(93, 22) Source(34, 39) + SourceIndex(3) -5 >Emitted(93, 39) Source(34, 56) + SourceIndex(3) -6 >Emitted(93, 40) Source(34, 57) + SourceIndex(3) -7 >Emitted(93, 49) Source(34, 66) + SourceIndex(3) -8 >Emitted(93, 50) Source(34, 67) + SourceIndex(3) ---- ->>>var internalConst = 10; -1 > -2 >^^^^ -3 > ^^^^^^^^^^^^^ -4 > ^^^ -5 > ^^ -6 > ^ -1 > - >/*@internal*/ type internalType = internalC; - >/*@internal*/ -2 >const -3 > internalConst -4 > = -5 > 10 -6 > ; -1 >Emitted(94, 1) Source(36, 15) + SourceIndex(3) -2 >Emitted(94, 5) Source(36, 21) + SourceIndex(3) -3 >Emitted(94, 18) Source(36, 34) + SourceIndex(3) -4 >Emitted(94, 21) Source(36, 37) + SourceIndex(3) -5 >Emitted(94, 23) Source(36, 39) + SourceIndex(3) -6 >Emitted(94, 24) Source(36, 40) + SourceIndex(3) ---- ->>>var internalEnum; -1 > -2 >^^^^ -3 > ^^^^^^^^^^^^ -4 > ^^^^^^^^^^^-> -1 > - >/*@internal*/ -2 >enum -3 > internalEnum { a, b, c } -1 >Emitted(95, 1) Source(37, 15) + SourceIndex(3) -2 >Emitted(95, 5) Source(37, 20) + SourceIndex(3) -3 >Emitted(95, 17) Source(37, 44) + SourceIndex(3) ---- ->>>(function (internalEnum) { -1-> -2 >^^^^^^^^^^^ -3 > ^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 >enum -3 > internalEnum -1->Emitted(96, 1) Source(37, 15) + SourceIndex(3) -2 >Emitted(96, 12) Source(37, 20) + SourceIndex(3) -3 >Emitted(96, 24) Source(37, 32) + SourceIndex(3) ---- ->>> internalEnum[internalEnum["a"] = 0] = "a"; -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^-> -1-> { -2 > a -3 > -1->Emitted(97, 5) Source(37, 35) + SourceIndex(3) -2 >Emitted(97, 46) Source(37, 36) + SourceIndex(3) -3 >Emitted(97, 47) Source(37, 36) + SourceIndex(3) ---- ->>> internalEnum[internalEnum["b"] = 1] = "b"; -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^-> -1->, -2 > b -3 > -1->Emitted(98, 5) Source(37, 38) + SourceIndex(3) -2 >Emitted(98, 46) Source(37, 39) + SourceIndex(3) -3 >Emitted(98, 47) Source(37, 39) + SourceIndex(3) ---- ->>> internalEnum[internalEnum["c"] = 2] = "c"; -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -1->, -2 > c -3 > -1->Emitted(99, 5) Source(37, 41) + SourceIndex(3) -2 >Emitted(99, 46) Source(37, 42) + SourceIndex(3) -3 >Emitted(99, 47) Source(37, 42) + SourceIndex(3) ---- ->>>})(internalEnum || (internalEnum = {})); -1 > -2 >^ -3 > ^^ -4 > ^^^^^^^^^^^^ -5 > ^^^^^ -6 > ^^^^^^^^^^^^ -7 > ^^^^^^^^ -1 > -2 >} -3 > -4 > internalEnum -5 > -6 > internalEnum -7 > { a, b, c } -1 >Emitted(100, 1) Source(37, 43) + SourceIndex(3) -2 >Emitted(100, 2) Source(37, 44) + SourceIndex(3) -3 >Emitted(100, 4) Source(37, 20) + SourceIndex(3) -4 >Emitted(100, 16) Source(37, 32) + SourceIndex(3) -5 >Emitted(100, 21) Source(37, 20) + SourceIndex(3) -6 >Emitted(100, 33) Source(37, 32) + SourceIndex(3) -7 >Emitted(100, 41) Source(37, 44) + SourceIndex(3) ---- -------------------------------------------------------------------- -emittedFile:/src/2/second-output.js -sourceFile:../second/second_part2.ts -------------------------------------------------------------------- ->>>var C = (function () { -1 > -2 >^^^^^^^^^^^^^^^^^^^-> -1 > -1 >Emitted(101, 1) Source(1, 1) + SourceIndex(4) ---- ->>> function C() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(102, 5) Source(1, 1) + SourceIndex(4) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->class C { - > doSomething() { - > console.log("something got done"); - > } - > -2 > } -1->Emitted(103, 5) Source(5, 1) + SourceIndex(4) -2 >Emitted(103, 6) Source(5, 2) + SourceIndex(4) ---- ->>> C.prototype.doSomething = function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^^^^^^^^^^-> -1-> -2 > doSomething -3 > -1->Emitted(104, 5) Source(2, 5) + SourceIndex(4) -2 >Emitted(104, 28) Source(2, 16) + SourceIndex(4) -3 >Emitted(104, 31) Source(2, 5) + SourceIndex(4) ---- ->>> console.log("something got done"); -1->^^^^^^^^ -2 > ^^^^^^^ -3 > ^ -4 > ^^^ -5 > ^ -6 > ^^^^^^^^^^^^^^^^^^^^ -7 > ^ -8 > ^ -1->doSomething() { - > -2 > console -3 > . -4 > log -5 > ( -6 > "something got done" -7 > ) -8 > ; -1->Emitted(105, 9) Source(3, 9) + SourceIndex(4) -2 >Emitted(105, 16) Source(3, 16) + SourceIndex(4) -3 >Emitted(105, 17) Source(3, 17) + SourceIndex(4) -4 >Emitted(105, 20) Source(3, 20) + SourceIndex(4) -5 >Emitted(105, 21) Source(3, 21) + SourceIndex(4) -6 >Emitted(105, 41) Source(3, 41) + SourceIndex(4) -7 >Emitted(105, 42) Source(3, 42) + SourceIndex(4) -8 >Emitted(105, 43) Source(3, 43) + SourceIndex(4) ---- ->>> }; -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(106, 5) Source(4, 5) + SourceIndex(4) -2 >Emitted(106, 6) Source(4, 6) + SourceIndex(4) ---- ->>> return C; -1->^^^^ -2 > ^^^^^^^^ -1-> - > -2 > } -1->Emitted(107, 5) Source(5, 1) + SourceIndex(4) -2 >Emitted(107, 13) Source(5, 2) + SourceIndex(4) ---- ->>>}()); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > class C { - > doSomething() { - > console.log("something got done"); - > } - > } -1 >Emitted(108, 1) Source(5, 1) + SourceIndex(4) -2 >Emitted(108, 2) Source(5, 2) + SourceIndex(4) -3 >Emitted(108, 2) Source(1, 1) + SourceIndex(4) -4 >Emitted(108, 6) Source(5, 2) + SourceIndex(4) ---- ->>>//# sourceMappingURL=second-output.js.map - -//// [/src/2/second-output.tsbuildinfo] -{ - "bundle": { - "commonSourceDirectory": "../second", - "sourceFiles": [ - "../second/second_part1.ts", - "../second/second_part2.ts" - ], - "js": { - "sections": [ - { - "pos": 0, - "end": 110, - "kind": "prepend", - "data": "../first/bin/first-output.js", - "texts": [ - { - "pos": 0, - "end": 110, - "kind": "text" - } - ] - }, - { - "pos": 110, - "end": 3162, - "kind": "text" - } - ] - }, - "dts": { - "sections": [ - { - "pos": 0, - "end": 157, - "kind": "prepend", - "data": "../first/bin/first-output.d.ts", - "texts": [ - { - "pos": 0, - "end": 157, - "kind": "text" - } - ] - }, - { - "pos": 157, - "end": 234, - "kind": "text" - }, - { - "pos": 234, - "end": 308, - "kind": "internal" - }, - { - "pos": 310, - "end": 342, - "kind": "text" - }, - { - "pos": 342, - "end": 734, - "kind": "internal" - }, - { - "pos": 736, - "end": 739, - "kind": "text" - }, - { - "pos": 739, - "end": 1152, - "kind": "internal" - }, - { - "pos": 1154, - "end": 1202, - "kind": "text" - } - ] - } - }, - "version": "FakeTSVersion" -} - -//// [/src/2/second-output.tsbuildinfo.baseline.txt] -====================================================================== -File:: /src/2/second-output.js ----------------------------------------------------------------------- -prepend: (0-110):: ../first/bin/first-output.js texts:: 1 ->>-------------------------------------------------------------------- -text: (0-110) -var s = "Hello, world"; -console.log(s); -console.log(f()); -function f() { - return "JS does hoists"; -} - ----------------------------------------------------------------------- -text: (110-3162) -var N; -(function (N) { - function f() { - console.log('testing'); - } - f(); -})(N || (N = {})); -var normalC = (function () { - function normalC() { - } - normalC.prototype.method = function () { }; - Object.defineProperty(normalC.prototype, "c", { - get: function () { return 10; }, - set: function (val) { }, - enumerable: true, - configurable: true - }); - return normalC; -}()); -var normalN; -(function (normalN) { - var C = (function () { - function C() { - } - return C; - }()); - normalN.C = C; - function foo() { } - normalN.foo = foo; - var someNamespace; - (function (someNamespace) { - var C = (function () { - function C() { - } - return C; - }()); - someNamespace.C = C; - })(someNamespace = normalN.someNamespace || (normalN.someNamespace = {})); - var someOther; - (function (someOther) { - var something; - (function (something) { - var someClass = (function () { - function someClass() { - } - return someClass; - }()); - something.someClass = someClass; - })(something = someOther.something || (someOther.something = {})); - })(someOther = normalN.someOther || (normalN.someOther = {})); - normalN.someImport = someNamespace.C; - normalN.internalConst = 10; - var internalEnum; - (function (internalEnum) { - internalEnum[internalEnum["a"] = 0] = "a"; - internalEnum[internalEnum["b"] = 1] = "b"; - internalEnum[internalEnum["c"] = 2] = "c"; - })(internalEnum = normalN.internalEnum || (normalN.internalEnum = {})); -})(normalN || (normalN = {})); -var internalC = (function () { - function internalC() { - } - return internalC; -}()); -function internalfoo() { } -var internalNamespace; -(function (internalNamespace) { - var someClass = (function () { - function someClass() { - } - return someClass; - }()); - internalNamespace.someClass = someClass; -})(internalNamespace || (internalNamespace = {})); -var internalOther; -(function (internalOther) { - var something; - (function (something) { - var someClass = (function () { - function someClass() { - } - return someClass; - }()); - something.someClass = someClass; - })(something = internalOther.something || (internalOther.something = {})); -})(internalOther || (internalOther = {})); -var internalImport = internalNamespace.someClass; -var internalConst = 10; -var internalEnum; -(function (internalEnum) { - internalEnum[internalEnum["a"] = 0] = "a"; - internalEnum[internalEnum["b"] = 1] = "b"; - internalEnum[internalEnum["c"] = 2] = "c"; -})(internalEnum || (internalEnum = {})); -var C = (function () { - function C() { - } - C.prototype.doSomething = function () { - console.log("something got done"); - }; - return C; -}()); - -====================================================================== -====================================================================== -File:: /src/2/second-output.d.ts ----------------------------------------------------------------------- -prepend: (0-157):: ../first/bin/first-output.d.ts texts:: 1 ->>-------------------------------------------------------------------- -text: (0-157) -interface TheFirst { - none: any; -} -declare const s = "Hello, world"; -interface NoJsForHereEither { - none: any; -} -declare function f(): string; - ----------------------------------------------------------------------- -text: (157-234) -declare namespace N { -} -declare namespace N { -} -declare class normalC { - ----------------------------------------------------------------------- -internal: (234-308) - constructor(); - prop: string; - method(): void; - c: number; ----------------------------------------------------------------------- -text: (310-342) -} -declare namespace normalN { - ----------------------------------------------------------------------- -internal: (342-734) - class C { - } - function foo(): void; - namespace someNamespace { - class C { - } - } - namespace someOther.something { - class someClass { - } - } - export import someImport = someNamespace.C; - type internalType = internalC; - const internalConst = 10; - enum internalEnum { - a = 0, - b = 1, - c = 2 - } ----------------------------------------------------------------------- -text: (736-739) -} - ----------------------------------------------------------------------- -internal: (739-1152) -declare class internalC { -} -declare function internalfoo(): void; -declare namespace internalNamespace { - class someClass { - } -} -declare namespace internalOther.something { - class someClass { - } -} -import internalImport = internalNamespace.someClass; -declare type internalType = internalC; -declare const internalConst = 10; -declare enum internalEnum { - a = 0, - b = 1, - c = 2 -} ----------------------------------------------------------------------- -text: (1154-1202) -declare class C { - doSomething(): void; -} - -====================================================================== - -//// [/src/first/bin/first-output.d.ts.map] -{"version":3,"file":"first-output.d.ts","sourceRoot":"","sources":["../first_PART1.ts","../first_part2.ts","../first_part3.ts"],"names":[],"mappings":"AAAA,UAAU,QAAQ;IACd,IAAI,EAAE,GAAG,CAAC;CACb;AAED,QAAA,MAAM,CAAC,iBAAiB,CAAC;AAEzB,UAAU,iBAAiB;IACvB,IAAI,EAAE,GAAG,CAAC;CACb;AERD,iBAAS,CAAC,WAET"} - -//// [/src/first/bin/first-output.d.ts.map.baseline.txt] -=================================================================== -JsFile: first-output.d.ts -mapUrl: first-output.d.ts.map -sourceRoot: -sources: ../first_PART1.ts,../first_part2.ts,../first_part3.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:/src/first/bin/first-output.d.ts -sourceFile:../first_PART1.ts -------------------------------------------------------------------- ->>>interface TheFirst { -1 > -2 >^^^^^^^^^^ -3 > ^^^^^^^^ -1 > -2 >interface -3 > TheFirst -1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -2 >Emitted(1, 11) Source(1, 11) + SourceIndex(0) -3 >Emitted(1, 19) Source(1, 19) + SourceIndex(0) ---- ->>> none: any; -1 >^^^^ -2 > ^^^^ -3 > ^^ -4 > ^^^ -5 > ^ -1 > { - > -2 > none -3 > : -4 > any -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 9) Source(2, 9) + SourceIndex(0) -3 >Emitted(2, 11) Source(2, 11) + SourceIndex(0) -4 >Emitted(2, 14) Source(2, 14) + SourceIndex(0) -5 >Emitted(2, 15) Source(2, 15) + SourceIndex(0) ---- ->>>} -1 >^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - >} -1 >Emitted(3, 2) Source(3, 2) + SourceIndex(0) ---- ->>>declare const s = "Hello, world"; -1-> -2 >^^^^^^^^ -3 > ^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^^^^ -6 > ^ -1-> - > - > -2 > -3 > const -4 > s -5 > = "Hello, world" -6 > ; -1->Emitted(4, 1) Source(5, 1) + SourceIndex(0) -2 >Emitted(4, 9) Source(5, 1) + SourceIndex(0) -3 >Emitted(4, 15) Source(5, 7) + SourceIndex(0) -4 >Emitted(4, 16) Source(5, 8) + SourceIndex(0) -5 >Emitted(4, 33) Source(5, 25) + SourceIndex(0) -6 >Emitted(4, 34) Source(5, 26) + SourceIndex(0) ---- ->>>interface NoJsForHereEither { -1 > -2 >^^^^^^^^^^ -3 > ^^^^^^^^^^^^^^^^^ -1 > - > - > -2 >interface -3 > NoJsForHereEither -1 >Emitted(5, 1) Source(7, 1) + SourceIndex(0) -2 >Emitted(5, 11) Source(7, 11) + SourceIndex(0) -3 >Emitted(5, 28) Source(7, 28) + SourceIndex(0) ---- ->>> none: any; -1 >^^^^ -2 > ^^^^ -3 > ^^ -4 > ^^^ -5 > ^ -1 > { - > -2 > none -3 > : -4 > any -5 > ; -1 >Emitted(6, 5) Source(8, 5) + SourceIndex(0) -2 >Emitted(6, 9) Source(8, 9) + SourceIndex(0) -3 >Emitted(6, 11) Source(8, 11) + SourceIndex(0) -4 >Emitted(6, 14) Source(8, 14) + SourceIndex(0) -5 >Emitted(6, 15) Source(8, 15) + SourceIndex(0) ---- ->>>} -1 >^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - >} -1 >Emitted(7, 2) Source(9, 2) + SourceIndex(0) ---- -------------------------------------------------------------------- -emittedFile:/src/first/bin/first-output.d.ts -sourceFile:../first_part3.ts -------------------------------------------------------------------- ->>>declare function f(): string; -1-> -2 >^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^ -5 > ^^^^^^^^^^^^-> -1-> -2 >function -3 > f -4 > () { - > return "JS does hoists"; - > } -1->Emitted(8, 1) Source(1, 1) + SourceIndex(2) -2 >Emitted(8, 18) Source(1, 10) + SourceIndex(2) -3 >Emitted(8, 19) Source(1, 11) + SourceIndex(2) -4 >Emitted(8, 30) Source(3, 2) + SourceIndex(2) ---- ->>>//# sourceMappingURL=first-output.d.ts.map - -//// [/src/first/bin/first-output.js.map.baseline.txt] -=================================================================== -JsFile: first-output.js -mapUrl: first-output.js.map -sourceRoot: -sources: ../first_PART1.ts,../first_part2.ts,../first_part3.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:/src/first/bin/first-output.js -sourceFile:../first_PART1.ts -------------------------------------------------------------------- ->>>var s = "Hello, world"; -1 > -2 >^^^^ -3 > ^ -4 > ^^^ -5 > ^^^^^^^^^^^^^^ -6 > ^ -1 >interface TheFirst { - > none: any; - >} - > - > -2 >const -3 > s -4 > = -5 > "Hello, world" -6 > ; -1 >Emitted(1, 1) Source(5, 1) + SourceIndex(0) -2 >Emitted(1, 5) Source(5, 7) + SourceIndex(0) -3 >Emitted(1, 6) Source(5, 8) + SourceIndex(0) -4 >Emitted(1, 9) Source(5, 11) + SourceIndex(0) -5 >Emitted(1, 23) Source(5, 25) + SourceIndex(0) -6 >Emitted(1, 24) Source(5, 26) + SourceIndex(0) ---- ->>>console.log(s); -1 > -2 >^^^^^^^ -3 > ^ -4 > ^^^ -5 > ^ -6 > ^ -7 > ^ -8 > ^ -9 > ^^^-> -1 > - > - >interface NoJsForHereEither { - > none: any; - >} - > - > -2 >console -3 > . -4 > log -5 > ( -6 > s -7 > ) -8 > ; -1 >Emitted(2, 1) Source(11, 1) + SourceIndex(0) -2 >Emitted(2, 8) Source(11, 8) + SourceIndex(0) -3 >Emitted(2, 9) Source(11, 9) + SourceIndex(0) -4 >Emitted(2, 12) Source(11, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(11, 13) + SourceIndex(0) -6 >Emitted(2, 14) Source(11, 14) + SourceIndex(0) -7 >Emitted(2, 15) Source(11, 15) + SourceIndex(0) -8 >Emitted(2, 16) Source(11, 16) + SourceIndex(0) ---- -------------------------------------------------------------------- -emittedFile:/src/first/bin/first-output.js -sourceFile:../first_part2.ts -------------------------------------------------------------------- ->>>console.log(f()); -1-> -2 >^^^^^^^ -3 > ^ -4 > ^^^ -5 > ^ -6 > ^ -7 > ^^ -8 > ^ -9 > ^ -1-> -2 >console -3 > . -4 > log -5 > ( -6 > f -7 > () -8 > ) -9 > ; -1->Emitted(3, 1) Source(1, 1) + SourceIndex(1) -2 >Emitted(3, 8) Source(1, 8) + SourceIndex(1) -3 >Emitted(3, 9) Source(1, 9) + SourceIndex(1) -4 >Emitted(3, 12) Source(1, 12) + SourceIndex(1) -5 >Emitted(3, 13) Source(1, 13) + SourceIndex(1) -6 >Emitted(3, 14) Source(1, 14) + SourceIndex(1) -7 >Emitted(3, 16) Source(1, 16) + SourceIndex(1) -8 >Emitted(3, 17) Source(1, 17) + SourceIndex(1) -9 >Emitted(3, 18) Source(1, 18) + SourceIndex(1) ---- -------------------------------------------------------------------- -emittedFile:/src/first/bin/first-output.js -sourceFile:../first_part3.ts -------------------------------------------------------------------- ->>>function f() { -1 > -2 >^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^-> -1 > -2 >function -3 > f -1 >Emitted(4, 1) Source(1, 1) + SourceIndex(2) -2 >Emitted(4, 10) Source(1, 10) + SourceIndex(2) -3 >Emitted(4, 11) Source(1, 11) + SourceIndex(2) ---- ->>> return "JS does hoists"; -1->^^^^ -2 > ^^^^^^^ -3 > ^^^^^^^^^^^^^^^^ -4 > ^ -1->() { - > -2 > return -3 > "JS does hoists" -4 > ; -1->Emitted(5, 5) Source(2, 5) + SourceIndex(2) -2 >Emitted(5, 12) Source(2, 12) + SourceIndex(2) -3 >Emitted(5, 28) Source(2, 28) + SourceIndex(2) -4 >Emitted(5, 29) Source(2, 29) + SourceIndex(2) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(6, 1) Source(3, 1) + SourceIndex(2) -2 >Emitted(6, 2) Source(3, 2) + SourceIndex(2) ---- ->>>//# sourceMappingURL=first-output.js.map - -//// [/src/first/bin/first-output.tsbuildinfo] -{ - "bundle": { - "commonSourceDirectory": "..", - "sourceFiles": [ - "../first_PART1.ts", - "../first_part2.ts", - "../first_part3.ts" - ], - "js": { - "sections": [ - { - "pos": 0, - "end": 110, - "kind": "text" - } - ] - }, - "dts": { - "sections": [ - { - "pos": 0, - "end": 157, - "kind": "text" - } - ] - } - }, - "version": "FakeTSVersion" -} - -//// [/src/first/bin/first-output.tsbuildinfo.baseline.txt] -====================================================================== -File:: /src/first/bin/first-output.js ----------------------------------------------------------------------- -text: (0-110) -var s = "Hello, world"; -console.log(s); -console.log(f()); -function f() { - return "JS does hoists"; -} - -====================================================================== -====================================================================== -File:: /src/first/bin/first-output.d.ts ----------------------------------------------------------------------- -text: (0-157) -interface TheFirst { - none: any; -} -declare const s = "Hello, world"; -interface NoJsForHereEither { - none: any; -} -declare function f(): string; - -====================================================================== - -//// [/src/first/first_PART1.ts] -interface TheFirst { - none: any; -} - -const s = "Hello, world"; - -interface NoJsForHereEither { - none: any; -} - -console.log(s); - - -//// [/src/third/thirdjs/output/third-output.d.ts] -interface TheFirst { - none: any; -} -declare const s = "Hello, world"; -interface NoJsForHereEither { - none: any; -} -declare function f(): string; -declare namespace N { -} -declare namespace N { -} -declare class normalC { -} -declare namespace normalN { -} -declare class C { - doSomething(): void; -} -declare var c: C; -//# sourceMappingURL=third-output.d.ts.map - -//// [/src/third/thirdjs/output/third-output.d.ts.map] -{"version":3,"file":"third-output.d.ts","sourceRoot":"","sources":["../../../first/first_PART1.ts","../../../first/first_part3.ts","../../../second/second_part1.ts","../../../second/second_part2.ts","../../third_part1.ts"],"names":[],"mappings":"AAAA,UAAU,QAAQ;IACd,IAAI,EAAE,GAAG,CAAC;CACb;AAED,QAAA,MAAM,CAAC,iBAAiB,CAAC;AAEzB,UAAU,iBAAiB;IACvB,IAAI,EAAE,GAAG,CAAC;CACb;ACRD,iBAAS,CAAC,WAET;ACFD,kBAAU,CAAC,CAAC;CAEX;AAED,kBAAU,CAAC,CAAC;CAMX;AAED,cAAM,OAAO;CAMZ;AACD,kBAAU,OAAO,CAAC;CASjB;AC5BD,cAAM,CAAC;IACH,WAAW;CAGd;ACJD,QAAA,IAAI,CAAC,GAAU,CAAC"} - -//// [/src/third/thirdjs/output/third-output.d.ts.map.baseline.txt] -=================================================================== -JsFile: third-output.d.ts -mapUrl: third-output.d.ts.map -sourceRoot: -sources: ../../../first/first_PART1.ts,../../../first/first_part3.ts,../../../second/second_part1.ts,../../../second/second_part2.ts,../../third_part1.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:/src/third/thirdjs/output/third-output.d.ts -sourceFile:../../../first/first_PART1.ts -------------------------------------------------------------------- ->>>interface TheFirst { -1 > -2 >^^^^^^^^^^ -3 > ^^^^^^^^ -1 > -2 >interface -3 > TheFirst -1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -2 >Emitted(1, 11) Source(1, 11) + SourceIndex(0) -3 >Emitted(1, 19) Source(1, 19) + SourceIndex(0) ---- ->>> none: any; -1 >^^^^ -2 > ^^^^ -3 > ^^ -4 > ^^^ -5 > ^ -1 > { - > -2 > none -3 > : -4 > any -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 9) Source(2, 9) + SourceIndex(0) -3 >Emitted(2, 11) Source(2, 11) + SourceIndex(0) -4 >Emitted(2, 14) Source(2, 14) + SourceIndex(0) -5 >Emitted(2, 15) Source(2, 15) + SourceIndex(0) ---- ->>>} -1 >^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - >} -1 >Emitted(3, 2) Source(3, 2) + SourceIndex(0) ---- ->>>declare const s = "Hello, world"; -1-> -2 >^^^^^^^^ -3 > ^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^^^^ -6 > ^ -1-> - > - > -2 > -3 > const -4 > s -5 > = "Hello, world" -6 > ; -1->Emitted(4, 1) Source(5, 1) + SourceIndex(0) -2 >Emitted(4, 9) Source(5, 1) + SourceIndex(0) -3 >Emitted(4, 15) Source(5, 7) + SourceIndex(0) -4 >Emitted(4, 16) Source(5, 8) + SourceIndex(0) -5 >Emitted(4, 33) Source(5, 25) + SourceIndex(0) -6 >Emitted(4, 34) Source(5, 26) + SourceIndex(0) ---- ->>>interface NoJsForHereEither { -1 > -2 >^^^^^^^^^^ -3 > ^^^^^^^^^^^^^^^^^ -1 > - > - > -2 >interface -3 > NoJsForHereEither -1 >Emitted(5, 1) Source(7, 1) + SourceIndex(0) -2 >Emitted(5, 11) Source(7, 11) + SourceIndex(0) -3 >Emitted(5, 28) Source(7, 28) + SourceIndex(0) ---- ->>> none: any; -1 >^^^^ -2 > ^^^^ -3 > ^^ -4 > ^^^ -5 > ^ -1 > { - > -2 > none -3 > : -4 > any -5 > ; -1 >Emitted(6, 5) Source(8, 5) + SourceIndex(0) -2 >Emitted(6, 9) Source(8, 9) + SourceIndex(0) -3 >Emitted(6, 11) Source(8, 11) + SourceIndex(0) -4 >Emitted(6, 14) Source(8, 14) + SourceIndex(0) -5 >Emitted(6, 15) Source(8, 15) + SourceIndex(0) ---- ->>>} -1 >^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - >} -1 >Emitted(7, 2) Source(9, 2) + SourceIndex(0) ---- -------------------------------------------------------------------- -emittedFile:/src/third/thirdjs/output/third-output.d.ts -sourceFile:../../../first/first_part3.ts -------------------------------------------------------------------- ->>>declare function f(): string; -1-> -2 >^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^ -1-> -2 >function -3 > f -4 > () { - > return "JS does hoists"; - > } -1->Emitted(8, 1) Source(1, 1) + SourceIndex(1) -2 >Emitted(8, 18) Source(1, 10) + SourceIndex(1) -3 >Emitted(8, 19) Source(1, 11) + SourceIndex(1) -4 >Emitted(8, 30) Source(3, 2) + SourceIndex(1) ---- -------------------------------------------------------------------- -emittedFile:/src/third/thirdjs/output/third-output.d.ts -sourceFile:../../../second/second_part1.ts -------------------------------------------------------------------- ->>>declare namespace N { -1 > -2 >^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^ -1 > -2 >namespace -3 > N -4 > -1 >Emitted(9, 1) Source(1, 1) + SourceIndex(2) -2 >Emitted(9, 19) Source(1, 11) + SourceIndex(2) -3 >Emitted(9, 20) Source(1, 12) + SourceIndex(2) -4 >Emitted(9, 21) Source(1, 13) + SourceIndex(2) ---- ->>>} -1 >^ -2 > ^^^^^^^^^^^^^^^^^^^^^-> -1 >{ - > // Comment text - >} -1 >Emitted(10, 2) Source(3, 2) + SourceIndex(2) ---- ->>>declare namespace N { -1-> -2 >^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^ -1-> - > - > -2 >namespace -3 > N -4 > -1->Emitted(11, 1) Source(5, 1) + SourceIndex(2) -2 >Emitted(11, 19) Source(5, 11) + SourceIndex(2) -3 >Emitted(11, 20) Source(5, 12) + SourceIndex(2) -4 >Emitted(11, 21) Source(5, 13) + SourceIndex(2) ---- ->>>} -1 >^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^-> -1 >{ - > function f() { - > console.log('testing'); - > } - > - > f(); - >} -1 >Emitted(12, 2) Source(11, 2) + SourceIndex(2) ---- ->>>declare class normalC { -1-> -2 >^^^^^^^^^^^^^^ -3 > ^^^^^^^ -1-> - > - > -2 >class -3 > normalC -1->Emitted(13, 1) Source(13, 1) + SourceIndex(2) -2 >Emitted(13, 15) Source(13, 7) + SourceIndex(2) -3 >Emitted(13, 22) Source(13, 14) + SourceIndex(2) ---- ->>>} -1 >^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > { - > /*@internal*/ constructor() { } - > /*@internal*/ prop: string; - > /*@internal*/ method() { } - > /*@internal*/ get c() { return 10; } - > /*@internal*/ set c(val: number) { } - >} -1 >Emitted(14, 2) Source(19, 2) + SourceIndex(2) ---- ->>>declare namespace normalN { -1-> -2 >^^^^^^^^^^^^^^^^^^ -3 > ^^^^^^^ -4 > ^ -1-> - > -2 >namespace -3 > normalN -4 > -1->Emitted(15, 1) Source(20, 1) + SourceIndex(2) -2 >Emitted(15, 19) Source(20, 11) + SourceIndex(2) -3 >Emitted(15, 26) Source(20, 18) + SourceIndex(2) -4 >Emitted(15, 27) Source(20, 19) + SourceIndex(2) ---- ->>>} -1 >^ -2 > ^^^^^^^^^^^^^^^^^-> -1 >{ - > /*@internal*/ export class C { } - > /*@internal*/ export function foo() {} - > /*@internal*/ export namespace someNamespace { export class C {} } - > /*@internal*/ export namespace someOther.something { export class someClass {} } - > /*@internal*/ export import someImport = someNamespace.C; - > /*@internal*/ export type internalType = internalC; - > /*@internal*/ export const internalConst = 10; - > /*@internal*/ export enum internalEnum { a, b, c } - >} -1 >Emitted(16, 2) Source(29, 2) + SourceIndex(2) ---- -------------------------------------------------------------------- -emittedFile:/src/third/thirdjs/output/third-output.d.ts -sourceFile:../../../second/second_part2.ts -------------------------------------------------------------------- ->>>declare class C { -1-> -2 >^^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^-> -1-> -2 >class -3 > C -1->Emitted(17, 1) Source(1, 1) + SourceIndex(3) -2 >Emitted(17, 15) Source(1, 7) + SourceIndex(3) -3 >Emitted(17, 16) Source(1, 8) + SourceIndex(3) ---- ->>> doSomething(): void; -1->^^^^ -2 > ^^^^^^^^^^^ -1-> { - > -2 > doSomething -1->Emitted(18, 5) Source(2, 5) + SourceIndex(3) -2 >Emitted(18, 16) Source(2, 16) + SourceIndex(3) ---- ->>>} -1 >^ -2 > ^^^^^^^^^^^^^^^^^-> -1 >() { - > console.log("something got done"); - > } - >} -1 >Emitted(19, 2) Source(5, 2) + SourceIndex(3) ---- -------------------------------------------------------------------- -emittedFile:/src/third/thirdjs/output/third-output.d.ts -sourceFile:../../third_part1.ts -------------------------------------------------------------------- ->>>declare var c: C; -1-> -2 >^^^^^^^^ -3 > ^^^^ -4 > ^ -5 > ^^^ -6 > ^ -7 > ^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 > -3 > var -4 > c -5 > = new C() -6 > ; -1->Emitted(20, 1) Source(1, 1) + SourceIndex(4) -2 >Emitted(20, 9) Source(1, 1) + SourceIndex(4) -3 >Emitted(20, 13) Source(1, 5) + SourceIndex(4) -4 >Emitted(20, 14) Source(1, 6) + SourceIndex(4) -5 >Emitted(20, 17) Source(1, 16) + SourceIndex(4) -6 >Emitted(20, 18) Source(1, 17) + SourceIndex(4) ---- ->>>//# sourceMappingURL=third-output.d.ts.map +//// [/src/2/second-output.tsbuildinfo] +{ + "bundle": { + "commonSourceDirectory": "../second", + "sourceFiles": [ + "../second/second_part1.ts", + "../second/second_part2.ts" + ], + "js": { + "sections": [ + { + "pos": 0, + "end": 110, + "kind": "prepend", + "data": "../first/bin/first-output.js", + "texts": [ + { + "pos": 0, + "end": 110, + "kind": "text" + } + ] + }, + { + "pos": 110, + "end": 3162, + "kind": "text" + } + ] + }, + "dts": { + "sections": [ + { + "pos": 0, + "end": 157, + "kind": "prepend", + "data": "../first/bin/first-output.d.ts", + "texts": [ + { + "pos": 0, + "end": 157, + "kind": "text" + } + ] + }, + { + "pos": 157, + "end": 234, + "kind": "text" + }, + { + "pos": 234, + "end": 308, + "kind": "internal" + }, + { + "pos": 310, + "end": 342, + "kind": "text" + }, + { + "pos": 342, + "end": 734, + "kind": "internal" + }, + { + "pos": 736, + "end": 739, + "kind": "text" + }, + { + "pos": 739, + "end": 1152, + "kind": "internal" + }, + { + "pos": 1154, + "end": 1202, + "kind": "text" + } + ] + } + }, + "version": "FakeTSVersion" +} + +//// [/src/2/second-output.tsbuildinfo.baseline.txt] +====================================================================== +File:: /src/2/second-output.js +---------------------------------------------------------------------- +prepend: (0-110):: ../first/bin/first-output.js texts:: 1 +>>-------------------------------------------------------------------- +text: (0-110) +var s = "Hello, world"; +console.log(s); +console.log(f()); +function f() { + return "JS does hoists"; +} -//// [/src/third/thirdjs/output/third-output.js.map.baseline.txt] -=================================================================== -JsFile: third-output.js -mapUrl: third-output.js.map -sourceRoot: -sources: ../../../first/first_PART1.ts,../../../first/first_part2.ts,../../../first/first_part3.ts,../../../second/second_part1.ts,../../../second/second_part2.ts,../../third_part1.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:/src/third/thirdjs/output/third-output.js -sourceFile:../../../first/first_PART1.ts -------------------------------------------------------------------- ->>>var s = "Hello, world"; -1 > -2 >^^^^ -3 > ^ -4 > ^^^ -5 > ^^^^^^^^^^^^^^ -6 > ^ -1 >interface TheFirst { - > none: any; - >} - > - > -2 >const -3 > s -4 > = -5 > "Hello, world" -6 > ; -1 >Emitted(1, 1) Source(5, 1) + SourceIndex(0) -2 >Emitted(1, 5) Source(5, 7) + SourceIndex(0) -3 >Emitted(1, 6) Source(5, 8) + SourceIndex(0) -4 >Emitted(1, 9) Source(5, 11) + SourceIndex(0) -5 >Emitted(1, 23) Source(5, 25) + SourceIndex(0) -6 >Emitted(1, 24) Source(5, 26) + SourceIndex(0) ---- ->>>console.log(s); -1 > -2 >^^^^^^^ -3 > ^ -4 > ^^^ -5 > ^ -6 > ^ -7 > ^ -8 > ^ -9 > ^^^-> -1 > - > - >interface NoJsForHereEither { - > none: any; - >} - > - > -2 >console -3 > . -4 > log -5 > ( -6 > s -7 > ) -8 > ; -1 >Emitted(2, 1) Source(11, 1) + SourceIndex(0) -2 >Emitted(2, 8) Source(11, 8) + SourceIndex(0) -3 >Emitted(2, 9) Source(11, 9) + SourceIndex(0) -4 >Emitted(2, 12) Source(11, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(11, 13) + SourceIndex(0) -6 >Emitted(2, 14) Source(11, 14) + SourceIndex(0) -7 >Emitted(2, 15) Source(11, 15) + SourceIndex(0) -8 >Emitted(2, 16) Source(11, 16) + SourceIndex(0) ---- -------------------------------------------------------------------- -emittedFile:/src/third/thirdjs/output/third-output.js -sourceFile:../../../first/first_part2.ts -------------------------------------------------------------------- ->>>console.log(f()); -1-> -2 >^^^^^^^ -3 > ^ -4 > ^^^ -5 > ^ -6 > ^ -7 > ^^ -8 > ^ -9 > ^ -1-> -2 >console -3 > . -4 > log -5 > ( -6 > f -7 > () -8 > ) -9 > ; -1->Emitted(3, 1) Source(1, 1) + SourceIndex(1) -2 >Emitted(3, 8) Source(1, 8) + SourceIndex(1) -3 >Emitted(3, 9) Source(1, 9) + SourceIndex(1) -4 >Emitted(3, 12) Source(1, 12) + SourceIndex(1) -5 >Emitted(3, 13) Source(1, 13) + SourceIndex(1) -6 >Emitted(3, 14) Source(1, 14) + SourceIndex(1) -7 >Emitted(3, 16) Source(1, 16) + SourceIndex(1) -8 >Emitted(3, 17) Source(1, 17) + SourceIndex(1) -9 >Emitted(3, 18) Source(1, 18) + SourceIndex(1) ---- -------------------------------------------------------------------- -emittedFile:/src/third/thirdjs/output/third-output.js -sourceFile:../../../first/first_part3.ts -------------------------------------------------------------------- ->>>function f() { -1 > -2 >^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^-> -1 > -2 >function -3 > f -1 >Emitted(4, 1) Source(1, 1) + SourceIndex(2) -2 >Emitted(4, 10) Source(1, 10) + SourceIndex(2) -3 >Emitted(4, 11) Source(1, 11) + SourceIndex(2) ---- ->>> return "JS does hoists"; -1->^^^^ -2 > ^^^^^^^ -3 > ^^^^^^^^^^^^^^^^ -4 > ^ -1->() { - > -2 > return -3 > "JS does hoists" -4 > ; -1->Emitted(5, 5) Source(2, 5) + SourceIndex(2) -2 >Emitted(5, 12) Source(2, 12) + SourceIndex(2) -3 >Emitted(5, 28) Source(2, 28) + SourceIndex(2) -4 >Emitted(5, 29) Source(2, 29) + SourceIndex(2) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^-> -1 > - > -2 >} -1 >Emitted(6, 1) Source(3, 1) + SourceIndex(2) -2 >Emitted(6, 2) Source(3, 2) + SourceIndex(2) ---- +---------------------------------------------------------------------- +text: (110-3162) +var N; +(function (N) { + function f() { + console.log('testing'); + } + f(); +})(N || (N = {})); +var normalC = (function () { + function normalC() { + } + normalC.prototype.method = function () { }; + Object.defineProperty(normalC.prototype, "c", { + get: function () { return 10; }, + set: function (val) { }, + enumerable: true, + configurable: true + }); + return normalC; +}()); +var normalN; +(function (normalN) { + var C = (function () { + function C() { + } + return C; + }()); + normalN.C = C; + function foo() { } + normalN.foo = foo; + var someNamespace; + (function (someNamespace) { + var C = (function () { + function C() { + } + return C; + }()); + someNamespace.C = C; + })(someNamespace = normalN.someNamespace || (normalN.someNamespace = {})); + var someOther; + (function (someOther) { + var something; + (function (something) { + var someClass = (function () { + function someClass() { + } + return someClass; + }()); + something.someClass = someClass; + })(something = someOther.something || (someOther.something = {})); + })(someOther = normalN.someOther || (normalN.someOther = {})); + normalN.someImport = someNamespace.C; + normalN.internalConst = 10; + var internalEnum; + (function (internalEnum) { + internalEnum[internalEnum["a"] = 0] = "a"; + internalEnum[internalEnum["b"] = 1] = "b"; + internalEnum[internalEnum["c"] = 2] = "c"; + })(internalEnum = normalN.internalEnum || (normalN.internalEnum = {})); +})(normalN || (normalN = {})); +var internalC = (function () { + function internalC() { + } + return internalC; +}()); +function internalfoo() { } +var internalNamespace; +(function (internalNamespace) { + var someClass = (function () { + function someClass() { + } + return someClass; + }()); + internalNamespace.someClass = someClass; +})(internalNamespace || (internalNamespace = {})); +var internalOther; +(function (internalOther) { + var something; + (function (something) { + var someClass = (function () { + function someClass() { + } + return someClass; + }()); + something.someClass = someClass; + })(something = internalOther.something || (internalOther.something = {})); +})(internalOther || (internalOther = {})); +var internalImport = internalNamespace.someClass; +var internalConst = 10; +var internalEnum; +(function (internalEnum) { + internalEnum[internalEnum["a"] = 0] = "a"; + internalEnum[internalEnum["b"] = 1] = "b"; + internalEnum[internalEnum["c"] = 2] = "c"; +})(internalEnum || (internalEnum = {})); +var C = (function () { + function C() { + } + C.prototype.doSomething = function () { + console.log("something got done"); + }; + return C; +}()); + +====================================================================== +====================================================================== +File:: /src/2/second-output.d.ts +---------------------------------------------------------------------- +prepend: (0-157):: ../first/bin/first-output.d.ts texts:: 1 +>>-------------------------------------------------------------------- +text: (0-157) +interface TheFirst { + none: any; +} +declare const s = "Hello, world"; +interface NoJsForHereEither { + none: any; +} +declare function f(): string; + +---------------------------------------------------------------------- +text: (157-234) +declare namespace N { +} +declare namespace N { +} +declare class normalC { + +---------------------------------------------------------------------- +internal: (234-308) + constructor(); + prop: string; + method(): void; + c: number; +---------------------------------------------------------------------- +text: (310-342) +} +declare namespace normalN { + +---------------------------------------------------------------------- +internal: (342-734) + class C { + } + function foo(): void; + namespace someNamespace { + class C { + } + } + namespace someOther.something { + class someClass { + } + } + export import someImport = someNamespace.C; + type internalType = internalC; + const internalConst = 10; + enum internalEnum { + a = 0, + b = 1, + c = 2 + } +---------------------------------------------------------------------- +text: (736-739) +} + +---------------------------------------------------------------------- +internal: (739-1152) +declare class internalC { +} +declare function internalfoo(): void; +declare namespace internalNamespace { + class someClass { + } +} +declare namespace internalOther.something { + class someClass { + } +} +import internalImport = internalNamespace.someClass; +declare type internalType = internalC; +declare const internalConst = 10; +declare enum internalEnum { + a = 0, + b = 1, + c = 2 +} +---------------------------------------------------------------------- +text: (1154-1202) +declare class C { + doSomething(): void; +} + +====================================================================== + +//// [/src/first/bin/first-output.d.ts] file written with same contents +//// [/src/first/bin/first-output.d.ts.map] +{"version":3,"file":"first-output.d.ts","sourceRoot":"","sources":["../first_PART1.ts","../first_part2.ts","../first_part3.ts"],"names":[],"mappings":"AAAA,UAAU,QAAQ;IACd,IAAI,EAAE,GAAG,CAAC;CACb;AAED,QAAA,MAAM,CAAC,iBAAiB,CAAC;AAEzB,UAAU,iBAAiB;IACvB,IAAI,EAAE,GAAG,CAAC;CACb;AERD,iBAAS,CAAC,WAET"} + +//// [/src/first/bin/first-output.d.ts.map.baseline.txt] +=================================================================== +JsFile: first-output.d.ts +mapUrl: first-output.d.ts.map +sourceRoot: +sources: ../first_PART1.ts,../first_part2.ts,../first_part3.ts +=================================================================== ------------------------------------------------------------------- -emittedFile:/src/third/thirdjs/output/third-output.js -sourceFile:../../../second/second_part1.ts +emittedFile:/src/first/bin/first-output.d.ts +sourceFile:../first_PART1.ts ------------------------------------------------------------------- ->>>var N; -1-> -2 >^^^^ -3 > ^ -4 > ^ -5 > ^^^^^^^^^^-> -1->namespace N { - > // Comment text - >} - > - > -2 >namespace -3 > N -4 > { - > function f() { - > console.log('testing'); - > } - > - > f(); - > } -1->Emitted(7, 1) Source(5, 1) + SourceIndex(3) -2 >Emitted(7, 5) Source(5, 11) + SourceIndex(3) -3 >Emitted(7, 6) Source(5, 12) + SourceIndex(3) -4 >Emitted(7, 7) Source(11, 2) + SourceIndex(3) ---- ->>>(function (N) { -1-> -2 >^^^^^^^^^^^ -3 > ^ -4 > ^^^^^^^-> -1-> -2 >namespace -3 > N -1->Emitted(8, 1) Source(5, 1) + SourceIndex(3) -2 >Emitted(8, 12) Source(5, 11) + SourceIndex(3) -3 >Emitted(8, 13) Source(5, 12) + SourceIndex(3) ---- ->>> function f() { -1->^^^^ -2 > ^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^-> -1-> { - > -2 > function -3 > f -1->Emitted(9, 5) Source(6, 5) + SourceIndex(3) -2 >Emitted(9, 14) Source(6, 14) + SourceIndex(3) -3 >Emitted(9, 15) Source(6, 15) + SourceIndex(3) ---- ->>> console.log('testing'); -1->^^^^^^^^ -2 > ^^^^^^^ -3 > ^ -4 > ^^^ -5 > ^ -6 > ^^^^^^^^^ -7 > ^ -8 > ^ -1->() { - > -2 > console -3 > . -4 > log -5 > ( -6 > 'testing' -7 > ) -8 > ; -1->Emitted(10, 9) Source(7, 9) + SourceIndex(3) -2 >Emitted(10, 16) Source(7, 16) + SourceIndex(3) -3 >Emitted(10, 17) Source(7, 17) + SourceIndex(3) -4 >Emitted(10, 20) Source(7, 20) + SourceIndex(3) -5 >Emitted(10, 21) Source(7, 21) + SourceIndex(3) -6 >Emitted(10, 30) Source(7, 30) + SourceIndex(3) -7 >Emitted(10, 31) Source(7, 31) + SourceIndex(3) -8 >Emitted(10, 32) Source(7, 32) + SourceIndex(3) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^-> -1 > - > -2 > } -1 >Emitted(11, 5) Source(8, 5) + SourceIndex(3) -2 >Emitted(11, 6) Source(8, 6) + SourceIndex(3) ---- ->>> f(); -1->^^^^ -2 > ^ -3 > ^^ -4 > ^ -5 > ^^^^^^^^^^^-> -1-> - > - > -2 > f -3 > () -4 > ; -1->Emitted(12, 5) Source(10, 5) + SourceIndex(3) -2 >Emitted(12, 6) Source(10, 6) + SourceIndex(3) -3 >Emitted(12, 8) Source(10, 8) + SourceIndex(3) -4 >Emitted(12, 9) Source(10, 9) + SourceIndex(3) ---- ->>>})(N || (N = {})); -1-> -2 >^ -3 > ^^ -4 > ^ -5 > ^^^^^ -6 > ^ -7 > ^^^^^^^^ -8 > ^^^^^^^^^^^-> -1-> - > -2 >} -3 > -4 > N -5 > -6 > N -7 > { - > function f() { - > console.log('testing'); - > } - > - > f(); - > } -1->Emitted(13, 1) Source(11, 1) + SourceIndex(3) -2 >Emitted(13, 2) Source(11, 2) + SourceIndex(3) -3 >Emitted(13, 4) Source(5, 11) + SourceIndex(3) -4 >Emitted(13, 5) Source(5, 12) + SourceIndex(3) -5 >Emitted(13, 10) Source(5, 11) + SourceIndex(3) -6 >Emitted(13, 11) Source(5, 12) + SourceIndex(3) -7 >Emitted(13, 19) Source(11, 2) + SourceIndex(3) ---- ->>>var normalC = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > - > -1->Emitted(14, 1) Source(13, 1) + SourceIndex(3) ---- ->>> function normalC() { -1->^^^^ -2 > ^^-> -1->class normalC { - > /*@internal*/ -1->Emitted(15, 5) Source(14, 19) + SourceIndex(3) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->constructor() { -2 > } -1->Emitted(16, 5) Source(14, 35) + SourceIndex(3) -2 >Emitted(16, 6) Source(14, 36) + SourceIndex(3) ---- ->>> normalC.prototype.method = function () { }; -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^^^^^^^^^^^ -5 > ^ -6 > ^^^^^^-> -1-> - > /*@internal*/ prop: string; - > /*@internal*/ -2 > method -3 > -4 > method() { -5 > } -1->Emitted(17, 5) Source(16, 19) + SourceIndex(3) -2 >Emitted(17, 29) Source(16, 25) + SourceIndex(3) -3 >Emitted(17, 32) Source(16, 19) + SourceIndex(3) -4 >Emitted(17, 46) Source(16, 30) + SourceIndex(3) -5 >Emitted(17, 47) Source(16, 31) + SourceIndex(3) ---- ->>> Object.defineProperty(normalC.prototype, "c", { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^^^^^^^^^^ -1-> - > /*@internal*/ -2 > get -3 > c -1->Emitted(18, 5) Source(17, 19) + SourceIndex(3) -2 >Emitted(18, 27) Source(17, 23) + SourceIndex(3) -3 >Emitted(18, 49) Source(17, 24) + SourceIndex(3) ---- ->>> get: function () { return 10; }, -1 >^^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^ -3 > ^^^^^^^ -4 > ^^ -5 > ^ -6 > ^ -7 > ^ -1 > -2 > get c() { -3 > return -4 > 10 -5 > ; -6 > -7 > } -1 >Emitted(19, 14) Source(17, 19) + SourceIndex(3) -2 >Emitted(19, 28) Source(17, 29) + SourceIndex(3) -3 >Emitted(19, 35) Source(17, 36) + SourceIndex(3) -4 >Emitted(19, 37) Source(17, 38) + SourceIndex(3) -5 >Emitted(19, 38) Source(17, 39) + SourceIndex(3) -6 >Emitted(19, 39) Source(17, 40) + SourceIndex(3) -7 >Emitted(19, 40) Source(17, 41) + SourceIndex(3) ---- ->>> set: function (val) { }, -1 >^^^^^^^^^^^^^ -2 > ^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^ -1 > - > /*@internal*/ -2 > set c( -3 > val: number -4 > ) { -5 > } -1 >Emitted(20, 14) Source(18, 19) + SourceIndex(3) -2 >Emitted(20, 24) Source(18, 25) + SourceIndex(3) -3 >Emitted(20, 27) Source(18, 36) + SourceIndex(3) -4 >Emitted(20, 31) Source(18, 40) + SourceIndex(3) -5 >Emitted(20, 32) Source(18, 41) + SourceIndex(3) ---- ->>> enumerable: true, ->>> configurable: true ->>> }); -1 >^^^^^^^ -2 > ^^^^^^^^^^^^^-> -1 > -1 >Emitted(23, 8) Source(17, 41) + SourceIndex(3) ---- ->>> return normalC; -1->^^^^ -2 > ^^^^^^^^^^^^^^ -1-> - > /*@internal*/ set c(val: number) { } - > -2 > } -1->Emitted(24, 5) Source(19, 1) + SourceIndex(3) -2 >Emitted(24, 19) Source(19, 2) + SourceIndex(3) ---- ->>>}()); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^-> -1 > -2 >} -3 > -4 > class normalC { - > /*@internal*/ constructor() { } - > /*@internal*/ prop: string; - > /*@internal*/ method() { } - > /*@internal*/ get c() { return 10; } - > /*@internal*/ set c(val: number) { } - > } -1 >Emitted(25, 1) Source(19, 1) + SourceIndex(3) -2 >Emitted(25, 2) Source(19, 2) + SourceIndex(3) -3 >Emitted(25, 2) Source(13, 1) + SourceIndex(3) -4 >Emitted(25, 6) Source(19, 2) + SourceIndex(3) ---- ->>>var normalN; -1-> -2 >^^^^ -3 > ^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^-> -1-> - > -2 >namespace -3 > normalN -4 > { - > /*@internal*/ export class C { } - > /*@internal*/ export function foo() {} - > /*@internal*/ export namespace someNamespace { export class C {} } - > /*@internal*/ export namespace someOther.something { export class someClass {} } - > /*@internal*/ export import someImport = someNamespace.C; - > /*@internal*/ export type internalType = internalC; - > /*@internal*/ export const internalConst = 10; - > /*@internal*/ export enum internalEnum { a, b, c } - > } -1->Emitted(26, 1) Source(20, 1) + SourceIndex(3) -2 >Emitted(26, 5) Source(20, 11) + SourceIndex(3) -3 >Emitted(26, 12) Source(20, 18) + SourceIndex(3) -4 >Emitted(26, 13) Source(29, 2) + SourceIndex(3) ---- ->>>(function (normalN) { -1-> -2 >^^^^^^^^^^^ -3 > ^^^^^^^ -4 > ^^^^^^^^^-> -1-> -2 >namespace -3 > normalN -1->Emitted(27, 1) Source(20, 1) + SourceIndex(3) -2 >Emitted(27, 12) Source(20, 11) + SourceIndex(3) -3 >Emitted(27, 19) Source(20, 18) + SourceIndex(3) ---- ->>> var C = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^-> -1-> { - > /*@internal*/ -1->Emitted(28, 5) Source(21, 19) + SourceIndex(3) ---- ->>> function C() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(29, 9) Source(21, 19) + SourceIndex(3) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^-> -1->export class C { -2 > } -1->Emitted(30, 9) Source(21, 36) + SourceIndex(3) -2 >Emitted(30, 10) Source(21, 37) + SourceIndex(3) ---- ->>> return C; -1->^^^^^^^^ -2 > ^^^^^^^^ -1-> -2 > } -1->Emitted(31, 9) Source(21, 36) + SourceIndex(3) -2 >Emitted(31, 17) Source(21, 37) + SourceIndex(3) ---- ->>> }()); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^-> +>>>interface TheFirst { 1 > -2 > } -3 > -4 > export class C { } -1 >Emitted(32, 5) Source(21, 36) + SourceIndex(3) -2 >Emitted(32, 6) Source(21, 37) + SourceIndex(3) -3 >Emitted(32, 6) Source(21, 19) + SourceIndex(3) -4 >Emitted(32, 10) Source(21, 37) + SourceIndex(3) ---- ->>> normalN.C = C; -1->^^^^ -2 > ^^^^^^^^^ -3 > ^^^^ -4 > ^ -5 > ^^^^^-> -1-> -2 > C -3 > { } -4 > -1->Emitted(33, 5) Source(21, 32) + SourceIndex(3) -2 >Emitted(33, 14) Source(21, 33) + SourceIndex(3) -3 >Emitted(33, 18) Source(21, 37) + SourceIndex(3) -4 >Emitted(33, 19) Source(21, 37) + SourceIndex(3) ---- ->>> function foo() { } -1->^^^^ -2 > ^^^^^^^^^ -3 > ^^^ -4 > ^^^^^ -5 > ^ -6 > ^-> -1-> - > /*@internal*/ -2 > export function -3 > foo -4 > () { -5 > } -1->Emitted(34, 5) Source(22, 19) + SourceIndex(3) -2 >Emitted(34, 14) Source(22, 35) + SourceIndex(3) -3 >Emitted(34, 17) Source(22, 38) + SourceIndex(3) -4 >Emitted(34, 22) Source(22, 42) + SourceIndex(3) -5 >Emitted(34, 23) Source(22, 43) + SourceIndex(3) ---- ->>> normalN.foo = foo; -1->^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^ -4 > ^ -5 > ^-> -1-> -2 > foo -3 > () {} -4 > -1->Emitted(35, 5) Source(22, 35) + SourceIndex(3) -2 >Emitted(35, 16) Source(22, 38) + SourceIndex(3) -3 >Emitted(35, 22) Source(22, 43) + SourceIndex(3) -4 >Emitted(35, 23) Source(22, 43) + SourceIndex(3) ---- ->>> var someNamespace; -1->^^^^ -2 > ^^^^ -3 > ^^^^^^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^-> -1-> - > /*@internal*/ -2 > export namespace -3 > someNamespace -4 > { export class C {} } -1->Emitted(36, 5) Source(23, 19) + SourceIndex(3) -2 >Emitted(36, 9) Source(23, 36) + SourceIndex(3) -3 >Emitted(36, 22) Source(23, 49) + SourceIndex(3) -4 >Emitted(36, 23) Source(23, 71) + SourceIndex(3) ---- ->>> (function (someNamespace) { -1->^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^ -4 > ^^^-> -1-> -2 > export namespace -3 > someNamespace -1->Emitted(37, 5) Source(23, 19) + SourceIndex(3) -2 >Emitted(37, 16) Source(23, 36) + SourceIndex(3) -3 >Emitted(37, 29) Source(23, 49) + SourceIndex(3) ---- ->>> var C = (function () { -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^-> -1-> { -1->Emitted(38, 9) Source(23, 52) + SourceIndex(3) ---- ->>> function C() { -1->^^^^^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(39, 13) Source(23, 52) + SourceIndex(3) ---- ->>> } -1->^^^^^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^-> -1->export class C { -2 > } -1->Emitted(40, 13) Source(23, 68) + SourceIndex(3) -2 >Emitted(40, 14) Source(23, 69) + SourceIndex(3) ---- ->>> return C; -1->^^^^^^^^^^^^ -2 > ^^^^^^^^ -1-> -2 > } -1->Emitted(41, 13) Source(23, 68) + SourceIndex(3) -2 >Emitted(41, 21) Source(23, 69) + SourceIndex(3) ---- ->>> }()); -1 >^^^^^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^-> +2 >^^^^^^^^^^ +3 > ^^^^^^^^ 1 > -2 > } -3 > -4 > export class C {} -1 >Emitted(42, 9) Source(23, 68) + SourceIndex(3) -2 >Emitted(42, 10) Source(23, 69) + SourceIndex(3) -3 >Emitted(42, 10) Source(23, 52) + SourceIndex(3) -4 >Emitted(42, 14) Source(23, 69) + SourceIndex(3) ---- ->>> someNamespace.C = C; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^ -3 > ^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 > C -3 > {} -4 > -1->Emitted(43, 9) Source(23, 65) + SourceIndex(3) -2 >Emitted(43, 24) Source(23, 66) + SourceIndex(3) -3 >Emitted(43, 28) Source(23, 69) + SourceIndex(3) -4 >Emitted(43, 29) Source(23, 69) + SourceIndex(3) ---- ->>> })(someNamespace = normalN.someNamespace || (normalN.someNamespace = {})); -1->^^^^ -2 > ^ -3 > ^^ -4 > ^^^^^^^^^^^^^ -5 > ^^^ -6 > ^^^^^^^^^^^^^^^^^^^^^ -7 > ^^^^^ -8 > ^^^^^^^^^^^^^^^^^^^^^ -9 > ^^^^^^^^ -1-> -2 > } -3 > -4 > someNamespace -5 > -6 > someNamespace -7 > -8 > someNamespace -9 > { export class C {} } -1->Emitted(44, 5) Source(23, 70) + SourceIndex(3) -2 >Emitted(44, 6) Source(23, 71) + SourceIndex(3) -3 >Emitted(44, 8) Source(23, 36) + SourceIndex(3) -4 >Emitted(44, 21) Source(23, 49) + SourceIndex(3) -5 >Emitted(44, 24) Source(23, 36) + SourceIndex(3) -6 >Emitted(44, 45) Source(23, 49) + SourceIndex(3) -7 >Emitted(44, 50) Source(23, 36) + SourceIndex(3) -8 >Emitted(44, 71) Source(23, 49) + SourceIndex(3) -9 >Emitted(44, 79) Source(23, 71) + SourceIndex(3) ---- ->>> var someOther; -1 >^^^^ -2 > ^^^^ -3 > ^^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^-> -1 > - > /*@internal*/ -2 > export namespace -3 > someOther -4 > .something { export class someClass {} } -1 >Emitted(45, 5) Source(24, 19) + SourceIndex(3) -2 >Emitted(45, 9) Source(24, 36) + SourceIndex(3) -3 >Emitted(45, 18) Source(24, 45) + SourceIndex(3) -4 >Emitted(45, 19) Source(24, 85) + SourceIndex(3) ---- ->>> (function (someOther) { -1->^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^^^^ -1-> -2 > export namespace -3 > someOther -1->Emitted(46, 5) Source(24, 19) + SourceIndex(3) -2 >Emitted(46, 16) Source(24, 36) + SourceIndex(3) -3 >Emitted(46, 25) Source(24, 45) + SourceIndex(3) ---- ->>> var something; -1 >^^^^^^^^ -2 > ^^^^ -3 > ^^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^-> -1 >. -2 > -3 > something -4 > { export class someClass {} } -1 >Emitted(47, 9) Source(24, 46) + SourceIndex(3) -2 >Emitted(47, 13) Source(24, 46) + SourceIndex(3) -3 >Emitted(47, 22) Source(24, 55) + SourceIndex(3) -4 >Emitted(47, 23) Source(24, 85) + SourceIndex(3) +2 >interface +3 > TheFirst +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 11) Source(1, 11) + SourceIndex(0) +3 >Emitted(1, 19) Source(1, 19) + SourceIndex(0) --- ->>> (function (something) { -1->^^^^^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^-> -1-> -2 > -3 > something -1->Emitted(48, 9) Source(24, 46) + SourceIndex(3) -2 >Emitted(48, 20) Source(24, 46) + SourceIndex(3) -3 >Emitted(48, 29) Source(24, 55) + SourceIndex(3) +>>> none: any; +1 >^^^^ +2 > ^^^^ +3 > ^^ +4 > ^^^ +5 > ^ +1 > { + > +2 > none +3 > : +4 > any +5 > ; +1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +2 >Emitted(2, 9) Source(2, 9) + SourceIndex(0) +3 >Emitted(2, 11) Source(2, 11) + SourceIndex(0) +4 >Emitted(2, 14) Source(2, 14) + SourceIndex(0) +5 >Emitted(2, 15) Source(2, 15) + SourceIndex(0) --- ->>> var someClass = (function () { -1->^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> { -1->Emitted(49, 13) Source(24, 58) + SourceIndex(3) +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(3, 2) Source(3, 2) + SourceIndex(0) --- ->>> function someClass() { -1->^^^^^^^^^^^^^^^^ -2 > ^^-> +>>>declare const s = "Hello, world"; 1-> -1->Emitted(50, 17) Source(24, 58) + SourceIndex(3) ---- ->>> } -1->^^^^^^^^^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^-> -1->export class someClass { -2 > } -1->Emitted(51, 17) Source(24, 82) + SourceIndex(3) -2 >Emitted(51, 18) Source(24, 83) + SourceIndex(3) ---- ->>> return someClass; -1->^^^^^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^ +2 >^^^^^^^^ +3 > ^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^ +6 > ^ 1-> -2 > } -1->Emitted(52, 17) Source(24, 82) + SourceIndex(3) -2 >Emitted(52, 33) Source(24, 83) + SourceIndex(3) + > + > +2 > +3 > const +4 > s +5 > = "Hello, world" +6 > ; +1->Emitted(4, 1) Source(5, 1) + SourceIndex(0) +2 >Emitted(4, 9) Source(5, 1) + SourceIndex(0) +3 >Emitted(4, 15) Source(5, 7) + SourceIndex(0) +4 >Emitted(4, 16) Source(5, 8) + SourceIndex(0) +5 >Emitted(4, 33) Source(5, 25) + SourceIndex(0) +6 >Emitted(4, 34) Source(5, 26) + SourceIndex(0) --- ->>> }()); -1 >^^^^^^^^^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +>>>interface NoJsForHereEither { 1 > -2 > } -3 > -4 > export class someClass {} -1 >Emitted(53, 13) Source(24, 82) + SourceIndex(3) -2 >Emitted(53, 14) Source(24, 83) + SourceIndex(3) -3 >Emitted(53, 14) Source(24, 58) + SourceIndex(3) -4 >Emitted(53, 18) Source(24, 83) + SourceIndex(3) ---- ->>> something.someClass = someClass; -1->^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^ -3 > ^^^^^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 > someClass -3 > {} -4 > -1->Emitted(54, 13) Source(24, 71) + SourceIndex(3) -2 >Emitted(54, 32) Source(24, 80) + SourceIndex(3) -3 >Emitted(54, 44) Source(24, 83) + SourceIndex(3) -4 >Emitted(54, 45) Source(24, 83) + SourceIndex(3) ---- ->>> })(something = someOther.something || (someOther.something = {})); -1->^^^^^^^^ -2 > ^ -3 > ^^ -4 > ^^^^^^^^^ -5 > ^^^ -6 > ^^^^^^^^^^^^^^^^^^^ -7 > ^^^^^ -8 > ^^^^^^^^^^^^^^^^^^^ -9 > ^^^^^^^^ -1-> -2 > } -3 > -4 > something -5 > -6 > something -7 > -8 > something -9 > { export class someClass {} } -1->Emitted(55, 9) Source(24, 84) + SourceIndex(3) -2 >Emitted(55, 10) Source(24, 85) + SourceIndex(3) -3 >Emitted(55, 12) Source(24, 46) + SourceIndex(3) -4 >Emitted(55, 21) Source(24, 55) + SourceIndex(3) -5 >Emitted(55, 24) Source(24, 46) + SourceIndex(3) -6 >Emitted(55, 43) Source(24, 55) + SourceIndex(3) -7 >Emitted(55, 48) Source(24, 46) + SourceIndex(3) -8 >Emitted(55, 67) Source(24, 55) + SourceIndex(3) -9 >Emitted(55, 75) Source(24, 85) + SourceIndex(3) ---- ->>> })(someOther = normalN.someOther || (normalN.someOther = {})); -1 >^^^^ -2 > ^ -3 > ^^ -4 > ^^^^^^^^^ -5 > ^^^ -6 > ^^^^^^^^^^^^^^^^^ -7 > ^^^^^ -8 > ^^^^^^^^^^^^^^^^^ -9 > ^^^^^^^^ +2 >^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^ 1 > -2 > } -3 > -4 > someOther -5 > -6 > someOther -7 > -8 > someOther -9 > .something { export class someClass {} } -1 >Emitted(56, 5) Source(24, 84) + SourceIndex(3) -2 >Emitted(56, 6) Source(24, 85) + SourceIndex(3) -3 >Emitted(56, 8) Source(24, 36) + SourceIndex(3) -4 >Emitted(56, 17) Source(24, 45) + SourceIndex(3) -5 >Emitted(56, 20) Source(24, 36) + SourceIndex(3) -6 >Emitted(56, 37) Source(24, 45) + SourceIndex(3) -7 >Emitted(56, 42) Source(24, 36) + SourceIndex(3) -8 >Emitted(56, 59) Source(24, 45) + SourceIndex(3) -9 >Emitted(56, 67) Source(24, 85) + SourceIndex(3) ---- ->>> normalN.someImport = someNamespace.C; -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^^^^^^^^^^ -5 > ^ -6 > ^ -7 > ^ -1 > - > /*@internal*/ export import -2 > someImport -3 > = -4 > someNamespace -5 > . -6 > C -7 > ; -1 >Emitted(57, 5) Source(25, 33) + SourceIndex(3) -2 >Emitted(57, 23) Source(25, 43) + SourceIndex(3) -3 >Emitted(57, 26) Source(25, 46) + SourceIndex(3) -4 >Emitted(57, 39) Source(25, 59) + SourceIndex(3) -5 >Emitted(57, 40) Source(25, 60) + SourceIndex(3) -6 >Emitted(57, 41) Source(25, 61) + SourceIndex(3) -7 >Emitted(57, 42) Source(25, 62) + SourceIndex(3) ---- ->>> normalN.internalConst = 10; -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -1 > - > /*@internal*/ export type internalType = internalC; - > /*@internal*/ export const -2 > internalConst -3 > = -4 > 10 -5 > ; -1 >Emitted(58, 5) Source(27, 32) + SourceIndex(3) -2 >Emitted(58, 26) Source(27, 45) + SourceIndex(3) -3 >Emitted(58, 29) Source(27, 48) + SourceIndex(3) -4 >Emitted(58, 31) Source(27, 50) + SourceIndex(3) -5 >Emitted(58, 32) Source(27, 51) + SourceIndex(3) + > + > +2 >interface +3 > NoJsForHereEither +1 >Emitted(5, 1) Source(7, 1) + SourceIndex(0) +2 >Emitted(5, 11) Source(7, 11) + SourceIndex(0) +3 >Emitted(5, 28) Source(7, 28) + SourceIndex(0) --- ->>> var internalEnum; +>>> none: any; 1 >^^^^ 2 > ^^^^ -3 > ^^^^^^^^^^^^ -4 > ^^^^^^^^^^^-> -1 > - > /*@internal*/ -2 > export enum -3 > internalEnum { a, b, c } -1 >Emitted(59, 5) Source(28, 19) + SourceIndex(3) -2 >Emitted(59, 9) Source(28, 31) + SourceIndex(3) -3 >Emitted(59, 21) Source(28, 55) + SourceIndex(3) ---- ->>> (function (internalEnum) { -1->^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 > export enum -3 > internalEnum -1->Emitted(60, 5) Source(28, 19) + SourceIndex(3) -2 >Emitted(60, 16) Source(28, 31) + SourceIndex(3) -3 >Emitted(60, 28) Source(28, 43) + SourceIndex(3) ---- ->>> internalEnum[internalEnum["a"] = 0] = "a"; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^-> -1-> { -2 > a -3 > -1->Emitted(61, 9) Source(28, 46) + SourceIndex(3) -2 >Emitted(61, 50) Source(28, 47) + SourceIndex(3) -3 >Emitted(61, 51) Source(28, 47) + SourceIndex(3) ---- ->>> internalEnum[internalEnum["b"] = 1] = "b"; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^-> -1->, -2 > b -3 > -1->Emitted(62, 9) Source(28, 49) + SourceIndex(3) -2 >Emitted(62, 50) Source(28, 50) + SourceIndex(3) -3 >Emitted(62, 51) Source(28, 50) + SourceIndex(3) +3 > ^^ +4 > ^^^ +5 > ^ +1 > { + > +2 > none +3 > : +4 > any +5 > ; +1 >Emitted(6, 5) Source(8, 5) + SourceIndex(0) +2 >Emitted(6, 9) Source(8, 9) + SourceIndex(0) +3 >Emitted(6, 11) Source(8, 11) + SourceIndex(0) +4 >Emitted(6, 14) Source(8, 14) + SourceIndex(0) +5 >Emitted(6, 15) Source(8, 15) + SourceIndex(0) --- ->>> internalEnum[internalEnum["c"] = 2] = "c"; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->, -2 > c -3 > -1->Emitted(63, 9) Source(28, 52) + SourceIndex(3) -2 >Emitted(63, 50) Source(28, 53) + SourceIndex(3) -3 >Emitted(63, 51) Source(28, 53) + SourceIndex(3) +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(7, 2) Source(9, 2) + SourceIndex(0) --- ->>> })(internalEnum = normalN.internalEnum || (normalN.internalEnum = {})); -1->^^^^ -2 > ^ -3 > ^^ -4 > ^^^^^^^^^^^^ -5 > ^^^ -6 > ^^^^^^^^^^^^^^^^^^^^ -7 > ^^^^^ -8 > ^^^^^^^^^^^^^^^^^^^^ -9 > ^^^^^^^^ -1-> -2 > } -3 > -4 > internalEnum -5 > -6 > internalEnum -7 > -8 > internalEnum -9 > { a, b, c } -1->Emitted(64, 5) Source(28, 54) + SourceIndex(3) -2 >Emitted(64, 6) Source(28, 55) + SourceIndex(3) -3 >Emitted(64, 8) Source(28, 31) + SourceIndex(3) -4 >Emitted(64, 20) Source(28, 43) + SourceIndex(3) -5 >Emitted(64, 23) Source(28, 31) + SourceIndex(3) -6 >Emitted(64, 43) Source(28, 43) + SourceIndex(3) -7 >Emitted(64, 48) Source(28, 31) + SourceIndex(3) -8 >Emitted(64, 68) Source(28, 43) + SourceIndex(3) -9 >Emitted(64, 76) Source(28, 55) + SourceIndex(3) +------------------------------------------------------------------- +emittedFile:/src/first/bin/first-output.d.ts +sourceFile:../first_part3.ts +------------------------------------------------------------------- +>>>declare function f(): string; +1-> +2 >^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^ +5 > ^^^^^^^^^^^^-> +1-> +2 >function +3 > f +4 > () { + > return "JS does hoists"; + > } +1->Emitted(8, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(8, 18) Source(1, 10) + SourceIndex(2) +3 >Emitted(8, 19) Source(1, 11) + SourceIndex(2) +4 >Emitted(8, 30) Source(3, 2) + SourceIndex(2) --- ->>>})(normalN || (normalN = {})); +>>>//# sourceMappingURL=first-output.d.ts.map + +//// [/src/first/bin/first-output.js] file written with same contents +//// [/src/first/bin/first-output.js.map] file written with same contents +//// [/src/first/bin/first-output.js.map.baseline.txt] +=================================================================== +JsFile: first-output.js +mapUrl: first-output.js.map +sourceRoot: +sources: ../first_PART1.ts,../first_part2.ts,../first_part3.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:/src/first/bin/first-output.js +sourceFile:../first_PART1.ts +------------------------------------------------------------------- +>>>var s = "Hello, world"; 1 > -2 >^ -3 > ^^ -4 > ^^^^^^^ -5 > ^^^^^ -6 > ^^^^^^^ -7 > ^^^^^^^^ -8 > ^-> -1 > +2 >^^^^ +3 > ^ +4 > ^^^ +5 > ^^^^^^^^^^^^^^ +6 > ^ +1 >interface TheFirst { + > none: any; + >} > -2 >} -3 > -4 > normalN -5 > -6 > normalN -7 > { - > /*@internal*/ export class C { } - > /*@internal*/ export function foo() {} - > /*@internal*/ export namespace someNamespace { export class C {} } - > /*@internal*/ export namespace someOther.something { export class someClass {} } - > /*@internal*/ export import someImport = someNamespace.C; - > /*@internal*/ export type internalType = internalC; - > /*@internal*/ export const internalConst = 10; - > /*@internal*/ export enum internalEnum { a, b, c } - > } -1 >Emitted(65, 1) Source(29, 1) + SourceIndex(3) -2 >Emitted(65, 2) Source(29, 2) + SourceIndex(3) -3 >Emitted(65, 4) Source(20, 11) + SourceIndex(3) -4 >Emitted(65, 11) Source(20, 18) + SourceIndex(3) -5 >Emitted(65, 16) Source(20, 11) + SourceIndex(3) -6 >Emitted(65, 23) Source(20, 18) + SourceIndex(3) -7 >Emitted(65, 31) Source(29, 2) + SourceIndex(3) + > +2 >const +3 > s +4 > = +5 > "Hello, world" +6 > ; +1 >Emitted(1, 1) Source(5, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(5, 7) + SourceIndex(0) +3 >Emitted(1, 6) Source(5, 8) + SourceIndex(0) +4 >Emitted(1, 9) Source(5, 11) + SourceIndex(0) +5 >Emitted(1, 23) Source(5, 25) + SourceIndex(0) +6 >Emitted(1, 24) Source(5, 26) + SourceIndex(0) --- ->>>var internalC = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - >/*@internal*/ -1->Emitted(66, 1) Source(30, 15) + SourceIndex(3) +>>>console.log(s); +1 > +2 >^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^ +7 > ^ +8 > ^ +9 > ^^^-> +1 > + > + >interface NoJsForHereEither { + > none: any; + >} + > + > +2 >console +3 > . +4 > log +5 > ( +6 > s +7 > ) +8 > ; +1 >Emitted(2, 1) Source(11, 1) + SourceIndex(0) +2 >Emitted(2, 8) Source(11, 8) + SourceIndex(0) +3 >Emitted(2, 9) Source(11, 9) + SourceIndex(0) +4 >Emitted(2, 12) Source(11, 12) + SourceIndex(0) +5 >Emitted(2, 13) Source(11, 13) + SourceIndex(0) +6 >Emitted(2, 14) Source(11, 14) + SourceIndex(0) +7 >Emitted(2, 15) Source(11, 15) + SourceIndex(0) +8 >Emitted(2, 16) Source(11, 16) + SourceIndex(0) --- ->>> function internalC() { -1->^^^^ -2 > ^^-> +------------------------------------------------------------------- +emittedFile:/src/first/bin/first-output.js +sourceFile:../first_part2.ts +------------------------------------------------------------------- +>>>console.log(f()); 1-> -1->Emitted(67, 5) Source(30, 15) + SourceIndex(3) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^-> -1->class internalC { -2 > } -1->Emitted(68, 5) Source(30, 32) + SourceIndex(3) -2 >Emitted(68, 6) Source(30, 33) + SourceIndex(3) ---- ->>> return internalC; -1->^^^^ -2 > ^^^^^^^^^^^^^^^^ +2 >^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^ +7 > ^^ +8 > ^ +9 > ^ 1-> -2 > } -1->Emitted(69, 5) Source(30, 32) + SourceIndex(3) -2 >Emitted(69, 21) Source(30, 33) + SourceIndex(3) +2 >console +3 > . +4 > log +5 > ( +6 > f +7 > () +8 > ) +9 > ; +1->Emitted(3, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(3, 8) Source(1, 8) + SourceIndex(1) +3 >Emitted(3, 9) Source(1, 9) + SourceIndex(1) +4 >Emitted(3, 12) Source(1, 12) + SourceIndex(1) +5 >Emitted(3, 13) Source(1, 13) + SourceIndex(1) +6 >Emitted(3, 14) Source(1, 14) + SourceIndex(1) +7 >Emitted(3, 16) Source(1, 16) + SourceIndex(1) +8 >Emitted(3, 17) Source(1, 17) + SourceIndex(1) +9 >Emitted(3, 18) Source(1, 18) + SourceIndex(1) --- ->>>}()); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^-> +------------------------------------------------------------------- +emittedFile:/src/first/bin/first-output.js +sourceFile:../first_part3.ts +------------------------------------------------------------------- +>>>function f() { 1 > -2 >} -3 > -4 > class internalC {} -1 >Emitted(70, 1) Source(30, 32) + SourceIndex(3) -2 >Emitted(70, 2) Source(30, 33) + SourceIndex(3) -3 >Emitted(70, 2) Source(30, 15) + SourceIndex(3) -4 >Emitted(70, 6) Source(30, 33) + SourceIndex(3) ---- ->>>function internalfoo() { } -1-> 2 >^^^^^^^^^ -3 > ^^^^^^^^^^^ -4 > ^^^^^ -5 > ^ -1-> - >/*@internal*/ -2 >function -3 > internalfoo -4 > () { -5 > } -1->Emitted(71, 1) Source(31, 15) + SourceIndex(3) -2 >Emitted(71, 10) Source(31, 24) + SourceIndex(3) -3 >Emitted(71, 21) Source(31, 35) + SourceIndex(3) -4 >Emitted(71, 26) Source(31, 39) + SourceIndex(3) -5 >Emitted(71, 27) Source(31, 40) + SourceIndex(3) ---- ->>>var internalNamespace; +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^-> 1 > -2 >^^^^ -3 > ^^^^^^^^^^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^-> -1 > - >/*@internal*/ -2 >namespace -3 > internalNamespace -4 > { export class someClass {} } -1 >Emitted(72, 1) Source(32, 15) + SourceIndex(3) -2 >Emitted(72, 5) Source(32, 25) + SourceIndex(3) -3 >Emitted(72, 22) Source(32, 42) + SourceIndex(3) -4 >Emitted(72, 23) Source(32, 72) + SourceIndex(3) ---- ->>>(function (internalNamespace) { -1-> -2 >^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^-> -1-> -2 >namespace -3 > internalNamespace -1->Emitted(73, 1) Source(32, 15) + SourceIndex(3) -2 >Emitted(73, 12) Source(32, 25) + SourceIndex(3) -3 >Emitted(73, 29) Source(32, 42) + SourceIndex(3) +2 >function +3 > f +1 >Emitted(4, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(4, 10) Source(1, 10) + SourceIndex(2) +3 >Emitted(4, 11) Source(1, 11) + SourceIndex(2) --- ->>> var someClass = (function () { +>>> return "JS does hoists"; 1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> { -1->Emitted(74, 5) Source(32, 45) + SourceIndex(3) ---- ->>> function someClass() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(75, 9) Source(32, 45) + SourceIndex(3) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^-> -1->export class someClass { -2 > } -1->Emitted(76, 9) Source(32, 69) + SourceIndex(3) -2 >Emitted(76, 10) Source(32, 70) + SourceIndex(3) ---- ->>> return someClass; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(77, 9) Source(32, 69) + SourceIndex(3) -2 >Emitted(77, 25) Source(32, 70) + SourceIndex(3) +2 > ^^^^^^^ +3 > ^^^^^^^^^^^^^^^^ +4 > ^ +1->() { + > +2 > return +3 > "JS does hoists" +4 > ; +1->Emitted(5, 5) Source(2, 5) + SourceIndex(2) +2 >Emitted(5, 12) Source(2, 12) + SourceIndex(2) +3 >Emitted(5, 28) Source(2, 28) + SourceIndex(2) +4 >Emitted(5, 29) Source(2, 29) + SourceIndex(2) --- ->>> }()); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +>>>} 1 > -2 > } -3 > -4 > export class someClass {} -1 >Emitted(78, 5) Source(32, 69) + SourceIndex(3) -2 >Emitted(78, 6) Source(32, 70) + SourceIndex(3) -3 >Emitted(78, 6) Source(32, 45) + SourceIndex(3) -4 >Emitted(78, 10) Source(32, 70) + SourceIndex(3) ---- ->>> internalNamespace.someClass = someClass; -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^^^^^^^^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 > someClass -3 > {} -4 > -1->Emitted(79, 5) Source(32, 58) + SourceIndex(3) -2 >Emitted(79, 32) Source(32, 67) + SourceIndex(3) -3 >Emitted(79, 44) Source(32, 70) + SourceIndex(3) -4 >Emitted(79, 45) Source(32, 70) + SourceIndex(3) ---- ->>>})(internalNamespace || (internalNamespace = {})); -1-> 2 >^ -3 > ^^ -4 > ^^^^^^^^^^^^^^^^^ -5 > ^^^^^ -6 > ^^^^^^^^^^^^^^^^^ -7 > ^^^^^^^^ -1-> +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > 2 >} -3 > -4 > internalNamespace -5 > -6 > internalNamespace -7 > { export class someClass {} } -1->Emitted(80, 1) Source(32, 71) + SourceIndex(3) -2 >Emitted(80, 2) Source(32, 72) + SourceIndex(3) -3 >Emitted(80, 4) Source(32, 25) + SourceIndex(3) -4 >Emitted(80, 21) Source(32, 42) + SourceIndex(3) -5 >Emitted(80, 26) Source(32, 25) + SourceIndex(3) -6 >Emitted(80, 43) Source(32, 42) + SourceIndex(3) -7 >Emitted(80, 51) Source(32, 72) + SourceIndex(3) +1 >Emitted(6, 1) Source(3, 1) + SourceIndex(2) +2 >Emitted(6, 2) Source(3, 2) + SourceIndex(2) --- ->>>var internalOther; +>>>//# sourceMappingURL=first-output.js.map + +//// [/src/first/bin/first-output.tsbuildinfo] +{ + "bundle": { + "commonSourceDirectory": "..", + "sourceFiles": [ + "../first_PART1.ts", + "../first_part2.ts", + "../first_part3.ts" + ], + "js": { + "sections": [ + { + "pos": 0, + "end": 110, + "kind": "text" + } + ] + }, + "dts": { + "sections": [ + { + "pos": 0, + "end": 157, + "kind": "text" + } + ] + } + }, + "version": "FakeTSVersion" +} + +//// [/src/first/bin/first-output.tsbuildinfo.baseline.txt] +====================================================================== +File:: /src/first/bin/first-output.js +---------------------------------------------------------------------- +text: (0-110) +var s = "Hello, world"; +console.log(s); +console.log(f()); +function f() { + return "JS does hoists"; +} + +====================================================================== +====================================================================== +File:: /src/first/bin/first-output.d.ts +---------------------------------------------------------------------- +text: (0-157) +interface TheFirst { + none: any; +} +declare const s = "Hello, world"; +interface NoJsForHereEither { + none: any; +} +declare function f(): string; + +====================================================================== + +//// [/src/first/first_PART1.ts] +interface TheFirst { + none: any; +} + +const s = "Hello, world"; + +interface NoJsForHereEither { + none: any; +} + +console.log(s); + + +//// [/src/third/thirdjs/output/third-output.d.ts] +interface TheFirst { + none: any; +} +declare const s = "Hello, world"; +interface NoJsForHereEither { + none: any; +} +declare function f(): string; +declare namespace N { +} +declare namespace N { +} +declare class normalC { +} +declare namespace normalN { +} +declare class C { + doSomething(): void; +} +declare var c: C; +//# sourceMappingURL=third-output.d.ts.map + +//// [/src/third/thirdjs/output/third-output.d.ts.map] +{"version":3,"file":"third-output.d.ts","sourceRoot":"","sources":["../../../first/first_PART1.ts","../../../first/first_part3.ts","../../../second/second_part1.ts","../../../second/second_part2.ts","../../third_part1.ts"],"names":[],"mappings":"AAAA,UAAU,QAAQ;IACd,IAAI,EAAE,GAAG,CAAC;CACb;AAED,QAAA,MAAM,CAAC,iBAAiB,CAAC;AAEzB,UAAU,iBAAiB;IACvB,IAAI,EAAE,GAAG,CAAC;CACb;ACRD,iBAAS,CAAC,WAET;ACFD,kBAAU,CAAC,CAAC;CAEX;AAED,kBAAU,CAAC,CAAC;CAMX;AAED,cAAM,OAAO;CAMZ;AACD,kBAAU,OAAO,CAAC;CASjB;AC5BD,cAAM,CAAC;IACH,WAAW;CAGd;ACJD,QAAA,IAAI,CAAC,GAAU,CAAC"} + +//// [/src/third/thirdjs/output/third-output.d.ts.map.baseline.txt] +=================================================================== +JsFile: third-output.d.ts +mapUrl: third-output.d.ts.map +sourceRoot: +sources: ../../../first/first_PART1.ts,../../../first/first_part3.ts,../../../second/second_part1.ts,../../../second/second_part2.ts,../../third_part1.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:/src/third/thirdjs/output/third-output.d.ts +sourceFile:../../../first/first_PART1.ts +------------------------------------------------------------------- +>>>interface TheFirst { 1 > -2 >^^^^ -3 > ^^^^^^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^-> -1 > - >/*@internal*/ -2 >namespace -3 > internalOther -4 > .something { export class someClass {} } -1 >Emitted(81, 1) Source(33, 15) + SourceIndex(3) -2 >Emitted(81, 5) Source(33, 25) + SourceIndex(3) -3 >Emitted(81, 18) Source(33, 38) + SourceIndex(3) -4 >Emitted(81, 19) Source(33, 78) + SourceIndex(3) ---- ->>>(function (internalOther) { -1-> -2 >^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^ -1-> -2 >namespace -3 > internalOther -1->Emitted(82, 1) Source(33, 15) + SourceIndex(3) -2 >Emitted(82, 12) Source(33, 25) + SourceIndex(3) -3 >Emitted(82, 25) Source(33, 38) + SourceIndex(3) +2 >^^^^^^^^^^ +3 > ^^^^^^^^ +1 > +2 >interface +3 > TheFirst +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 11) Source(1, 11) + SourceIndex(0) +3 >Emitted(1, 19) Source(1, 19) + SourceIndex(0) --- ->>> var something; +>>> none: any; 1 >^^^^ 2 > ^^^^ -3 > ^^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^-> -1 >. -2 > -3 > something -4 > { export class someClass {} } -1 >Emitted(83, 5) Source(33, 39) + SourceIndex(3) -2 >Emitted(83, 9) Source(33, 39) + SourceIndex(3) -3 >Emitted(83, 18) Source(33, 48) + SourceIndex(3) -4 >Emitted(83, 19) Source(33, 78) + SourceIndex(3) ---- ->>> (function (something) { -1->^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^-> -1-> -2 > -3 > something -1->Emitted(84, 5) Source(33, 39) + SourceIndex(3) -2 >Emitted(84, 16) Source(33, 39) + SourceIndex(3) -3 >Emitted(84, 25) Source(33, 48) + SourceIndex(3) ---- ->>> var someClass = (function () { -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> { -1->Emitted(85, 9) Source(33, 51) + SourceIndex(3) ---- ->>> function someClass() { -1->^^^^^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(86, 13) Source(33, 51) + SourceIndex(3) ---- ->>> } -1->^^^^^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^-> -1->export class someClass { -2 > } -1->Emitted(87, 13) Source(33, 75) + SourceIndex(3) -2 >Emitted(87, 14) Source(33, 76) + SourceIndex(3) ---- ->>> return someClass; -1->^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(88, 13) Source(33, 75) + SourceIndex(3) -2 >Emitted(88, 29) Source(33, 76) + SourceIndex(3) +3 > ^^ +4 > ^^^ +5 > ^ +1 > { + > +2 > none +3 > : +4 > any +5 > ; +1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +2 >Emitted(2, 9) Source(2, 9) + SourceIndex(0) +3 >Emitted(2, 11) Source(2, 11) + SourceIndex(0) +4 >Emitted(2, 14) Source(2, 14) + SourceIndex(0) +5 >Emitted(2, 15) Source(2, 15) + SourceIndex(0) --- ->>> }()); -1 >^^^^^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > -2 > } -3 > -4 > export class someClass {} -1 >Emitted(89, 9) Source(33, 75) + SourceIndex(3) -2 >Emitted(89, 10) Source(33, 76) + SourceIndex(3) -3 >Emitted(89, 10) Source(33, 51) + SourceIndex(3) -4 >Emitted(89, 14) Source(33, 76) + SourceIndex(3) + >} +1 >Emitted(3, 2) Source(3, 2) + SourceIndex(0) --- ->>> something.someClass = someClass; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^ -3 > ^^^^^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +>>>declare const s = "Hello, world"; 1-> -2 > someClass -3 > {} -4 > -1->Emitted(90, 9) Source(33, 64) + SourceIndex(3) -2 >Emitted(90, 28) Source(33, 73) + SourceIndex(3) -3 >Emitted(90, 40) Source(33, 76) + SourceIndex(3) -4 >Emitted(90, 41) Source(33, 76) + SourceIndex(3) ---- ->>> })(something = internalOther.something || (internalOther.something = {})); -1->^^^^ -2 > ^ -3 > ^^ -4 > ^^^^^^^^^ -5 > ^^^ -6 > ^^^^^^^^^^^^^^^^^^^^^^^ -7 > ^^^^^ -8 > ^^^^^^^^^^^^^^^^^^^^^^^ -9 > ^^^^^^^^ -1-> -2 > } -3 > -4 > something -5 > -6 > something -7 > -8 > something -9 > { export class someClass {} } -1->Emitted(91, 5) Source(33, 77) + SourceIndex(3) -2 >Emitted(91, 6) Source(33, 78) + SourceIndex(3) -3 >Emitted(91, 8) Source(33, 39) + SourceIndex(3) -4 >Emitted(91, 17) Source(33, 48) + SourceIndex(3) -5 >Emitted(91, 20) Source(33, 39) + SourceIndex(3) -6 >Emitted(91, 43) Source(33, 48) + SourceIndex(3) -7 >Emitted(91, 48) Source(33, 39) + SourceIndex(3) -8 >Emitted(91, 71) Source(33, 48) + SourceIndex(3) -9 >Emitted(91, 79) Source(33, 78) + SourceIndex(3) ---- ->>>})(internalOther || (internalOther = {})); -1 > -2 >^ -3 > ^^ -4 > ^^^^^^^^^^^^^ -5 > ^^^^^ -6 > ^^^^^^^^^^^^^ -7 > ^^^^^^^^ -8 > ^^^^^^^^-> -1 > -2 >} -3 > -4 > internalOther -5 > -6 > internalOther -7 > .something { export class someClass {} } -1 >Emitted(92, 1) Source(33, 77) + SourceIndex(3) -2 >Emitted(92, 2) Source(33, 78) + SourceIndex(3) -3 >Emitted(92, 4) Source(33, 25) + SourceIndex(3) -4 >Emitted(92, 17) Source(33, 38) + SourceIndex(3) -5 >Emitted(92, 22) Source(33, 25) + SourceIndex(3) -6 >Emitted(92, 35) Source(33, 38) + SourceIndex(3) -7 >Emitted(92, 43) Source(33, 78) + SourceIndex(3) ---- ->>>var internalImport = internalNamespace.someClass; +2 >^^^^^^^^ +3 > ^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^ +6 > ^ 1-> -2 >^^^^ -3 > ^^^^^^^^^^^^^^ -4 > ^^^ -5 > ^^^^^^^^^^^^^^^^^ -6 > ^ -7 > ^^^^^^^^^ -8 > ^ -1-> - >/*@internal*/ -2 >import -3 > internalImport -4 > = -5 > internalNamespace -6 > . -7 > someClass -8 > ; -1->Emitted(93, 1) Source(34, 15) + SourceIndex(3) -2 >Emitted(93, 5) Source(34, 22) + SourceIndex(3) -3 >Emitted(93, 19) Source(34, 36) + SourceIndex(3) -4 >Emitted(93, 22) Source(34, 39) + SourceIndex(3) -5 >Emitted(93, 39) Source(34, 56) + SourceIndex(3) -6 >Emitted(93, 40) Source(34, 57) + SourceIndex(3) -7 >Emitted(93, 49) Source(34, 66) + SourceIndex(3) -8 >Emitted(93, 50) Source(34, 67) + SourceIndex(3) + > + > +2 > +3 > const +4 > s +5 > = "Hello, world" +6 > ; +1->Emitted(4, 1) Source(5, 1) + SourceIndex(0) +2 >Emitted(4, 9) Source(5, 1) + SourceIndex(0) +3 >Emitted(4, 15) Source(5, 7) + SourceIndex(0) +4 >Emitted(4, 16) Source(5, 8) + SourceIndex(0) +5 >Emitted(4, 33) Source(5, 25) + SourceIndex(0) +6 >Emitted(4, 34) Source(5, 26) + SourceIndex(0) --- ->>>var internalConst = 10; +>>>interface NoJsForHereEither { 1 > -2 >^^^^ -3 > ^^^^^^^^^^^^^ -4 > ^^^ -5 > ^^ -6 > ^ -1 > - >/*@internal*/ type internalType = internalC; - >/*@internal*/ -2 >const -3 > internalConst -4 > = -5 > 10 -6 > ; -1 >Emitted(94, 1) Source(36, 15) + SourceIndex(3) -2 >Emitted(94, 5) Source(36, 21) + SourceIndex(3) -3 >Emitted(94, 18) Source(36, 34) + SourceIndex(3) -4 >Emitted(94, 21) Source(36, 37) + SourceIndex(3) -5 >Emitted(94, 23) Source(36, 39) + SourceIndex(3) -6 >Emitted(94, 24) Source(36, 40) + SourceIndex(3) +2 >^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^ +1 > + > + > +2 >interface +3 > NoJsForHereEither +1 >Emitted(5, 1) Source(7, 1) + SourceIndex(0) +2 >Emitted(5, 11) Source(7, 11) + SourceIndex(0) +3 >Emitted(5, 28) Source(7, 28) + SourceIndex(0) +--- +>>> none: any; +1 >^^^^ +2 > ^^^^ +3 > ^^ +4 > ^^^ +5 > ^ +1 > { + > +2 > none +3 > : +4 > any +5 > ; +1 >Emitted(6, 5) Source(8, 5) + SourceIndex(0) +2 >Emitted(6, 9) Source(8, 9) + SourceIndex(0) +3 >Emitted(6, 11) Source(8, 11) + SourceIndex(0) +4 >Emitted(6, 14) Source(8, 14) + SourceIndex(0) +5 >Emitted(6, 15) Source(8, 15) + SourceIndex(0) --- ->>>var internalEnum; +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > -2 >^^^^ -3 > ^^^^^^^^^^^^ -4 > ^^^^^^^^^^^-> -1 > - >/*@internal*/ -2 >enum -3 > internalEnum { a, b, c } -1 >Emitted(95, 1) Source(37, 15) + SourceIndex(3) -2 >Emitted(95, 5) Source(37, 20) + SourceIndex(3) -3 >Emitted(95, 17) Source(37, 44) + SourceIndex(3) + >} +1 >Emitted(7, 2) Source(9, 2) + SourceIndex(0) --- ->>>(function (internalEnum) { +------------------------------------------------------------------- +emittedFile:/src/third/thirdjs/output/third-output.d.ts +sourceFile:../../../first/first_part3.ts +------------------------------------------------------------------- +>>>declare function f(): string; 1-> -2 >^^^^^^^^^^^ -3 > ^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^-> +2 >^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^ 1-> -2 >enum -3 > internalEnum -1->Emitted(96, 1) Source(37, 15) + SourceIndex(3) -2 >Emitted(96, 12) Source(37, 20) + SourceIndex(3) -3 >Emitted(96, 24) Source(37, 32) + SourceIndex(3) ---- ->>> internalEnum[internalEnum["a"] = 0] = "a"; -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^-> -1-> { -2 > a -3 > -1->Emitted(97, 5) Source(37, 35) + SourceIndex(3) -2 >Emitted(97, 46) Source(37, 36) + SourceIndex(3) -3 >Emitted(97, 47) Source(37, 36) + SourceIndex(3) ---- ->>> internalEnum[internalEnum["b"] = 1] = "b"; -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^-> -1->, -2 > b -3 > -1->Emitted(98, 5) Source(37, 38) + SourceIndex(3) -2 >Emitted(98, 46) Source(37, 39) + SourceIndex(3) -3 >Emitted(98, 47) Source(37, 39) + SourceIndex(3) ---- ->>> internalEnum[internalEnum["c"] = 2] = "c"; -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -1->, -2 > c -3 > -1->Emitted(99, 5) Source(37, 41) + SourceIndex(3) -2 >Emitted(99, 46) Source(37, 42) + SourceIndex(3) -3 >Emitted(99, 47) Source(37, 42) + SourceIndex(3) ---- ->>>})(internalEnum || (internalEnum = {})); -1 > -2 >^ -3 > ^^ -4 > ^^^^^^^^^^^^ -5 > ^^^^^ -6 > ^^^^^^^^^^^^ -7 > ^^^^^^^^ -1 > -2 >} -3 > -4 > internalEnum -5 > -6 > internalEnum -7 > { a, b, c } -1 >Emitted(100, 1) Source(37, 43) + SourceIndex(3) -2 >Emitted(100, 2) Source(37, 44) + SourceIndex(3) -3 >Emitted(100, 4) Source(37, 20) + SourceIndex(3) -4 >Emitted(100, 16) Source(37, 32) + SourceIndex(3) -5 >Emitted(100, 21) Source(37, 20) + SourceIndex(3) -6 >Emitted(100, 33) Source(37, 32) + SourceIndex(3) -7 >Emitted(100, 41) Source(37, 44) + SourceIndex(3) +2 >function +3 > f +4 > () { + > return "JS does hoists"; + > } +1->Emitted(8, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(8, 18) Source(1, 10) + SourceIndex(1) +3 >Emitted(8, 19) Source(1, 11) + SourceIndex(1) +4 >Emitted(8, 30) Source(3, 2) + SourceIndex(1) --- ------------------------------------------------------------------- -emittedFile:/src/third/thirdjs/output/third-output.js -sourceFile:../../../second/second_part2.ts +emittedFile:/src/third/thirdjs/output/third-output.d.ts +sourceFile:../../../second/second_part1.ts ------------------------------------------------------------------- ->>>var C = (function () { +>>>declare namespace N { 1 > -2 >^^^^^^^^^^^^^^^^^^^-> +2 >^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^ 1 > -1 >Emitted(101, 1) Source(1, 1) + SourceIndex(4) +2 >namespace +3 > N +4 > +1 >Emitted(9, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(9, 19) Source(1, 11) + SourceIndex(2) +3 >Emitted(9, 20) Source(1, 12) + SourceIndex(2) +4 >Emitted(9, 21) Source(1, 13) + SourceIndex(2) --- ->>> function C() { -1->^^^^ -2 > ^^-> +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^-> +1 >{ + > // Comment text + >} +1 >Emitted(10, 2) Source(3, 2) + SourceIndex(2) +--- +>>>declare namespace N { +1-> +2 >^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^ 1-> -1->Emitted(102, 5) Source(1, 1) + SourceIndex(4) + > + > +2 >namespace +3 > N +4 > +1->Emitted(11, 1) Source(5, 1) + SourceIndex(2) +2 >Emitted(11, 19) Source(5, 11) + SourceIndex(2) +3 >Emitted(11, 20) Source(5, 12) + SourceIndex(2) +4 >Emitted(11, 21) Source(5, 13) + SourceIndex(2) --- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->class C { - > doSomething() { - > console.log("something got done"); +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1 >{ + > function f() { + > console.log('testing'); > } > -2 > } -1->Emitted(103, 5) Source(5, 1) + SourceIndex(4) -2 >Emitted(103, 6) Source(5, 2) + SourceIndex(4) + > f(); + >} +1 >Emitted(12, 2) Source(11, 2) + SourceIndex(2) --- ->>> C.prototype.doSomething = function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^^^^^^^^^^-> +>>>declare class normalC { 1-> -2 > doSomething -3 > -1->Emitted(104, 5) Source(2, 5) + SourceIndex(4) -2 >Emitted(104, 28) Source(2, 16) + SourceIndex(4) -3 >Emitted(104, 31) Source(2, 5) + SourceIndex(4) ---- ->>> console.log("something got done"); -1->^^^^^^^^ -2 > ^^^^^^^ -3 > ^ -4 > ^^^ -5 > ^ -6 > ^^^^^^^^^^^^^^^^^^^^ -7 > ^ -8 > ^ -1->doSomething() { - > -2 > console -3 > . -4 > log -5 > ( -6 > "something got done" -7 > ) -8 > ; -1->Emitted(105, 9) Source(3, 9) + SourceIndex(4) -2 >Emitted(105, 16) Source(3, 16) + SourceIndex(4) -3 >Emitted(105, 17) Source(3, 17) + SourceIndex(4) -4 >Emitted(105, 20) Source(3, 20) + SourceIndex(4) -5 >Emitted(105, 21) Source(3, 21) + SourceIndex(4) -6 >Emitted(105, 41) Source(3, 41) + SourceIndex(4) -7 >Emitted(105, 42) Source(3, 42) + SourceIndex(4) -8 >Emitted(105, 43) Source(3, 43) + SourceIndex(4) +2 >^^^^^^^^^^^^^^ +3 > ^^^^^^^ +1-> + > + > +2 >class +3 > normalC +1->Emitted(13, 1) Source(13, 1) + SourceIndex(2) +2 >Emitted(13, 15) Source(13, 7) + SourceIndex(2) +3 >Emitted(13, 22) Source(13, 14) + SourceIndex(2) --- ->>> }; -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(106, 5) Source(4, 5) + SourceIndex(4) -2 >Emitted(106, 6) Source(4, 6) + SourceIndex(4) +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > { + > /*@internal*/ constructor() { } + > /*@internal*/ prop: string; + > /*@internal*/ method() { } + > /*@internal*/ get c() { return 10; } + > /*@internal*/ set c(val: number) { } + >} +1 >Emitted(14, 2) Source(19, 2) + SourceIndex(2) --- ->>> return C; -1->^^^^ -2 > ^^^^^^^^ +>>>declare namespace normalN { 1-> +2 >^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^ +4 > ^ +1-> > -2 > } -1->Emitted(107, 5) Source(5, 1) + SourceIndex(4) -2 >Emitted(107, 13) Source(5, 2) + SourceIndex(4) +2 >namespace +3 > normalN +4 > +1->Emitted(15, 1) Source(20, 1) + SourceIndex(2) +2 >Emitted(15, 19) Source(20, 11) + SourceIndex(2) +3 >Emitted(15, 26) Source(20, 18) + SourceIndex(2) +4 >Emitted(15, 27) Source(20, 19) + SourceIndex(2) --- ->>>}()); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > class C { - > doSomething() { - > console.log("something got done"); - > } - > } -1 >Emitted(108, 1) Source(5, 1) + SourceIndex(4) -2 >Emitted(108, 2) Source(5, 2) + SourceIndex(4) -3 >Emitted(108, 2) Source(1, 1) + SourceIndex(4) -4 >Emitted(108, 6) Source(5, 2) + SourceIndex(4) +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^-> +1 >{ + > /*@internal*/ export class C { } + > /*@internal*/ export function foo() {} + > /*@internal*/ export namespace someNamespace { export class C {} } + > /*@internal*/ export namespace someOther.something { export class someClass {} } + > /*@internal*/ export import someImport = someNamespace.C; + > /*@internal*/ export type internalType = internalC; + > /*@internal*/ export const internalConst = 10; + > /*@internal*/ export enum internalEnum { a, b, c } + >} +1 >Emitted(16, 2) Source(29, 2) + SourceIndex(2) --- ------------------------------------------------------------------- -emittedFile:/src/third/thirdjs/output/third-output.js -sourceFile:../../third_part1.ts +emittedFile:/src/third/thirdjs/output/third-output.d.ts +sourceFile:../../../second/second_part2.ts ------------------------------------------------------------------- ->>>var c = new C(); +>>>declare class C { 1-> -2 >^^^^ -3 > ^ -4 > ^^^ -5 > ^^^^ -6 > ^ -7 > ^^ -8 > ^ -9 > ^-> +2 >^^^^^^^^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^-> 1-> -2 >var -3 > c -4 > = -5 > new -6 > C -7 > () -8 > ; -1->Emitted(109, 1) Source(1, 1) + SourceIndex(5) -2 >Emitted(109, 5) Source(1, 5) + SourceIndex(5) -3 >Emitted(109, 6) Source(1, 6) + SourceIndex(5) -4 >Emitted(109, 9) Source(1, 9) + SourceIndex(5) -5 >Emitted(109, 13) Source(1, 13) + SourceIndex(5) -6 >Emitted(109, 14) Source(1, 14) + SourceIndex(5) -7 >Emitted(109, 16) Source(1, 16) + SourceIndex(5) -8 >Emitted(109, 17) Source(1, 17) + SourceIndex(5) +2 >class +3 > C +1->Emitted(17, 1) Source(1, 1) + SourceIndex(3) +2 >Emitted(17, 15) Source(1, 7) + SourceIndex(3) +3 >Emitted(17, 16) Source(1, 8) + SourceIndex(3) +--- +>>> doSomething(): void; +1->^^^^ +2 > ^^^^^^^^^^^ +1-> { + > +2 > doSomething +1->Emitted(18, 5) Source(2, 5) + SourceIndex(3) +2 >Emitted(18, 16) Source(2, 16) + SourceIndex(3) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^-> +1 >() { + > console.log("something got done"); + > } + >} +1 >Emitted(19, 2) Source(5, 2) + SourceIndex(3) --- ->>>c.doSomething(); +------------------------------------------------------------------- +emittedFile:/src/third/thirdjs/output/third-output.d.ts +sourceFile:../../third_part1.ts +------------------------------------------------------------------- +>>>declare var c: C; 1-> -2 >^ -3 > ^ -4 > ^^^^^^^^^^^ -5 > ^^ -6 > ^ -7 > ^^^^^^^^^^^^^^^^^^^^^^^-> +2 >^^^^^^^^ +3 > ^^^^ +4 > ^ +5 > ^^^ +6 > ^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> - > -2 >c -3 > . -4 > doSomething -5 > () -6 > ; -1->Emitted(110, 1) Source(2, 1) + SourceIndex(5) -2 >Emitted(110, 2) Source(2, 2) + SourceIndex(5) -3 >Emitted(110, 3) Source(2, 3) + SourceIndex(5) -4 >Emitted(110, 14) Source(2, 14) + SourceIndex(5) -5 >Emitted(110, 16) Source(2, 16) + SourceIndex(5) -6 >Emitted(110, 17) Source(2, 17) + SourceIndex(5) +2 > +3 > var +4 > c +5 > = new C() +6 > ; +1->Emitted(20, 1) Source(1, 1) + SourceIndex(4) +2 >Emitted(20, 9) Source(1, 1) + SourceIndex(4) +3 >Emitted(20, 13) Source(1, 5) + SourceIndex(4) +4 >Emitted(20, 14) Source(1, 6) + SourceIndex(4) +5 >Emitted(20, 17) Source(1, 16) + SourceIndex(4) +6 >Emitted(20, 18) Source(1, 17) + SourceIndex(4) --- ->>>//# sourceMappingURL=third-output.js.map +>>>//# sourceMappingURL=third-output.d.ts.map //// [/src/third/thirdjs/output/third-output.tsbuildinfo] { diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/stripInternal-with-comments-emit-enabled-when-one-two-three-are-prepended-in-order.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/stripInternal-with-comments-emit-enabled-when-one-two-three-are-prepended-in-order.js index 962e2c190993c..fb2071dc25616 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/stripInternal-with-comments-emit-enabled-when-one-two-three-are-prepended-in-order.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/stripInternal-with-comments-emit-enabled-when-one-two-three-are-prepended-in-order.js @@ -1,3 +1,29 @@ +//// [/lib/incremental-headers-change-without-dts-changesOutput.txt] +/lib/tsc --b /src/third --verbose +12:08:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:08:00 AM - Project 'src/first/tsconfig.json' is out of date because oldest output 'src/first/bin/first-output.js' is older than newest input 'src/first/first_PART1.ts' + +12:08:00 AM - Building project '/src/first/tsconfig.json'... + +12:08:00 AM - Project 'src/second/tsconfig.json' is out of date because output of its dependency 'src/first' has changed + +12:08:00 AM - Updating output of project '/src/second/tsconfig.json'... + +12:08:00 AM - Updating unchanged output timestamps of project '/src/second/tsconfig.json'... + +12:08:00 AM - Project 'src/third/tsconfig.json' is out of date because output of its dependency 'src/second' has changed + +12:08:00 AM - Updating output of project '/src/third/tsconfig.json'... + +12:08:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... + +exitCode:: 0 + + //// [/src/2/second-output.d.ts.map] {"version":3,"file":"second-output.d.ts","sourceRoot":"","sources":["../first/first_PART1.ts","../first/first_part3.ts","../second/second_part1.ts","../second/second_part2.ts"],"names":[],"mappings":"AAAA,UAAU,QAAQ;IACd,IAAI,EAAE,GAAG,CAAC;CACb;AAED,QAAA,MAAM,CAAC,iBAAiB,CAAC;AAEzB,UAAU,iBAAiB;IACvB,IAAI,EAAE,GAAG,CAAC;CACb;ACRD,iBAAS,CAAC,WAET;ACFD,kBAAU,CAAC,CAAC;CAEX;AAED,kBAAU,CAAC,CAAC;CAMX;AAED,cAAM,OAAO;;IAEK,IAAI,EAAE,MAAM,CAAC;IACb,MAAM;kBACF,CAAC,EACM,MAAM;CAClC;AACD,kBAAU,OAAO,CAAC;IACA,MAAa,CAAC;KAAI;IAClB,SAAgB,GAAG,SAAK;IACxB,UAAiB,aAAa,CAAC;QAAE,MAAa,CAAC;SAAG;KAAE;IACpD,UAAiB,SAAS,CAAC,SAAS,CAAC;QAAE,MAAa,SAAS;SAAG;KAAE;IAClE,MAAM,QAAQ,UAAU,GAAG,aAAa,CAAC,CAAC,CAAC;IAC3C,KAAY,YAAY,GAAG,SAAS,CAAC;IAC9B,MAAM,aAAa,KAAK,CAAC;IAChC,KAAY,YAAY;QAAG,CAAC,IAAA;QAAE,CAAC,IAAA;QAAE,CAAC,IAAA;KAAE;CACrD;AACa,cAAM,SAAS;CAAG;AAClB,iBAAS,WAAW,SAAK;AACzB,kBAAU,iBAAiB,CAAC;IAAE,MAAa,SAAS;KAAG;CAAE;AACzD,kBAAU,aAAa,CAAC,SAAS,CAAC;IAAE,MAAa,SAAS;KAAG;CAAE;AAC/D,OAAO,cAAc,GAAG,iBAAiB,CAAC,SAAS,CAAC;AACpD,aAAK,YAAY,GAAG,SAAS,CAAC;AAC9B,QAAA,MAAM,aAAa,KAAK,CAAC;AACzB,aAAK,YAAY;IAAG,CAAC,IAAA;IAAE,CAAC,IAAA;IAAE,CAAC,IAAA;CAAE;ACpC3C,cAAM,CAAC;IACH,WAAW;CAGd"} @@ -778,4387 +804,975 @@ sourceFile:../second/second_part2.ts --- >>>//# sourceMappingURL=second-output.d.ts.map -//// [/src/2/second-output.js.map.baseline.txt] -=================================================================== -JsFile: second-output.js -mapUrl: second-output.js.map -sourceRoot: -sources: ../first/first_PART1.ts,../first/first_part2.ts,../first/first_part3.ts,../second/second_part1.ts,../second/second_part2.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:/src/2/second-output.js -sourceFile:../first/first_PART1.ts -------------------------------------------------------------------- ->>>var s = "Hello, world"; -1 > -2 >^^^^ -3 > ^ -4 > ^^^ -5 > ^^^^^^^^^^^^^^ -6 > ^ -1 >interface TheFirst { - > none: any; - >} - > - > -2 >const -3 > s -4 > = -5 > "Hello, world" -6 > ; -1 >Emitted(1, 1) Source(5, 1) + SourceIndex(0) -2 >Emitted(1, 5) Source(5, 7) + SourceIndex(0) -3 >Emitted(1, 6) Source(5, 8) + SourceIndex(0) -4 >Emitted(1, 9) Source(5, 11) + SourceIndex(0) -5 >Emitted(1, 23) Source(5, 25) + SourceIndex(0) -6 >Emitted(1, 24) Source(5, 26) + SourceIndex(0) ---- ->>>console.log(s); -1 > -2 >^^^^^^^ -3 > ^ -4 > ^^^ -5 > ^ -6 > ^ -7 > ^ -8 > ^ -9 > ^^^-> -1 > - > - >interface NoJsForHereEither { - > none: any; - >} - > - > -2 >console -3 > . -4 > log -5 > ( -6 > s -7 > ) -8 > ; -1 >Emitted(2, 1) Source(11, 1) + SourceIndex(0) -2 >Emitted(2, 8) Source(11, 8) + SourceIndex(0) -3 >Emitted(2, 9) Source(11, 9) + SourceIndex(0) -4 >Emitted(2, 12) Source(11, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(11, 13) + SourceIndex(0) -6 >Emitted(2, 14) Source(11, 14) + SourceIndex(0) -7 >Emitted(2, 15) Source(11, 15) + SourceIndex(0) -8 >Emitted(2, 16) Source(11, 16) + SourceIndex(0) ---- -------------------------------------------------------------------- -emittedFile:/src/2/second-output.js -sourceFile:../first/first_part2.ts -------------------------------------------------------------------- ->>>console.log(f()); -1-> -2 >^^^^^^^ -3 > ^ -4 > ^^^ -5 > ^ -6 > ^ -7 > ^^ -8 > ^ -9 > ^ -1-> -2 >console -3 > . -4 > log -5 > ( -6 > f -7 > () -8 > ) -9 > ; -1->Emitted(3, 1) Source(1, 1) + SourceIndex(1) -2 >Emitted(3, 8) Source(1, 8) + SourceIndex(1) -3 >Emitted(3, 9) Source(1, 9) + SourceIndex(1) -4 >Emitted(3, 12) Source(1, 12) + SourceIndex(1) -5 >Emitted(3, 13) Source(1, 13) + SourceIndex(1) -6 >Emitted(3, 14) Source(1, 14) + SourceIndex(1) -7 >Emitted(3, 16) Source(1, 16) + SourceIndex(1) -8 >Emitted(3, 17) Source(1, 17) + SourceIndex(1) -9 >Emitted(3, 18) Source(1, 18) + SourceIndex(1) ---- -------------------------------------------------------------------- -emittedFile:/src/2/second-output.js -sourceFile:../first/first_part3.ts -------------------------------------------------------------------- ->>>function f() { -1 > -2 >^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^-> -1 > -2 >function -3 > f -1 >Emitted(4, 1) Source(1, 1) + SourceIndex(2) -2 >Emitted(4, 10) Source(1, 10) + SourceIndex(2) -3 >Emitted(4, 11) Source(1, 11) + SourceIndex(2) ---- ->>> return "JS does hoists"; -1->^^^^ -2 > ^^^^^^^ -3 > ^^^^^^^^^^^^^^^^ -4 > ^ -1->() { - > -2 > return -3 > "JS does hoists" -4 > ; -1->Emitted(5, 5) Source(2, 5) + SourceIndex(2) -2 >Emitted(5, 12) Source(2, 12) + SourceIndex(2) -3 >Emitted(5, 28) Source(2, 28) + SourceIndex(2) -4 >Emitted(5, 29) Source(2, 29) + SourceIndex(2) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^-> -1 > - > -2 >} -1 >Emitted(6, 1) Source(3, 1) + SourceIndex(2) -2 >Emitted(6, 2) Source(3, 2) + SourceIndex(2) ---- -------------------------------------------------------------------- -emittedFile:/src/2/second-output.js -sourceFile:../second/second_part1.ts -------------------------------------------------------------------- ->>>var N; -1-> -2 >^^^^ -3 > ^ -4 > ^ -5 > ^^^^^^^^^^-> -1->namespace N { - > // Comment text - >} - > - > -2 >namespace -3 > N -4 > { - > function f() { - > console.log('testing'); - > } - > - > f(); - > } -1->Emitted(7, 1) Source(5, 1) + SourceIndex(3) -2 >Emitted(7, 5) Source(5, 11) + SourceIndex(3) -3 >Emitted(7, 6) Source(5, 12) + SourceIndex(3) -4 >Emitted(7, 7) Source(11, 2) + SourceIndex(3) ---- ->>>(function (N) { -1-> -2 >^^^^^^^^^^^ -3 > ^ -4 > ^^^^^^^-> -1-> -2 >namespace -3 > N -1->Emitted(8, 1) Source(5, 1) + SourceIndex(3) -2 >Emitted(8, 12) Source(5, 11) + SourceIndex(3) -3 >Emitted(8, 13) Source(5, 12) + SourceIndex(3) ---- ->>> function f() { -1->^^^^ -2 > ^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^-> -1-> { - > -2 > function -3 > f -1->Emitted(9, 5) Source(6, 5) + SourceIndex(3) -2 >Emitted(9, 14) Source(6, 14) + SourceIndex(3) -3 >Emitted(9, 15) Source(6, 15) + SourceIndex(3) ---- ->>> console.log('testing'); -1->^^^^^^^^ -2 > ^^^^^^^ -3 > ^ -4 > ^^^ -5 > ^ -6 > ^^^^^^^^^ -7 > ^ -8 > ^ -1->() { - > -2 > console -3 > . -4 > log -5 > ( -6 > 'testing' -7 > ) -8 > ; -1->Emitted(10, 9) Source(7, 9) + SourceIndex(3) -2 >Emitted(10, 16) Source(7, 16) + SourceIndex(3) -3 >Emitted(10, 17) Source(7, 17) + SourceIndex(3) -4 >Emitted(10, 20) Source(7, 20) + SourceIndex(3) -5 >Emitted(10, 21) Source(7, 21) + SourceIndex(3) -6 >Emitted(10, 30) Source(7, 30) + SourceIndex(3) -7 >Emitted(10, 31) Source(7, 31) + SourceIndex(3) -8 >Emitted(10, 32) Source(7, 32) + SourceIndex(3) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^-> -1 > - > -2 > } -1 >Emitted(11, 5) Source(8, 5) + SourceIndex(3) -2 >Emitted(11, 6) Source(8, 6) + SourceIndex(3) ---- ->>> f(); -1->^^^^ -2 > ^ -3 > ^^ -4 > ^ -5 > ^^^^^^^^^^^-> -1-> - > - > -2 > f -3 > () -4 > ; -1->Emitted(12, 5) Source(10, 5) + SourceIndex(3) -2 >Emitted(12, 6) Source(10, 6) + SourceIndex(3) -3 >Emitted(12, 8) Source(10, 8) + SourceIndex(3) -4 >Emitted(12, 9) Source(10, 9) + SourceIndex(3) ---- ->>>})(N || (N = {})); -1-> -2 >^ -3 > ^^ -4 > ^ -5 > ^^^^^ -6 > ^ -7 > ^^^^^^^^ -8 > ^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -2 >} -3 > -4 > N -5 > -6 > N -7 > { - > function f() { - > console.log('testing'); - > } - > - > f(); - > } -1->Emitted(13, 1) Source(11, 1) + SourceIndex(3) -2 >Emitted(13, 2) Source(11, 2) + SourceIndex(3) -3 >Emitted(13, 4) Source(5, 11) + SourceIndex(3) -4 >Emitted(13, 5) Source(5, 12) + SourceIndex(3) -5 >Emitted(13, 10) Source(5, 11) + SourceIndex(3) -6 >Emitted(13, 11) Source(5, 12) + SourceIndex(3) -7 >Emitted(13, 19) Source(11, 2) + SourceIndex(3) ---- ->>>var normalC = /** @class */ (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > - > -1->Emitted(14, 1) Source(13, 1) + SourceIndex(3) ---- ->>> /*@internal*/ function normalC() { -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^ -1->class normalC { - > -2 > /*@internal*/ -3 > -1->Emitted(15, 5) Source(14, 5) + SourceIndex(3) -2 >Emitted(15, 18) Source(14, 18) + SourceIndex(3) -3 >Emitted(15, 19) Source(14, 19) + SourceIndex(3) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 >constructor() { -2 > } -1 >Emitted(16, 5) Source(14, 35) + SourceIndex(3) -2 >Emitted(16, 6) Source(14, 36) + SourceIndex(3) ---- ->>> /*@internal*/ normalC.prototype.method = function () { }; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^ -5 > ^^^ -6 > ^^^^^^^^^^^^^^ -7 > ^ -1-> - > /*@internal*/ prop: string; - > -2 > /*@internal*/ -3 > -4 > method -5 > -6 > method() { -7 > } -1->Emitted(17, 5) Source(16, 5) + SourceIndex(3) -2 >Emitted(17, 18) Source(16, 18) + SourceIndex(3) -3 >Emitted(17, 19) Source(16, 19) + SourceIndex(3) -4 >Emitted(17, 43) Source(16, 25) + SourceIndex(3) -5 >Emitted(17, 46) Source(16, 19) + SourceIndex(3) -6 >Emitted(17, 60) Source(16, 30) + SourceIndex(3) -7 >Emitted(17, 61) Source(16, 31) + SourceIndex(3) ---- ->>> Object.defineProperty(normalC.prototype, "c", { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^-> -1 > - > /*@internal*/ -2 > get -3 > c -1 >Emitted(18, 5) Source(17, 19) + SourceIndex(3) -2 >Emitted(18, 27) Source(17, 23) + SourceIndex(3) -3 >Emitted(18, 49) Source(17, 24) + SourceIndex(3) ---- ->>> /*@internal*/ get: function () { return 10; }, -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^ -4 > ^^^^^^^^^^^^^^ -5 > ^^^^^^^ -6 > ^^ -7 > ^ -8 > ^ -9 > ^ -1-> -2 > /*@internal*/ -3 > -4 > get c() { -5 > return -6 > 10 -7 > ; -8 > -9 > } -1->Emitted(19, 9) Source(17, 5) + SourceIndex(3) -2 >Emitted(19, 22) Source(17, 18) + SourceIndex(3) -3 >Emitted(19, 28) Source(17, 19) + SourceIndex(3) -4 >Emitted(19, 42) Source(17, 29) + SourceIndex(3) -5 >Emitted(19, 49) Source(17, 36) + SourceIndex(3) -6 >Emitted(19, 51) Source(17, 38) + SourceIndex(3) -7 >Emitted(19, 52) Source(17, 39) + SourceIndex(3) -8 >Emitted(19, 53) Source(17, 40) + SourceIndex(3) -9 >Emitted(19, 54) Source(17, 41) + SourceIndex(3) ---- ->>> /*@internal*/ set: function (val) { }, -1 >^^^^^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^ -4 > ^^^^^^^^^^ -5 > ^^^ -6 > ^^^^ -7 > ^ -1 > - > -2 > /*@internal*/ -3 > -4 > set c( -5 > val: number -6 > ) { -7 > } -1 >Emitted(20, 9) Source(18, 5) + SourceIndex(3) -2 >Emitted(20, 22) Source(18, 18) + SourceIndex(3) -3 >Emitted(20, 28) Source(18, 19) + SourceIndex(3) -4 >Emitted(20, 38) Source(18, 25) + SourceIndex(3) -5 >Emitted(20, 41) Source(18, 36) + SourceIndex(3) -6 >Emitted(20, 45) Source(18, 40) + SourceIndex(3) -7 >Emitted(20, 46) Source(18, 41) + SourceIndex(3) ---- ->>> enumerable: true, ->>> configurable: true ->>> }); -1 >^^^^^^^ -2 > ^^^^^^^^^^^^^-> -1 > -1 >Emitted(23, 8) Source(17, 41) + SourceIndex(3) ---- ->>> return normalC; -1->^^^^ -2 > ^^^^^^^^^^^^^^ -1-> - > /*@internal*/ set c(val: number) { } - > -2 > } -1->Emitted(24, 5) Source(19, 1) + SourceIndex(3) -2 >Emitted(24, 19) Source(19, 2) + SourceIndex(3) ---- ->>>}()); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^-> -1 > -2 >} -3 > -4 > class normalC { - > /*@internal*/ constructor() { } - > /*@internal*/ prop: string; - > /*@internal*/ method() { } - > /*@internal*/ get c() { return 10; } - > /*@internal*/ set c(val: number) { } - > } -1 >Emitted(25, 1) Source(19, 1) + SourceIndex(3) -2 >Emitted(25, 2) Source(19, 2) + SourceIndex(3) -3 >Emitted(25, 2) Source(13, 1) + SourceIndex(3) -4 >Emitted(25, 6) Source(19, 2) + SourceIndex(3) ---- ->>>var normalN; -1-> -2 >^^^^ -3 > ^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^-> -1-> - > -2 >namespace -3 > normalN -4 > { - > /*@internal*/ export class C { } - > /*@internal*/ export function foo() {} - > /*@internal*/ export namespace someNamespace { export class C {} } - > /*@internal*/ export namespace someOther.something { export class someClass {} } - > /*@internal*/ export import someImport = someNamespace.C; - > /*@internal*/ export type internalType = internalC; - > /*@internal*/ export const internalConst = 10; - > /*@internal*/ export enum internalEnum { a, b, c } - > } -1->Emitted(26, 1) Source(20, 1) + SourceIndex(3) -2 >Emitted(26, 5) Source(20, 11) + SourceIndex(3) -3 >Emitted(26, 12) Source(20, 18) + SourceIndex(3) -4 >Emitted(26, 13) Source(29, 2) + SourceIndex(3) ---- ->>>(function (normalN) { -1-> -2 >^^^^^^^^^^^ -3 > ^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 >namespace -3 > normalN -1->Emitted(27, 1) Source(20, 1) + SourceIndex(3) -2 >Emitted(27, 12) Source(20, 11) + SourceIndex(3) -3 >Emitted(27, 19) Source(20, 18) + SourceIndex(3) ---- ->>> /*@internal*/ var C = /** @class */ (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^^-> -1-> { - > -2 > /*@internal*/ -3 > -1->Emitted(28, 5) Source(21, 5) + SourceIndex(3) -2 >Emitted(28, 18) Source(21, 18) + SourceIndex(3) -3 >Emitted(28, 19) Source(21, 19) + SourceIndex(3) ---- ->>> function C() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(29, 9) Source(21, 19) + SourceIndex(3) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^-> -1->export class C { -2 > } -1->Emitted(30, 9) Source(21, 36) + SourceIndex(3) -2 >Emitted(30, 10) Source(21, 37) + SourceIndex(3) ---- ->>> return C; -1->^^^^^^^^ -2 > ^^^^^^^^ -1-> -2 > } -1->Emitted(31, 9) Source(21, 36) + SourceIndex(3) -2 >Emitted(31, 17) Source(21, 37) + SourceIndex(3) ---- ->>> }()); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class C { } -1 >Emitted(32, 5) Source(21, 36) + SourceIndex(3) -2 >Emitted(32, 6) Source(21, 37) + SourceIndex(3) -3 >Emitted(32, 6) Source(21, 19) + SourceIndex(3) -4 >Emitted(32, 10) Source(21, 37) + SourceIndex(3) ---- ->>> normalN.C = C; -1->^^^^ -2 > ^^^^^^^^^ -3 > ^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^-> -1-> -2 > C -3 > { } -4 > -1->Emitted(33, 5) Source(21, 32) + SourceIndex(3) -2 >Emitted(33, 14) Source(21, 33) + SourceIndex(3) -3 >Emitted(33, 18) Source(21, 37) + SourceIndex(3) -4 >Emitted(33, 19) Source(21, 37) + SourceIndex(3) ---- ->>> /*@internal*/ function foo() { } -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^ -5 > ^^^ -6 > ^^^^^ -7 > ^ -1-> - > -2 > /*@internal*/ -3 > -4 > export function -5 > foo -6 > () { -7 > } -1->Emitted(34, 5) Source(22, 5) + SourceIndex(3) -2 >Emitted(34, 18) Source(22, 18) + SourceIndex(3) -3 >Emitted(34, 19) Source(22, 19) + SourceIndex(3) -4 >Emitted(34, 28) Source(22, 35) + SourceIndex(3) -5 >Emitted(34, 31) Source(22, 38) + SourceIndex(3) -6 >Emitted(34, 36) Source(22, 42) + SourceIndex(3) -7 >Emitted(34, 37) Source(22, 43) + SourceIndex(3) ---- ->>> normalN.foo = foo; -1 >^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^^-> -1 > -2 > foo -3 > () {} -4 > -1 >Emitted(35, 5) Source(22, 35) + SourceIndex(3) -2 >Emitted(35, 16) Source(22, 38) + SourceIndex(3) -3 >Emitted(35, 22) Source(22, 43) + SourceIndex(3) -4 >Emitted(35, 23) Source(22, 43) + SourceIndex(3) ---- ->>> /*@internal*/ var someNamespace; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^ -5 > ^^^^^^^^^^^^^ -6 > ^ -1-> - > -2 > /*@internal*/ -3 > -4 > export namespace -5 > someNamespace -6 > { export class C {} } -1->Emitted(36, 5) Source(23, 5) + SourceIndex(3) -2 >Emitted(36, 18) Source(23, 18) + SourceIndex(3) -3 >Emitted(36, 19) Source(23, 19) + SourceIndex(3) -4 >Emitted(36, 23) Source(23, 36) + SourceIndex(3) -5 >Emitted(36, 36) Source(23, 49) + SourceIndex(3) -6 >Emitted(36, 37) Source(23, 71) + SourceIndex(3) ---- ->>> (function (someNamespace) { -1 >^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^-> -1 > -2 > export namespace -3 > someNamespace -1 >Emitted(37, 5) Source(23, 19) + SourceIndex(3) -2 >Emitted(37, 16) Source(23, 36) + SourceIndex(3) -3 >Emitted(37, 29) Source(23, 49) + SourceIndex(3) ---- ->>> var C = /** @class */ (function () { -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^-> -1-> { -1->Emitted(38, 9) Source(23, 52) + SourceIndex(3) ---- ->>> function C() { -1->^^^^^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(39, 13) Source(23, 52) + SourceIndex(3) ---- ->>> } -1->^^^^^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^-> -1->export class C { -2 > } -1->Emitted(40, 13) Source(23, 68) + SourceIndex(3) -2 >Emitted(40, 14) Source(23, 69) + SourceIndex(3) ---- ->>> return C; -1->^^^^^^^^^^^^ -2 > ^^^^^^^^ -1-> -2 > } -1->Emitted(41, 13) Source(23, 68) + SourceIndex(3) -2 >Emitted(41, 21) Source(23, 69) + SourceIndex(3) ---- ->>> }()); -1 >^^^^^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class C {} -1 >Emitted(42, 9) Source(23, 68) + SourceIndex(3) -2 >Emitted(42, 10) Source(23, 69) + SourceIndex(3) -3 >Emitted(42, 10) Source(23, 52) + SourceIndex(3) -4 >Emitted(42, 14) Source(23, 69) + SourceIndex(3) ---- ->>> someNamespace.C = C; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^ -3 > ^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 > C -3 > {} -4 > -1->Emitted(43, 9) Source(23, 65) + SourceIndex(3) -2 >Emitted(43, 24) Source(23, 66) + SourceIndex(3) -3 >Emitted(43, 28) Source(23, 69) + SourceIndex(3) -4 >Emitted(43, 29) Source(23, 69) + SourceIndex(3) ---- ->>> })(someNamespace = normalN.someNamespace || (normalN.someNamespace = {})); -1->^^^^ -2 > ^ -3 > ^^ -4 > ^^^^^^^^^^^^^ -5 > ^^^ -6 > ^^^^^^^^^^^^^^^^^^^^^ -7 > ^^^^^ -8 > ^^^^^^^^^^^^^^^^^^^^^ -9 > ^^^^^^^^ -1-> -2 > } -3 > -4 > someNamespace -5 > -6 > someNamespace -7 > -8 > someNamespace -9 > { export class C {} } -1->Emitted(44, 5) Source(23, 70) + SourceIndex(3) -2 >Emitted(44, 6) Source(23, 71) + SourceIndex(3) -3 >Emitted(44, 8) Source(23, 36) + SourceIndex(3) -4 >Emitted(44, 21) Source(23, 49) + SourceIndex(3) -5 >Emitted(44, 24) Source(23, 36) + SourceIndex(3) -6 >Emitted(44, 45) Source(23, 49) + SourceIndex(3) -7 >Emitted(44, 50) Source(23, 36) + SourceIndex(3) -8 >Emitted(44, 71) Source(23, 49) + SourceIndex(3) -9 >Emitted(44, 79) Source(23, 71) + SourceIndex(3) ---- ->>> /*@internal*/ var someOther; -1 >^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^ -5 > ^^^^^^^^^ -6 > ^ -1 > - > -2 > /*@internal*/ -3 > -4 > export namespace -5 > someOther -6 > .something { export class someClass {} } -1 >Emitted(45, 5) Source(24, 5) + SourceIndex(3) -2 >Emitted(45, 18) Source(24, 18) + SourceIndex(3) -3 >Emitted(45, 19) Source(24, 19) + SourceIndex(3) -4 >Emitted(45, 23) Source(24, 36) + SourceIndex(3) -5 >Emitted(45, 32) Source(24, 45) + SourceIndex(3) -6 >Emitted(45, 33) Source(24, 85) + SourceIndex(3) ---- ->>> (function (someOther) { -1 >^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^^^^ -1 > -2 > export namespace -3 > someOther -1 >Emitted(46, 5) Source(24, 19) + SourceIndex(3) -2 >Emitted(46, 16) Source(24, 36) + SourceIndex(3) -3 >Emitted(46, 25) Source(24, 45) + SourceIndex(3) ---- ->>> var something; -1 >^^^^^^^^ -2 > ^^^^ -3 > ^^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^-> -1 >. -2 > -3 > something -4 > { export class someClass {} } -1 >Emitted(47, 9) Source(24, 46) + SourceIndex(3) -2 >Emitted(47, 13) Source(24, 46) + SourceIndex(3) -3 >Emitted(47, 22) Source(24, 55) + SourceIndex(3) -4 >Emitted(47, 23) Source(24, 85) + SourceIndex(3) ---- ->>> (function (something) { -1->^^^^^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 > -3 > something -1->Emitted(48, 9) Source(24, 46) + SourceIndex(3) -2 >Emitted(48, 20) Source(24, 46) + SourceIndex(3) -3 >Emitted(48, 29) Source(24, 55) + SourceIndex(3) ---- ->>> var someClass = /** @class */ (function () { -1->^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> { -1->Emitted(49, 13) Source(24, 58) + SourceIndex(3) ---- ->>> function someClass() { -1->^^^^^^^^^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(50, 17) Source(24, 58) + SourceIndex(3) ---- ->>> } -1->^^^^^^^^^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^-> -1->export class someClass { -2 > } -1->Emitted(51, 17) Source(24, 82) + SourceIndex(3) -2 >Emitted(51, 18) Source(24, 83) + SourceIndex(3) ---- ->>> return someClass; -1->^^^^^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(52, 17) Source(24, 82) + SourceIndex(3) -2 >Emitted(52, 33) Source(24, 83) + SourceIndex(3) ---- ->>> }()); -1 >^^^^^^^^^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class someClass {} -1 >Emitted(53, 13) Source(24, 82) + SourceIndex(3) -2 >Emitted(53, 14) Source(24, 83) + SourceIndex(3) -3 >Emitted(53, 14) Source(24, 58) + SourceIndex(3) -4 >Emitted(53, 18) Source(24, 83) + SourceIndex(3) ---- ->>> something.someClass = someClass; -1->^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^ -3 > ^^^^^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 > someClass -3 > {} -4 > -1->Emitted(54, 13) Source(24, 71) + SourceIndex(3) -2 >Emitted(54, 32) Source(24, 80) + SourceIndex(3) -3 >Emitted(54, 44) Source(24, 83) + SourceIndex(3) -4 >Emitted(54, 45) Source(24, 83) + SourceIndex(3) ---- ->>> })(something = someOther.something || (someOther.something = {})); -1->^^^^^^^^ -2 > ^ -3 > ^^ -4 > ^^^^^^^^^ -5 > ^^^ -6 > ^^^^^^^^^^^^^^^^^^^ -7 > ^^^^^ -8 > ^^^^^^^^^^^^^^^^^^^ -9 > ^^^^^^^^ -1-> -2 > } -3 > -4 > something -5 > -6 > something -7 > -8 > something -9 > { export class someClass {} } -1->Emitted(55, 9) Source(24, 84) + SourceIndex(3) -2 >Emitted(55, 10) Source(24, 85) + SourceIndex(3) -3 >Emitted(55, 12) Source(24, 46) + SourceIndex(3) -4 >Emitted(55, 21) Source(24, 55) + SourceIndex(3) -5 >Emitted(55, 24) Source(24, 46) + SourceIndex(3) -6 >Emitted(55, 43) Source(24, 55) + SourceIndex(3) -7 >Emitted(55, 48) Source(24, 46) + SourceIndex(3) -8 >Emitted(55, 67) Source(24, 55) + SourceIndex(3) -9 >Emitted(55, 75) Source(24, 85) + SourceIndex(3) ---- ->>> })(someOther = normalN.someOther || (normalN.someOther = {})); -1 >^^^^ -2 > ^ -3 > ^^ -4 > ^^^^^^^^^ -5 > ^^^ -6 > ^^^^^^^^^^^^^^^^^ -7 > ^^^^^ -8 > ^^^^^^^^^^^^^^^^^ -9 > ^^^^^^^^ -1 > -2 > } -3 > -4 > someOther -5 > -6 > someOther -7 > -8 > someOther -9 > .something { export class someClass {} } -1 >Emitted(56, 5) Source(24, 84) + SourceIndex(3) -2 >Emitted(56, 6) Source(24, 85) + SourceIndex(3) -3 >Emitted(56, 8) Source(24, 36) + SourceIndex(3) -4 >Emitted(56, 17) Source(24, 45) + SourceIndex(3) -5 >Emitted(56, 20) Source(24, 36) + SourceIndex(3) -6 >Emitted(56, 37) Source(24, 45) + SourceIndex(3) -7 >Emitted(56, 42) Source(24, 36) + SourceIndex(3) -8 >Emitted(56, 59) Source(24, 45) + SourceIndex(3) -9 >Emitted(56, 67) Source(24, 85) + SourceIndex(3) ---- ->>> /*@internal*/ normalN.someImport = someNamespace.C; -1 >^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^ -5 > ^^^ -6 > ^^^^^^^^^^^^^ -7 > ^ -8 > ^ -9 > ^ -1 > - > -2 > /*@internal*/ -3 > export import -4 > someImport -5 > = -6 > someNamespace -7 > . -8 > C -9 > ; -1 >Emitted(57, 5) Source(25, 5) + SourceIndex(3) -2 >Emitted(57, 18) Source(25, 18) + SourceIndex(3) -3 >Emitted(57, 19) Source(25, 33) + SourceIndex(3) -4 >Emitted(57, 37) Source(25, 43) + SourceIndex(3) -5 >Emitted(57, 40) Source(25, 46) + SourceIndex(3) -6 >Emitted(57, 53) Source(25, 59) + SourceIndex(3) -7 >Emitted(57, 54) Source(25, 60) + SourceIndex(3) -8 >Emitted(57, 55) Source(25, 61) + SourceIndex(3) -9 >Emitted(57, 56) Source(25, 62) + SourceIndex(3) ---- ->>> /*@internal*/ normalN.internalConst = 10; -1 >^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^ -5 > ^^^ -6 > ^^ -7 > ^ -1 > - > /*@internal*/ export type internalType = internalC; - > -2 > /*@internal*/ -3 > export const -4 > internalConst -5 > = -6 > 10 -7 > ; -1 >Emitted(58, 5) Source(27, 5) + SourceIndex(3) -2 >Emitted(58, 18) Source(27, 18) + SourceIndex(3) -3 >Emitted(58, 19) Source(27, 32) + SourceIndex(3) -4 >Emitted(58, 40) Source(27, 45) + SourceIndex(3) -5 >Emitted(58, 43) Source(27, 48) + SourceIndex(3) -6 >Emitted(58, 45) Source(27, 50) + SourceIndex(3) -7 >Emitted(58, 46) Source(27, 51) + SourceIndex(3) ---- ->>> /*@internal*/ var internalEnum; -1 >^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^ -5 > ^^^^^^^^^^^^ -1 > - > -2 > /*@internal*/ -3 > -4 > export enum -5 > internalEnum { a, b, c } -1 >Emitted(59, 5) Source(28, 5) + SourceIndex(3) -2 >Emitted(59, 18) Source(28, 18) + SourceIndex(3) -3 >Emitted(59, 19) Source(28, 19) + SourceIndex(3) -4 >Emitted(59, 23) Source(28, 31) + SourceIndex(3) -5 >Emitted(59, 35) Source(28, 55) + SourceIndex(3) ---- ->>> (function (internalEnum) { -1 >^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 > export enum -3 > internalEnum -1 >Emitted(60, 5) Source(28, 19) + SourceIndex(3) -2 >Emitted(60, 16) Source(28, 31) + SourceIndex(3) -3 >Emitted(60, 28) Source(28, 43) + SourceIndex(3) ---- ->>> internalEnum[internalEnum["a"] = 0] = "a"; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^-> -1-> { -2 > a -3 > -1->Emitted(61, 9) Source(28, 46) + SourceIndex(3) -2 >Emitted(61, 50) Source(28, 47) + SourceIndex(3) -3 >Emitted(61, 51) Source(28, 47) + SourceIndex(3) ---- ->>> internalEnum[internalEnum["b"] = 1] = "b"; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^-> -1->, -2 > b -3 > -1->Emitted(62, 9) Source(28, 49) + SourceIndex(3) -2 >Emitted(62, 50) Source(28, 50) + SourceIndex(3) -3 >Emitted(62, 51) Source(28, 50) + SourceIndex(3) ---- ->>> internalEnum[internalEnum["c"] = 2] = "c"; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->, -2 > c -3 > -1->Emitted(63, 9) Source(28, 52) + SourceIndex(3) -2 >Emitted(63, 50) Source(28, 53) + SourceIndex(3) -3 >Emitted(63, 51) Source(28, 53) + SourceIndex(3) ---- ->>> })(internalEnum = normalN.internalEnum || (normalN.internalEnum = {})); -1->^^^^ -2 > ^ -3 > ^^ -4 > ^^^^^^^^^^^^ -5 > ^^^ -6 > ^^^^^^^^^^^^^^^^^^^^ -7 > ^^^^^ -8 > ^^^^^^^^^^^^^^^^^^^^ -9 > ^^^^^^^^ -1-> -2 > } -3 > -4 > internalEnum -5 > -6 > internalEnum -7 > -8 > internalEnum -9 > { a, b, c } -1->Emitted(64, 5) Source(28, 54) + SourceIndex(3) -2 >Emitted(64, 6) Source(28, 55) + SourceIndex(3) -3 >Emitted(64, 8) Source(28, 31) + SourceIndex(3) -4 >Emitted(64, 20) Source(28, 43) + SourceIndex(3) -5 >Emitted(64, 23) Source(28, 31) + SourceIndex(3) -6 >Emitted(64, 43) Source(28, 43) + SourceIndex(3) -7 >Emitted(64, 48) Source(28, 31) + SourceIndex(3) -8 >Emitted(64, 68) Source(28, 43) + SourceIndex(3) -9 >Emitted(64, 76) Source(28, 55) + SourceIndex(3) ---- ->>>})(normalN || (normalN = {})); -1 > -2 >^ -3 > ^^ -4 > ^^^^^^^ -5 > ^^^^^ -6 > ^^^^^^^ -7 > ^^^^^^^^ -8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -3 > -4 > normalN -5 > -6 > normalN -7 > { - > /*@internal*/ export class C { } - > /*@internal*/ export function foo() {} - > /*@internal*/ export namespace someNamespace { export class C {} } - > /*@internal*/ export namespace someOther.something { export class someClass {} } - > /*@internal*/ export import someImport = someNamespace.C; - > /*@internal*/ export type internalType = internalC; - > /*@internal*/ export const internalConst = 10; - > /*@internal*/ export enum internalEnum { a, b, c } - > } -1 >Emitted(65, 1) Source(29, 1) + SourceIndex(3) -2 >Emitted(65, 2) Source(29, 2) + SourceIndex(3) -3 >Emitted(65, 4) Source(20, 11) + SourceIndex(3) -4 >Emitted(65, 11) Source(20, 18) + SourceIndex(3) -5 >Emitted(65, 16) Source(20, 11) + SourceIndex(3) -6 >Emitted(65, 23) Source(20, 18) + SourceIndex(3) -7 >Emitted(65, 31) Source(29, 2) + SourceIndex(3) ---- ->>>/*@internal*/ var internalC = /** @class */ (function () { -1-> -2 >^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^-> -1-> - > -2 >/*@internal*/ -3 > -1->Emitted(66, 1) Source(30, 1) + SourceIndex(3) -2 >Emitted(66, 14) Source(30, 14) + SourceIndex(3) -3 >Emitted(66, 15) Source(30, 15) + SourceIndex(3) ---- ->>> function internalC() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(67, 5) Source(30, 15) + SourceIndex(3) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^-> -1->class internalC { -2 > } -1->Emitted(68, 5) Source(30, 32) + SourceIndex(3) -2 >Emitted(68, 6) Source(30, 33) + SourceIndex(3) ---- ->>> return internalC; -1->^^^^ -2 > ^^^^^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(69, 5) Source(30, 32) + SourceIndex(3) -2 >Emitted(69, 21) Source(30, 33) + SourceIndex(3) ---- ->>>}()); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > class internalC {} -1 >Emitted(70, 1) Source(30, 32) + SourceIndex(3) -2 >Emitted(70, 2) Source(30, 33) + SourceIndex(3) -3 >Emitted(70, 2) Source(30, 15) + SourceIndex(3) -4 >Emitted(70, 6) Source(30, 33) + SourceIndex(3) ---- ->>>/*@internal*/ function internalfoo() { } -1-> -2 >^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^ -5 > ^^^^^^^^^^^ -6 > ^^^^^ -7 > ^ -1-> - > -2 >/*@internal*/ -3 > -4 > function -5 > internalfoo -6 > () { -7 > } -1->Emitted(71, 1) Source(31, 1) + SourceIndex(3) -2 >Emitted(71, 14) Source(31, 14) + SourceIndex(3) -3 >Emitted(71, 15) Source(31, 15) + SourceIndex(3) -4 >Emitted(71, 24) Source(31, 24) + SourceIndex(3) -5 >Emitted(71, 35) Source(31, 35) + SourceIndex(3) -6 >Emitted(71, 40) Source(31, 39) + SourceIndex(3) -7 >Emitted(71, 41) Source(31, 40) + SourceIndex(3) ---- ->>>/*@internal*/ var internalNamespace; -1 > -2 >^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^ -6 > ^ -1 > - > -2 >/*@internal*/ -3 > -4 > namespace -5 > internalNamespace -6 > { export class someClass {} } -1 >Emitted(72, 1) Source(32, 1) + SourceIndex(3) -2 >Emitted(72, 14) Source(32, 14) + SourceIndex(3) -3 >Emitted(72, 15) Source(32, 15) + SourceIndex(3) -4 >Emitted(72, 19) Source(32, 25) + SourceIndex(3) -5 >Emitted(72, 36) Source(32, 42) + SourceIndex(3) -6 >Emitted(72, 37) Source(32, 72) + SourceIndex(3) ---- ->>>(function (internalNamespace) { -1 > -2 >^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >namespace -3 > internalNamespace -1 >Emitted(73, 1) Source(32, 15) + SourceIndex(3) -2 >Emitted(73, 12) Source(32, 25) + SourceIndex(3) -3 >Emitted(73, 29) Source(32, 42) + SourceIndex(3) ---- ->>> var someClass = /** @class */ (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> { -1->Emitted(74, 5) Source(32, 45) + SourceIndex(3) ---- ->>> function someClass() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(75, 9) Source(32, 45) + SourceIndex(3) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^-> -1->export class someClass { -2 > } -1->Emitted(76, 9) Source(32, 69) + SourceIndex(3) -2 >Emitted(76, 10) Source(32, 70) + SourceIndex(3) ---- ->>> return someClass; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(77, 9) Source(32, 69) + SourceIndex(3) -2 >Emitted(77, 25) Source(32, 70) + SourceIndex(3) ---- ->>> }()); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class someClass {} -1 >Emitted(78, 5) Source(32, 69) + SourceIndex(3) -2 >Emitted(78, 6) Source(32, 70) + SourceIndex(3) -3 >Emitted(78, 6) Source(32, 45) + SourceIndex(3) -4 >Emitted(78, 10) Source(32, 70) + SourceIndex(3) ---- ->>> internalNamespace.someClass = someClass; -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^^^^^^^^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 > someClass -3 > {} -4 > -1->Emitted(79, 5) Source(32, 58) + SourceIndex(3) -2 >Emitted(79, 32) Source(32, 67) + SourceIndex(3) -3 >Emitted(79, 44) Source(32, 70) + SourceIndex(3) -4 >Emitted(79, 45) Source(32, 70) + SourceIndex(3) ---- ->>>})(internalNamespace || (internalNamespace = {})); -1-> -2 >^ -3 > ^^ -4 > ^^^^^^^^^^^^^^^^^ -5 > ^^^^^ -6 > ^^^^^^^^^^^^^^^^^ -7 > ^^^^^^^^ -1-> -2 >} -3 > -4 > internalNamespace -5 > -6 > internalNamespace -7 > { export class someClass {} } -1->Emitted(80, 1) Source(32, 71) + SourceIndex(3) -2 >Emitted(80, 2) Source(32, 72) + SourceIndex(3) -3 >Emitted(80, 4) Source(32, 25) + SourceIndex(3) -4 >Emitted(80, 21) Source(32, 42) + SourceIndex(3) -5 >Emitted(80, 26) Source(32, 25) + SourceIndex(3) -6 >Emitted(80, 43) Source(32, 42) + SourceIndex(3) -7 >Emitted(80, 51) Source(32, 72) + SourceIndex(3) ---- ->>>/*@internal*/ var internalOther; -1 > -2 >^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^ -5 > ^^^^^^^^^^^^^ -6 > ^ -1 > - > -2 >/*@internal*/ -3 > -4 > namespace -5 > internalOther -6 > .something { export class someClass {} } -1 >Emitted(81, 1) Source(33, 1) + SourceIndex(3) -2 >Emitted(81, 14) Source(33, 14) + SourceIndex(3) -3 >Emitted(81, 15) Source(33, 15) + SourceIndex(3) -4 >Emitted(81, 19) Source(33, 25) + SourceIndex(3) -5 >Emitted(81, 32) Source(33, 38) + SourceIndex(3) -6 >Emitted(81, 33) Source(33, 78) + SourceIndex(3) ---- ->>>(function (internalOther) { -1 > -2 >^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^ -1 > -2 >namespace -3 > internalOther -1 >Emitted(82, 1) Source(33, 15) + SourceIndex(3) -2 >Emitted(82, 12) Source(33, 25) + SourceIndex(3) -3 >Emitted(82, 25) Source(33, 38) + SourceIndex(3) ---- ->>> var something; -1 >^^^^ -2 > ^^^^ -3 > ^^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^-> -1 >. -2 > -3 > something -4 > { export class someClass {} } -1 >Emitted(83, 5) Source(33, 39) + SourceIndex(3) -2 >Emitted(83, 9) Source(33, 39) + SourceIndex(3) -3 >Emitted(83, 18) Source(33, 48) + SourceIndex(3) -4 >Emitted(83, 19) Source(33, 78) + SourceIndex(3) ---- ->>> (function (something) { -1->^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 > -3 > something -1->Emitted(84, 5) Source(33, 39) + SourceIndex(3) -2 >Emitted(84, 16) Source(33, 39) + SourceIndex(3) -3 >Emitted(84, 25) Source(33, 48) + SourceIndex(3) ---- ->>> var someClass = /** @class */ (function () { -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> { -1->Emitted(85, 9) Source(33, 51) + SourceIndex(3) ---- ->>> function someClass() { -1->^^^^^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(86, 13) Source(33, 51) + SourceIndex(3) ---- ->>> } -1->^^^^^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^-> -1->export class someClass { -2 > } -1->Emitted(87, 13) Source(33, 75) + SourceIndex(3) -2 >Emitted(87, 14) Source(33, 76) + SourceIndex(3) ---- ->>> return someClass; -1->^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(88, 13) Source(33, 75) + SourceIndex(3) -2 >Emitted(88, 29) Source(33, 76) + SourceIndex(3) ---- ->>> }()); -1 >^^^^^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class someClass {} -1 >Emitted(89, 9) Source(33, 75) + SourceIndex(3) -2 >Emitted(89, 10) Source(33, 76) + SourceIndex(3) -3 >Emitted(89, 10) Source(33, 51) + SourceIndex(3) -4 >Emitted(89, 14) Source(33, 76) + SourceIndex(3) ---- ->>> something.someClass = someClass; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^ -3 > ^^^^^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 > someClass -3 > {} -4 > -1->Emitted(90, 9) Source(33, 64) + SourceIndex(3) -2 >Emitted(90, 28) Source(33, 73) + SourceIndex(3) -3 >Emitted(90, 40) Source(33, 76) + SourceIndex(3) -4 >Emitted(90, 41) Source(33, 76) + SourceIndex(3) ---- ->>> })(something = internalOther.something || (internalOther.something = {})); -1->^^^^ -2 > ^ -3 > ^^ -4 > ^^^^^^^^^ -5 > ^^^ -6 > ^^^^^^^^^^^^^^^^^^^^^^^ -7 > ^^^^^ -8 > ^^^^^^^^^^^^^^^^^^^^^^^ -9 > ^^^^^^^^ -1-> -2 > } -3 > -4 > something -5 > -6 > something -7 > -8 > something -9 > { export class someClass {} } -1->Emitted(91, 5) Source(33, 77) + SourceIndex(3) -2 >Emitted(91, 6) Source(33, 78) + SourceIndex(3) -3 >Emitted(91, 8) Source(33, 39) + SourceIndex(3) -4 >Emitted(91, 17) Source(33, 48) + SourceIndex(3) -5 >Emitted(91, 20) Source(33, 39) + SourceIndex(3) -6 >Emitted(91, 43) Source(33, 48) + SourceIndex(3) -7 >Emitted(91, 48) Source(33, 39) + SourceIndex(3) -8 >Emitted(91, 71) Source(33, 48) + SourceIndex(3) -9 >Emitted(91, 79) Source(33, 78) + SourceIndex(3) ---- ->>>})(internalOther || (internalOther = {})); -1 > -2 >^ -3 > ^^ -4 > ^^^^^^^^^^^^^ -5 > ^^^^^ -6 > ^^^^^^^^^^^^^ -7 > ^^^^^^^^ -8 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > internalOther -5 > -6 > internalOther -7 > .something { export class someClass {} } -1 >Emitted(92, 1) Source(33, 77) + SourceIndex(3) -2 >Emitted(92, 2) Source(33, 78) + SourceIndex(3) -3 >Emitted(92, 4) Source(33, 25) + SourceIndex(3) -4 >Emitted(92, 17) Source(33, 38) + SourceIndex(3) -5 >Emitted(92, 22) Source(33, 25) + SourceIndex(3) -6 >Emitted(92, 35) Source(33, 38) + SourceIndex(3) -7 >Emitted(92, 43) Source(33, 78) + SourceIndex(3) ---- ->>>/*@internal*/ var internalImport = internalNamespace.someClass; -1-> -2 >^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^ -5 > ^^^^^^^^^^^^^^ -6 > ^^^ -7 > ^^^^^^^^^^^^^^^^^ -8 > ^ -9 > ^^^^^^^^^ -10> ^ -1-> - > -2 >/*@internal*/ -3 > -4 > import -5 > internalImport -6 > = -7 > internalNamespace -8 > . -9 > someClass -10> ; -1->Emitted(93, 1) Source(34, 1) + SourceIndex(3) -2 >Emitted(93, 14) Source(34, 14) + SourceIndex(3) -3 >Emitted(93, 15) Source(34, 15) + SourceIndex(3) -4 >Emitted(93, 19) Source(34, 22) + SourceIndex(3) -5 >Emitted(93, 33) Source(34, 36) + SourceIndex(3) -6 >Emitted(93, 36) Source(34, 39) + SourceIndex(3) -7 >Emitted(93, 53) Source(34, 56) + SourceIndex(3) -8 >Emitted(93, 54) Source(34, 57) + SourceIndex(3) -9 >Emitted(93, 63) Source(34, 66) + SourceIndex(3) -10>Emitted(93, 64) Source(34, 67) + SourceIndex(3) ---- ->>>/*@internal*/ var internalConst = 10; -1 > -2 >^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^ -5 > ^^^^^^^^^^^^^ -6 > ^^^ -7 > ^^ -8 > ^ -1 > - >/*@internal*/ type internalType = internalC; - > -2 >/*@internal*/ -3 > -4 > const -5 > internalConst -6 > = -7 > 10 -8 > ; -1 >Emitted(94, 1) Source(36, 1) + SourceIndex(3) -2 >Emitted(94, 14) Source(36, 14) + SourceIndex(3) -3 >Emitted(94, 15) Source(36, 15) + SourceIndex(3) -4 >Emitted(94, 19) Source(36, 21) + SourceIndex(3) -5 >Emitted(94, 32) Source(36, 34) + SourceIndex(3) -6 >Emitted(94, 35) Source(36, 37) + SourceIndex(3) -7 >Emitted(94, 37) Source(36, 39) + SourceIndex(3) -8 >Emitted(94, 38) Source(36, 40) + SourceIndex(3) ---- ->>>/*@internal*/ var internalEnum; -1 > -2 >^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^ -5 > ^^^^^^^^^^^^ -1 > - > -2 >/*@internal*/ -3 > -4 > enum -5 > internalEnum { a, b, c } -1 >Emitted(95, 1) Source(37, 1) + SourceIndex(3) -2 >Emitted(95, 14) Source(37, 14) + SourceIndex(3) -3 >Emitted(95, 15) Source(37, 15) + SourceIndex(3) -4 >Emitted(95, 19) Source(37, 20) + SourceIndex(3) -5 >Emitted(95, 31) Source(37, 44) + SourceIndex(3) ---- ->>>(function (internalEnum) { -1 > -2 >^^^^^^^^^^^ -3 > ^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >enum -3 > internalEnum -1 >Emitted(96, 1) Source(37, 15) + SourceIndex(3) -2 >Emitted(96, 12) Source(37, 20) + SourceIndex(3) -3 >Emitted(96, 24) Source(37, 32) + SourceIndex(3) ---- ->>> internalEnum[internalEnum["a"] = 0] = "a"; -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^-> -1-> { -2 > a -3 > -1->Emitted(97, 5) Source(37, 35) + SourceIndex(3) -2 >Emitted(97, 46) Source(37, 36) + SourceIndex(3) -3 >Emitted(97, 47) Source(37, 36) + SourceIndex(3) ---- ->>> internalEnum[internalEnum["b"] = 1] = "b"; -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^-> -1->, -2 > b -3 > -1->Emitted(98, 5) Source(37, 38) + SourceIndex(3) -2 >Emitted(98, 46) Source(37, 39) + SourceIndex(3) -3 >Emitted(98, 47) Source(37, 39) + SourceIndex(3) ---- ->>> internalEnum[internalEnum["c"] = 2] = "c"; -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -1->, -2 > c -3 > -1->Emitted(99, 5) Source(37, 41) + SourceIndex(3) -2 >Emitted(99, 46) Source(37, 42) + SourceIndex(3) -3 >Emitted(99, 47) Source(37, 42) + SourceIndex(3) ---- ->>>})(internalEnum || (internalEnum = {})); -1 > -2 >^ -3 > ^^ -4 > ^^^^^^^^^^^^ -5 > ^^^^^ -6 > ^^^^^^^^^^^^ -7 > ^^^^^^^^ -1 > -2 >} -3 > -4 > internalEnum -5 > -6 > internalEnum -7 > { a, b, c } -1 >Emitted(100, 1) Source(37, 43) + SourceIndex(3) -2 >Emitted(100, 2) Source(37, 44) + SourceIndex(3) -3 >Emitted(100, 4) Source(37, 20) + SourceIndex(3) -4 >Emitted(100, 16) Source(37, 32) + SourceIndex(3) -5 >Emitted(100, 21) Source(37, 20) + SourceIndex(3) -6 >Emitted(100, 33) Source(37, 32) + SourceIndex(3) -7 >Emitted(100, 41) Source(37, 44) + SourceIndex(3) ---- -------------------------------------------------------------------- -emittedFile:/src/2/second-output.js -sourceFile:../second/second_part2.ts -------------------------------------------------------------------- ->>>var C = /** @class */ (function () { -1 > -2 >^^^^^^^^^^^^^^^^^^^-> -1 > -1 >Emitted(101, 1) Source(1, 1) + SourceIndex(4) ---- ->>> function C() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(102, 5) Source(1, 1) + SourceIndex(4) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->class C { - > doSomething() { - > console.log("something got done"); - > } - > -2 > } -1->Emitted(103, 5) Source(5, 1) + SourceIndex(4) -2 >Emitted(103, 6) Source(5, 2) + SourceIndex(4) ---- ->>> C.prototype.doSomething = function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^^^^^^^^^^-> -1-> -2 > doSomething -3 > -1->Emitted(104, 5) Source(2, 5) + SourceIndex(4) -2 >Emitted(104, 28) Source(2, 16) + SourceIndex(4) -3 >Emitted(104, 31) Source(2, 5) + SourceIndex(4) ---- ->>> console.log("something got done"); -1->^^^^^^^^ -2 > ^^^^^^^ -3 > ^ -4 > ^^^ -5 > ^ -6 > ^^^^^^^^^^^^^^^^^^^^ -7 > ^ -8 > ^ -1->doSomething() { - > -2 > console -3 > . -4 > log -5 > ( -6 > "something got done" -7 > ) -8 > ; -1->Emitted(105, 9) Source(3, 9) + SourceIndex(4) -2 >Emitted(105, 16) Source(3, 16) + SourceIndex(4) -3 >Emitted(105, 17) Source(3, 17) + SourceIndex(4) -4 >Emitted(105, 20) Source(3, 20) + SourceIndex(4) -5 >Emitted(105, 21) Source(3, 21) + SourceIndex(4) -6 >Emitted(105, 41) Source(3, 41) + SourceIndex(4) -7 >Emitted(105, 42) Source(3, 42) + SourceIndex(4) -8 >Emitted(105, 43) Source(3, 43) + SourceIndex(4) ---- ->>> }; -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(106, 5) Source(4, 5) + SourceIndex(4) -2 >Emitted(106, 6) Source(4, 6) + SourceIndex(4) ---- ->>> return C; -1->^^^^ -2 > ^^^^^^^^ -1-> - > -2 > } -1->Emitted(107, 5) Source(5, 1) + SourceIndex(4) -2 >Emitted(107, 13) Source(5, 2) + SourceIndex(4) ---- ->>>}()); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > class C { - > doSomething() { - > console.log("something got done"); - > } - > } -1 >Emitted(108, 1) Source(5, 1) + SourceIndex(4) -2 >Emitted(108, 2) Source(5, 2) + SourceIndex(4) -3 >Emitted(108, 2) Source(1, 1) + SourceIndex(4) -4 >Emitted(108, 6) Source(5, 2) + SourceIndex(4) ---- ->>>//# sourceMappingURL=second-output.js.map - -//// [/src/2/second-output.tsbuildinfo] -{ - "bundle": { - "commonSourceDirectory": "../second", - "sourceFiles": [ - "../second/second_part1.ts", - "../second/second_part2.ts" - ], - "js": { - "sections": [ - { - "pos": 0, - "end": 110, - "kind": "prepend", - "data": "../first/bin/first-output.js", - "texts": [ - { - "pos": 0, - "end": 110, - "kind": "text" - } - ] - }, - { - "pos": 110, - "end": 3526, - "kind": "text" - } - ] - }, - "dts": { - "sections": [ - { - "pos": 0, - "end": 157, - "kind": "prepend", - "data": "../first/bin/first-output.d.ts", - "texts": [ - { - "pos": 0, - "end": 157, - "kind": "text" - } - ] - }, - { - "pos": 157, - "end": 234, - "kind": "text" - }, - { - "pos": 234, - "end": 322, - "kind": "internal" - }, - { - "pos": 324, - "end": 356, - "kind": "text" - }, - { - "pos": 356, - "end": 748, - "kind": "internal" - }, - { - "pos": 750, - "end": 753, - "kind": "text" - }, - { - "pos": 753, - "end": 1166, - "kind": "internal" - }, - { - "pos": 1168, - "end": 1216, - "kind": "text" - } - ] - } - }, - "version": "FakeTSVersion" -} - -//// [/src/2/second-output.tsbuildinfo.baseline.txt] -====================================================================== -File:: /src/2/second-output.js ----------------------------------------------------------------------- -prepend: (0-110):: ../first/bin/first-output.js texts:: 1 ->>-------------------------------------------------------------------- -text: (0-110) -var s = "Hello, world"; -console.log(s); -console.log(f()); -function f() { - return "JS does hoists"; -} - ----------------------------------------------------------------------- -text: (110-3526) -var N; -(function (N) { - function f() { - console.log('testing'); - } - f(); -})(N || (N = {})); -var normalC = /** @class */ (function () { - /*@internal*/ function normalC() { - } - /*@internal*/ normalC.prototype.method = function () { }; - Object.defineProperty(normalC.prototype, "c", { - /*@internal*/ get: function () { return 10; }, - /*@internal*/ set: function (val) { }, - enumerable: true, - configurable: true - }); - return normalC; -}()); -var normalN; -(function (normalN) { - /*@internal*/ var C = /** @class */ (function () { - function C() { - } - return C; - }()); - normalN.C = C; - /*@internal*/ function foo() { } - normalN.foo = foo; - /*@internal*/ var someNamespace; - (function (someNamespace) { - var C = /** @class */ (function () { - function C() { - } - return C; - }()); - someNamespace.C = C; - })(someNamespace = normalN.someNamespace || (normalN.someNamespace = {})); - /*@internal*/ var someOther; - (function (someOther) { - var something; - (function (something) { - var someClass = /** @class */ (function () { - function someClass() { - } - return someClass; - }()); - something.someClass = someClass; - })(something = someOther.something || (someOther.something = {})); - })(someOther = normalN.someOther || (normalN.someOther = {})); - /*@internal*/ normalN.someImport = someNamespace.C; - /*@internal*/ normalN.internalConst = 10; - /*@internal*/ var internalEnum; - (function (internalEnum) { - internalEnum[internalEnum["a"] = 0] = "a"; - internalEnum[internalEnum["b"] = 1] = "b"; - internalEnum[internalEnum["c"] = 2] = "c"; - })(internalEnum = normalN.internalEnum || (normalN.internalEnum = {})); -})(normalN || (normalN = {})); -/*@internal*/ var internalC = /** @class */ (function () { - function internalC() { - } - return internalC; -}()); -/*@internal*/ function internalfoo() { } -/*@internal*/ var internalNamespace; -(function (internalNamespace) { - var someClass = /** @class */ (function () { - function someClass() { - } - return someClass; - }()); - internalNamespace.someClass = someClass; -})(internalNamespace || (internalNamespace = {})); -/*@internal*/ var internalOther; -(function (internalOther) { - var something; - (function (something) { - var someClass = /** @class */ (function () { - function someClass() { - } - return someClass; - }()); - something.someClass = someClass; - })(something = internalOther.something || (internalOther.something = {})); -})(internalOther || (internalOther = {})); -/*@internal*/ var internalImport = internalNamespace.someClass; -/*@internal*/ var internalConst = 10; -/*@internal*/ var internalEnum; -(function (internalEnum) { - internalEnum[internalEnum["a"] = 0] = "a"; - internalEnum[internalEnum["b"] = 1] = "b"; - internalEnum[internalEnum["c"] = 2] = "c"; -})(internalEnum || (internalEnum = {})); -var C = /** @class */ (function () { - function C() { - } - C.prototype.doSomething = function () { - console.log("something got done"); - }; - return C; -}()); - -====================================================================== -====================================================================== -File:: /src/2/second-output.d.ts ----------------------------------------------------------------------- -prepend: (0-157):: ../first/bin/first-output.d.ts texts:: 1 ->>-------------------------------------------------------------------- -text: (0-157) -interface TheFirst { - none: any; -} -declare const s = "Hello, world"; -interface NoJsForHereEither { - none: any; -} -declare function f(): string; - ----------------------------------------------------------------------- -text: (157-234) -declare namespace N { -} -declare namespace N { -} -declare class normalC { - ----------------------------------------------------------------------- -internal: (234-322) - constructor(); - prop: string; - method(): void; - /*@internal*/ c: number; ----------------------------------------------------------------------- -text: (324-356) -} -declare namespace normalN { - ----------------------------------------------------------------------- -internal: (356-748) - class C { - } - function foo(): void; - namespace someNamespace { - class C { - } - } - namespace someOther.something { - class someClass { - } - } - export import someImport = someNamespace.C; - type internalType = internalC; - const internalConst = 10; - enum internalEnum { - a = 0, - b = 1, - c = 2 - } ----------------------------------------------------------------------- -text: (750-753) -} - ----------------------------------------------------------------------- -internal: (753-1166) -declare class internalC { -} -declare function internalfoo(): void; -declare namespace internalNamespace { - class someClass { - } -} -declare namespace internalOther.something { - class someClass { - } -} -import internalImport = internalNamespace.someClass; -declare type internalType = internalC; -declare const internalConst = 10; -declare enum internalEnum { - a = 0, - b = 1, - c = 2 -} ----------------------------------------------------------------------- -text: (1168-1216) -declare class C { - doSomething(): void; -} - -====================================================================== - -//// [/src/first/bin/first-output.d.ts.map] -{"version":3,"file":"first-output.d.ts","sourceRoot":"","sources":["../first_PART1.ts","../first_part2.ts","../first_part3.ts"],"names":[],"mappings":"AAAA,UAAU,QAAQ;IACd,IAAI,EAAE,GAAG,CAAC;CACb;AAED,QAAA,MAAM,CAAC,iBAAiB,CAAC;AAEzB,UAAU,iBAAiB;IACvB,IAAI,EAAE,GAAG,CAAC;CACb;AERD,iBAAS,CAAC,WAET"} - -//// [/src/first/bin/first-output.d.ts.map.baseline.txt] -=================================================================== -JsFile: first-output.d.ts -mapUrl: first-output.d.ts.map -sourceRoot: -sources: ../first_PART1.ts,../first_part2.ts,../first_part3.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:/src/first/bin/first-output.d.ts -sourceFile:../first_PART1.ts -------------------------------------------------------------------- ->>>interface TheFirst { -1 > -2 >^^^^^^^^^^ -3 > ^^^^^^^^ -1 > -2 >interface -3 > TheFirst -1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -2 >Emitted(1, 11) Source(1, 11) + SourceIndex(0) -3 >Emitted(1, 19) Source(1, 19) + SourceIndex(0) ---- ->>> none: any; -1 >^^^^ -2 > ^^^^ -3 > ^^ -4 > ^^^ -5 > ^ -1 > { - > -2 > none -3 > : -4 > any -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 9) Source(2, 9) + SourceIndex(0) -3 >Emitted(2, 11) Source(2, 11) + SourceIndex(0) -4 >Emitted(2, 14) Source(2, 14) + SourceIndex(0) -5 >Emitted(2, 15) Source(2, 15) + SourceIndex(0) ---- ->>>} -1 >^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - >} -1 >Emitted(3, 2) Source(3, 2) + SourceIndex(0) ---- ->>>declare const s = "Hello, world"; -1-> -2 >^^^^^^^^ -3 > ^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^^^^ -6 > ^ -1-> - > - > -2 > -3 > const -4 > s -5 > = "Hello, world" -6 > ; -1->Emitted(4, 1) Source(5, 1) + SourceIndex(0) -2 >Emitted(4, 9) Source(5, 1) + SourceIndex(0) -3 >Emitted(4, 15) Source(5, 7) + SourceIndex(0) -4 >Emitted(4, 16) Source(5, 8) + SourceIndex(0) -5 >Emitted(4, 33) Source(5, 25) + SourceIndex(0) -6 >Emitted(4, 34) Source(5, 26) + SourceIndex(0) ---- ->>>interface NoJsForHereEither { -1 > -2 >^^^^^^^^^^ -3 > ^^^^^^^^^^^^^^^^^ -1 > - > - > -2 >interface -3 > NoJsForHereEither -1 >Emitted(5, 1) Source(7, 1) + SourceIndex(0) -2 >Emitted(5, 11) Source(7, 11) + SourceIndex(0) -3 >Emitted(5, 28) Source(7, 28) + SourceIndex(0) ---- ->>> none: any; -1 >^^^^ -2 > ^^^^ -3 > ^^ -4 > ^^^ -5 > ^ -1 > { - > -2 > none -3 > : -4 > any -5 > ; -1 >Emitted(6, 5) Source(8, 5) + SourceIndex(0) -2 >Emitted(6, 9) Source(8, 9) + SourceIndex(0) -3 >Emitted(6, 11) Source(8, 11) + SourceIndex(0) -4 >Emitted(6, 14) Source(8, 14) + SourceIndex(0) -5 >Emitted(6, 15) Source(8, 15) + SourceIndex(0) ---- ->>>} -1 >^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - >} -1 >Emitted(7, 2) Source(9, 2) + SourceIndex(0) ---- -------------------------------------------------------------------- -emittedFile:/src/first/bin/first-output.d.ts -sourceFile:../first_part3.ts -------------------------------------------------------------------- ->>>declare function f(): string; -1-> -2 >^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^ -5 > ^^^^^^^^^^^^-> -1-> -2 >function -3 > f -4 > () { - > return "JS does hoists"; - > } -1->Emitted(8, 1) Source(1, 1) + SourceIndex(2) -2 >Emitted(8, 18) Source(1, 10) + SourceIndex(2) -3 >Emitted(8, 19) Source(1, 11) + SourceIndex(2) -4 >Emitted(8, 30) Source(3, 2) + SourceIndex(2) ---- ->>>//# sourceMappingURL=first-output.d.ts.map - -//// [/src/first/bin/first-output.js.map.baseline.txt] -=================================================================== -JsFile: first-output.js -mapUrl: first-output.js.map -sourceRoot: -sources: ../first_PART1.ts,../first_part2.ts,../first_part3.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:/src/first/bin/first-output.js -sourceFile:../first_PART1.ts -------------------------------------------------------------------- ->>>var s = "Hello, world"; -1 > -2 >^^^^ -3 > ^ -4 > ^^^ -5 > ^^^^^^^^^^^^^^ -6 > ^ -1 >interface TheFirst { - > none: any; - >} - > - > -2 >const -3 > s -4 > = -5 > "Hello, world" -6 > ; -1 >Emitted(1, 1) Source(5, 1) + SourceIndex(0) -2 >Emitted(1, 5) Source(5, 7) + SourceIndex(0) -3 >Emitted(1, 6) Source(5, 8) + SourceIndex(0) -4 >Emitted(1, 9) Source(5, 11) + SourceIndex(0) -5 >Emitted(1, 23) Source(5, 25) + SourceIndex(0) -6 >Emitted(1, 24) Source(5, 26) + SourceIndex(0) ---- ->>>console.log(s); -1 > -2 >^^^^^^^ -3 > ^ -4 > ^^^ -5 > ^ -6 > ^ -7 > ^ -8 > ^ -9 > ^^^-> -1 > - > - >interface NoJsForHereEither { - > none: any; - >} - > - > -2 >console -3 > . -4 > log -5 > ( -6 > s -7 > ) -8 > ; -1 >Emitted(2, 1) Source(11, 1) + SourceIndex(0) -2 >Emitted(2, 8) Source(11, 8) + SourceIndex(0) -3 >Emitted(2, 9) Source(11, 9) + SourceIndex(0) -4 >Emitted(2, 12) Source(11, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(11, 13) + SourceIndex(0) -6 >Emitted(2, 14) Source(11, 14) + SourceIndex(0) -7 >Emitted(2, 15) Source(11, 15) + SourceIndex(0) -8 >Emitted(2, 16) Source(11, 16) + SourceIndex(0) ---- -------------------------------------------------------------------- -emittedFile:/src/first/bin/first-output.js -sourceFile:../first_part2.ts -------------------------------------------------------------------- ->>>console.log(f()); -1-> -2 >^^^^^^^ -3 > ^ -4 > ^^^ -5 > ^ -6 > ^ -7 > ^^ -8 > ^ -9 > ^ -1-> -2 >console -3 > . -4 > log -5 > ( -6 > f -7 > () -8 > ) -9 > ; -1->Emitted(3, 1) Source(1, 1) + SourceIndex(1) -2 >Emitted(3, 8) Source(1, 8) + SourceIndex(1) -3 >Emitted(3, 9) Source(1, 9) + SourceIndex(1) -4 >Emitted(3, 12) Source(1, 12) + SourceIndex(1) -5 >Emitted(3, 13) Source(1, 13) + SourceIndex(1) -6 >Emitted(3, 14) Source(1, 14) + SourceIndex(1) -7 >Emitted(3, 16) Source(1, 16) + SourceIndex(1) -8 >Emitted(3, 17) Source(1, 17) + SourceIndex(1) -9 >Emitted(3, 18) Source(1, 18) + SourceIndex(1) ---- -------------------------------------------------------------------- -emittedFile:/src/first/bin/first-output.js -sourceFile:../first_part3.ts -------------------------------------------------------------------- ->>>function f() { -1 > -2 >^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^-> -1 > -2 >function -3 > f -1 >Emitted(4, 1) Source(1, 1) + SourceIndex(2) -2 >Emitted(4, 10) Source(1, 10) + SourceIndex(2) -3 >Emitted(4, 11) Source(1, 11) + SourceIndex(2) ---- ->>> return "JS does hoists"; -1->^^^^ -2 > ^^^^^^^ -3 > ^^^^^^^^^^^^^^^^ -4 > ^ -1->() { - > -2 > return -3 > "JS does hoists" -4 > ; -1->Emitted(5, 5) Source(2, 5) + SourceIndex(2) -2 >Emitted(5, 12) Source(2, 12) + SourceIndex(2) -3 >Emitted(5, 28) Source(2, 28) + SourceIndex(2) -4 >Emitted(5, 29) Source(2, 29) + SourceIndex(2) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(6, 1) Source(3, 1) + SourceIndex(2) -2 >Emitted(6, 2) Source(3, 2) + SourceIndex(2) ---- ->>>//# sourceMappingURL=first-output.js.map - -//// [/src/first/bin/first-output.tsbuildinfo] -{ - "bundle": { - "commonSourceDirectory": "..", - "sourceFiles": [ - "../first_PART1.ts", - "../first_part2.ts", - "../first_part3.ts" - ], - "js": { - "sections": [ - { - "pos": 0, - "end": 110, - "kind": "text" - } - ] - }, - "dts": { - "sections": [ - { - "pos": 0, - "end": 157, - "kind": "text" - } - ] - } - }, - "version": "FakeTSVersion" -} - -//// [/src/first/bin/first-output.tsbuildinfo.baseline.txt] -====================================================================== -File:: /src/first/bin/first-output.js ----------------------------------------------------------------------- -text: (0-110) -var s = "Hello, world"; -console.log(s); -console.log(f()); -function f() { - return "JS does hoists"; -} - -====================================================================== -====================================================================== -File:: /src/first/bin/first-output.d.ts ----------------------------------------------------------------------- -text: (0-157) -interface TheFirst { - none: any; -} -declare const s = "Hello, world"; -interface NoJsForHereEither { - none: any; -} -declare function f(): string; - -====================================================================== - -//// [/src/first/first_PART1.ts] -interface TheFirst { - none: any; -} - -const s = "Hello, world"; - -interface NoJsForHereEither { - none: any; -} - -console.log(s); - - -//// [/src/third/thirdjs/output/third-output.d.ts] -interface TheFirst { - none: any; -} -declare const s = "Hello, world"; -interface NoJsForHereEither { - none: any; -} -declare function f(): string; -declare namespace N { -} -declare namespace N { -} -declare class normalC { -} -declare namespace normalN { -} -declare class C { - doSomething(): void; -} -declare var c: C; -//# sourceMappingURL=third-output.d.ts.map - -//// [/src/third/thirdjs/output/third-output.d.ts.map] -{"version":3,"file":"third-output.d.ts","sourceRoot":"","sources":["../../../first/first_PART1.ts","../../../first/first_part3.ts","../../../second/second_part1.ts","../../../second/second_part2.ts","../../third_part1.ts"],"names":[],"mappings":"AAAA,UAAU,QAAQ;IACd,IAAI,EAAE,GAAG,CAAC;CACb;AAED,QAAA,MAAM,CAAC,iBAAiB,CAAC;AAEzB,UAAU,iBAAiB;IACvB,IAAI,EAAE,GAAG,CAAC;CACb;ACRD,iBAAS,CAAC,WAET;ACFD,kBAAU,CAAC,CAAC;CAEX;AAED,kBAAU,CAAC,CAAC;CAMX;AAED,cAAM,OAAO;CAMZ;AACD,kBAAU,OAAO,CAAC;CASjB;AC5BD,cAAM,CAAC;IACH,WAAW;CAGd;ACJD,QAAA,IAAI,CAAC,GAAU,CAAC"} - -//// [/src/third/thirdjs/output/third-output.d.ts.map.baseline.txt] -=================================================================== -JsFile: third-output.d.ts -mapUrl: third-output.d.ts.map -sourceRoot: -sources: ../../../first/first_PART1.ts,../../../first/first_part3.ts,../../../second/second_part1.ts,../../../second/second_part2.ts,../../third_part1.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:/src/third/thirdjs/output/third-output.d.ts -sourceFile:../../../first/first_PART1.ts -------------------------------------------------------------------- ->>>interface TheFirst { -1 > -2 >^^^^^^^^^^ -3 > ^^^^^^^^ -1 > -2 >interface -3 > TheFirst -1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -2 >Emitted(1, 11) Source(1, 11) + SourceIndex(0) -3 >Emitted(1, 19) Source(1, 19) + SourceIndex(0) ---- ->>> none: any; -1 >^^^^ -2 > ^^^^ -3 > ^^ -4 > ^^^ -5 > ^ -1 > { - > -2 > none -3 > : -4 > any -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 9) Source(2, 9) + SourceIndex(0) -3 >Emitted(2, 11) Source(2, 11) + SourceIndex(0) -4 >Emitted(2, 14) Source(2, 14) + SourceIndex(0) -5 >Emitted(2, 15) Source(2, 15) + SourceIndex(0) ---- ->>>} -1 >^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - >} -1 >Emitted(3, 2) Source(3, 2) + SourceIndex(0) ---- ->>>declare const s = "Hello, world"; -1-> -2 >^^^^^^^^ -3 > ^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^^^^ -6 > ^ -1-> - > - > -2 > -3 > const -4 > s -5 > = "Hello, world" -6 > ; -1->Emitted(4, 1) Source(5, 1) + SourceIndex(0) -2 >Emitted(4, 9) Source(5, 1) + SourceIndex(0) -3 >Emitted(4, 15) Source(5, 7) + SourceIndex(0) -4 >Emitted(4, 16) Source(5, 8) + SourceIndex(0) -5 >Emitted(4, 33) Source(5, 25) + SourceIndex(0) -6 >Emitted(4, 34) Source(5, 26) + SourceIndex(0) ---- ->>>interface NoJsForHereEither { -1 > -2 >^^^^^^^^^^ -3 > ^^^^^^^^^^^^^^^^^ -1 > - > - > -2 >interface -3 > NoJsForHereEither -1 >Emitted(5, 1) Source(7, 1) + SourceIndex(0) -2 >Emitted(5, 11) Source(7, 11) + SourceIndex(0) -3 >Emitted(5, 28) Source(7, 28) + SourceIndex(0) ---- ->>> none: any; -1 >^^^^ -2 > ^^^^ -3 > ^^ -4 > ^^^ -5 > ^ -1 > { - > -2 > none -3 > : -4 > any -5 > ; -1 >Emitted(6, 5) Source(8, 5) + SourceIndex(0) -2 >Emitted(6, 9) Source(8, 9) + SourceIndex(0) -3 >Emitted(6, 11) Source(8, 11) + SourceIndex(0) -4 >Emitted(6, 14) Source(8, 14) + SourceIndex(0) -5 >Emitted(6, 15) Source(8, 15) + SourceIndex(0) ---- ->>>} -1 >^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - >} -1 >Emitted(7, 2) Source(9, 2) + SourceIndex(0) ---- -------------------------------------------------------------------- -emittedFile:/src/third/thirdjs/output/third-output.d.ts -sourceFile:../../../first/first_part3.ts -------------------------------------------------------------------- ->>>declare function f(): string; -1-> -2 >^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^ -1-> -2 >function -3 > f -4 > () { - > return "JS does hoists"; - > } -1->Emitted(8, 1) Source(1, 1) + SourceIndex(1) -2 >Emitted(8, 18) Source(1, 10) + SourceIndex(1) -3 >Emitted(8, 19) Source(1, 11) + SourceIndex(1) -4 >Emitted(8, 30) Source(3, 2) + SourceIndex(1) ---- -------------------------------------------------------------------- -emittedFile:/src/third/thirdjs/output/third-output.d.ts -sourceFile:../../../second/second_part1.ts -------------------------------------------------------------------- ->>>declare namespace N { -1 > -2 >^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^ -1 > -2 >namespace -3 > N -4 > -1 >Emitted(9, 1) Source(1, 1) + SourceIndex(2) -2 >Emitted(9, 19) Source(1, 11) + SourceIndex(2) -3 >Emitted(9, 20) Source(1, 12) + SourceIndex(2) -4 >Emitted(9, 21) Source(1, 13) + SourceIndex(2) ---- ->>>} -1 >^ -2 > ^^^^^^^^^^^^^^^^^^^^^-> -1 >{ - > // Comment text - >} -1 >Emitted(10, 2) Source(3, 2) + SourceIndex(2) ---- ->>>declare namespace N { -1-> -2 >^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^ -1-> - > - > -2 >namespace -3 > N -4 > -1->Emitted(11, 1) Source(5, 1) + SourceIndex(2) -2 >Emitted(11, 19) Source(5, 11) + SourceIndex(2) -3 >Emitted(11, 20) Source(5, 12) + SourceIndex(2) -4 >Emitted(11, 21) Source(5, 13) + SourceIndex(2) ---- ->>>} -1 >^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^-> -1 >{ - > function f() { - > console.log('testing'); - > } - > - > f(); - >} -1 >Emitted(12, 2) Source(11, 2) + SourceIndex(2) ---- ->>>declare class normalC { -1-> -2 >^^^^^^^^^^^^^^ -3 > ^^^^^^^ -1-> - > - > -2 >class -3 > normalC -1->Emitted(13, 1) Source(13, 1) + SourceIndex(2) -2 >Emitted(13, 15) Source(13, 7) + SourceIndex(2) -3 >Emitted(13, 22) Source(13, 14) + SourceIndex(2) ---- ->>>} -1 >^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > { - > /*@internal*/ constructor() { } - > /*@internal*/ prop: string; - > /*@internal*/ method() { } - > /*@internal*/ get c() { return 10; } - > /*@internal*/ set c(val: number) { } - >} -1 >Emitted(14, 2) Source(19, 2) + SourceIndex(2) ---- ->>>declare namespace normalN { -1-> -2 >^^^^^^^^^^^^^^^^^^ -3 > ^^^^^^^ -4 > ^ -1-> - > -2 >namespace -3 > normalN -4 > -1->Emitted(15, 1) Source(20, 1) + SourceIndex(2) -2 >Emitted(15, 19) Source(20, 11) + SourceIndex(2) -3 >Emitted(15, 26) Source(20, 18) + SourceIndex(2) -4 >Emitted(15, 27) Source(20, 19) + SourceIndex(2) ---- ->>>} -1 >^ -2 > ^^^^^^^^^^^^^^^^^-> -1 >{ - > /*@internal*/ export class C { } - > /*@internal*/ export function foo() {} - > /*@internal*/ export namespace someNamespace { export class C {} } - > /*@internal*/ export namespace someOther.something { export class someClass {} } - > /*@internal*/ export import someImport = someNamespace.C; - > /*@internal*/ export type internalType = internalC; - > /*@internal*/ export const internalConst = 10; - > /*@internal*/ export enum internalEnum { a, b, c } - >} -1 >Emitted(16, 2) Source(29, 2) + SourceIndex(2) ---- -------------------------------------------------------------------- -emittedFile:/src/third/thirdjs/output/third-output.d.ts -sourceFile:../../../second/second_part2.ts -------------------------------------------------------------------- ->>>declare class C { -1-> -2 >^^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^-> -1-> -2 >class -3 > C -1->Emitted(17, 1) Source(1, 1) + SourceIndex(3) -2 >Emitted(17, 15) Source(1, 7) + SourceIndex(3) -3 >Emitted(17, 16) Source(1, 8) + SourceIndex(3) ---- ->>> doSomething(): void; -1->^^^^ -2 > ^^^^^^^^^^^ -1-> { - > -2 > doSomething -1->Emitted(18, 5) Source(2, 5) + SourceIndex(3) -2 >Emitted(18, 16) Source(2, 16) + SourceIndex(3) ---- ->>>} -1 >^ -2 > ^^^^^^^^^^^^^^^^^-> -1 >() { - > console.log("something got done"); - > } - >} -1 >Emitted(19, 2) Source(5, 2) + SourceIndex(3) ---- -------------------------------------------------------------------- -emittedFile:/src/third/thirdjs/output/third-output.d.ts -sourceFile:../../third_part1.ts -------------------------------------------------------------------- ->>>declare var c: C; -1-> -2 >^^^^^^^^ -3 > ^^^^ -4 > ^ -5 > ^^^ -6 > ^ -7 > ^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 > -3 > var -4 > c -5 > = new C() -6 > ; -1->Emitted(20, 1) Source(1, 1) + SourceIndex(4) -2 >Emitted(20, 9) Source(1, 1) + SourceIndex(4) -3 >Emitted(20, 13) Source(1, 5) + SourceIndex(4) -4 >Emitted(20, 14) Source(1, 6) + SourceIndex(4) -5 >Emitted(20, 17) Source(1, 16) + SourceIndex(4) -6 >Emitted(20, 18) Source(1, 17) + SourceIndex(4) ---- ->>>//# sourceMappingURL=third-output.d.ts.map +//// [/src/2/second-output.tsbuildinfo] +{ + "bundle": { + "commonSourceDirectory": "../second", + "sourceFiles": [ + "../second/second_part1.ts", + "../second/second_part2.ts" + ], + "js": { + "sections": [ + { + "pos": 0, + "end": 110, + "kind": "prepend", + "data": "../first/bin/first-output.js", + "texts": [ + { + "pos": 0, + "end": 110, + "kind": "text" + } + ] + }, + { + "pos": 110, + "end": 3526, + "kind": "text" + } + ] + }, + "dts": { + "sections": [ + { + "pos": 0, + "end": 157, + "kind": "prepend", + "data": "../first/bin/first-output.d.ts", + "texts": [ + { + "pos": 0, + "end": 157, + "kind": "text" + } + ] + }, + { + "pos": 157, + "end": 234, + "kind": "text" + }, + { + "pos": 234, + "end": 322, + "kind": "internal" + }, + { + "pos": 324, + "end": 356, + "kind": "text" + }, + { + "pos": 356, + "end": 748, + "kind": "internal" + }, + { + "pos": 750, + "end": 753, + "kind": "text" + }, + { + "pos": 753, + "end": 1166, + "kind": "internal" + }, + { + "pos": 1168, + "end": 1216, + "kind": "text" + } + ] + } + }, + "version": "FakeTSVersion" +} -//// [/src/third/thirdjs/output/third-output.js.map.baseline.txt] -=================================================================== -JsFile: third-output.js -mapUrl: third-output.js.map -sourceRoot: -sources: ../../../first/first_PART1.ts,../../../first/first_part2.ts,../../../first/first_part3.ts,../../../second/second_part1.ts,../../../second/second_part2.ts,../../third_part1.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:/src/third/thirdjs/output/third-output.js -sourceFile:../../../first/first_PART1.ts -------------------------------------------------------------------- ->>>var s = "Hello, world"; -1 > -2 >^^^^ -3 > ^ -4 > ^^^ -5 > ^^^^^^^^^^^^^^ -6 > ^ -1 >interface TheFirst { - > none: any; - >} - > - > -2 >const -3 > s -4 > = -5 > "Hello, world" -6 > ; -1 >Emitted(1, 1) Source(5, 1) + SourceIndex(0) -2 >Emitted(1, 5) Source(5, 7) + SourceIndex(0) -3 >Emitted(1, 6) Source(5, 8) + SourceIndex(0) -4 >Emitted(1, 9) Source(5, 11) + SourceIndex(0) -5 >Emitted(1, 23) Source(5, 25) + SourceIndex(0) -6 >Emitted(1, 24) Source(5, 26) + SourceIndex(0) ---- ->>>console.log(s); -1 > -2 >^^^^^^^ -3 > ^ -4 > ^^^ -5 > ^ -6 > ^ -7 > ^ -8 > ^ -9 > ^^^-> -1 > - > - >interface NoJsForHereEither { - > none: any; - >} - > - > -2 >console -3 > . -4 > log -5 > ( -6 > s -7 > ) -8 > ; -1 >Emitted(2, 1) Source(11, 1) + SourceIndex(0) -2 >Emitted(2, 8) Source(11, 8) + SourceIndex(0) -3 >Emitted(2, 9) Source(11, 9) + SourceIndex(0) -4 >Emitted(2, 12) Source(11, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(11, 13) + SourceIndex(0) -6 >Emitted(2, 14) Source(11, 14) + SourceIndex(0) -7 >Emitted(2, 15) Source(11, 15) + SourceIndex(0) -8 >Emitted(2, 16) Source(11, 16) + SourceIndex(0) ---- -------------------------------------------------------------------- -emittedFile:/src/third/thirdjs/output/third-output.js -sourceFile:../../../first/first_part2.ts -------------------------------------------------------------------- ->>>console.log(f()); -1-> -2 >^^^^^^^ -3 > ^ -4 > ^^^ -5 > ^ -6 > ^ -7 > ^^ -8 > ^ -9 > ^ -1-> -2 >console -3 > . -4 > log -5 > ( -6 > f -7 > () -8 > ) -9 > ; -1->Emitted(3, 1) Source(1, 1) + SourceIndex(1) -2 >Emitted(3, 8) Source(1, 8) + SourceIndex(1) -3 >Emitted(3, 9) Source(1, 9) + SourceIndex(1) -4 >Emitted(3, 12) Source(1, 12) + SourceIndex(1) -5 >Emitted(3, 13) Source(1, 13) + SourceIndex(1) -6 >Emitted(3, 14) Source(1, 14) + SourceIndex(1) -7 >Emitted(3, 16) Source(1, 16) + SourceIndex(1) -8 >Emitted(3, 17) Source(1, 17) + SourceIndex(1) -9 >Emitted(3, 18) Source(1, 18) + SourceIndex(1) ---- -------------------------------------------------------------------- -emittedFile:/src/third/thirdjs/output/third-output.js -sourceFile:../../../first/first_part3.ts -------------------------------------------------------------------- ->>>function f() { -1 > -2 >^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^-> -1 > -2 >function -3 > f -1 >Emitted(4, 1) Source(1, 1) + SourceIndex(2) -2 >Emitted(4, 10) Source(1, 10) + SourceIndex(2) -3 >Emitted(4, 11) Source(1, 11) + SourceIndex(2) ---- ->>> return "JS does hoists"; -1->^^^^ -2 > ^^^^^^^ -3 > ^^^^^^^^^^^^^^^^ -4 > ^ -1->() { - > -2 > return -3 > "JS does hoists" -4 > ; -1->Emitted(5, 5) Source(2, 5) + SourceIndex(2) -2 >Emitted(5, 12) Source(2, 12) + SourceIndex(2) -3 >Emitted(5, 28) Source(2, 28) + SourceIndex(2) -4 >Emitted(5, 29) Source(2, 29) + SourceIndex(2) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^-> -1 > - > -2 >} -1 >Emitted(6, 1) Source(3, 1) + SourceIndex(2) -2 >Emitted(6, 2) Source(3, 2) + SourceIndex(2) ---- +//// [/src/2/second-output.tsbuildinfo.baseline.txt] +====================================================================== +File:: /src/2/second-output.js +---------------------------------------------------------------------- +prepend: (0-110):: ../first/bin/first-output.js texts:: 1 +>>-------------------------------------------------------------------- +text: (0-110) +var s = "Hello, world"; +console.log(s); +console.log(f()); +function f() { + return "JS does hoists"; +} + +---------------------------------------------------------------------- +text: (110-3526) +var N; +(function (N) { + function f() { + console.log('testing'); + } + f(); +})(N || (N = {})); +var normalC = /** @class */ (function () { + /*@internal*/ function normalC() { + } + /*@internal*/ normalC.prototype.method = function () { }; + Object.defineProperty(normalC.prototype, "c", { + /*@internal*/ get: function () { return 10; }, + /*@internal*/ set: function (val) { }, + enumerable: true, + configurable: true + }); + return normalC; +}()); +var normalN; +(function (normalN) { + /*@internal*/ var C = /** @class */ (function () { + function C() { + } + return C; + }()); + normalN.C = C; + /*@internal*/ function foo() { } + normalN.foo = foo; + /*@internal*/ var someNamespace; + (function (someNamespace) { + var C = /** @class */ (function () { + function C() { + } + return C; + }()); + someNamespace.C = C; + })(someNamespace = normalN.someNamespace || (normalN.someNamespace = {})); + /*@internal*/ var someOther; + (function (someOther) { + var something; + (function (something) { + var someClass = /** @class */ (function () { + function someClass() { + } + return someClass; + }()); + something.someClass = someClass; + })(something = someOther.something || (someOther.something = {})); + })(someOther = normalN.someOther || (normalN.someOther = {})); + /*@internal*/ normalN.someImport = someNamespace.C; + /*@internal*/ normalN.internalConst = 10; + /*@internal*/ var internalEnum; + (function (internalEnum) { + internalEnum[internalEnum["a"] = 0] = "a"; + internalEnum[internalEnum["b"] = 1] = "b"; + internalEnum[internalEnum["c"] = 2] = "c"; + })(internalEnum = normalN.internalEnum || (normalN.internalEnum = {})); +})(normalN || (normalN = {})); +/*@internal*/ var internalC = /** @class */ (function () { + function internalC() { + } + return internalC; +}()); +/*@internal*/ function internalfoo() { } +/*@internal*/ var internalNamespace; +(function (internalNamespace) { + var someClass = /** @class */ (function () { + function someClass() { + } + return someClass; + }()); + internalNamespace.someClass = someClass; +})(internalNamespace || (internalNamespace = {})); +/*@internal*/ var internalOther; +(function (internalOther) { + var something; + (function (something) { + var someClass = /** @class */ (function () { + function someClass() { + } + return someClass; + }()); + something.someClass = someClass; + })(something = internalOther.something || (internalOther.something = {})); +})(internalOther || (internalOther = {})); +/*@internal*/ var internalImport = internalNamespace.someClass; +/*@internal*/ var internalConst = 10; +/*@internal*/ var internalEnum; +(function (internalEnum) { + internalEnum[internalEnum["a"] = 0] = "a"; + internalEnum[internalEnum["b"] = 1] = "b"; + internalEnum[internalEnum["c"] = 2] = "c"; +})(internalEnum || (internalEnum = {})); +var C = /** @class */ (function () { + function C() { + } + C.prototype.doSomething = function () { + console.log("something got done"); + }; + return C; +}()); + +====================================================================== +====================================================================== +File:: /src/2/second-output.d.ts +---------------------------------------------------------------------- +prepend: (0-157):: ../first/bin/first-output.d.ts texts:: 1 +>>-------------------------------------------------------------------- +text: (0-157) +interface TheFirst { + none: any; +} +declare const s = "Hello, world"; +interface NoJsForHereEither { + none: any; +} +declare function f(): string; + +---------------------------------------------------------------------- +text: (157-234) +declare namespace N { +} +declare namespace N { +} +declare class normalC { + +---------------------------------------------------------------------- +internal: (234-322) + constructor(); + prop: string; + method(): void; + /*@internal*/ c: number; +---------------------------------------------------------------------- +text: (324-356) +} +declare namespace normalN { + +---------------------------------------------------------------------- +internal: (356-748) + class C { + } + function foo(): void; + namespace someNamespace { + class C { + } + } + namespace someOther.something { + class someClass { + } + } + export import someImport = someNamespace.C; + type internalType = internalC; + const internalConst = 10; + enum internalEnum { + a = 0, + b = 1, + c = 2 + } +---------------------------------------------------------------------- +text: (750-753) +} + +---------------------------------------------------------------------- +internal: (753-1166) +declare class internalC { +} +declare function internalfoo(): void; +declare namespace internalNamespace { + class someClass { + } +} +declare namespace internalOther.something { + class someClass { + } +} +import internalImport = internalNamespace.someClass; +declare type internalType = internalC; +declare const internalConst = 10; +declare enum internalEnum { + a = 0, + b = 1, + c = 2 +} +---------------------------------------------------------------------- +text: (1168-1216) +declare class C { + doSomething(): void; +} + +====================================================================== + +//// [/src/first/bin/first-output.d.ts] file written with same contents +//// [/src/first/bin/first-output.d.ts.map] +{"version":3,"file":"first-output.d.ts","sourceRoot":"","sources":["../first_PART1.ts","../first_part2.ts","../first_part3.ts"],"names":[],"mappings":"AAAA,UAAU,QAAQ;IACd,IAAI,EAAE,GAAG,CAAC;CACb;AAED,QAAA,MAAM,CAAC,iBAAiB,CAAC;AAEzB,UAAU,iBAAiB;IACvB,IAAI,EAAE,GAAG,CAAC;CACb;AERD,iBAAS,CAAC,WAET"} + +//// [/src/first/bin/first-output.d.ts.map.baseline.txt] +=================================================================== +JsFile: first-output.d.ts +mapUrl: first-output.d.ts.map +sourceRoot: +sources: ../first_PART1.ts,../first_part2.ts,../first_part3.ts +=================================================================== ------------------------------------------------------------------- -emittedFile:/src/third/thirdjs/output/third-output.js -sourceFile:../../../second/second_part1.ts +emittedFile:/src/first/bin/first-output.d.ts +sourceFile:../first_PART1.ts ------------------------------------------------------------------- ->>>var N; -1-> -2 >^^^^ -3 > ^ -4 > ^ -5 > ^^^^^^^^^^-> -1->namespace N { - > // Comment text - >} - > - > -2 >namespace -3 > N -4 > { - > function f() { - > console.log('testing'); - > } - > - > f(); - > } -1->Emitted(7, 1) Source(5, 1) + SourceIndex(3) -2 >Emitted(7, 5) Source(5, 11) + SourceIndex(3) -3 >Emitted(7, 6) Source(5, 12) + SourceIndex(3) -4 >Emitted(7, 7) Source(11, 2) + SourceIndex(3) ---- ->>>(function (N) { -1-> -2 >^^^^^^^^^^^ -3 > ^ -4 > ^^^^^^^-> -1-> -2 >namespace -3 > N -1->Emitted(8, 1) Source(5, 1) + SourceIndex(3) -2 >Emitted(8, 12) Source(5, 11) + SourceIndex(3) -3 >Emitted(8, 13) Source(5, 12) + SourceIndex(3) ---- ->>> function f() { -1->^^^^ -2 > ^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^-> -1-> { - > -2 > function -3 > f -1->Emitted(9, 5) Source(6, 5) + SourceIndex(3) -2 >Emitted(9, 14) Source(6, 14) + SourceIndex(3) -3 >Emitted(9, 15) Source(6, 15) + SourceIndex(3) ---- ->>> console.log('testing'); -1->^^^^^^^^ -2 > ^^^^^^^ -3 > ^ -4 > ^^^ -5 > ^ -6 > ^^^^^^^^^ -7 > ^ -8 > ^ -1->() { - > -2 > console -3 > . -4 > log -5 > ( -6 > 'testing' -7 > ) -8 > ; -1->Emitted(10, 9) Source(7, 9) + SourceIndex(3) -2 >Emitted(10, 16) Source(7, 16) + SourceIndex(3) -3 >Emitted(10, 17) Source(7, 17) + SourceIndex(3) -4 >Emitted(10, 20) Source(7, 20) + SourceIndex(3) -5 >Emitted(10, 21) Source(7, 21) + SourceIndex(3) -6 >Emitted(10, 30) Source(7, 30) + SourceIndex(3) -7 >Emitted(10, 31) Source(7, 31) + SourceIndex(3) -8 >Emitted(10, 32) Source(7, 32) + SourceIndex(3) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^-> -1 > - > -2 > } -1 >Emitted(11, 5) Source(8, 5) + SourceIndex(3) -2 >Emitted(11, 6) Source(8, 6) + SourceIndex(3) ---- ->>> f(); -1->^^^^ -2 > ^ -3 > ^^ -4 > ^ -5 > ^^^^^^^^^^^-> -1-> - > - > -2 > f -3 > () -4 > ; -1->Emitted(12, 5) Source(10, 5) + SourceIndex(3) -2 >Emitted(12, 6) Source(10, 6) + SourceIndex(3) -3 >Emitted(12, 8) Source(10, 8) + SourceIndex(3) -4 >Emitted(12, 9) Source(10, 9) + SourceIndex(3) ---- ->>>})(N || (N = {})); -1-> -2 >^ -3 > ^^ -4 > ^ -5 > ^^^^^ -6 > ^ -7 > ^^^^^^^^ -8 > ^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -2 >} -3 > -4 > N -5 > -6 > N -7 > { - > function f() { - > console.log('testing'); - > } - > - > f(); - > } -1->Emitted(13, 1) Source(11, 1) + SourceIndex(3) -2 >Emitted(13, 2) Source(11, 2) + SourceIndex(3) -3 >Emitted(13, 4) Source(5, 11) + SourceIndex(3) -4 >Emitted(13, 5) Source(5, 12) + SourceIndex(3) -5 >Emitted(13, 10) Source(5, 11) + SourceIndex(3) -6 >Emitted(13, 11) Source(5, 12) + SourceIndex(3) -7 >Emitted(13, 19) Source(11, 2) + SourceIndex(3) ---- ->>>var normalC = /** @class */ (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > - > -1->Emitted(14, 1) Source(13, 1) + SourceIndex(3) ---- ->>> /*@internal*/ function normalC() { -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^ -1->class normalC { - > -2 > /*@internal*/ -3 > -1->Emitted(15, 5) Source(14, 5) + SourceIndex(3) -2 >Emitted(15, 18) Source(14, 18) + SourceIndex(3) -3 >Emitted(15, 19) Source(14, 19) + SourceIndex(3) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 >constructor() { -2 > } -1 >Emitted(16, 5) Source(14, 35) + SourceIndex(3) -2 >Emitted(16, 6) Source(14, 36) + SourceIndex(3) ---- ->>> /*@internal*/ normalC.prototype.method = function () { }; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^ -5 > ^^^ -6 > ^^^^^^^^^^^^^^ -7 > ^ -1-> - > /*@internal*/ prop: string; - > -2 > /*@internal*/ -3 > -4 > method -5 > -6 > method() { -7 > } -1->Emitted(17, 5) Source(16, 5) + SourceIndex(3) -2 >Emitted(17, 18) Source(16, 18) + SourceIndex(3) -3 >Emitted(17, 19) Source(16, 19) + SourceIndex(3) -4 >Emitted(17, 43) Source(16, 25) + SourceIndex(3) -5 >Emitted(17, 46) Source(16, 19) + SourceIndex(3) -6 >Emitted(17, 60) Source(16, 30) + SourceIndex(3) -7 >Emitted(17, 61) Source(16, 31) + SourceIndex(3) ---- ->>> Object.defineProperty(normalC.prototype, "c", { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^-> -1 > - > /*@internal*/ -2 > get -3 > c -1 >Emitted(18, 5) Source(17, 19) + SourceIndex(3) -2 >Emitted(18, 27) Source(17, 23) + SourceIndex(3) -3 >Emitted(18, 49) Source(17, 24) + SourceIndex(3) ---- ->>> /*@internal*/ get: function () { return 10; }, -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^ -4 > ^^^^^^^^^^^^^^ -5 > ^^^^^^^ -6 > ^^ -7 > ^ -8 > ^ -9 > ^ -1-> -2 > /*@internal*/ -3 > -4 > get c() { -5 > return -6 > 10 -7 > ; -8 > -9 > } -1->Emitted(19, 9) Source(17, 5) + SourceIndex(3) -2 >Emitted(19, 22) Source(17, 18) + SourceIndex(3) -3 >Emitted(19, 28) Source(17, 19) + SourceIndex(3) -4 >Emitted(19, 42) Source(17, 29) + SourceIndex(3) -5 >Emitted(19, 49) Source(17, 36) + SourceIndex(3) -6 >Emitted(19, 51) Source(17, 38) + SourceIndex(3) -7 >Emitted(19, 52) Source(17, 39) + SourceIndex(3) -8 >Emitted(19, 53) Source(17, 40) + SourceIndex(3) -9 >Emitted(19, 54) Source(17, 41) + SourceIndex(3) ---- ->>> /*@internal*/ set: function (val) { }, -1 >^^^^^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^ -4 > ^^^^^^^^^^ -5 > ^^^ -6 > ^^^^ -7 > ^ -1 > - > -2 > /*@internal*/ -3 > -4 > set c( -5 > val: number -6 > ) { -7 > } -1 >Emitted(20, 9) Source(18, 5) + SourceIndex(3) -2 >Emitted(20, 22) Source(18, 18) + SourceIndex(3) -3 >Emitted(20, 28) Source(18, 19) + SourceIndex(3) -4 >Emitted(20, 38) Source(18, 25) + SourceIndex(3) -5 >Emitted(20, 41) Source(18, 36) + SourceIndex(3) -6 >Emitted(20, 45) Source(18, 40) + SourceIndex(3) -7 >Emitted(20, 46) Source(18, 41) + SourceIndex(3) ---- ->>> enumerable: true, ->>> configurable: true ->>> }); -1 >^^^^^^^ -2 > ^^^^^^^^^^^^^-> -1 > -1 >Emitted(23, 8) Source(17, 41) + SourceIndex(3) ---- ->>> return normalC; -1->^^^^ -2 > ^^^^^^^^^^^^^^ -1-> - > /*@internal*/ set c(val: number) { } - > -2 > } -1->Emitted(24, 5) Source(19, 1) + SourceIndex(3) -2 >Emitted(24, 19) Source(19, 2) + SourceIndex(3) ---- ->>>}()); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^-> +>>>interface TheFirst { 1 > -2 >} -3 > -4 > class normalC { - > /*@internal*/ constructor() { } - > /*@internal*/ prop: string; - > /*@internal*/ method() { } - > /*@internal*/ get c() { return 10; } - > /*@internal*/ set c(val: number) { } - > } -1 >Emitted(25, 1) Source(19, 1) + SourceIndex(3) -2 >Emitted(25, 2) Source(19, 2) + SourceIndex(3) -3 >Emitted(25, 2) Source(13, 1) + SourceIndex(3) -4 >Emitted(25, 6) Source(19, 2) + SourceIndex(3) ---- ->>>var normalN; -1-> -2 >^^^^ -3 > ^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^-> -1-> - > -2 >namespace -3 > normalN -4 > { - > /*@internal*/ export class C { } - > /*@internal*/ export function foo() {} - > /*@internal*/ export namespace someNamespace { export class C {} } - > /*@internal*/ export namespace someOther.something { export class someClass {} } - > /*@internal*/ export import someImport = someNamespace.C; - > /*@internal*/ export type internalType = internalC; - > /*@internal*/ export const internalConst = 10; - > /*@internal*/ export enum internalEnum { a, b, c } - > } -1->Emitted(26, 1) Source(20, 1) + SourceIndex(3) -2 >Emitted(26, 5) Source(20, 11) + SourceIndex(3) -3 >Emitted(26, 12) Source(20, 18) + SourceIndex(3) -4 >Emitted(26, 13) Source(29, 2) + SourceIndex(3) ---- ->>>(function (normalN) { -1-> -2 >^^^^^^^^^^^ -3 > ^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 >namespace -3 > normalN -1->Emitted(27, 1) Source(20, 1) + SourceIndex(3) -2 >Emitted(27, 12) Source(20, 11) + SourceIndex(3) -3 >Emitted(27, 19) Source(20, 18) + SourceIndex(3) ---- ->>> /*@internal*/ var C = /** @class */ (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^^-> -1-> { - > -2 > /*@internal*/ -3 > -1->Emitted(28, 5) Source(21, 5) + SourceIndex(3) -2 >Emitted(28, 18) Source(21, 18) + SourceIndex(3) -3 >Emitted(28, 19) Source(21, 19) + SourceIndex(3) ---- ->>> function C() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(29, 9) Source(21, 19) + SourceIndex(3) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^-> -1->export class C { -2 > } -1->Emitted(30, 9) Source(21, 36) + SourceIndex(3) -2 >Emitted(30, 10) Source(21, 37) + SourceIndex(3) ---- ->>> return C; -1->^^^^^^^^ -2 > ^^^^^^^^ -1-> -2 > } -1->Emitted(31, 9) Source(21, 36) + SourceIndex(3) -2 >Emitted(31, 17) Source(21, 37) + SourceIndex(3) ---- ->>> }()); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^-> +2 >^^^^^^^^^^ +3 > ^^^^^^^^ 1 > -2 > } -3 > -4 > export class C { } -1 >Emitted(32, 5) Source(21, 36) + SourceIndex(3) -2 >Emitted(32, 6) Source(21, 37) + SourceIndex(3) -3 >Emitted(32, 6) Source(21, 19) + SourceIndex(3) -4 >Emitted(32, 10) Source(21, 37) + SourceIndex(3) ---- ->>> normalN.C = C; -1->^^^^ -2 > ^^^^^^^^^ -3 > ^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^-> -1-> -2 > C -3 > { } -4 > -1->Emitted(33, 5) Source(21, 32) + SourceIndex(3) -2 >Emitted(33, 14) Source(21, 33) + SourceIndex(3) -3 >Emitted(33, 18) Source(21, 37) + SourceIndex(3) -4 >Emitted(33, 19) Source(21, 37) + SourceIndex(3) ---- ->>> /*@internal*/ function foo() { } -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^ -5 > ^^^ -6 > ^^^^^ -7 > ^ -1-> - > -2 > /*@internal*/ -3 > -4 > export function -5 > foo -6 > () { -7 > } -1->Emitted(34, 5) Source(22, 5) + SourceIndex(3) -2 >Emitted(34, 18) Source(22, 18) + SourceIndex(3) -3 >Emitted(34, 19) Source(22, 19) + SourceIndex(3) -4 >Emitted(34, 28) Source(22, 35) + SourceIndex(3) -5 >Emitted(34, 31) Source(22, 38) + SourceIndex(3) -6 >Emitted(34, 36) Source(22, 42) + SourceIndex(3) -7 >Emitted(34, 37) Source(22, 43) + SourceIndex(3) +2 >interface +3 > TheFirst +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 11) Source(1, 11) + SourceIndex(0) +3 >Emitted(1, 19) Source(1, 19) + SourceIndex(0) --- ->>> normalN.foo = foo; +>>> none: any; 1 >^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^^-> -1 > -2 > foo -3 > () {} -4 > -1 >Emitted(35, 5) Source(22, 35) + SourceIndex(3) -2 >Emitted(35, 16) Source(22, 38) + SourceIndex(3) -3 >Emitted(35, 22) Source(22, 43) + SourceIndex(3) -4 >Emitted(35, 23) Source(22, 43) + SourceIndex(3) ---- ->>> /*@internal*/ var someNamespace; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^ -5 > ^^^^^^^^^^^^^ -6 > ^ -1-> +2 > ^^^^ +3 > ^^ +4 > ^^^ +5 > ^ +1 > { > -2 > /*@internal*/ -3 > -4 > export namespace -5 > someNamespace -6 > { export class C {} } -1->Emitted(36, 5) Source(23, 5) + SourceIndex(3) -2 >Emitted(36, 18) Source(23, 18) + SourceIndex(3) -3 >Emitted(36, 19) Source(23, 19) + SourceIndex(3) -4 >Emitted(36, 23) Source(23, 36) + SourceIndex(3) -5 >Emitted(36, 36) Source(23, 49) + SourceIndex(3) -6 >Emitted(36, 37) Source(23, 71) + SourceIndex(3) +2 > none +3 > : +4 > any +5 > ; +1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +2 >Emitted(2, 9) Source(2, 9) + SourceIndex(0) +3 >Emitted(2, 11) Source(2, 11) + SourceIndex(0) +4 >Emitted(2, 14) Source(2, 14) + SourceIndex(0) +5 >Emitted(2, 15) Source(2, 15) + SourceIndex(0) --- ->>> (function (someNamespace) { -1 >^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^-> +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > -2 > export namespace -3 > someNamespace -1 >Emitted(37, 5) Source(23, 19) + SourceIndex(3) -2 >Emitted(37, 16) Source(23, 36) + SourceIndex(3) -3 >Emitted(37, 29) Source(23, 49) + SourceIndex(3) ---- ->>> var C = /** @class */ (function () { -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^-> -1-> { -1->Emitted(38, 9) Source(23, 52) + SourceIndex(3) + >} +1 >Emitted(3, 2) Source(3, 2) + SourceIndex(0) --- ->>> function C() { -1->^^^^^^^^^^^^ -2 > ^^-> +>>>declare const s = "Hello, world"; 1-> -1->Emitted(39, 13) Source(23, 52) + SourceIndex(3) ---- ->>> } -1->^^^^^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^-> -1->export class C { -2 > } -1->Emitted(40, 13) Source(23, 68) + SourceIndex(3) -2 >Emitted(40, 14) Source(23, 69) + SourceIndex(3) ---- ->>> return C; -1->^^^^^^^^^^^^ -2 > ^^^^^^^^ +2 >^^^^^^^^ +3 > ^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^ +6 > ^ 1-> -2 > } -1->Emitted(41, 13) Source(23, 68) + SourceIndex(3) -2 >Emitted(41, 21) Source(23, 69) + SourceIndex(3) + > + > +2 > +3 > const +4 > s +5 > = "Hello, world" +6 > ; +1->Emitted(4, 1) Source(5, 1) + SourceIndex(0) +2 >Emitted(4, 9) Source(5, 1) + SourceIndex(0) +3 >Emitted(4, 15) Source(5, 7) + SourceIndex(0) +4 >Emitted(4, 16) Source(5, 8) + SourceIndex(0) +5 >Emitted(4, 33) Source(5, 25) + SourceIndex(0) +6 >Emitted(4, 34) Source(5, 26) + SourceIndex(0) --- ->>> }()); -1 >^^^^^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^-> +>>>interface NoJsForHereEither { 1 > -2 > } -3 > -4 > export class C {} -1 >Emitted(42, 9) Source(23, 68) + SourceIndex(3) -2 >Emitted(42, 10) Source(23, 69) + SourceIndex(3) -3 >Emitted(42, 10) Source(23, 52) + SourceIndex(3) -4 >Emitted(42, 14) Source(23, 69) + SourceIndex(3) ---- ->>> someNamespace.C = C; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^ -3 > ^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 > C -3 > {} -4 > -1->Emitted(43, 9) Source(23, 65) + SourceIndex(3) -2 >Emitted(43, 24) Source(23, 66) + SourceIndex(3) -3 >Emitted(43, 28) Source(23, 69) + SourceIndex(3) -4 >Emitted(43, 29) Source(23, 69) + SourceIndex(3) ---- ->>> })(someNamespace = normalN.someNamespace || (normalN.someNamespace = {})); -1->^^^^ -2 > ^ -3 > ^^ -4 > ^^^^^^^^^^^^^ -5 > ^^^ -6 > ^^^^^^^^^^^^^^^^^^^^^ -7 > ^^^^^ -8 > ^^^^^^^^^^^^^^^^^^^^^ -9 > ^^^^^^^^ -1-> -2 > } -3 > -4 > someNamespace -5 > -6 > someNamespace -7 > -8 > someNamespace -9 > { export class C {} } -1->Emitted(44, 5) Source(23, 70) + SourceIndex(3) -2 >Emitted(44, 6) Source(23, 71) + SourceIndex(3) -3 >Emitted(44, 8) Source(23, 36) + SourceIndex(3) -4 >Emitted(44, 21) Source(23, 49) + SourceIndex(3) -5 >Emitted(44, 24) Source(23, 36) + SourceIndex(3) -6 >Emitted(44, 45) Source(23, 49) + SourceIndex(3) -7 >Emitted(44, 50) Source(23, 36) + SourceIndex(3) -8 >Emitted(44, 71) Source(23, 49) + SourceIndex(3) -9 >Emitted(44, 79) Source(23, 71) + SourceIndex(3) +2 >^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^ +1 > + > + > +2 >interface +3 > NoJsForHereEither +1 >Emitted(5, 1) Source(7, 1) + SourceIndex(0) +2 >Emitted(5, 11) Source(7, 11) + SourceIndex(0) +3 >Emitted(5, 28) Source(7, 28) + SourceIndex(0) --- ->>> /*@internal*/ var someOther; +>>> none: any; 1 >^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^ -5 > ^^^^^^^^^ -6 > ^ -1 > +2 > ^^^^ +3 > ^^ +4 > ^^^ +5 > ^ +1 > { > -2 > /*@internal*/ -3 > -4 > export namespace -5 > someOther -6 > .something { export class someClass {} } -1 >Emitted(45, 5) Source(24, 5) + SourceIndex(3) -2 >Emitted(45, 18) Source(24, 18) + SourceIndex(3) -3 >Emitted(45, 19) Source(24, 19) + SourceIndex(3) -4 >Emitted(45, 23) Source(24, 36) + SourceIndex(3) -5 >Emitted(45, 32) Source(24, 45) + SourceIndex(3) -6 >Emitted(45, 33) Source(24, 85) + SourceIndex(3) +2 > none +3 > : +4 > any +5 > ; +1 >Emitted(6, 5) Source(8, 5) + SourceIndex(0) +2 >Emitted(6, 9) Source(8, 9) + SourceIndex(0) +3 >Emitted(6, 11) Source(8, 11) + SourceIndex(0) +4 >Emitted(6, 14) Source(8, 14) + SourceIndex(0) +5 >Emitted(6, 15) Source(8, 15) + SourceIndex(0) --- ->>> (function (someOther) { -1 >^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^^^^ +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > -2 > export namespace -3 > someOther -1 >Emitted(46, 5) Source(24, 19) + SourceIndex(3) -2 >Emitted(46, 16) Source(24, 36) + SourceIndex(3) -3 >Emitted(46, 25) Source(24, 45) + SourceIndex(3) ---- ->>> var something; -1 >^^^^^^^^ -2 > ^^^^ -3 > ^^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^-> -1 >. -2 > -3 > something -4 > { export class someClass {} } -1 >Emitted(47, 9) Source(24, 46) + SourceIndex(3) -2 >Emitted(47, 13) Source(24, 46) + SourceIndex(3) -3 >Emitted(47, 22) Source(24, 55) + SourceIndex(3) -4 >Emitted(47, 23) Source(24, 85) + SourceIndex(3) + >} +1 >Emitted(7, 2) Source(9, 2) + SourceIndex(0) --- ->>> (function (something) { -1->^^^^^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +------------------------------------------------------------------- +emittedFile:/src/first/bin/first-output.d.ts +sourceFile:../first_part3.ts +------------------------------------------------------------------- +>>>declare function f(): string; 1-> -2 > -3 > something -1->Emitted(48, 9) Source(24, 46) + SourceIndex(3) -2 >Emitted(48, 20) Source(24, 46) + SourceIndex(3) -3 >Emitted(48, 29) Source(24, 55) + SourceIndex(3) ---- ->>> var someClass = /** @class */ (function () { -1->^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> { -1->Emitted(49, 13) Source(24, 58) + SourceIndex(3) ---- ->>> function someClass() { -1->^^^^^^^^^^^^^^^^ -2 > ^^-> +2 >^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^ +5 > ^^^^^^^^^^^^-> 1-> -1->Emitted(50, 17) Source(24, 58) + SourceIndex(3) ---- ->>> } -1->^^^^^^^^^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^-> -1->export class someClass { -2 > } -1->Emitted(51, 17) Source(24, 82) + SourceIndex(3) -2 >Emitted(51, 18) Source(24, 83) + SourceIndex(3) +2 >function +3 > f +4 > () { + > return "JS does hoists"; + > } +1->Emitted(8, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(8, 18) Source(1, 10) + SourceIndex(2) +3 >Emitted(8, 19) Source(1, 11) + SourceIndex(2) +4 >Emitted(8, 30) Source(3, 2) + SourceIndex(2) --- ->>> return someClass; -1->^^^^^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(52, 17) Source(24, 82) + SourceIndex(3) -2 >Emitted(52, 33) Source(24, 83) + SourceIndex(3) +>>>//# sourceMappingURL=first-output.d.ts.map + +//// [/src/first/bin/first-output.js] file written with same contents +//// [/src/first/bin/first-output.js.map] file written with same contents +//// [/src/first/bin/first-output.js.map.baseline.txt] +=================================================================== +JsFile: first-output.js +mapUrl: first-output.js.map +sourceRoot: +sources: ../first_PART1.ts,../first_part2.ts,../first_part3.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:/src/first/bin/first-output.js +sourceFile:../first_PART1.ts +------------------------------------------------------------------- +>>>var s = "Hello, world"; +1 > +2 >^^^^ +3 > ^ +4 > ^^^ +5 > ^^^^^^^^^^^^^^ +6 > ^ +1 >interface TheFirst { + > none: any; + >} + > + > +2 >const +3 > s +4 > = +5 > "Hello, world" +6 > ; +1 >Emitted(1, 1) Source(5, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(5, 7) + SourceIndex(0) +3 >Emitted(1, 6) Source(5, 8) + SourceIndex(0) +4 >Emitted(1, 9) Source(5, 11) + SourceIndex(0) +5 >Emitted(1, 23) Source(5, 25) + SourceIndex(0) +6 >Emitted(1, 24) Source(5, 26) + SourceIndex(0) --- ->>> }()); -1 >^^^^^^^^^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +>>>console.log(s); +1 > +2 >^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^ +7 > ^ +8 > ^ +9 > ^^^-> 1 > -2 > } -3 > -4 > export class someClass {} -1 >Emitted(53, 13) Source(24, 82) + SourceIndex(3) -2 >Emitted(53, 14) Source(24, 83) + SourceIndex(3) -3 >Emitted(53, 14) Source(24, 58) + SourceIndex(3) -4 >Emitted(53, 18) Source(24, 83) + SourceIndex(3) + > + >interface NoJsForHereEither { + > none: any; + >} + > + > +2 >console +3 > . +4 > log +5 > ( +6 > s +7 > ) +8 > ; +1 >Emitted(2, 1) Source(11, 1) + SourceIndex(0) +2 >Emitted(2, 8) Source(11, 8) + SourceIndex(0) +3 >Emitted(2, 9) Source(11, 9) + SourceIndex(0) +4 >Emitted(2, 12) Source(11, 12) + SourceIndex(0) +5 >Emitted(2, 13) Source(11, 13) + SourceIndex(0) +6 >Emitted(2, 14) Source(11, 14) + SourceIndex(0) +7 >Emitted(2, 15) Source(11, 15) + SourceIndex(0) +8 >Emitted(2, 16) Source(11, 16) + SourceIndex(0) --- ->>> something.someClass = someClass; -1->^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^ -3 > ^^^^^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +------------------------------------------------------------------- +emittedFile:/src/first/bin/first-output.js +sourceFile:../first_part2.ts +------------------------------------------------------------------- +>>>console.log(f()); 1-> -2 > someClass -3 > {} -4 > -1->Emitted(54, 13) Source(24, 71) + SourceIndex(3) -2 >Emitted(54, 32) Source(24, 80) + SourceIndex(3) -3 >Emitted(54, 44) Source(24, 83) + SourceIndex(3) -4 >Emitted(54, 45) Source(24, 83) + SourceIndex(3) ---- ->>> })(something = someOther.something || (someOther.something = {})); -1->^^^^^^^^ -2 > ^ -3 > ^^ -4 > ^^^^^^^^^ -5 > ^^^ -6 > ^^^^^^^^^^^^^^^^^^^ -7 > ^^^^^ -8 > ^^^^^^^^^^^^^^^^^^^ -9 > ^^^^^^^^ -1-> -2 > } -3 > -4 > something -5 > -6 > something -7 > -8 > something -9 > { export class someClass {} } -1->Emitted(55, 9) Source(24, 84) + SourceIndex(3) -2 >Emitted(55, 10) Source(24, 85) + SourceIndex(3) -3 >Emitted(55, 12) Source(24, 46) + SourceIndex(3) -4 >Emitted(55, 21) Source(24, 55) + SourceIndex(3) -5 >Emitted(55, 24) Source(24, 46) + SourceIndex(3) -6 >Emitted(55, 43) Source(24, 55) + SourceIndex(3) -7 >Emitted(55, 48) Source(24, 46) + SourceIndex(3) -8 >Emitted(55, 67) Source(24, 55) + SourceIndex(3) -9 >Emitted(55, 75) Source(24, 85) + SourceIndex(3) +2 >^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^ +7 > ^^ +8 > ^ +9 > ^ +1-> +2 >console +3 > . +4 > log +5 > ( +6 > f +7 > () +8 > ) +9 > ; +1->Emitted(3, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(3, 8) Source(1, 8) + SourceIndex(1) +3 >Emitted(3, 9) Source(1, 9) + SourceIndex(1) +4 >Emitted(3, 12) Source(1, 12) + SourceIndex(1) +5 >Emitted(3, 13) Source(1, 13) + SourceIndex(1) +6 >Emitted(3, 14) Source(1, 14) + SourceIndex(1) +7 >Emitted(3, 16) Source(1, 16) + SourceIndex(1) +8 >Emitted(3, 17) Source(1, 17) + SourceIndex(1) +9 >Emitted(3, 18) Source(1, 18) + SourceIndex(1) --- ->>> })(someOther = normalN.someOther || (normalN.someOther = {})); -1 >^^^^ -2 > ^ -3 > ^^ -4 > ^^^^^^^^^ -5 > ^^^ -6 > ^^^^^^^^^^^^^^^^^ -7 > ^^^^^ -8 > ^^^^^^^^^^^^^^^^^ -9 > ^^^^^^^^ +------------------------------------------------------------------- +emittedFile:/src/first/bin/first-output.js +sourceFile:../first_part3.ts +------------------------------------------------------------------- +>>>function f() { 1 > -2 > } -3 > -4 > someOther -5 > -6 > someOther -7 > -8 > someOther -9 > .something { export class someClass {} } -1 >Emitted(56, 5) Source(24, 84) + SourceIndex(3) -2 >Emitted(56, 6) Source(24, 85) + SourceIndex(3) -3 >Emitted(56, 8) Source(24, 36) + SourceIndex(3) -4 >Emitted(56, 17) Source(24, 45) + SourceIndex(3) -5 >Emitted(56, 20) Source(24, 36) + SourceIndex(3) -6 >Emitted(56, 37) Source(24, 45) + SourceIndex(3) -7 >Emitted(56, 42) Source(24, 36) + SourceIndex(3) -8 >Emitted(56, 59) Source(24, 45) + SourceIndex(3) -9 >Emitted(56, 67) Source(24, 85) + SourceIndex(3) ---- ->>> /*@internal*/ normalN.someImport = someNamespace.C; -1 >^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^ -5 > ^^^ -6 > ^^^^^^^^^^^^^ -7 > ^ -8 > ^ -9 > ^ -1 > - > -2 > /*@internal*/ -3 > export import -4 > someImport -5 > = -6 > someNamespace -7 > . -8 > C -9 > ; -1 >Emitted(57, 5) Source(25, 5) + SourceIndex(3) -2 >Emitted(57, 18) Source(25, 18) + SourceIndex(3) -3 >Emitted(57, 19) Source(25, 33) + SourceIndex(3) -4 >Emitted(57, 37) Source(25, 43) + SourceIndex(3) -5 >Emitted(57, 40) Source(25, 46) + SourceIndex(3) -6 >Emitted(57, 53) Source(25, 59) + SourceIndex(3) -7 >Emitted(57, 54) Source(25, 60) + SourceIndex(3) -8 >Emitted(57, 55) Source(25, 61) + SourceIndex(3) -9 >Emitted(57, 56) Source(25, 62) + SourceIndex(3) ---- ->>> /*@internal*/ normalN.internalConst = 10; -1 >^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^ -5 > ^^^ -6 > ^^ -7 > ^ -1 > - > /*@internal*/ export type internalType = internalC; - > -2 > /*@internal*/ -3 > export const -4 > internalConst -5 > = -6 > 10 -7 > ; -1 >Emitted(58, 5) Source(27, 5) + SourceIndex(3) -2 >Emitted(58, 18) Source(27, 18) + SourceIndex(3) -3 >Emitted(58, 19) Source(27, 32) + SourceIndex(3) -4 >Emitted(58, 40) Source(27, 45) + SourceIndex(3) -5 >Emitted(58, 43) Source(27, 48) + SourceIndex(3) -6 >Emitted(58, 45) Source(27, 50) + SourceIndex(3) -7 >Emitted(58, 46) Source(27, 51) + SourceIndex(3) ---- ->>> /*@internal*/ var internalEnum; -1 >^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^ -5 > ^^^^^^^^^^^^ -1 > - > -2 > /*@internal*/ -3 > -4 > export enum -5 > internalEnum { a, b, c } -1 >Emitted(59, 5) Source(28, 5) + SourceIndex(3) -2 >Emitted(59, 18) Source(28, 18) + SourceIndex(3) -3 >Emitted(59, 19) Source(28, 19) + SourceIndex(3) -4 >Emitted(59, 23) Source(28, 31) + SourceIndex(3) -5 >Emitted(59, 35) Source(28, 55) + SourceIndex(3) ---- ->>> (function (internalEnum) { -1 >^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^-> +2 >^^^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^-> 1 > -2 > export enum -3 > internalEnum -1 >Emitted(60, 5) Source(28, 19) + SourceIndex(3) -2 >Emitted(60, 16) Source(28, 31) + SourceIndex(3) -3 >Emitted(60, 28) Source(28, 43) + SourceIndex(3) ---- ->>> internalEnum[internalEnum["a"] = 0] = "a"; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^-> -1-> { -2 > a -3 > -1->Emitted(61, 9) Source(28, 46) + SourceIndex(3) -2 >Emitted(61, 50) Source(28, 47) + SourceIndex(3) -3 >Emitted(61, 51) Source(28, 47) + SourceIndex(3) ---- ->>> internalEnum[internalEnum["b"] = 1] = "b"; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^-> -1->, -2 > b -3 > -1->Emitted(62, 9) Source(28, 49) + SourceIndex(3) -2 >Emitted(62, 50) Source(28, 50) + SourceIndex(3) -3 >Emitted(62, 51) Source(28, 50) + SourceIndex(3) ---- ->>> internalEnum[internalEnum["c"] = 2] = "c"; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->, -2 > c -3 > -1->Emitted(63, 9) Source(28, 52) + SourceIndex(3) -2 >Emitted(63, 50) Source(28, 53) + SourceIndex(3) -3 >Emitted(63, 51) Source(28, 53) + SourceIndex(3) +2 >function +3 > f +1 >Emitted(4, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(4, 10) Source(1, 10) + SourceIndex(2) +3 >Emitted(4, 11) Source(1, 11) + SourceIndex(2) --- ->>> })(internalEnum = normalN.internalEnum || (normalN.internalEnum = {})); +>>> return "JS does hoists"; 1->^^^^ -2 > ^ -3 > ^^ -4 > ^^^^^^^^^^^^ -5 > ^^^ -6 > ^^^^^^^^^^^^^^^^^^^^ -7 > ^^^^^ -8 > ^^^^^^^^^^^^^^^^^^^^ -9 > ^^^^^^^^ -1-> -2 > } -3 > -4 > internalEnum -5 > -6 > internalEnum -7 > -8 > internalEnum -9 > { a, b, c } -1->Emitted(64, 5) Source(28, 54) + SourceIndex(3) -2 >Emitted(64, 6) Source(28, 55) + SourceIndex(3) -3 >Emitted(64, 8) Source(28, 31) + SourceIndex(3) -4 >Emitted(64, 20) Source(28, 43) + SourceIndex(3) -5 >Emitted(64, 23) Source(28, 31) + SourceIndex(3) -6 >Emitted(64, 43) Source(28, 43) + SourceIndex(3) -7 >Emitted(64, 48) Source(28, 31) + SourceIndex(3) -8 >Emitted(64, 68) Source(28, 43) + SourceIndex(3) -9 >Emitted(64, 76) Source(28, 55) + SourceIndex(3) +2 > ^^^^^^^ +3 > ^^^^^^^^^^^^^^^^ +4 > ^ +1->() { + > +2 > return +3 > "JS does hoists" +4 > ; +1->Emitted(5, 5) Source(2, 5) + SourceIndex(2) +2 >Emitted(5, 12) Source(2, 12) + SourceIndex(2) +3 >Emitted(5, 28) Source(2, 28) + SourceIndex(2) +4 >Emitted(5, 29) Source(2, 29) + SourceIndex(2) --- ->>>})(normalN || (normalN = {})); +>>>} 1 > 2 >^ -3 > ^^ -4 > ^^^^^^^ -5 > ^^^^^ -6 > ^^^^^^^ -7 > ^^^^^^^^ -8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > > 2 >} -3 > -4 > normalN -5 > -6 > normalN -7 > { - > /*@internal*/ export class C { } - > /*@internal*/ export function foo() {} - > /*@internal*/ export namespace someNamespace { export class C {} } - > /*@internal*/ export namespace someOther.something { export class someClass {} } - > /*@internal*/ export import someImport = someNamespace.C; - > /*@internal*/ export type internalType = internalC; - > /*@internal*/ export const internalConst = 10; - > /*@internal*/ export enum internalEnum { a, b, c } - > } -1 >Emitted(65, 1) Source(29, 1) + SourceIndex(3) -2 >Emitted(65, 2) Source(29, 2) + SourceIndex(3) -3 >Emitted(65, 4) Source(20, 11) + SourceIndex(3) -4 >Emitted(65, 11) Source(20, 18) + SourceIndex(3) -5 >Emitted(65, 16) Source(20, 11) + SourceIndex(3) -6 >Emitted(65, 23) Source(20, 18) + SourceIndex(3) -7 >Emitted(65, 31) Source(29, 2) + SourceIndex(3) ---- ->>>/*@internal*/ var internalC = /** @class */ (function () { -1-> -2 >^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^-> -1-> - > -2 >/*@internal*/ -3 > -1->Emitted(66, 1) Source(30, 1) + SourceIndex(3) -2 >Emitted(66, 14) Source(30, 14) + SourceIndex(3) -3 >Emitted(66, 15) Source(30, 15) + SourceIndex(3) ---- ->>> function internalC() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(67, 5) Source(30, 15) + SourceIndex(3) +1 >Emitted(6, 1) Source(3, 1) + SourceIndex(2) +2 >Emitted(6, 2) Source(3, 2) + SourceIndex(2) --- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^-> -1->class internalC { -2 > } -1->Emitted(68, 5) Source(30, 32) + SourceIndex(3) -2 >Emitted(68, 6) Source(30, 33) + SourceIndex(3) +>>>//# sourceMappingURL=first-output.js.map + +//// [/src/first/bin/first-output.tsbuildinfo] +{ + "bundle": { + "commonSourceDirectory": "..", + "sourceFiles": [ + "../first_PART1.ts", + "../first_part2.ts", + "../first_part3.ts" + ], + "js": { + "sections": [ + { + "pos": 0, + "end": 110, + "kind": "text" + } + ] + }, + "dts": { + "sections": [ + { + "pos": 0, + "end": 157, + "kind": "text" + } + ] + } + }, + "version": "FakeTSVersion" +} + +//// [/src/first/bin/first-output.tsbuildinfo.baseline.txt] +====================================================================== +File:: /src/first/bin/first-output.js +---------------------------------------------------------------------- +text: (0-110) +var s = "Hello, world"; +console.log(s); +console.log(f()); +function f() { + return "JS does hoists"; +} + +====================================================================== +====================================================================== +File:: /src/first/bin/first-output.d.ts +---------------------------------------------------------------------- +text: (0-157) +interface TheFirst { + none: any; +} +declare const s = "Hello, world"; +interface NoJsForHereEither { + none: any; +} +declare function f(): string; + +====================================================================== + +//// [/src/first/first_PART1.ts] +interface TheFirst { + none: any; +} + +const s = "Hello, world"; + +interface NoJsForHereEither { + none: any; +} + +console.log(s); + + +//// [/src/third/thirdjs/output/third-output.d.ts] +interface TheFirst { + none: any; +} +declare const s = "Hello, world"; +interface NoJsForHereEither { + none: any; +} +declare function f(): string; +declare namespace N { +} +declare namespace N { +} +declare class normalC { +} +declare namespace normalN { +} +declare class C { + doSomething(): void; +} +declare var c: C; +//# sourceMappingURL=third-output.d.ts.map + +//// [/src/third/thirdjs/output/third-output.d.ts.map] +{"version":3,"file":"third-output.d.ts","sourceRoot":"","sources":["../../../first/first_PART1.ts","../../../first/first_part3.ts","../../../second/second_part1.ts","../../../second/second_part2.ts","../../third_part1.ts"],"names":[],"mappings":"AAAA,UAAU,QAAQ;IACd,IAAI,EAAE,GAAG,CAAC;CACb;AAED,QAAA,MAAM,CAAC,iBAAiB,CAAC;AAEzB,UAAU,iBAAiB;IACvB,IAAI,EAAE,GAAG,CAAC;CACb;ACRD,iBAAS,CAAC,WAET;ACFD,kBAAU,CAAC,CAAC;CAEX;AAED,kBAAU,CAAC,CAAC;CAMX;AAED,cAAM,OAAO;CAMZ;AACD,kBAAU,OAAO,CAAC;CASjB;AC5BD,cAAM,CAAC;IACH,WAAW;CAGd;ACJD,QAAA,IAAI,CAAC,GAAU,CAAC"} + +//// [/src/third/thirdjs/output/third-output.d.ts.map.baseline.txt] +=================================================================== +JsFile: third-output.d.ts +mapUrl: third-output.d.ts.map +sourceRoot: +sources: ../../../first/first_PART1.ts,../../../first/first_part3.ts,../../../second/second_part1.ts,../../../second/second_part2.ts,../../third_part1.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:/src/third/thirdjs/output/third-output.d.ts +sourceFile:../../../first/first_PART1.ts +------------------------------------------------------------------- +>>>interface TheFirst { +1 > +2 >^^^^^^^^^^ +3 > ^^^^^^^^ +1 > +2 >interface +3 > TheFirst +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 11) Source(1, 11) + SourceIndex(0) +3 >Emitted(1, 19) Source(1, 19) + SourceIndex(0) --- ->>> return internalC; -1->^^^^ -2 > ^^^^^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(69, 5) Source(30, 32) + SourceIndex(3) -2 >Emitted(69, 21) Source(30, 33) + SourceIndex(3) +>>> none: any; +1 >^^^^ +2 > ^^^^ +3 > ^^ +4 > ^^^ +5 > ^ +1 > { + > +2 > none +3 > : +4 > any +5 > ; +1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +2 >Emitted(2, 9) Source(2, 9) + SourceIndex(0) +3 >Emitted(2, 11) Source(2, 11) + SourceIndex(0) +4 >Emitted(2, 14) Source(2, 14) + SourceIndex(0) +5 >Emitted(2, 15) Source(2, 15) + SourceIndex(0) --- ->>>}()); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > -2 >} -3 > -4 > class internalC {} -1 >Emitted(70, 1) Source(30, 32) + SourceIndex(3) -2 >Emitted(70, 2) Source(30, 33) + SourceIndex(3) -3 >Emitted(70, 2) Source(30, 15) + SourceIndex(3) -4 >Emitted(70, 6) Source(30, 33) + SourceIndex(3) + >} +1 >Emitted(3, 2) Source(3, 2) + SourceIndex(0) --- ->>>/*@internal*/ function internalfoo() { } +>>>declare const s = "Hello, world"; +1-> +2 >^^^^^^^^ +3 > ^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^ +6 > ^ 1-> -2 >^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^ -5 > ^^^^^^^^^^^ -6 > ^^^^^ -7 > ^ -1-> > -2 >/*@internal*/ -3 > -4 > function -5 > internalfoo -6 > () { -7 > } -1->Emitted(71, 1) Source(31, 1) + SourceIndex(3) -2 >Emitted(71, 14) Source(31, 14) + SourceIndex(3) -3 >Emitted(71, 15) Source(31, 15) + SourceIndex(3) -4 >Emitted(71, 24) Source(31, 24) + SourceIndex(3) -5 >Emitted(71, 35) Source(31, 35) + SourceIndex(3) -6 >Emitted(71, 40) Source(31, 39) + SourceIndex(3) -7 >Emitted(71, 41) Source(31, 40) + SourceIndex(3) ---- ->>>/*@internal*/ var internalNamespace; -1 > -2 >^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^ -6 > ^ -1 > > -2 >/*@internal*/ -3 > -4 > namespace -5 > internalNamespace -6 > { export class someClass {} } -1 >Emitted(72, 1) Source(32, 1) + SourceIndex(3) -2 >Emitted(72, 14) Source(32, 14) + SourceIndex(3) -3 >Emitted(72, 15) Source(32, 15) + SourceIndex(3) -4 >Emitted(72, 19) Source(32, 25) + SourceIndex(3) -5 >Emitted(72, 36) Source(32, 42) + SourceIndex(3) -6 >Emitted(72, 37) Source(32, 72) + SourceIndex(3) +2 > +3 > const +4 > s +5 > = "Hello, world" +6 > ; +1->Emitted(4, 1) Source(5, 1) + SourceIndex(0) +2 >Emitted(4, 9) Source(5, 1) + SourceIndex(0) +3 >Emitted(4, 15) Source(5, 7) + SourceIndex(0) +4 >Emitted(4, 16) Source(5, 8) + SourceIndex(0) +5 >Emitted(4, 33) Source(5, 25) + SourceIndex(0) +6 >Emitted(4, 34) Source(5, 26) + SourceIndex(0) --- ->>>(function (internalNamespace) { +>>>interface NoJsForHereEither { 1 > -2 >^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^-> +2 >^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^ 1 > -2 >namespace -3 > internalNamespace -1 >Emitted(73, 1) Source(32, 15) + SourceIndex(3) -2 >Emitted(73, 12) Source(32, 25) + SourceIndex(3) -3 >Emitted(73, 29) Source(32, 42) + SourceIndex(3) ---- ->>> var someClass = /** @class */ (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> { -1->Emitted(74, 5) Source(32, 45) + SourceIndex(3) ---- ->>> function someClass() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(75, 9) Source(32, 45) + SourceIndex(3) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^-> -1->export class someClass { -2 > } -1->Emitted(76, 9) Source(32, 69) + SourceIndex(3) -2 >Emitted(76, 10) Source(32, 70) + SourceIndex(3) ---- ->>> return someClass; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(77, 9) Source(32, 69) + SourceIndex(3) -2 >Emitted(77, 25) Source(32, 70) + SourceIndex(3) + > + > +2 >interface +3 > NoJsForHereEither +1 >Emitted(5, 1) Source(7, 1) + SourceIndex(0) +2 >Emitted(5, 11) Source(7, 11) + SourceIndex(0) +3 >Emitted(5, 28) Source(7, 28) + SourceIndex(0) --- ->>> }()); +>>> none: any; 1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +2 > ^^^^ +3 > ^^ +4 > ^^^ +5 > ^ +1 > { + > +2 > none +3 > : +4 > any +5 > ; +1 >Emitted(6, 5) Source(8, 5) + SourceIndex(0) +2 >Emitted(6, 9) Source(8, 9) + SourceIndex(0) +3 >Emitted(6, 11) Source(8, 11) + SourceIndex(0) +4 >Emitted(6, 14) Source(8, 14) + SourceIndex(0) +5 >Emitted(6, 15) Source(8, 15) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > -2 > } -3 > -4 > export class someClass {} -1 >Emitted(78, 5) Source(32, 69) + SourceIndex(3) -2 >Emitted(78, 6) Source(32, 70) + SourceIndex(3) -3 >Emitted(78, 6) Source(32, 45) + SourceIndex(3) -4 >Emitted(78, 10) Source(32, 70) + SourceIndex(3) + >} +1 >Emitted(7, 2) Source(9, 2) + SourceIndex(0) --- ->>> internalNamespace.someClass = someClass; -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^^^^^^^^^^^^ -4 > ^ -5 > ^^^^^^^-> +------------------------------------------------------------------- +emittedFile:/src/third/thirdjs/output/third-output.d.ts +sourceFile:../../../first/first_part3.ts +------------------------------------------------------------------- +>>>declare function f(): string; 1-> -2 > someClass -3 > {} -4 > -1->Emitted(79, 5) Source(32, 58) + SourceIndex(3) -2 >Emitted(79, 32) Source(32, 67) + SourceIndex(3) -3 >Emitted(79, 44) Source(32, 70) + SourceIndex(3) -4 >Emitted(79, 45) Source(32, 70) + SourceIndex(3) ---- ->>>})(internalNamespace || (internalNamespace = {})); +2 >^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^ 1-> -2 >^ -3 > ^^ -4 > ^^^^^^^^^^^^^^^^^ -5 > ^^^^^ -6 > ^^^^^^^^^^^^^^^^^ -7 > ^^^^^^^^ -1-> -2 >} -3 > -4 > internalNamespace -5 > -6 > internalNamespace -7 > { export class someClass {} } -1->Emitted(80, 1) Source(32, 71) + SourceIndex(3) -2 >Emitted(80, 2) Source(32, 72) + SourceIndex(3) -3 >Emitted(80, 4) Source(32, 25) + SourceIndex(3) -4 >Emitted(80, 21) Source(32, 42) + SourceIndex(3) -5 >Emitted(80, 26) Source(32, 25) + SourceIndex(3) -6 >Emitted(80, 43) Source(32, 42) + SourceIndex(3) -7 >Emitted(80, 51) Source(32, 72) + SourceIndex(3) ---- ->>>/*@internal*/ var internalOther; -1 > -2 >^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^ -5 > ^^^^^^^^^^^^^ -6 > ^ -1 > - > -2 >/*@internal*/ -3 > -4 > namespace -5 > internalOther -6 > .something { export class someClass {} } -1 >Emitted(81, 1) Source(33, 1) + SourceIndex(3) -2 >Emitted(81, 14) Source(33, 14) + SourceIndex(3) -3 >Emitted(81, 15) Source(33, 15) + SourceIndex(3) -4 >Emitted(81, 19) Source(33, 25) + SourceIndex(3) -5 >Emitted(81, 32) Source(33, 38) + SourceIndex(3) -6 >Emitted(81, 33) Source(33, 78) + SourceIndex(3) +2 >function +3 > f +4 > () { + > return "JS does hoists"; + > } +1->Emitted(8, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(8, 18) Source(1, 10) + SourceIndex(1) +3 >Emitted(8, 19) Source(1, 11) + SourceIndex(1) +4 >Emitted(8, 30) Source(3, 2) + SourceIndex(1) --- ->>>(function (internalOther) { +------------------------------------------------------------------- +emittedFile:/src/third/thirdjs/output/third-output.d.ts +sourceFile:../../../second/second_part1.ts +------------------------------------------------------------------- +>>>declare namespace N { 1 > -2 >^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^ +2 >^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^ 1 > 2 >namespace -3 > internalOther -1 >Emitted(82, 1) Source(33, 15) + SourceIndex(3) -2 >Emitted(82, 12) Source(33, 25) + SourceIndex(3) -3 >Emitted(82, 25) Source(33, 38) + SourceIndex(3) +3 > N +4 > +1 >Emitted(9, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(9, 19) Source(1, 11) + SourceIndex(2) +3 >Emitted(9, 20) Source(1, 12) + SourceIndex(2) +4 >Emitted(9, 21) Source(1, 13) + SourceIndex(2) --- ->>> var something; -1 >^^^^ -2 > ^^^^ -3 > ^^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^-> -1 >. -2 > -3 > something -4 > { export class someClass {} } -1 >Emitted(83, 5) Source(33, 39) + SourceIndex(3) -2 >Emitted(83, 9) Source(33, 39) + SourceIndex(3) -3 >Emitted(83, 18) Source(33, 48) + SourceIndex(3) -4 >Emitted(83, 19) Source(33, 78) + SourceIndex(3) +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^-> +1 >{ + > // Comment text + >} +1 >Emitted(10, 2) Source(3, 2) + SourceIndex(2) --- ->>> (function (something) { -1->^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +>>>declare namespace N { 1-> -2 > -3 > something -1->Emitted(84, 5) Source(33, 39) + SourceIndex(3) -2 >Emitted(84, 16) Source(33, 39) + SourceIndex(3) -3 >Emitted(84, 25) Source(33, 48) + SourceIndex(3) ---- ->>> var someClass = /** @class */ (function () { -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> { -1->Emitted(85, 9) Source(33, 51) + SourceIndex(3) ---- ->>> function someClass() { -1->^^^^^^^^^^^^ -2 > ^^-> +2 >^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^ 1-> -1->Emitted(86, 13) Source(33, 51) + SourceIndex(3) + > + > +2 >namespace +3 > N +4 > +1->Emitted(11, 1) Source(5, 1) + SourceIndex(2) +2 >Emitted(11, 19) Source(5, 11) + SourceIndex(2) +3 >Emitted(11, 20) Source(5, 12) + SourceIndex(2) +4 >Emitted(11, 21) Source(5, 13) + SourceIndex(2) --- ->>> } -1->^^^^^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^-> -1->export class someClass { -2 > } -1->Emitted(87, 13) Source(33, 75) + SourceIndex(3) -2 >Emitted(87, 14) Source(33, 76) + SourceIndex(3) +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1 >{ + > function f() { + > console.log('testing'); + > } + > + > f(); + >} +1 >Emitted(12, 2) Source(11, 2) + SourceIndex(2) --- ->>> return someClass; -1->^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^ +>>>declare class normalC { 1-> -2 > } -1->Emitted(88, 13) Source(33, 75) + SourceIndex(3) -2 >Emitted(88, 29) Source(33, 76) + SourceIndex(3) ---- ->>> }()); -1 >^^^^^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class someClass {} -1 >Emitted(89, 9) Source(33, 75) + SourceIndex(3) -2 >Emitted(89, 10) Source(33, 76) + SourceIndex(3) -3 >Emitted(89, 10) Source(33, 51) + SourceIndex(3) -4 >Emitted(89, 14) Source(33, 76) + SourceIndex(3) ---- ->>> something.someClass = someClass; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^ -3 > ^^^^^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +2 >^^^^^^^^^^^^^^ +3 > ^^^^^^^ 1-> -2 > someClass -3 > {} -4 > -1->Emitted(90, 9) Source(33, 64) + SourceIndex(3) -2 >Emitted(90, 28) Source(33, 73) + SourceIndex(3) -3 >Emitted(90, 40) Source(33, 76) + SourceIndex(3) -4 >Emitted(90, 41) Source(33, 76) + SourceIndex(3) ---- ->>> })(something = internalOther.something || (internalOther.something = {})); -1->^^^^ -2 > ^ -3 > ^^ -4 > ^^^^^^^^^ -5 > ^^^ -6 > ^^^^^^^^^^^^^^^^^^^^^^^ -7 > ^^^^^ -8 > ^^^^^^^^^^^^^^^^^^^^^^^ -9 > ^^^^^^^^ -1-> -2 > } -3 > -4 > something -5 > -6 > something -7 > -8 > something -9 > { export class someClass {} } -1->Emitted(91, 5) Source(33, 77) + SourceIndex(3) -2 >Emitted(91, 6) Source(33, 78) + SourceIndex(3) -3 >Emitted(91, 8) Source(33, 39) + SourceIndex(3) -4 >Emitted(91, 17) Source(33, 48) + SourceIndex(3) -5 >Emitted(91, 20) Source(33, 39) + SourceIndex(3) -6 >Emitted(91, 43) Source(33, 48) + SourceIndex(3) -7 >Emitted(91, 48) Source(33, 39) + SourceIndex(3) -8 >Emitted(91, 71) Source(33, 48) + SourceIndex(3) -9 >Emitted(91, 79) Source(33, 78) + SourceIndex(3) + > + > +2 >class +3 > normalC +1->Emitted(13, 1) Source(13, 1) + SourceIndex(2) +2 >Emitted(13, 15) Source(13, 7) + SourceIndex(2) +3 >Emitted(13, 22) Source(13, 14) + SourceIndex(2) --- ->>>})(internalOther || (internalOther = {})); -1 > -2 >^ -3 > ^^ -4 > ^^^^^^^^^^^^^ -5 > ^^^^^ -6 > ^^^^^^^^^^^^^ -7 > ^^^^^^^^ -8 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > internalOther -5 > -6 > internalOther -7 > .something { export class someClass {} } -1 >Emitted(92, 1) Source(33, 77) + SourceIndex(3) -2 >Emitted(92, 2) Source(33, 78) + SourceIndex(3) -3 >Emitted(92, 4) Source(33, 25) + SourceIndex(3) -4 >Emitted(92, 17) Source(33, 38) + SourceIndex(3) -5 >Emitted(92, 22) Source(33, 25) + SourceIndex(3) -6 >Emitted(92, 35) Source(33, 38) + SourceIndex(3) -7 >Emitted(92, 43) Source(33, 78) + SourceIndex(3) +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > { + > /*@internal*/ constructor() { } + > /*@internal*/ prop: string; + > /*@internal*/ method() { } + > /*@internal*/ get c() { return 10; } + > /*@internal*/ set c(val: number) { } + >} +1 >Emitted(14, 2) Source(19, 2) + SourceIndex(2) --- ->>>/*@internal*/ var internalImport = internalNamespace.someClass; +>>>declare namespace normalN { 1-> -2 >^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^ -5 > ^^^^^^^^^^^^^^ -6 > ^^^ -7 > ^^^^^^^^^^^^^^^^^ -8 > ^ -9 > ^^^^^^^^^ -10> ^ +2 >^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^ +4 > ^ 1-> > -2 >/*@internal*/ -3 > -4 > import -5 > internalImport -6 > = -7 > internalNamespace -8 > . -9 > someClass -10> ; -1->Emitted(93, 1) Source(34, 1) + SourceIndex(3) -2 >Emitted(93, 14) Source(34, 14) + SourceIndex(3) -3 >Emitted(93, 15) Source(34, 15) + SourceIndex(3) -4 >Emitted(93, 19) Source(34, 22) + SourceIndex(3) -5 >Emitted(93, 33) Source(34, 36) + SourceIndex(3) -6 >Emitted(93, 36) Source(34, 39) + SourceIndex(3) -7 >Emitted(93, 53) Source(34, 56) + SourceIndex(3) -8 >Emitted(93, 54) Source(34, 57) + SourceIndex(3) -9 >Emitted(93, 63) Source(34, 66) + SourceIndex(3) -10>Emitted(93, 64) Source(34, 67) + SourceIndex(3) ---- ->>>/*@internal*/ var internalConst = 10; -1 > -2 >^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^ -5 > ^^^^^^^^^^^^^ -6 > ^^^ -7 > ^^ -8 > ^ -1 > - >/*@internal*/ type internalType = internalC; - > -2 >/*@internal*/ -3 > -4 > const -5 > internalConst -6 > = -7 > 10 -8 > ; -1 >Emitted(94, 1) Source(36, 1) + SourceIndex(3) -2 >Emitted(94, 14) Source(36, 14) + SourceIndex(3) -3 >Emitted(94, 15) Source(36, 15) + SourceIndex(3) -4 >Emitted(94, 19) Source(36, 21) + SourceIndex(3) -5 >Emitted(94, 32) Source(36, 34) + SourceIndex(3) -6 >Emitted(94, 35) Source(36, 37) + SourceIndex(3) -7 >Emitted(94, 37) Source(36, 39) + SourceIndex(3) -8 >Emitted(94, 38) Source(36, 40) + SourceIndex(3) ---- ->>>/*@internal*/ var internalEnum; -1 > -2 >^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^ -5 > ^^^^^^^^^^^^ -1 > - > -2 >/*@internal*/ -3 > -4 > enum -5 > internalEnum { a, b, c } -1 >Emitted(95, 1) Source(37, 1) + SourceIndex(3) -2 >Emitted(95, 14) Source(37, 14) + SourceIndex(3) -3 >Emitted(95, 15) Source(37, 15) + SourceIndex(3) -4 >Emitted(95, 19) Source(37, 20) + SourceIndex(3) -5 >Emitted(95, 31) Source(37, 44) + SourceIndex(3) ---- ->>>(function (internalEnum) { -1 > -2 >^^^^^^^^^^^ -3 > ^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >enum -3 > internalEnum -1 >Emitted(96, 1) Source(37, 15) + SourceIndex(3) -2 >Emitted(96, 12) Source(37, 20) + SourceIndex(3) -3 >Emitted(96, 24) Source(37, 32) + SourceIndex(3) ---- ->>> internalEnum[internalEnum["a"] = 0] = "a"; -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^-> -1-> { -2 > a -3 > -1->Emitted(97, 5) Source(37, 35) + SourceIndex(3) -2 >Emitted(97, 46) Source(37, 36) + SourceIndex(3) -3 >Emitted(97, 47) Source(37, 36) + SourceIndex(3) ---- ->>> internalEnum[internalEnum["b"] = 1] = "b"; -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^-> -1->, -2 > b -3 > -1->Emitted(98, 5) Source(37, 38) + SourceIndex(3) -2 >Emitted(98, 46) Source(37, 39) + SourceIndex(3) -3 >Emitted(98, 47) Source(37, 39) + SourceIndex(3) ---- ->>> internalEnum[internalEnum["c"] = 2] = "c"; -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -1->, -2 > c -3 > -1->Emitted(99, 5) Source(37, 41) + SourceIndex(3) -2 >Emitted(99, 46) Source(37, 42) + SourceIndex(3) -3 >Emitted(99, 47) Source(37, 42) + SourceIndex(3) +2 >namespace +3 > normalN +4 > +1->Emitted(15, 1) Source(20, 1) + SourceIndex(2) +2 >Emitted(15, 19) Source(20, 11) + SourceIndex(2) +3 >Emitted(15, 26) Source(20, 18) + SourceIndex(2) +4 >Emitted(15, 27) Source(20, 19) + SourceIndex(2) --- ->>>})(internalEnum || (internalEnum = {})); -1 > -2 >^ -3 > ^^ -4 > ^^^^^^^^^^^^ -5 > ^^^^^ -6 > ^^^^^^^^^^^^ -7 > ^^^^^^^^ -1 > -2 >} -3 > -4 > internalEnum -5 > -6 > internalEnum -7 > { a, b, c } -1 >Emitted(100, 1) Source(37, 43) + SourceIndex(3) -2 >Emitted(100, 2) Source(37, 44) + SourceIndex(3) -3 >Emitted(100, 4) Source(37, 20) + SourceIndex(3) -4 >Emitted(100, 16) Source(37, 32) + SourceIndex(3) -5 >Emitted(100, 21) Source(37, 20) + SourceIndex(3) -6 >Emitted(100, 33) Source(37, 32) + SourceIndex(3) -7 >Emitted(100, 41) Source(37, 44) + SourceIndex(3) +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^-> +1 >{ + > /*@internal*/ export class C { } + > /*@internal*/ export function foo() {} + > /*@internal*/ export namespace someNamespace { export class C {} } + > /*@internal*/ export namespace someOther.something { export class someClass {} } + > /*@internal*/ export import someImport = someNamespace.C; + > /*@internal*/ export type internalType = internalC; + > /*@internal*/ export const internalConst = 10; + > /*@internal*/ export enum internalEnum { a, b, c } + >} +1 >Emitted(16, 2) Source(29, 2) + SourceIndex(2) --- ------------------------------------------------------------------- -emittedFile:/src/third/thirdjs/output/third-output.js +emittedFile:/src/third/thirdjs/output/third-output.d.ts sourceFile:../../../second/second_part2.ts ------------------------------------------------------------------- ->>>var C = /** @class */ (function () { -1 > -2 >^^^^^^^^^^^^^^^^^^^-> -1 > -1 >Emitted(101, 1) Source(1, 1) + SourceIndex(4) ---- ->>> function C() { -1->^^^^ -2 > ^^-> +>>>declare class C { 1-> -1->Emitted(102, 5) Source(1, 1) + SourceIndex(4) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->class C { - > doSomething() { - > console.log("something got done"); - > } - > -2 > } -1->Emitted(103, 5) Source(5, 1) + SourceIndex(4) -2 >Emitted(103, 6) Source(5, 2) + SourceIndex(4) ---- ->>> C.prototype.doSomething = function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^^^^^^^^^^-> +2 >^^^^^^^^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^-> 1-> -2 > doSomething -3 > -1->Emitted(104, 5) Source(2, 5) + SourceIndex(4) -2 >Emitted(104, 28) Source(2, 16) + SourceIndex(4) -3 >Emitted(104, 31) Source(2, 5) + SourceIndex(4) ---- ->>> console.log("something got done"); -1->^^^^^^^^ -2 > ^^^^^^^ -3 > ^ -4 > ^^^ -5 > ^ -6 > ^^^^^^^^^^^^^^^^^^^^ -7 > ^ -8 > ^ -1->doSomething() { - > -2 > console -3 > . -4 > log -5 > ( -6 > "something got done" -7 > ) -8 > ; -1->Emitted(105, 9) Source(3, 9) + SourceIndex(4) -2 >Emitted(105, 16) Source(3, 16) + SourceIndex(4) -3 >Emitted(105, 17) Source(3, 17) + SourceIndex(4) -4 >Emitted(105, 20) Source(3, 20) + SourceIndex(4) -5 >Emitted(105, 21) Source(3, 21) + SourceIndex(4) -6 >Emitted(105, 41) Source(3, 41) + SourceIndex(4) -7 >Emitted(105, 42) Source(3, 42) + SourceIndex(4) -8 >Emitted(105, 43) Source(3, 43) + SourceIndex(4) ---- ->>> }; -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(106, 5) Source(4, 5) + SourceIndex(4) -2 >Emitted(106, 6) Source(4, 6) + SourceIndex(4) +2 >class +3 > C +1->Emitted(17, 1) Source(1, 1) + SourceIndex(3) +2 >Emitted(17, 15) Source(1, 7) + SourceIndex(3) +3 >Emitted(17, 16) Source(1, 8) + SourceIndex(3) --- ->>> return C; +>>> doSomething(): void; 1->^^^^ -2 > ^^^^^^^^ -1-> - > -2 > } -1->Emitted(107, 5) Source(5, 1) + SourceIndex(4) -2 >Emitted(107, 13) Source(5, 2) + SourceIndex(4) +2 > ^^^^^^^^^^^ +1-> { + > +2 > doSomething +1->Emitted(18, 5) Source(2, 5) + SourceIndex(3) +2 >Emitted(18, 16) Source(2, 16) + SourceIndex(3) --- ->>>}()); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > class C { - > doSomething() { - > console.log("something got done"); - > } - > } -1 >Emitted(108, 1) Source(5, 1) + SourceIndex(4) -2 >Emitted(108, 2) Source(5, 2) + SourceIndex(4) -3 >Emitted(108, 2) Source(1, 1) + SourceIndex(4) -4 >Emitted(108, 6) Source(5, 2) + SourceIndex(4) +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^-> +1 >() { + > console.log("something got done"); + > } + >} +1 >Emitted(19, 2) Source(5, 2) + SourceIndex(3) --- ------------------------------------------------------------------- -emittedFile:/src/third/thirdjs/output/third-output.js +emittedFile:/src/third/thirdjs/output/third-output.d.ts sourceFile:../../third_part1.ts ------------------------------------------------------------------- ->>>var c = new C(); -1-> -2 >^^^^ -3 > ^ -4 > ^^^ -5 > ^^^^ -6 > ^ -7 > ^^ -8 > ^ -9 > ^-> -1-> -2 >var -3 > c -4 > = -5 > new -6 > C -7 > () -8 > ; -1->Emitted(109, 1) Source(1, 1) + SourceIndex(5) -2 >Emitted(109, 5) Source(1, 5) + SourceIndex(5) -3 >Emitted(109, 6) Source(1, 6) + SourceIndex(5) -4 >Emitted(109, 9) Source(1, 9) + SourceIndex(5) -5 >Emitted(109, 13) Source(1, 13) + SourceIndex(5) -6 >Emitted(109, 14) Source(1, 14) + SourceIndex(5) -7 >Emitted(109, 16) Source(1, 16) + SourceIndex(5) -8 >Emitted(109, 17) Source(1, 17) + SourceIndex(5) ---- ->>>c.doSomething(); +>>>declare var c: C; 1-> -2 >^ -3 > ^ -4 > ^^^^^^^^^^^ -5 > ^^ -6 > ^ -7 > ^^^^^^^^^^^^^^^^^^^^^^^-> +2 >^^^^^^^^ +3 > ^^^^ +4 > ^ +5 > ^^^ +6 > ^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> - > -2 >c -3 > . -4 > doSomething -5 > () -6 > ; -1->Emitted(110, 1) Source(2, 1) + SourceIndex(5) -2 >Emitted(110, 2) Source(2, 2) + SourceIndex(5) -3 >Emitted(110, 3) Source(2, 3) + SourceIndex(5) -4 >Emitted(110, 14) Source(2, 14) + SourceIndex(5) -5 >Emitted(110, 16) Source(2, 16) + SourceIndex(5) -6 >Emitted(110, 17) Source(2, 17) + SourceIndex(5) +2 > +3 > var +4 > c +5 > = new C() +6 > ; +1->Emitted(20, 1) Source(1, 1) + SourceIndex(4) +2 >Emitted(20, 9) Source(1, 1) + SourceIndex(4) +3 >Emitted(20, 13) Source(1, 5) + SourceIndex(4) +4 >Emitted(20, 14) Source(1, 6) + SourceIndex(4) +5 >Emitted(20, 17) Source(1, 16) + SourceIndex(4) +6 >Emitted(20, 18) Source(1, 17) + SourceIndex(4) --- ->>>//# sourceMappingURL=third-output.js.map +>>>//# sourceMappingURL=third-output.d.ts.map //// [/src/third/thirdjs/output/third-output.tsbuildinfo] { diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/stripInternal-with-comments-emit-enabled.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/stripInternal-with-comments-emit-enabled.js index fb04c867b4ebe..a4a3c13a5f468 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/stripInternal-with-comments-emit-enabled.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/stripInternal-with-comments-emit-enabled.js @@ -1,3 +1,26 @@ +//// [/lib/incremental-headers-change-without-dts-changesOutput.txt] +/lib/tsc --b /src/third --verbose +12:08:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:08:00 AM - Project 'src/first/tsconfig.json' is out of date because oldest output 'src/first/bin/first-output.js' is older than newest input 'src/first/first_PART1.ts' + +12:08:00 AM - Building project '/src/first/tsconfig.json'... + +12:08:00 AM - Project 'src/second/tsconfig.json' is up to date because newest input 'src/second/second_part1.ts' is older than oldest output 'src/2/second-output.js' + +12:08:00 AM - Project 'src/third/tsconfig.json' is out of date because output of its dependency 'src/first' has changed + +12:08:00 AM - Updating output of project '/src/third/tsconfig.json'... + +12:08:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... + +exitCode:: 0 + + +//// [/src/first/bin/first-output.d.ts] file written with same contents //// [/src/first/bin/first-output.d.ts.map] {"version":3,"file":"first-output.d.ts","sourceRoot":"","sources":["../first_PART1.ts","../first_part2.ts","../first_part3.ts"],"names":[],"mappings":"AAAA,UAAU,QAAQ;IACd,IAAI,EAAE,GAAG,CAAC;CACb;AAED,QAAA,MAAM,CAAC,iBAAiB,CAAC;AAEzB,UAAU,iBAAiB;IACvB,IAAI,EAAE,GAAG,CAAC;CACb;AERD,iBAAS,CAAC,WAET"} @@ -131,6 +154,8 @@ sourceFile:../first_part3.ts --- >>>//# sourceMappingURL=first-output.d.ts.map +//// [/src/first/bin/first-output.js] file written with same contents +//// [/src/first/bin/first-output.js.map] file written with same contents //// [/src/first/bin/first-output.js.map.baseline.txt] =================================================================== JsFile: first-output.js @@ -671,1740 +696,6 @@ sourceFile:../../third_part1.ts --- >>>//# sourceMappingURL=third-output.d.ts.map -//// [/src/third/thirdjs/output/third-output.js.map.baseline.txt] -=================================================================== -JsFile: third-output.js -mapUrl: third-output.js.map -sourceRoot: -sources: ../../../first/first_PART1.ts,../../../first/first_part2.ts,../../../first/first_part3.ts,../../../second/second_part1.ts,../../../second/second_part2.ts,../../third_part1.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:/src/third/thirdjs/output/third-output.js -sourceFile:../../../first/first_PART1.ts -------------------------------------------------------------------- ->>>var s = "Hello, world"; -1 > -2 >^^^^ -3 > ^ -4 > ^^^ -5 > ^^^^^^^^^^^^^^ -6 > ^ -1 >interface TheFirst { - > none: any; - >} - > - > -2 >const -3 > s -4 > = -5 > "Hello, world" -6 > ; -1 >Emitted(1, 1) Source(5, 1) + SourceIndex(0) -2 >Emitted(1, 5) Source(5, 7) + SourceIndex(0) -3 >Emitted(1, 6) Source(5, 8) + SourceIndex(0) -4 >Emitted(1, 9) Source(5, 11) + SourceIndex(0) -5 >Emitted(1, 23) Source(5, 25) + SourceIndex(0) -6 >Emitted(1, 24) Source(5, 26) + SourceIndex(0) ---- ->>>console.log(s); -1 > -2 >^^^^^^^ -3 > ^ -4 > ^^^ -5 > ^ -6 > ^ -7 > ^ -8 > ^ -9 > ^^^-> -1 > - > - >interface NoJsForHereEither { - > none: any; - >} - > - > -2 >console -3 > . -4 > log -5 > ( -6 > s -7 > ) -8 > ; -1 >Emitted(2, 1) Source(11, 1) + SourceIndex(0) -2 >Emitted(2, 8) Source(11, 8) + SourceIndex(0) -3 >Emitted(2, 9) Source(11, 9) + SourceIndex(0) -4 >Emitted(2, 12) Source(11, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(11, 13) + SourceIndex(0) -6 >Emitted(2, 14) Source(11, 14) + SourceIndex(0) -7 >Emitted(2, 15) Source(11, 15) + SourceIndex(0) -8 >Emitted(2, 16) Source(11, 16) + SourceIndex(0) ---- -------------------------------------------------------------------- -emittedFile:/src/third/thirdjs/output/third-output.js -sourceFile:../../../first/first_part2.ts -------------------------------------------------------------------- ->>>console.log(f()); -1-> -2 >^^^^^^^ -3 > ^ -4 > ^^^ -5 > ^ -6 > ^ -7 > ^^ -8 > ^ -9 > ^ -1-> -2 >console -3 > . -4 > log -5 > ( -6 > f -7 > () -8 > ) -9 > ; -1->Emitted(3, 1) Source(1, 1) + SourceIndex(1) -2 >Emitted(3, 8) Source(1, 8) + SourceIndex(1) -3 >Emitted(3, 9) Source(1, 9) + SourceIndex(1) -4 >Emitted(3, 12) Source(1, 12) + SourceIndex(1) -5 >Emitted(3, 13) Source(1, 13) + SourceIndex(1) -6 >Emitted(3, 14) Source(1, 14) + SourceIndex(1) -7 >Emitted(3, 16) Source(1, 16) + SourceIndex(1) -8 >Emitted(3, 17) Source(1, 17) + SourceIndex(1) -9 >Emitted(3, 18) Source(1, 18) + SourceIndex(1) ---- -------------------------------------------------------------------- -emittedFile:/src/third/thirdjs/output/third-output.js -sourceFile:../../../first/first_part3.ts -------------------------------------------------------------------- ->>>function f() { -1 > -2 >^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^-> -1 > -2 >function -3 > f -1 >Emitted(4, 1) Source(1, 1) + SourceIndex(2) -2 >Emitted(4, 10) Source(1, 10) + SourceIndex(2) -3 >Emitted(4, 11) Source(1, 11) + SourceIndex(2) ---- ->>> return "JS does hoists"; -1->^^^^ -2 > ^^^^^^^ -3 > ^^^^^^^^^^^^^^^^ -4 > ^ -1->() { - > -2 > return -3 > "JS does hoists" -4 > ; -1->Emitted(5, 5) Source(2, 5) + SourceIndex(2) -2 >Emitted(5, 12) Source(2, 12) + SourceIndex(2) -3 >Emitted(5, 28) Source(2, 28) + SourceIndex(2) -4 >Emitted(5, 29) Source(2, 29) + SourceIndex(2) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^-> -1 > - > -2 >} -1 >Emitted(6, 1) Source(3, 1) + SourceIndex(2) -2 >Emitted(6, 2) Source(3, 2) + SourceIndex(2) ---- -------------------------------------------------------------------- -emittedFile:/src/third/thirdjs/output/third-output.js -sourceFile:../../../second/second_part1.ts -------------------------------------------------------------------- ->>>var N; -1-> -2 >^^^^ -3 > ^ -4 > ^ -5 > ^^^^^^^^^^-> -1->namespace N { - > // Comment text - >} - > - > -2 >namespace -3 > N -4 > { - > function f() { - > console.log('testing'); - > } - > - > f(); - > } -1->Emitted(7, 1) Source(5, 1) + SourceIndex(3) -2 >Emitted(7, 5) Source(5, 11) + SourceIndex(3) -3 >Emitted(7, 6) Source(5, 12) + SourceIndex(3) -4 >Emitted(7, 7) Source(11, 2) + SourceIndex(3) ---- ->>>(function (N) { -1-> -2 >^^^^^^^^^^^ -3 > ^ -4 > ^^^^^^^-> -1-> -2 >namespace -3 > N -1->Emitted(8, 1) Source(5, 1) + SourceIndex(3) -2 >Emitted(8, 12) Source(5, 11) + SourceIndex(3) -3 >Emitted(8, 13) Source(5, 12) + SourceIndex(3) ---- ->>> function f() { -1->^^^^ -2 > ^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^-> -1-> { - > -2 > function -3 > f -1->Emitted(9, 5) Source(6, 5) + SourceIndex(3) -2 >Emitted(9, 14) Source(6, 14) + SourceIndex(3) -3 >Emitted(9, 15) Source(6, 15) + SourceIndex(3) ---- ->>> console.log('testing'); -1->^^^^^^^^ -2 > ^^^^^^^ -3 > ^ -4 > ^^^ -5 > ^ -6 > ^^^^^^^^^ -7 > ^ -8 > ^ -1->() { - > -2 > console -3 > . -4 > log -5 > ( -6 > 'testing' -7 > ) -8 > ; -1->Emitted(10, 9) Source(7, 9) + SourceIndex(3) -2 >Emitted(10, 16) Source(7, 16) + SourceIndex(3) -3 >Emitted(10, 17) Source(7, 17) + SourceIndex(3) -4 >Emitted(10, 20) Source(7, 20) + SourceIndex(3) -5 >Emitted(10, 21) Source(7, 21) + SourceIndex(3) -6 >Emitted(10, 30) Source(7, 30) + SourceIndex(3) -7 >Emitted(10, 31) Source(7, 31) + SourceIndex(3) -8 >Emitted(10, 32) Source(7, 32) + SourceIndex(3) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^-> -1 > - > -2 > } -1 >Emitted(11, 5) Source(8, 5) + SourceIndex(3) -2 >Emitted(11, 6) Source(8, 6) + SourceIndex(3) ---- ->>> f(); -1->^^^^ -2 > ^ -3 > ^^ -4 > ^ -5 > ^^^^^^^^^^^-> -1-> - > - > -2 > f -3 > () -4 > ; -1->Emitted(12, 5) Source(10, 5) + SourceIndex(3) -2 >Emitted(12, 6) Source(10, 6) + SourceIndex(3) -3 >Emitted(12, 8) Source(10, 8) + SourceIndex(3) -4 >Emitted(12, 9) Source(10, 9) + SourceIndex(3) ---- ->>>})(N || (N = {})); -1-> -2 >^ -3 > ^^ -4 > ^ -5 > ^^^^^ -6 > ^ -7 > ^^^^^^^^ -8 > ^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -2 >} -3 > -4 > N -5 > -6 > N -7 > { - > function f() { - > console.log('testing'); - > } - > - > f(); - > } -1->Emitted(13, 1) Source(11, 1) + SourceIndex(3) -2 >Emitted(13, 2) Source(11, 2) + SourceIndex(3) -3 >Emitted(13, 4) Source(5, 11) + SourceIndex(3) -4 >Emitted(13, 5) Source(5, 12) + SourceIndex(3) -5 >Emitted(13, 10) Source(5, 11) + SourceIndex(3) -6 >Emitted(13, 11) Source(5, 12) + SourceIndex(3) -7 >Emitted(13, 19) Source(11, 2) + SourceIndex(3) ---- ->>>var normalC = /** @class */ (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > - > -1->Emitted(14, 1) Source(13, 1) + SourceIndex(3) ---- ->>> /*@internal*/ function normalC() { -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^ -1->class normalC { - > -2 > /*@internal*/ -3 > -1->Emitted(15, 5) Source(14, 5) + SourceIndex(3) -2 >Emitted(15, 18) Source(14, 18) + SourceIndex(3) -3 >Emitted(15, 19) Source(14, 19) + SourceIndex(3) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 >constructor() { -2 > } -1 >Emitted(16, 5) Source(14, 35) + SourceIndex(3) -2 >Emitted(16, 6) Source(14, 36) + SourceIndex(3) ---- ->>> /*@internal*/ normalC.prototype.method = function () { }; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^ -5 > ^^^ -6 > ^^^^^^^^^^^^^^ -7 > ^ -1-> - > /*@internal*/ prop: string; - > -2 > /*@internal*/ -3 > -4 > method -5 > -6 > method() { -7 > } -1->Emitted(17, 5) Source(16, 5) + SourceIndex(3) -2 >Emitted(17, 18) Source(16, 18) + SourceIndex(3) -3 >Emitted(17, 19) Source(16, 19) + SourceIndex(3) -4 >Emitted(17, 43) Source(16, 25) + SourceIndex(3) -5 >Emitted(17, 46) Source(16, 19) + SourceIndex(3) -6 >Emitted(17, 60) Source(16, 30) + SourceIndex(3) -7 >Emitted(17, 61) Source(16, 31) + SourceIndex(3) ---- ->>> Object.defineProperty(normalC.prototype, "c", { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^-> -1 > - > /*@internal*/ -2 > get -3 > c -1 >Emitted(18, 5) Source(17, 19) + SourceIndex(3) -2 >Emitted(18, 27) Source(17, 23) + SourceIndex(3) -3 >Emitted(18, 49) Source(17, 24) + SourceIndex(3) ---- ->>> /*@internal*/ get: function () { return 10; }, -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^ -4 > ^^^^^^^^^^^^^^ -5 > ^^^^^^^ -6 > ^^ -7 > ^ -8 > ^ -9 > ^ -1-> -2 > /*@internal*/ -3 > -4 > get c() { -5 > return -6 > 10 -7 > ; -8 > -9 > } -1->Emitted(19, 9) Source(17, 5) + SourceIndex(3) -2 >Emitted(19, 22) Source(17, 18) + SourceIndex(3) -3 >Emitted(19, 28) Source(17, 19) + SourceIndex(3) -4 >Emitted(19, 42) Source(17, 29) + SourceIndex(3) -5 >Emitted(19, 49) Source(17, 36) + SourceIndex(3) -6 >Emitted(19, 51) Source(17, 38) + SourceIndex(3) -7 >Emitted(19, 52) Source(17, 39) + SourceIndex(3) -8 >Emitted(19, 53) Source(17, 40) + SourceIndex(3) -9 >Emitted(19, 54) Source(17, 41) + SourceIndex(3) ---- ->>> /*@internal*/ set: function (val) { }, -1 >^^^^^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^ -4 > ^^^^^^^^^^ -5 > ^^^ -6 > ^^^^ -7 > ^ -1 > - > -2 > /*@internal*/ -3 > -4 > set c( -5 > val: number -6 > ) { -7 > } -1 >Emitted(20, 9) Source(18, 5) + SourceIndex(3) -2 >Emitted(20, 22) Source(18, 18) + SourceIndex(3) -3 >Emitted(20, 28) Source(18, 19) + SourceIndex(3) -4 >Emitted(20, 38) Source(18, 25) + SourceIndex(3) -5 >Emitted(20, 41) Source(18, 36) + SourceIndex(3) -6 >Emitted(20, 45) Source(18, 40) + SourceIndex(3) -7 >Emitted(20, 46) Source(18, 41) + SourceIndex(3) ---- ->>> enumerable: true, ->>> configurable: true ->>> }); -1 >^^^^^^^ -2 > ^^^^^^^^^^^^^-> -1 > -1 >Emitted(23, 8) Source(17, 41) + SourceIndex(3) ---- ->>> return normalC; -1->^^^^ -2 > ^^^^^^^^^^^^^^ -1-> - > /*@internal*/ set c(val: number) { } - > -2 > } -1->Emitted(24, 5) Source(19, 1) + SourceIndex(3) -2 >Emitted(24, 19) Source(19, 2) + SourceIndex(3) ---- ->>>}()); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^-> -1 > -2 >} -3 > -4 > class normalC { - > /*@internal*/ constructor() { } - > /*@internal*/ prop: string; - > /*@internal*/ method() { } - > /*@internal*/ get c() { return 10; } - > /*@internal*/ set c(val: number) { } - > } -1 >Emitted(25, 1) Source(19, 1) + SourceIndex(3) -2 >Emitted(25, 2) Source(19, 2) + SourceIndex(3) -3 >Emitted(25, 2) Source(13, 1) + SourceIndex(3) -4 >Emitted(25, 6) Source(19, 2) + SourceIndex(3) ---- ->>>var normalN; -1-> -2 >^^^^ -3 > ^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^-> -1-> - > -2 >namespace -3 > normalN -4 > { - > /*@internal*/ export class C { } - > /*@internal*/ export function foo() {} - > /*@internal*/ export namespace someNamespace { export class C {} } - > /*@internal*/ export namespace someOther.something { export class someClass {} } - > /*@internal*/ export import someImport = someNamespace.C; - > /*@internal*/ export type internalType = internalC; - > /*@internal*/ export const internalConst = 10; - > /*@internal*/ export enum internalEnum { a, b, c } - > } -1->Emitted(26, 1) Source(20, 1) + SourceIndex(3) -2 >Emitted(26, 5) Source(20, 11) + SourceIndex(3) -3 >Emitted(26, 12) Source(20, 18) + SourceIndex(3) -4 >Emitted(26, 13) Source(29, 2) + SourceIndex(3) ---- ->>>(function (normalN) { -1-> -2 >^^^^^^^^^^^ -3 > ^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 >namespace -3 > normalN -1->Emitted(27, 1) Source(20, 1) + SourceIndex(3) -2 >Emitted(27, 12) Source(20, 11) + SourceIndex(3) -3 >Emitted(27, 19) Source(20, 18) + SourceIndex(3) ---- ->>> /*@internal*/ var C = /** @class */ (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^^-> -1-> { - > -2 > /*@internal*/ -3 > -1->Emitted(28, 5) Source(21, 5) + SourceIndex(3) -2 >Emitted(28, 18) Source(21, 18) + SourceIndex(3) -3 >Emitted(28, 19) Source(21, 19) + SourceIndex(3) ---- ->>> function C() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(29, 9) Source(21, 19) + SourceIndex(3) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^-> -1->export class C { -2 > } -1->Emitted(30, 9) Source(21, 36) + SourceIndex(3) -2 >Emitted(30, 10) Source(21, 37) + SourceIndex(3) ---- ->>> return C; -1->^^^^^^^^ -2 > ^^^^^^^^ -1-> -2 > } -1->Emitted(31, 9) Source(21, 36) + SourceIndex(3) -2 >Emitted(31, 17) Source(21, 37) + SourceIndex(3) ---- ->>> }()); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class C { } -1 >Emitted(32, 5) Source(21, 36) + SourceIndex(3) -2 >Emitted(32, 6) Source(21, 37) + SourceIndex(3) -3 >Emitted(32, 6) Source(21, 19) + SourceIndex(3) -4 >Emitted(32, 10) Source(21, 37) + SourceIndex(3) ---- ->>> normalN.C = C; -1->^^^^ -2 > ^^^^^^^^^ -3 > ^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^-> -1-> -2 > C -3 > { } -4 > -1->Emitted(33, 5) Source(21, 32) + SourceIndex(3) -2 >Emitted(33, 14) Source(21, 33) + SourceIndex(3) -3 >Emitted(33, 18) Source(21, 37) + SourceIndex(3) -4 >Emitted(33, 19) Source(21, 37) + SourceIndex(3) ---- ->>> /*@internal*/ function foo() { } -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^ -5 > ^^^ -6 > ^^^^^ -7 > ^ -1-> - > -2 > /*@internal*/ -3 > -4 > export function -5 > foo -6 > () { -7 > } -1->Emitted(34, 5) Source(22, 5) + SourceIndex(3) -2 >Emitted(34, 18) Source(22, 18) + SourceIndex(3) -3 >Emitted(34, 19) Source(22, 19) + SourceIndex(3) -4 >Emitted(34, 28) Source(22, 35) + SourceIndex(3) -5 >Emitted(34, 31) Source(22, 38) + SourceIndex(3) -6 >Emitted(34, 36) Source(22, 42) + SourceIndex(3) -7 >Emitted(34, 37) Source(22, 43) + SourceIndex(3) ---- ->>> normalN.foo = foo; -1 >^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^^-> -1 > -2 > foo -3 > () {} -4 > -1 >Emitted(35, 5) Source(22, 35) + SourceIndex(3) -2 >Emitted(35, 16) Source(22, 38) + SourceIndex(3) -3 >Emitted(35, 22) Source(22, 43) + SourceIndex(3) -4 >Emitted(35, 23) Source(22, 43) + SourceIndex(3) ---- ->>> /*@internal*/ var someNamespace; -1->^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^ -5 > ^^^^^^^^^^^^^ -6 > ^ -1-> - > -2 > /*@internal*/ -3 > -4 > export namespace -5 > someNamespace -6 > { export class C {} } -1->Emitted(36, 5) Source(23, 5) + SourceIndex(3) -2 >Emitted(36, 18) Source(23, 18) + SourceIndex(3) -3 >Emitted(36, 19) Source(23, 19) + SourceIndex(3) -4 >Emitted(36, 23) Source(23, 36) + SourceIndex(3) -5 >Emitted(36, 36) Source(23, 49) + SourceIndex(3) -6 >Emitted(36, 37) Source(23, 71) + SourceIndex(3) ---- ->>> (function (someNamespace) { -1 >^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^-> -1 > -2 > export namespace -3 > someNamespace -1 >Emitted(37, 5) Source(23, 19) + SourceIndex(3) -2 >Emitted(37, 16) Source(23, 36) + SourceIndex(3) -3 >Emitted(37, 29) Source(23, 49) + SourceIndex(3) ---- ->>> var C = /** @class */ (function () { -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^-> -1-> { -1->Emitted(38, 9) Source(23, 52) + SourceIndex(3) ---- ->>> function C() { -1->^^^^^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(39, 13) Source(23, 52) + SourceIndex(3) ---- ->>> } -1->^^^^^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^-> -1->export class C { -2 > } -1->Emitted(40, 13) Source(23, 68) + SourceIndex(3) -2 >Emitted(40, 14) Source(23, 69) + SourceIndex(3) ---- ->>> return C; -1->^^^^^^^^^^^^ -2 > ^^^^^^^^ -1-> -2 > } -1->Emitted(41, 13) Source(23, 68) + SourceIndex(3) -2 >Emitted(41, 21) Source(23, 69) + SourceIndex(3) ---- ->>> }()); -1 >^^^^^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class C {} -1 >Emitted(42, 9) Source(23, 68) + SourceIndex(3) -2 >Emitted(42, 10) Source(23, 69) + SourceIndex(3) -3 >Emitted(42, 10) Source(23, 52) + SourceIndex(3) -4 >Emitted(42, 14) Source(23, 69) + SourceIndex(3) ---- ->>> someNamespace.C = C; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^ -3 > ^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 > C -3 > {} -4 > -1->Emitted(43, 9) Source(23, 65) + SourceIndex(3) -2 >Emitted(43, 24) Source(23, 66) + SourceIndex(3) -3 >Emitted(43, 28) Source(23, 69) + SourceIndex(3) -4 >Emitted(43, 29) Source(23, 69) + SourceIndex(3) ---- ->>> })(someNamespace = normalN.someNamespace || (normalN.someNamespace = {})); -1->^^^^ -2 > ^ -3 > ^^ -4 > ^^^^^^^^^^^^^ -5 > ^^^ -6 > ^^^^^^^^^^^^^^^^^^^^^ -7 > ^^^^^ -8 > ^^^^^^^^^^^^^^^^^^^^^ -9 > ^^^^^^^^ -1-> -2 > } -3 > -4 > someNamespace -5 > -6 > someNamespace -7 > -8 > someNamespace -9 > { export class C {} } -1->Emitted(44, 5) Source(23, 70) + SourceIndex(3) -2 >Emitted(44, 6) Source(23, 71) + SourceIndex(3) -3 >Emitted(44, 8) Source(23, 36) + SourceIndex(3) -4 >Emitted(44, 21) Source(23, 49) + SourceIndex(3) -5 >Emitted(44, 24) Source(23, 36) + SourceIndex(3) -6 >Emitted(44, 45) Source(23, 49) + SourceIndex(3) -7 >Emitted(44, 50) Source(23, 36) + SourceIndex(3) -8 >Emitted(44, 71) Source(23, 49) + SourceIndex(3) -9 >Emitted(44, 79) Source(23, 71) + SourceIndex(3) ---- ->>> /*@internal*/ var someOther; -1 >^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^ -5 > ^^^^^^^^^ -6 > ^ -1 > - > -2 > /*@internal*/ -3 > -4 > export namespace -5 > someOther -6 > .something { export class someClass {} } -1 >Emitted(45, 5) Source(24, 5) + SourceIndex(3) -2 >Emitted(45, 18) Source(24, 18) + SourceIndex(3) -3 >Emitted(45, 19) Source(24, 19) + SourceIndex(3) -4 >Emitted(45, 23) Source(24, 36) + SourceIndex(3) -5 >Emitted(45, 32) Source(24, 45) + SourceIndex(3) -6 >Emitted(45, 33) Source(24, 85) + SourceIndex(3) ---- ->>> (function (someOther) { -1 >^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^^^^ -1 > -2 > export namespace -3 > someOther -1 >Emitted(46, 5) Source(24, 19) + SourceIndex(3) -2 >Emitted(46, 16) Source(24, 36) + SourceIndex(3) -3 >Emitted(46, 25) Source(24, 45) + SourceIndex(3) ---- ->>> var something; -1 >^^^^^^^^ -2 > ^^^^ -3 > ^^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^-> -1 >. -2 > -3 > something -4 > { export class someClass {} } -1 >Emitted(47, 9) Source(24, 46) + SourceIndex(3) -2 >Emitted(47, 13) Source(24, 46) + SourceIndex(3) -3 >Emitted(47, 22) Source(24, 55) + SourceIndex(3) -4 >Emitted(47, 23) Source(24, 85) + SourceIndex(3) ---- ->>> (function (something) { -1->^^^^^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 > -3 > something -1->Emitted(48, 9) Source(24, 46) + SourceIndex(3) -2 >Emitted(48, 20) Source(24, 46) + SourceIndex(3) -3 >Emitted(48, 29) Source(24, 55) + SourceIndex(3) ---- ->>> var someClass = /** @class */ (function () { -1->^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> { -1->Emitted(49, 13) Source(24, 58) + SourceIndex(3) ---- ->>> function someClass() { -1->^^^^^^^^^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(50, 17) Source(24, 58) + SourceIndex(3) ---- ->>> } -1->^^^^^^^^^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^-> -1->export class someClass { -2 > } -1->Emitted(51, 17) Source(24, 82) + SourceIndex(3) -2 >Emitted(51, 18) Source(24, 83) + SourceIndex(3) ---- ->>> return someClass; -1->^^^^^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(52, 17) Source(24, 82) + SourceIndex(3) -2 >Emitted(52, 33) Source(24, 83) + SourceIndex(3) ---- ->>> }()); -1 >^^^^^^^^^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class someClass {} -1 >Emitted(53, 13) Source(24, 82) + SourceIndex(3) -2 >Emitted(53, 14) Source(24, 83) + SourceIndex(3) -3 >Emitted(53, 14) Source(24, 58) + SourceIndex(3) -4 >Emitted(53, 18) Source(24, 83) + SourceIndex(3) ---- ->>> something.someClass = someClass; -1->^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^ -3 > ^^^^^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 > someClass -3 > {} -4 > -1->Emitted(54, 13) Source(24, 71) + SourceIndex(3) -2 >Emitted(54, 32) Source(24, 80) + SourceIndex(3) -3 >Emitted(54, 44) Source(24, 83) + SourceIndex(3) -4 >Emitted(54, 45) Source(24, 83) + SourceIndex(3) ---- ->>> })(something = someOther.something || (someOther.something = {})); -1->^^^^^^^^ -2 > ^ -3 > ^^ -4 > ^^^^^^^^^ -5 > ^^^ -6 > ^^^^^^^^^^^^^^^^^^^ -7 > ^^^^^ -8 > ^^^^^^^^^^^^^^^^^^^ -9 > ^^^^^^^^ -1-> -2 > } -3 > -4 > something -5 > -6 > something -7 > -8 > something -9 > { export class someClass {} } -1->Emitted(55, 9) Source(24, 84) + SourceIndex(3) -2 >Emitted(55, 10) Source(24, 85) + SourceIndex(3) -3 >Emitted(55, 12) Source(24, 46) + SourceIndex(3) -4 >Emitted(55, 21) Source(24, 55) + SourceIndex(3) -5 >Emitted(55, 24) Source(24, 46) + SourceIndex(3) -6 >Emitted(55, 43) Source(24, 55) + SourceIndex(3) -7 >Emitted(55, 48) Source(24, 46) + SourceIndex(3) -8 >Emitted(55, 67) Source(24, 55) + SourceIndex(3) -9 >Emitted(55, 75) Source(24, 85) + SourceIndex(3) ---- ->>> })(someOther = normalN.someOther || (normalN.someOther = {})); -1 >^^^^ -2 > ^ -3 > ^^ -4 > ^^^^^^^^^ -5 > ^^^ -6 > ^^^^^^^^^^^^^^^^^ -7 > ^^^^^ -8 > ^^^^^^^^^^^^^^^^^ -9 > ^^^^^^^^ -1 > -2 > } -3 > -4 > someOther -5 > -6 > someOther -7 > -8 > someOther -9 > .something { export class someClass {} } -1 >Emitted(56, 5) Source(24, 84) + SourceIndex(3) -2 >Emitted(56, 6) Source(24, 85) + SourceIndex(3) -3 >Emitted(56, 8) Source(24, 36) + SourceIndex(3) -4 >Emitted(56, 17) Source(24, 45) + SourceIndex(3) -5 >Emitted(56, 20) Source(24, 36) + SourceIndex(3) -6 >Emitted(56, 37) Source(24, 45) + SourceIndex(3) -7 >Emitted(56, 42) Source(24, 36) + SourceIndex(3) -8 >Emitted(56, 59) Source(24, 45) + SourceIndex(3) -9 >Emitted(56, 67) Source(24, 85) + SourceIndex(3) ---- ->>> /*@internal*/ normalN.someImport = someNamespace.C; -1 >^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^ -5 > ^^^ -6 > ^^^^^^^^^^^^^ -7 > ^ -8 > ^ -9 > ^ -1 > - > -2 > /*@internal*/ -3 > export import -4 > someImport -5 > = -6 > someNamespace -7 > . -8 > C -9 > ; -1 >Emitted(57, 5) Source(25, 5) + SourceIndex(3) -2 >Emitted(57, 18) Source(25, 18) + SourceIndex(3) -3 >Emitted(57, 19) Source(25, 33) + SourceIndex(3) -4 >Emitted(57, 37) Source(25, 43) + SourceIndex(3) -5 >Emitted(57, 40) Source(25, 46) + SourceIndex(3) -6 >Emitted(57, 53) Source(25, 59) + SourceIndex(3) -7 >Emitted(57, 54) Source(25, 60) + SourceIndex(3) -8 >Emitted(57, 55) Source(25, 61) + SourceIndex(3) -9 >Emitted(57, 56) Source(25, 62) + SourceIndex(3) ---- ->>> /*@internal*/ normalN.internalConst = 10; -1 >^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^ -5 > ^^^ -6 > ^^ -7 > ^ -1 > - > /*@internal*/ export type internalType = internalC; - > -2 > /*@internal*/ -3 > export const -4 > internalConst -5 > = -6 > 10 -7 > ; -1 >Emitted(58, 5) Source(27, 5) + SourceIndex(3) -2 >Emitted(58, 18) Source(27, 18) + SourceIndex(3) -3 >Emitted(58, 19) Source(27, 32) + SourceIndex(3) -4 >Emitted(58, 40) Source(27, 45) + SourceIndex(3) -5 >Emitted(58, 43) Source(27, 48) + SourceIndex(3) -6 >Emitted(58, 45) Source(27, 50) + SourceIndex(3) -7 >Emitted(58, 46) Source(27, 51) + SourceIndex(3) ---- ->>> /*@internal*/ var internalEnum; -1 >^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^ -5 > ^^^^^^^^^^^^ -1 > - > -2 > /*@internal*/ -3 > -4 > export enum -5 > internalEnum { a, b, c } -1 >Emitted(59, 5) Source(28, 5) + SourceIndex(3) -2 >Emitted(59, 18) Source(28, 18) + SourceIndex(3) -3 >Emitted(59, 19) Source(28, 19) + SourceIndex(3) -4 >Emitted(59, 23) Source(28, 31) + SourceIndex(3) -5 >Emitted(59, 35) Source(28, 55) + SourceIndex(3) ---- ->>> (function (internalEnum) { -1 >^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 > export enum -3 > internalEnum -1 >Emitted(60, 5) Source(28, 19) + SourceIndex(3) -2 >Emitted(60, 16) Source(28, 31) + SourceIndex(3) -3 >Emitted(60, 28) Source(28, 43) + SourceIndex(3) ---- ->>> internalEnum[internalEnum["a"] = 0] = "a"; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^-> -1-> { -2 > a -3 > -1->Emitted(61, 9) Source(28, 46) + SourceIndex(3) -2 >Emitted(61, 50) Source(28, 47) + SourceIndex(3) -3 >Emitted(61, 51) Source(28, 47) + SourceIndex(3) ---- ->>> internalEnum[internalEnum["b"] = 1] = "b"; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^-> -1->, -2 > b -3 > -1->Emitted(62, 9) Source(28, 49) + SourceIndex(3) -2 >Emitted(62, 50) Source(28, 50) + SourceIndex(3) -3 >Emitted(62, 51) Source(28, 50) + SourceIndex(3) ---- ->>> internalEnum[internalEnum["c"] = 2] = "c"; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->, -2 > c -3 > -1->Emitted(63, 9) Source(28, 52) + SourceIndex(3) -2 >Emitted(63, 50) Source(28, 53) + SourceIndex(3) -3 >Emitted(63, 51) Source(28, 53) + SourceIndex(3) ---- ->>> })(internalEnum = normalN.internalEnum || (normalN.internalEnum = {})); -1->^^^^ -2 > ^ -3 > ^^ -4 > ^^^^^^^^^^^^ -5 > ^^^ -6 > ^^^^^^^^^^^^^^^^^^^^ -7 > ^^^^^ -8 > ^^^^^^^^^^^^^^^^^^^^ -9 > ^^^^^^^^ -1-> -2 > } -3 > -4 > internalEnum -5 > -6 > internalEnum -7 > -8 > internalEnum -9 > { a, b, c } -1->Emitted(64, 5) Source(28, 54) + SourceIndex(3) -2 >Emitted(64, 6) Source(28, 55) + SourceIndex(3) -3 >Emitted(64, 8) Source(28, 31) + SourceIndex(3) -4 >Emitted(64, 20) Source(28, 43) + SourceIndex(3) -5 >Emitted(64, 23) Source(28, 31) + SourceIndex(3) -6 >Emitted(64, 43) Source(28, 43) + SourceIndex(3) -7 >Emitted(64, 48) Source(28, 31) + SourceIndex(3) -8 >Emitted(64, 68) Source(28, 43) + SourceIndex(3) -9 >Emitted(64, 76) Source(28, 55) + SourceIndex(3) ---- ->>>})(normalN || (normalN = {})); -1 > -2 >^ -3 > ^^ -4 > ^^^^^^^ -5 > ^^^^^ -6 > ^^^^^^^ -7 > ^^^^^^^^ -8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -3 > -4 > normalN -5 > -6 > normalN -7 > { - > /*@internal*/ export class C { } - > /*@internal*/ export function foo() {} - > /*@internal*/ export namespace someNamespace { export class C {} } - > /*@internal*/ export namespace someOther.something { export class someClass {} } - > /*@internal*/ export import someImport = someNamespace.C; - > /*@internal*/ export type internalType = internalC; - > /*@internal*/ export const internalConst = 10; - > /*@internal*/ export enum internalEnum { a, b, c } - > } -1 >Emitted(65, 1) Source(29, 1) + SourceIndex(3) -2 >Emitted(65, 2) Source(29, 2) + SourceIndex(3) -3 >Emitted(65, 4) Source(20, 11) + SourceIndex(3) -4 >Emitted(65, 11) Source(20, 18) + SourceIndex(3) -5 >Emitted(65, 16) Source(20, 11) + SourceIndex(3) -6 >Emitted(65, 23) Source(20, 18) + SourceIndex(3) -7 >Emitted(65, 31) Source(29, 2) + SourceIndex(3) ---- ->>>/*@internal*/ var internalC = /** @class */ (function () { -1-> -2 >^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^-> -1-> - > -2 >/*@internal*/ -3 > -1->Emitted(66, 1) Source(30, 1) + SourceIndex(3) -2 >Emitted(66, 14) Source(30, 14) + SourceIndex(3) -3 >Emitted(66, 15) Source(30, 15) + SourceIndex(3) ---- ->>> function internalC() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(67, 5) Source(30, 15) + SourceIndex(3) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^-> -1->class internalC { -2 > } -1->Emitted(68, 5) Source(30, 32) + SourceIndex(3) -2 >Emitted(68, 6) Source(30, 33) + SourceIndex(3) ---- ->>> return internalC; -1->^^^^ -2 > ^^^^^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(69, 5) Source(30, 32) + SourceIndex(3) -2 >Emitted(69, 21) Source(30, 33) + SourceIndex(3) ---- ->>>}()); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > class internalC {} -1 >Emitted(70, 1) Source(30, 32) + SourceIndex(3) -2 >Emitted(70, 2) Source(30, 33) + SourceIndex(3) -3 >Emitted(70, 2) Source(30, 15) + SourceIndex(3) -4 >Emitted(70, 6) Source(30, 33) + SourceIndex(3) ---- ->>>/*@internal*/ function internalfoo() { } -1-> -2 >^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^ -5 > ^^^^^^^^^^^ -6 > ^^^^^ -7 > ^ -1-> - > -2 >/*@internal*/ -3 > -4 > function -5 > internalfoo -6 > () { -7 > } -1->Emitted(71, 1) Source(31, 1) + SourceIndex(3) -2 >Emitted(71, 14) Source(31, 14) + SourceIndex(3) -3 >Emitted(71, 15) Source(31, 15) + SourceIndex(3) -4 >Emitted(71, 24) Source(31, 24) + SourceIndex(3) -5 >Emitted(71, 35) Source(31, 35) + SourceIndex(3) -6 >Emitted(71, 40) Source(31, 39) + SourceIndex(3) -7 >Emitted(71, 41) Source(31, 40) + SourceIndex(3) ---- ->>>/*@internal*/ var internalNamespace; -1 > -2 >^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^ -6 > ^ -1 > - > -2 >/*@internal*/ -3 > -4 > namespace -5 > internalNamespace -6 > { export class someClass {} } -1 >Emitted(72, 1) Source(32, 1) + SourceIndex(3) -2 >Emitted(72, 14) Source(32, 14) + SourceIndex(3) -3 >Emitted(72, 15) Source(32, 15) + SourceIndex(3) -4 >Emitted(72, 19) Source(32, 25) + SourceIndex(3) -5 >Emitted(72, 36) Source(32, 42) + SourceIndex(3) -6 >Emitted(72, 37) Source(32, 72) + SourceIndex(3) ---- ->>>(function (internalNamespace) { -1 > -2 >^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >namespace -3 > internalNamespace -1 >Emitted(73, 1) Source(32, 15) + SourceIndex(3) -2 >Emitted(73, 12) Source(32, 25) + SourceIndex(3) -3 >Emitted(73, 29) Source(32, 42) + SourceIndex(3) ---- ->>> var someClass = /** @class */ (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> { -1->Emitted(74, 5) Source(32, 45) + SourceIndex(3) ---- ->>> function someClass() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(75, 9) Source(32, 45) + SourceIndex(3) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^-> -1->export class someClass { -2 > } -1->Emitted(76, 9) Source(32, 69) + SourceIndex(3) -2 >Emitted(76, 10) Source(32, 70) + SourceIndex(3) ---- ->>> return someClass; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(77, 9) Source(32, 69) + SourceIndex(3) -2 >Emitted(77, 25) Source(32, 70) + SourceIndex(3) ---- ->>> }()); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class someClass {} -1 >Emitted(78, 5) Source(32, 69) + SourceIndex(3) -2 >Emitted(78, 6) Source(32, 70) + SourceIndex(3) -3 >Emitted(78, 6) Source(32, 45) + SourceIndex(3) -4 >Emitted(78, 10) Source(32, 70) + SourceIndex(3) ---- ->>> internalNamespace.someClass = someClass; -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^^^^^^^^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 > someClass -3 > {} -4 > -1->Emitted(79, 5) Source(32, 58) + SourceIndex(3) -2 >Emitted(79, 32) Source(32, 67) + SourceIndex(3) -3 >Emitted(79, 44) Source(32, 70) + SourceIndex(3) -4 >Emitted(79, 45) Source(32, 70) + SourceIndex(3) ---- ->>>})(internalNamespace || (internalNamespace = {})); -1-> -2 >^ -3 > ^^ -4 > ^^^^^^^^^^^^^^^^^ -5 > ^^^^^ -6 > ^^^^^^^^^^^^^^^^^ -7 > ^^^^^^^^ -1-> -2 >} -3 > -4 > internalNamespace -5 > -6 > internalNamespace -7 > { export class someClass {} } -1->Emitted(80, 1) Source(32, 71) + SourceIndex(3) -2 >Emitted(80, 2) Source(32, 72) + SourceIndex(3) -3 >Emitted(80, 4) Source(32, 25) + SourceIndex(3) -4 >Emitted(80, 21) Source(32, 42) + SourceIndex(3) -5 >Emitted(80, 26) Source(32, 25) + SourceIndex(3) -6 >Emitted(80, 43) Source(32, 42) + SourceIndex(3) -7 >Emitted(80, 51) Source(32, 72) + SourceIndex(3) ---- ->>>/*@internal*/ var internalOther; -1 > -2 >^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^ -5 > ^^^^^^^^^^^^^ -6 > ^ -1 > - > -2 >/*@internal*/ -3 > -4 > namespace -5 > internalOther -6 > .something { export class someClass {} } -1 >Emitted(81, 1) Source(33, 1) + SourceIndex(3) -2 >Emitted(81, 14) Source(33, 14) + SourceIndex(3) -3 >Emitted(81, 15) Source(33, 15) + SourceIndex(3) -4 >Emitted(81, 19) Source(33, 25) + SourceIndex(3) -5 >Emitted(81, 32) Source(33, 38) + SourceIndex(3) -6 >Emitted(81, 33) Source(33, 78) + SourceIndex(3) ---- ->>>(function (internalOther) { -1 > -2 >^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^ -1 > -2 >namespace -3 > internalOther -1 >Emitted(82, 1) Source(33, 15) + SourceIndex(3) -2 >Emitted(82, 12) Source(33, 25) + SourceIndex(3) -3 >Emitted(82, 25) Source(33, 38) + SourceIndex(3) ---- ->>> var something; -1 >^^^^ -2 > ^^^^ -3 > ^^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^-> -1 >. -2 > -3 > something -4 > { export class someClass {} } -1 >Emitted(83, 5) Source(33, 39) + SourceIndex(3) -2 >Emitted(83, 9) Source(33, 39) + SourceIndex(3) -3 >Emitted(83, 18) Source(33, 48) + SourceIndex(3) -4 >Emitted(83, 19) Source(33, 78) + SourceIndex(3) ---- ->>> (function (something) { -1->^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 > -3 > something -1->Emitted(84, 5) Source(33, 39) + SourceIndex(3) -2 >Emitted(84, 16) Source(33, 39) + SourceIndex(3) -3 >Emitted(84, 25) Source(33, 48) + SourceIndex(3) ---- ->>> var someClass = /** @class */ (function () { -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> { -1->Emitted(85, 9) Source(33, 51) + SourceIndex(3) ---- ->>> function someClass() { -1->^^^^^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(86, 13) Source(33, 51) + SourceIndex(3) ---- ->>> } -1->^^^^^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^-> -1->export class someClass { -2 > } -1->Emitted(87, 13) Source(33, 75) + SourceIndex(3) -2 >Emitted(87, 14) Source(33, 76) + SourceIndex(3) ---- ->>> return someClass; -1->^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(88, 13) Source(33, 75) + SourceIndex(3) -2 >Emitted(88, 29) Source(33, 76) + SourceIndex(3) ---- ->>> }()); -1 >^^^^^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class someClass {} -1 >Emitted(89, 9) Source(33, 75) + SourceIndex(3) -2 >Emitted(89, 10) Source(33, 76) + SourceIndex(3) -3 >Emitted(89, 10) Source(33, 51) + SourceIndex(3) -4 >Emitted(89, 14) Source(33, 76) + SourceIndex(3) ---- ->>> something.someClass = someClass; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^ -3 > ^^^^^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 > someClass -3 > {} -4 > -1->Emitted(90, 9) Source(33, 64) + SourceIndex(3) -2 >Emitted(90, 28) Source(33, 73) + SourceIndex(3) -3 >Emitted(90, 40) Source(33, 76) + SourceIndex(3) -4 >Emitted(90, 41) Source(33, 76) + SourceIndex(3) ---- ->>> })(something = internalOther.something || (internalOther.something = {})); -1->^^^^ -2 > ^ -3 > ^^ -4 > ^^^^^^^^^ -5 > ^^^ -6 > ^^^^^^^^^^^^^^^^^^^^^^^ -7 > ^^^^^ -8 > ^^^^^^^^^^^^^^^^^^^^^^^ -9 > ^^^^^^^^ -1-> -2 > } -3 > -4 > something -5 > -6 > something -7 > -8 > something -9 > { export class someClass {} } -1->Emitted(91, 5) Source(33, 77) + SourceIndex(3) -2 >Emitted(91, 6) Source(33, 78) + SourceIndex(3) -3 >Emitted(91, 8) Source(33, 39) + SourceIndex(3) -4 >Emitted(91, 17) Source(33, 48) + SourceIndex(3) -5 >Emitted(91, 20) Source(33, 39) + SourceIndex(3) -6 >Emitted(91, 43) Source(33, 48) + SourceIndex(3) -7 >Emitted(91, 48) Source(33, 39) + SourceIndex(3) -8 >Emitted(91, 71) Source(33, 48) + SourceIndex(3) -9 >Emitted(91, 79) Source(33, 78) + SourceIndex(3) ---- ->>>})(internalOther || (internalOther = {})); -1 > -2 >^ -3 > ^^ -4 > ^^^^^^^^^^^^^ -5 > ^^^^^ -6 > ^^^^^^^^^^^^^ -7 > ^^^^^^^^ -8 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > internalOther -5 > -6 > internalOther -7 > .something { export class someClass {} } -1 >Emitted(92, 1) Source(33, 77) + SourceIndex(3) -2 >Emitted(92, 2) Source(33, 78) + SourceIndex(3) -3 >Emitted(92, 4) Source(33, 25) + SourceIndex(3) -4 >Emitted(92, 17) Source(33, 38) + SourceIndex(3) -5 >Emitted(92, 22) Source(33, 25) + SourceIndex(3) -6 >Emitted(92, 35) Source(33, 38) + SourceIndex(3) -7 >Emitted(92, 43) Source(33, 78) + SourceIndex(3) ---- ->>>/*@internal*/ var internalImport = internalNamespace.someClass; -1-> -2 >^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^ -5 > ^^^^^^^^^^^^^^ -6 > ^^^ -7 > ^^^^^^^^^^^^^^^^^ -8 > ^ -9 > ^^^^^^^^^ -10> ^ -1-> - > -2 >/*@internal*/ -3 > -4 > import -5 > internalImport -6 > = -7 > internalNamespace -8 > . -9 > someClass -10> ; -1->Emitted(93, 1) Source(34, 1) + SourceIndex(3) -2 >Emitted(93, 14) Source(34, 14) + SourceIndex(3) -3 >Emitted(93, 15) Source(34, 15) + SourceIndex(3) -4 >Emitted(93, 19) Source(34, 22) + SourceIndex(3) -5 >Emitted(93, 33) Source(34, 36) + SourceIndex(3) -6 >Emitted(93, 36) Source(34, 39) + SourceIndex(3) -7 >Emitted(93, 53) Source(34, 56) + SourceIndex(3) -8 >Emitted(93, 54) Source(34, 57) + SourceIndex(3) -9 >Emitted(93, 63) Source(34, 66) + SourceIndex(3) -10>Emitted(93, 64) Source(34, 67) + SourceIndex(3) ---- ->>>/*@internal*/ var internalConst = 10; -1 > -2 >^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^ -5 > ^^^^^^^^^^^^^ -6 > ^^^ -7 > ^^ -8 > ^ -1 > - >/*@internal*/ type internalType = internalC; - > -2 >/*@internal*/ -3 > -4 > const -5 > internalConst -6 > = -7 > 10 -8 > ; -1 >Emitted(94, 1) Source(36, 1) + SourceIndex(3) -2 >Emitted(94, 14) Source(36, 14) + SourceIndex(3) -3 >Emitted(94, 15) Source(36, 15) + SourceIndex(3) -4 >Emitted(94, 19) Source(36, 21) + SourceIndex(3) -5 >Emitted(94, 32) Source(36, 34) + SourceIndex(3) -6 >Emitted(94, 35) Source(36, 37) + SourceIndex(3) -7 >Emitted(94, 37) Source(36, 39) + SourceIndex(3) -8 >Emitted(94, 38) Source(36, 40) + SourceIndex(3) ---- ->>>/*@internal*/ var internalEnum; -1 > -2 >^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^ -5 > ^^^^^^^^^^^^ -1 > - > -2 >/*@internal*/ -3 > -4 > enum -5 > internalEnum { a, b, c } -1 >Emitted(95, 1) Source(37, 1) + SourceIndex(3) -2 >Emitted(95, 14) Source(37, 14) + SourceIndex(3) -3 >Emitted(95, 15) Source(37, 15) + SourceIndex(3) -4 >Emitted(95, 19) Source(37, 20) + SourceIndex(3) -5 >Emitted(95, 31) Source(37, 44) + SourceIndex(3) ---- ->>>(function (internalEnum) { -1 > -2 >^^^^^^^^^^^ -3 > ^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >enum -3 > internalEnum -1 >Emitted(96, 1) Source(37, 15) + SourceIndex(3) -2 >Emitted(96, 12) Source(37, 20) + SourceIndex(3) -3 >Emitted(96, 24) Source(37, 32) + SourceIndex(3) ---- ->>> internalEnum[internalEnum["a"] = 0] = "a"; -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^-> -1-> { -2 > a -3 > -1->Emitted(97, 5) Source(37, 35) + SourceIndex(3) -2 >Emitted(97, 46) Source(37, 36) + SourceIndex(3) -3 >Emitted(97, 47) Source(37, 36) + SourceIndex(3) ---- ->>> internalEnum[internalEnum["b"] = 1] = "b"; -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^-> -1->, -2 > b -3 > -1->Emitted(98, 5) Source(37, 38) + SourceIndex(3) -2 >Emitted(98, 46) Source(37, 39) + SourceIndex(3) -3 >Emitted(98, 47) Source(37, 39) + SourceIndex(3) ---- ->>> internalEnum[internalEnum["c"] = 2] = "c"; -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -1->, -2 > c -3 > -1->Emitted(99, 5) Source(37, 41) + SourceIndex(3) -2 >Emitted(99, 46) Source(37, 42) + SourceIndex(3) -3 >Emitted(99, 47) Source(37, 42) + SourceIndex(3) ---- ->>>})(internalEnum || (internalEnum = {})); -1 > -2 >^ -3 > ^^ -4 > ^^^^^^^^^^^^ -5 > ^^^^^ -6 > ^^^^^^^^^^^^ -7 > ^^^^^^^^ -1 > -2 >} -3 > -4 > internalEnum -5 > -6 > internalEnum -7 > { a, b, c } -1 >Emitted(100, 1) Source(37, 43) + SourceIndex(3) -2 >Emitted(100, 2) Source(37, 44) + SourceIndex(3) -3 >Emitted(100, 4) Source(37, 20) + SourceIndex(3) -4 >Emitted(100, 16) Source(37, 32) + SourceIndex(3) -5 >Emitted(100, 21) Source(37, 20) + SourceIndex(3) -6 >Emitted(100, 33) Source(37, 32) + SourceIndex(3) -7 >Emitted(100, 41) Source(37, 44) + SourceIndex(3) ---- -------------------------------------------------------------------- -emittedFile:/src/third/thirdjs/output/third-output.js -sourceFile:../../../second/second_part2.ts -------------------------------------------------------------------- ->>>var C = /** @class */ (function () { -1 > -2 >^^^^^^^^^^^^^^^^^^^-> -1 > -1 >Emitted(101, 1) Source(1, 1) + SourceIndex(4) ---- ->>> function C() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(102, 5) Source(1, 1) + SourceIndex(4) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->class C { - > doSomething() { - > console.log("something got done"); - > } - > -2 > } -1->Emitted(103, 5) Source(5, 1) + SourceIndex(4) -2 >Emitted(103, 6) Source(5, 2) + SourceIndex(4) ---- ->>> C.prototype.doSomething = function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^^^^^^^^^^-> -1-> -2 > doSomething -3 > -1->Emitted(104, 5) Source(2, 5) + SourceIndex(4) -2 >Emitted(104, 28) Source(2, 16) + SourceIndex(4) -3 >Emitted(104, 31) Source(2, 5) + SourceIndex(4) ---- ->>> console.log("something got done"); -1->^^^^^^^^ -2 > ^^^^^^^ -3 > ^ -4 > ^^^ -5 > ^ -6 > ^^^^^^^^^^^^^^^^^^^^ -7 > ^ -8 > ^ -1->doSomething() { - > -2 > console -3 > . -4 > log -5 > ( -6 > "something got done" -7 > ) -8 > ; -1->Emitted(105, 9) Source(3, 9) + SourceIndex(4) -2 >Emitted(105, 16) Source(3, 16) + SourceIndex(4) -3 >Emitted(105, 17) Source(3, 17) + SourceIndex(4) -4 >Emitted(105, 20) Source(3, 20) + SourceIndex(4) -5 >Emitted(105, 21) Source(3, 21) + SourceIndex(4) -6 >Emitted(105, 41) Source(3, 41) + SourceIndex(4) -7 >Emitted(105, 42) Source(3, 42) + SourceIndex(4) -8 >Emitted(105, 43) Source(3, 43) + SourceIndex(4) ---- ->>> }; -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(106, 5) Source(4, 5) + SourceIndex(4) -2 >Emitted(106, 6) Source(4, 6) + SourceIndex(4) ---- ->>> return C; -1->^^^^ -2 > ^^^^^^^^ -1-> - > -2 > } -1->Emitted(107, 5) Source(5, 1) + SourceIndex(4) -2 >Emitted(107, 13) Source(5, 2) + SourceIndex(4) ---- ->>>}()); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > class C { - > doSomething() { - > console.log("something got done"); - > } - > } -1 >Emitted(108, 1) Source(5, 1) + SourceIndex(4) -2 >Emitted(108, 2) Source(5, 2) + SourceIndex(4) -3 >Emitted(108, 2) Source(1, 1) + SourceIndex(4) -4 >Emitted(108, 6) Source(5, 2) + SourceIndex(4) ---- -------------------------------------------------------------------- -emittedFile:/src/third/thirdjs/output/third-output.js -sourceFile:../../third_part1.ts -------------------------------------------------------------------- ->>>var c = new C(); -1-> -2 >^^^^ -3 > ^ -4 > ^^^ -5 > ^^^^ -6 > ^ -7 > ^^ -8 > ^ -9 > ^-> -1-> -2 >var -3 > c -4 > = -5 > new -6 > C -7 > () -8 > ; -1->Emitted(109, 1) Source(1, 1) + SourceIndex(5) -2 >Emitted(109, 5) Source(1, 5) + SourceIndex(5) -3 >Emitted(109, 6) Source(1, 6) + SourceIndex(5) -4 >Emitted(109, 9) Source(1, 9) + SourceIndex(5) -5 >Emitted(109, 13) Source(1, 13) + SourceIndex(5) -6 >Emitted(109, 14) Source(1, 14) + SourceIndex(5) -7 >Emitted(109, 16) Source(1, 16) + SourceIndex(5) -8 >Emitted(109, 17) Source(1, 17) + SourceIndex(5) ---- ->>>c.doSomething(); -1-> -2 >^ -3 > ^ -4 > ^^^^^^^^^^^ -5 > ^^ -6 > ^ -7 > ^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -2 >c -3 > . -4 > doSomething -5 > () -6 > ; -1->Emitted(110, 1) Source(2, 1) + SourceIndex(5) -2 >Emitted(110, 2) Source(2, 2) + SourceIndex(5) -3 >Emitted(110, 3) Source(2, 3) + SourceIndex(5) -4 >Emitted(110, 14) Source(2, 14) + SourceIndex(5) -5 >Emitted(110, 16) Source(2, 16) + SourceIndex(5) -6 >Emitted(110, 17) Source(2, 17) + SourceIndex(5) ---- ->>>//# sourceMappingURL=third-output.js.map - //// [/src/third/thirdjs/output/third-output.tsbuildinfo] { "bundle": { diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/stripInternal.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/stripInternal.js index 4c263d59de860..a048c6ecd75ad 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/stripInternal.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/stripInternal.js @@ -1,3 +1,48 @@ +//// [/lib/incremental-headers-change-without-dts-changesOutput.txt] +/lib/tsc --b /src/third --verbose +12:12:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:12:00 AM - Project 'src/first/tsconfig.json' is out of date because oldest output 'src/first/bin/first-output.js' is older than newest input 'src/first/first_PART1.ts' + +12:12:00 AM - Building project '/src/first/tsconfig.json'... + +12:12:00 AM - Project 'src/second/tsconfig.json' is up to date because newest input 'src/second/second_part1.ts' is older than oldest output 'src/2/second-output.js' + +12:12:00 AM - Project 'src/third/tsconfig.json' is out of date because output of its dependency 'src/first' has changed + +12:12:00 AM - Updating output of project '/src/third/tsconfig.json'... + +12:12:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... + +exitCode:: 0 +readFiles:: { + "/src/third/tsconfig.json": 1, + "/src/first/tsconfig.json": 1, + "/src/second/tsconfig.json": 1, + "/src/first/first_PART1.ts": 1, + "/src/first/first_part2.ts": 1, + "/src/first/first_part3.ts": 1, + "/src/first/bin/first-output.d.ts": 1, + "/src/2/second-output.tsbuildinfo": 1, + "/src/third/thirdjs/output/third-output.tsbuildinfo": 1, + "/src/third/thirdjs/output/third-output.js": 1, + "/src/third/thirdjs/output/third-output.js.map": 1, + "/src/third/thirdjs/output/third-output.d.ts": 1, + "/src/third/thirdjs/output/third-output.d.ts.map": 1, + "/src/first/bin/first-output.tsbuildinfo": 1, + "/src/first/bin/first-output.js": 1, + "/src/2/second-output.js": 1, + "/src/first/bin/first-output.js.map": 1, + "/src/2/second-output.js.map": 1, + "/src/2/second-output.d.ts": 1, + "/src/first/bin/first-output.d.ts.map": 1, + "/src/2/second-output.d.ts.map": 1 +} + +//// [/src/first/bin/first-output.d.ts] file written with same contents //// [/src/first/bin/first-output.d.ts.map] {"version":3,"file":"first-output.d.ts","sourceRoot":"","sources":["../first_PART1.ts","../first_part2.ts","../first_part3.ts"],"names":[],"mappings":"AAAA,UAAU,QAAQ;IACd,IAAI,EAAE,GAAG,CAAC;CACb;AAED,QAAA,MAAM,CAAC,iBAAiB,CAAC;AAEzB,UAAU,iBAAiB;IACvB,IAAI,EAAE,GAAG,CAAC;CACb;AERD,iBAAS,CAAC,WAET"} @@ -131,6 +176,8 @@ sourceFile:../first_part3.ts --- >>>//# sourceMappingURL=first-output.d.ts.map +//// [/src/first/bin/first-output.js] file written with same contents +//// [/src/first/bin/first-output.js.map] file written with same contents //// [/src/first/bin/first-output.js.map.baseline.txt] =================================================================== JsFile: first-output.js @@ -671,1640 +718,6 @@ sourceFile:../../third_part1.ts --- >>>//# sourceMappingURL=third-output.d.ts.map -//// [/src/third/thirdjs/output/third-output.js.map.baseline.txt] -=================================================================== -JsFile: third-output.js -mapUrl: third-output.js.map -sourceRoot: -sources: ../../../first/first_PART1.ts,../../../first/first_part2.ts,../../../first/first_part3.ts,../../../second/second_part1.ts,../../../second/second_part2.ts,../../third_part1.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:/src/third/thirdjs/output/third-output.js -sourceFile:../../../first/first_PART1.ts -------------------------------------------------------------------- ->>>var s = "Hello, world"; -1 > -2 >^^^^ -3 > ^ -4 > ^^^ -5 > ^^^^^^^^^^^^^^ -6 > ^ -1 >interface TheFirst { - > none: any; - >} - > - > -2 >const -3 > s -4 > = -5 > "Hello, world" -6 > ; -1 >Emitted(1, 1) Source(5, 1) + SourceIndex(0) -2 >Emitted(1, 5) Source(5, 7) + SourceIndex(0) -3 >Emitted(1, 6) Source(5, 8) + SourceIndex(0) -4 >Emitted(1, 9) Source(5, 11) + SourceIndex(0) -5 >Emitted(1, 23) Source(5, 25) + SourceIndex(0) -6 >Emitted(1, 24) Source(5, 26) + SourceIndex(0) ---- ->>>console.log(s); -1 > -2 >^^^^^^^ -3 > ^ -4 > ^^^ -5 > ^ -6 > ^ -7 > ^ -8 > ^ -9 > ^^^-> -1 > - > - >interface NoJsForHereEither { - > none: any; - >} - > - > -2 >console -3 > . -4 > log -5 > ( -6 > s -7 > ) -8 > ; -1 >Emitted(2, 1) Source(11, 1) + SourceIndex(0) -2 >Emitted(2, 8) Source(11, 8) + SourceIndex(0) -3 >Emitted(2, 9) Source(11, 9) + SourceIndex(0) -4 >Emitted(2, 12) Source(11, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(11, 13) + SourceIndex(0) -6 >Emitted(2, 14) Source(11, 14) + SourceIndex(0) -7 >Emitted(2, 15) Source(11, 15) + SourceIndex(0) -8 >Emitted(2, 16) Source(11, 16) + SourceIndex(0) ---- -------------------------------------------------------------------- -emittedFile:/src/third/thirdjs/output/third-output.js -sourceFile:../../../first/first_part2.ts -------------------------------------------------------------------- ->>>console.log(f()); -1-> -2 >^^^^^^^ -3 > ^ -4 > ^^^ -5 > ^ -6 > ^ -7 > ^^ -8 > ^ -9 > ^ -1-> -2 >console -3 > . -4 > log -5 > ( -6 > f -7 > () -8 > ) -9 > ; -1->Emitted(3, 1) Source(1, 1) + SourceIndex(1) -2 >Emitted(3, 8) Source(1, 8) + SourceIndex(1) -3 >Emitted(3, 9) Source(1, 9) + SourceIndex(1) -4 >Emitted(3, 12) Source(1, 12) + SourceIndex(1) -5 >Emitted(3, 13) Source(1, 13) + SourceIndex(1) -6 >Emitted(3, 14) Source(1, 14) + SourceIndex(1) -7 >Emitted(3, 16) Source(1, 16) + SourceIndex(1) -8 >Emitted(3, 17) Source(1, 17) + SourceIndex(1) -9 >Emitted(3, 18) Source(1, 18) + SourceIndex(1) ---- -------------------------------------------------------------------- -emittedFile:/src/third/thirdjs/output/third-output.js -sourceFile:../../../first/first_part3.ts -------------------------------------------------------------------- ->>>function f() { -1 > -2 >^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^-> -1 > -2 >function -3 > f -1 >Emitted(4, 1) Source(1, 1) + SourceIndex(2) -2 >Emitted(4, 10) Source(1, 10) + SourceIndex(2) -3 >Emitted(4, 11) Source(1, 11) + SourceIndex(2) ---- ->>> return "JS does hoists"; -1->^^^^ -2 > ^^^^^^^ -3 > ^^^^^^^^^^^^^^^^ -4 > ^ -1->() { - > -2 > return -3 > "JS does hoists" -4 > ; -1->Emitted(5, 5) Source(2, 5) + SourceIndex(2) -2 >Emitted(5, 12) Source(2, 12) + SourceIndex(2) -3 >Emitted(5, 28) Source(2, 28) + SourceIndex(2) -4 >Emitted(5, 29) Source(2, 29) + SourceIndex(2) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^-> -1 > - > -2 >} -1 >Emitted(6, 1) Source(3, 1) + SourceIndex(2) -2 >Emitted(6, 2) Source(3, 2) + SourceIndex(2) ---- -------------------------------------------------------------------- -emittedFile:/src/third/thirdjs/output/third-output.js -sourceFile:../../../second/second_part1.ts -------------------------------------------------------------------- ->>>var N; -1-> -2 >^^^^ -3 > ^ -4 > ^ -5 > ^^^^^^^^^^-> -1->namespace N { - > // Comment text - >} - > - > -2 >namespace -3 > N -4 > { - > function f() { - > console.log('testing'); - > } - > - > f(); - > } -1->Emitted(7, 1) Source(5, 1) + SourceIndex(3) -2 >Emitted(7, 5) Source(5, 11) + SourceIndex(3) -3 >Emitted(7, 6) Source(5, 12) + SourceIndex(3) -4 >Emitted(7, 7) Source(11, 2) + SourceIndex(3) ---- ->>>(function (N) { -1-> -2 >^^^^^^^^^^^ -3 > ^ -4 > ^^^^^^^-> -1-> -2 >namespace -3 > N -1->Emitted(8, 1) Source(5, 1) + SourceIndex(3) -2 >Emitted(8, 12) Source(5, 11) + SourceIndex(3) -3 >Emitted(8, 13) Source(5, 12) + SourceIndex(3) ---- ->>> function f() { -1->^^^^ -2 > ^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^-> -1-> { - > -2 > function -3 > f -1->Emitted(9, 5) Source(6, 5) + SourceIndex(3) -2 >Emitted(9, 14) Source(6, 14) + SourceIndex(3) -3 >Emitted(9, 15) Source(6, 15) + SourceIndex(3) ---- ->>> console.log('testing'); -1->^^^^^^^^ -2 > ^^^^^^^ -3 > ^ -4 > ^^^ -5 > ^ -6 > ^^^^^^^^^ -7 > ^ -8 > ^ -1->() { - > -2 > console -3 > . -4 > log -5 > ( -6 > 'testing' -7 > ) -8 > ; -1->Emitted(10, 9) Source(7, 9) + SourceIndex(3) -2 >Emitted(10, 16) Source(7, 16) + SourceIndex(3) -3 >Emitted(10, 17) Source(7, 17) + SourceIndex(3) -4 >Emitted(10, 20) Source(7, 20) + SourceIndex(3) -5 >Emitted(10, 21) Source(7, 21) + SourceIndex(3) -6 >Emitted(10, 30) Source(7, 30) + SourceIndex(3) -7 >Emitted(10, 31) Source(7, 31) + SourceIndex(3) -8 >Emitted(10, 32) Source(7, 32) + SourceIndex(3) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^-> -1 > - > -2 > } -1 >Emitted(11, 5) Source(8, 5) + SourceIndex(3) -2 >Emitted(11, 6) Source(8, 6) + SourceIndex(3) ---- ->>> f(); -1->^^^^ -2 > ^ -3 > ^^ -4 > ^ -5 > ^^^^^^^^^^^-> -1-> - > - > -2 > f -3 > () -4 > ; -1->Emitted(12, 5) Source(10, 5) + SourceIndex(3) -2 >Emitted(12, 6) Source(10, 6) + SourceIndex(3) -3 >Emitted(12, 8) Source(10, 8) + SourceIndex(3) -4 >Emitted(12, 9) Source(10, 9) + SourceIndex(3) ---- ->>>})(N || (N = {})); -1-> -2 >^ -3 > ^^ -4 > ^ -5 > ^^^^^ -6 > ^ -7 > ^^^^^^^^ -8 > ^^^^^^^^^^^-> -1-> - > -2 >} -3 > -4 > N -5 > -6 > N -7 > { - > function f() { - > console.log('testing'); - > } - > - > f(); - > } -1->Emitted(13, 1) Source(11, 1) + SourceIndex(3) -2 >Emitted(13, 2) Source(11, 2) + SourceIndex(3) -3 >Emitted(13, 4) Source(5, 11) + SourceIndex(3) -4 >Emitted(13, 5) Source(5, 12) + SourceIndex(3) -5 >Emitted(13, 10) Source(5, 11) + SourceIndex(3) -6 >Emitted(13, 11) Source(5, 12) + SourceIndex(3) -7 >Emitted(13, 19) Source(11, 2) + SourceIndex(3) ---- ->>>var normalC = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > - > -1->Emitted(14, 1) Source(13, 1) + SourceIndex(3) ---- ->>> function normalC() { -1->^^^^ -2 > ^^-> -1->class normalC { - > /*@internal*/ -1->Emitted(15, 5) Source(14, 19) + SourceIndex(3) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->constructor() { -2 > } -1->Emitted(16, 5) Source(14, 35) + SourceIndex(3) -2 >Emitted(16, 6) Source(14, 36) + SourceIndex(3) ---- ->>> normalC.prototype.method = function () { }; -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^^^^^^^^^^^ -5 > ^ -6 > ^^^^^^-> -1-> - > /*@internal*/ prop: string; - > /*@internal*/ -2 > method -3 > -4 > method() { -5 > } -1->Emitted(17, 5) Source(16, 19) + SourceIndex(3) -2 >Emitted(17, 29) Source(16, 25) + SourceIndex(3) -3 >Emitted(17, 32) Source(16, 19) + SourceIndex(3) -4 >Emitted(17, 46) Source(16, 30) + SourceIndex(3) -5 >Emitted(17, 47) Source(16, 31) + SourceIndex(3) ---- ->>> Object.defineProperty(normalC.prototype, "c", { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^^^^^^^^^^ -1-> - > /*@internal*/ -2 > get -3 > c -1->Emitted(18, 5) Source(17, 19) + SourceIndex(3) -2 >Emitted(18, 27) Source(17, 23) + SourceIndex(3) -3 >Emitted(18, 49) Source(17, 24) + SourceIndex(3) ---- ->>> get: function () { return 10; }, -1 >^^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^ -3 > ^^^^^^^ -4 > ^^ -5 > ^ -6 > ^ -7 > ^ -1 > -2 > get c() { -3 > return -4 > 10 -5 > ; -6 > -7 > } -1 >Emitted(19, 14) Source(17, 19) + SourceIndex(3) -2 >Emitted(19, 28) Source(17, 29) + SourceIndex(3) -3 >Emitted(19, 35) Source(17, 36) + SourceIndex(3) -4 >Emitted(19, 37) Source(17, 38) + SourceIndex(3) -5 >Emitted(19, 38) Source(17, 39) + SourceIndex(3) -6 >Emitted(19, 39) Source(17, 40) + SourceIndex(3) -7 >Emitted(19, 40) Source(17, 41) + SourceIndex(3) ---- ->>> set: function (val) { }, -1 >^^^^^^^^^^^^^ -2 > ^^^^^^^^^^ -3 > ^^^ -4 > ^^^^ -5 > ^ -1 > - > /*@internal*/ -2 > set c( -3 > val: number -4 > ) { -5 > } -1 >Emitted(20, 14) Source(18, 19) + SourceIndex(3) -2 >Emitted(20, 24) Source(18, 25) + SourceIndex(3) -3 >Emitted(20, 27) Source(18, 36) + SourceIndex(3) -4 >Emitted(20, 31) Source(18, 40) + SourceIndex(3) -5 >Emitted(20, 32) Source(18, 41) + SourceIndex(3) ---- ->>> enumerable: true, ->>> configurable: true ->>> }); -1 >^^^^^^^ -2 > ^^^^^^^^^^^^^-> -1 > -1 >Emitted(23, 8) Source(17, 41) + SourceIndex(3) ---- ->>> return normalC; -1->^^^^ -2 > ^^^^^^^^^^^^^^ -1-> - > /*@internal*/ set c(val: number) { } - > -2 > } -1->Emitted(24, 5) Source(19, 1) + SourceIndex(3) -2 >Emitted(24, 19) Source(19, 2) + SourceIndex(3) ---- ->>>}()); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^-> -1 > -2 >} -3 > -4 > class normalC { - > /*@internal*/ constructor() { } - > /*@internal*/ prop: string; - > /*@internal*/ method() { } - > /*@internal*/ get c() { return 10; } - > /*@internal*/ set c(val: number) { } - > } -1 >Emitted(25, 1) Source(19, 1) + SourceIndex(3) -2 >Emitted(25, 2) Source(19, 2) + SourceIndex(3) -3 >Emitted(25, 2) Source(13, 1) + SourceIndex(3) -4 >Emitted(25, 6) Source(19, 2) + SourceIndex(3) ---- ->>>var normalN; -1-> -2 >^^^^ -3 > ^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^-> -1-> - > -2 >namespace -3 > normalN -4 > { - > /*@internal*/ export class C { } - > /*@internal*/ export function foo() {} - > /*@internal*/ export namespace someNamespace { export class C {} } - > /*@internal*/ export namespace someOther.something { export class someClass {} } - > /*@internal*/ export import someImport = someNamespace.C; - > /*@internal*/ export type internalType = internalC; - > /*@internal*/ export const internalConst = 10; - > /*@internal*/ export enum internalEnum { a, b, c } - > } -1->Emitted(26, 1) Source(20, 1) + SourceIndex(3) -2 >Emitted(26, 5) Source(20, 11) + SourceIndex(3) -3 >Emitted(26, 12) Source(20, 18) + SourceIndex(3) -4 >Emitted(26, 13) Source(29, 2) + SourceIndex(3) ---- ->>>(function (normalN) { -1-> -2 >^^^^^^^^^^^ -3 > ^^^^^^^ -4 > ^^^^^^^^^-> -1-> -2 >namespace -3 > normalN -1->Emitted(27, 1) Source(20, 1) + SourceIndex(3) -2 >Emitted(27, 12) Source(20, 11) + SourceIndex(3) -3 >Emitted(27, 19) Source(20, 18) + SourceIndex(3) ---- ->>> var C = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^-> -1-> { - > /*@internal*/ -1->Emitted(28, 5) Source(21, 19) + SourceIndex(3) ---- ->>> function C() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(29, 9) Source(21, 19) + SourceIndex(3) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^-> -1->export class C { -2 > } -1->Emitted(30, 9) Source(21, 36) + SourceIndex(3) -2 >Emitted(30, 10) Source(21, 37) + SourceIndex(3) ---- ->>> return C; -1->^^^^^^^^ -2 > ^^^^^^^^ -1-> -2 > } -1->Emitted(31, 9) Source(21, 36) + SourceIndex(3) -2 >Emitted(31, 17) Source(21, 37) + SourceIndex(3) ---- ->>> }()); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class C { } -1 >Emitted(32, 5) Source(21, 36) + SourceIndex(3) -2 >Emitted(32, 6) Source(21, 37) + SourceIndex(3) -3 >Emitted(32, 6) Source(21, 19) + SourceIndex(3) -4 >Emitted(32, 10) Source(21, 37) + SourceIndex(3) ---- ->>> normalN.C = C; -1->^^^^ -2 > ^^^^^^^^^ -3 > ^^^^ -4 > ^ -5 > ^^^^^-> -1-> -2 > C -3 > { } -4 > -1->Emitted(33, 5) Source(21, 32) + SourceIndex(3) -2 >Emitted(33, 14) Source(21, 33) + SourceIndex(3) -3 >Emitted(33, 18) Source(21, 37) + SourceIndex(3) -4 >Emitted(33, 19) Source(21, 37) + SourceIndex(3) ---- ->>> function foo() { } -1->^^^^ -2 > ^^^^^^^^^ -3 > ^^^ -4 > ^^^^^ -5 > ^ -6 > ^-> -1-> - > /*@internal*/ -2 > export function -3 > foo -4 > () { -5 > } -1->Emitted(34, 5) Source(22, 19) + SourceIndex(3) -2 >Emitted(34, 14) Source(22, 35) + SourceIndex(3) -3 >Emitted(34, 17) Source(22, 38) + SourceIndex(3) -4 >Emitted(34, 22) Source(22, 42) + SourceIndex(3) -5 >Emitted(34, 23) Source(22, 43) + SourceIndex(3) ---- ->>> normalN.foo = foo; -1->^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^ -4 > ^ -5 > ^-> -1-> -2 > foo -3 > () {} -4 > -1->Emitted(35, 5) Source(22, 35) + SourceIndex(3) -2 >Emitted(35, 16) Source(22, 38) + SourceIndex(3) -3 >Emitted(35, 22) Source(22, 43) + SourceIndex(3) -4 >Emitted(35, 23) Source(22, 43) + SourceIndex(3) ---- ->>> var someNamespace; -1->^^^^ -2 > ^^^^ -3 > ^^^^^^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^-> -1-> - > /*@internal*/ -2 > export namespace -3 > someNamespace -4 > { export class C {} } -1->Emitted(36, 5) Source(23, 19) + SourceIndex(3) -2 >Emitted(36, 9) Source(23, 36) + SourceIndex(3) -3 >Emitted(36, 22) Source(23, 49) + SourceIndex(3) -4 >Emitted(36, 23) Source(23, 71) + SourceIndex(3) ---- ->>> (function (someNamespace) { -1->^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^ -4 > ^^^-> -1-> -2 > export namespace -3 > someNamespace -1->Emitted(37, 5) Source(23, 19) + SourceIndex(3) -2 >Emitted(37, 16) Source(23, 36) + SourceIndex(3) -3 >Emitted(37, 29) Source(23, 49) + SourceIndex(3) ---- ->>> var C = (function () { -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^-> -1-> { -1->Emitted(38, 9) Source(23, 52) + SourceIndex(3) ---- ->>> function C() { -1->^^^^^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(39, 13) Source(23, 52) + SourceIndex(3) ---- ->>> } -1->^^^^^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^-> -1->export class C { -2 > } -1->Emitted(40, 13) Source(23, 68) + SourceIndex(3) -2 >Emitted(40, 14) Source(23, 69) + SourceIndex(3) ---- ->>> return C; -1->^^^^^^^^^^^^ -2 > ^^^^^^^^ -1-> -2 > } -1->Emitted(41, 13) Source(23, 68) + SourceIndex(3) -2 >Emitted(41, 21) Source(23, 69) + SourceIndex(3) ---- ->>> }()); -1 >^^^^^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class C {} -1 >Emitted(42, 9) Source(23, 68) + SourceIndex(3) -2 >Emitted(42, 10) Source(23, 69) + SourceIndex(3) -3 >Emitted(42, 10) Source(23, 52) + SourceIndex(3) -4 >Emitted(42, 14) Source(23, 69) + SourceIndex(3) ---- ->>> someNamespace.C = C; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^ -3 > ^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 > C -3 > {} -4 > -1->Emitted(43, 9) Source(23, 65) + SourceIndex(3) -2 >Emitted(43, 24) Source(23, 66) + SourceIndex(3) -3 >Emitted(43, 28) Source(23, 69) + SourceIndex(3) -4 >Emitted(43, 29) Source(23, 69) + SourceIndex(3) ---- ->>> })(someNamespace = normalN.someNamespace || (normalN.someNamespace = {})); -1->^^^^ -2 > ^ -3 > ^^ -4 > ^^^^^^^^^^^^^ -5 > ^^^ -6 > ^^^^^^^^^^^^^^^^^^^^^ -7 > ^^^^^ -8 > ^^^^^^^^^^^^^^^^^^^^^ -9 > ^^^^^^^^ -1-> -2 > } -3 > -4 > someNamespace -5 > -6 > someNamespace -7 > -8 > someNamespace -9 > { export class C {} } -1->Emitted(44, 5) Source(23, 70) + SourceIndex(3) -2 >Emitted(44, 6) Source(23, 71) + SourceIndex(3) -3 >Emitted(44, 8) Source(23, 36) + SourceIndex(3) -4 >Emitted(44, 21) Source(23, 49) + SourceIndex(3) -5 >Emitted(44, 24) Source(23, 36) + SourceIndex(3) -6 >Emitted(44, 45) Source(23, 49) + SourceIndex(3) -7 >Emitted(44, 50) Source(23, 36) + SourceIndex(3) -8 >Emitted(44, 71) Source(23, 49) + SourceIndex(3) -9 >Emitted(44, 79) Source(23, 71) + SourceIndex(3) ---- ->>> var someOther; -1 >^^^^ -2 > ^^^^ -3 > ^^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^-> -1 > - > /*@internal*/ -2 > export namespace -3 > someOther -4 > .something { export class someClass {} } -1 >Emitted(45, 5) Source(24, 19) + SourceIndex(3) -2 >Emitted(45, 9) Source(24, 36) + SourceIndex(3) -3 >Emitted(45, 18) Source(24, 45) + SourceIndex(3) -4 >Emitted(45, 19) Source(24, 85) + SourceIndex(3) ---- ->>> (function (someOther) { -1->^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^^^^ -1-> -2 > export namespace -3 > someOther -1->Emitted(46, 5) Source(24, 19) + SourceIndex(3) -2 >Emitted(46, 16) Source(24, 36) + SourceIndex(3) -3 >Emitted(46, 25) Source(24, 45) + SourceIndex(3) ---- ->>> var something; -1 >^^^^^^^^ -2 > ^^^^ -3 > ^^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^-> -1 >. -2 > -3 > something -4 > { export class someClass {} } -1 >Emitted(47, 9) Source(24, 46) + SourceIndex(3) -2 >Emitted(47, 13) Source(24, 46) + SourceIndex(3) -3 >Emitted(47, 22) Source(24, 55) + SourceIndex(3) -4 >Emitted(47, 23) Source(24, 85) + SourceIndex(3) ---- ->>> (function (something) { -1->^^^^^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^-> -1-> -2 > -3 > something -1->Emitted(48, 9) Source(24, 46) + SourceIndex(3) -2 >Emitted(48, 20) Source(24, 46) + SourceIndex(3) -3 >Emitted(48, 29) Source(24, 55) + SourceIndex(3) ---- ->>> var someClass = (function () { -1->^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> { -1->Emitted(49, 13) Source(24, 58) + SourceIndex(3) ---- ->>> function someClass() { -1->^^^^^^^^^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(50, 17) Source(24, 58) + SourceIndex(3) ---- ->>> } -1->^^^^^^^^^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^-> -1->export class someClass { -2 > } -1->Emitted(51, 17) Source(24, 82) + SourceIndex(3) -2 >Emitted(51, 18) Source(24, 83) + SourceIndex(3) ---- ->>> return someClass; -1->^^^^^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(52, 17) Source(24, 82) + SourceIndex(3) -2 >Emitted(52, 33) Source(24, 83) + SourceIndex(3) ---- ->>> }()); -1 >^^^^^^^^^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class someClass {} -1 >Emitted(53, 13) Source(24, 82) + SourceIndex(3) -2 >Emitted(53, 14) Source(24, 83) + SourceIndex(3) -3 >Emitted(53, 14) Source(24, 58) + SourceIndex(3) -4 >Emitted(53, 18) Source(24, 83) + SourceIndex(3) ---- ->>> something.someClass = someClass; -1->^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^ -3 > ^^^^^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 > someClass -3 > {} -4 > -1->Emitted(54, 13) Source(24, 71) + SourceIndex(3) -2 >Emitted(54, 32) Source(24, 80) + SourceIndex(3) -3 >Emitted(54, 44) Source(24, 83) + SourceIndex(3) -4 >Emitted(54, 45) Source(24, 83) + SourceIndex(3) ---- ->>> })(something = someOther.something || (someOther.something = {})); -1->^^^^^^^^ -2 > ^ -3 > ^^ -4 > ^^^^^^^^^ -5 > ^^^ -6 > ^^^^^^^^^^^^^^^^^^^ -7 > ^^^^^ -8 > ^^^^^^^^^^^^^^^^^^^ -9 > ^^^^^^^^ -1-> -2 > } -3 > -4 > something -5 > -6 > something -7 > -8 > something -9 > { export class someClass {} } -1->Emitted(55, 9) Source(24, 84) + SourceIndex(3) -2 >Emitted(55, 10) Source(24, 85) + SourceIndex(3) -3 >Emitted(55, 12) Source(24, 46) + SourceIndex(3) -4 >Emitted(55, 21) Source(24, 55) + SourceIndex(3) -5 >Emitted(55, 24) Source(24, 46) + SourceIndex(3) -6 >Emitted(55, 43) Source(24, 55) + SourceIndex(3) -7 >Emitted(55, 48) Source(24, 46) + SourceIndex(3) -8 >Emitted(55, 67) Source(24, 55) + SourceIndex(3) -9 >Emitted(55, 75) Source(24, 85) + SourceIndex(3) ---- ->>> })(someOther = normalN.someOther || (normalN.someOther = {})); -1 >^^^^ -2 > ^ -3 > ^^ -4 > ^^^^^^^^^ -5 > ^^^ -6 > ^^^^^^^^^^^^^^^^^ -7 > ^^^^^ -8 > ^^^^^^^^^^^^^^^^^ -9 > ^^^^^^^^ -1 > -2 > } -3 > -4 > someOther -5 > -6 > someOther -7 > -8 > someOther -9 > .something { export class someClass {} } -1 >Emitted(56, 5) Source(24, 84) + SourceIndex(3) -2 >Emitted(56, 6) Source(24, 85) + SourceIndex(3) -3 >Emitted(56, 8) Source(24, 36) + SourceIndex(3) -4 >Emitted(56, 17) Source(24, 45) + SourceIndex(3) -5 >Emitted(56, 20) Source(24, 36) + SourceIndex(3) -6 >Emitted(56, 37) Source(24, 45) + SourceIndex(3) -7 >Emitted(56, 42) Source(24, 36) + SourceIndex(3) -8 >Emitted(56, 59) Source(24, 45) + SourceIndex(3) -9 >Emitted(56, 67) Source(24, 85) + SourceIndex(3) ---- ->>> normalN.someImport = someNamespace.C; -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^^^^^^^^^^ -5 > ^ -6 > ^ -7 > ^ -1 > - > /*@internal*/ export import -2 > someImport -3 > = -4 > someNamespace -5 > . -6 > C -7 > ; -1 >Emitted(57, 5) Source(25, 33) + SourceIndex(3) -2 >Emitted(57, 23) Source(25, 43) + SourceIndex(3) -3 >Emitted(57, 26) Source(25, 46) + SourceIndex(3) -4 >Emitted(57, 39) Source(25, 59) + SourceIndex(3) -5 >Emitted(57, 40) Source(25, 60) + SourceIndex(3) -6 >Emitted(57, 41) Source(25, 61) + SourceIndex(3) -7 >Emitted(57, 42) Source(25, 62) + SourceIndex(3) ---- ->>> normalN.internalConst = 10; -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -1 > - > /*@internal*/ export type internalType = internalC; - > /*@internal*/ export const -2 > internalConst -3 > = -4 > 10 -5 > ; -1 >Emitted(58, 5) Source(27, 32) + SourceIndex(3) -2 >Emitted(58, 26) Source(27, 45) + SourceIndex(3) -3 >Emitted(58, 29) Source(27, 48) + SourceIndex(3) -4 >Emitted(58, 31) Source(27, 50) + SourceIndex(3) -5 >Emitted(58, 32) Source(27, 51) + SourceIndex(3) ---- ->>> var internalEnum; -1 >^^^^ -2 > ^^^^ -3 > ^^^^^^^^^^^^ -4 > ^^^^^^^^^^^-> -1 > - > /*@internal*/ -2 > export enum -3 > internalEnum { a, b, c } -1 >Emitted(59, 5) Source(28, 19) + SourceIndex(3) -2 >Emitted(59, 9) Source(28, 31) + SourceIndex(3) -3 >Emitted(59, 21) Source(28, 55) + SourceIndex(3) ---- ->>> (function (internalEnum) { -1->^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 > export enum -3 > internalEnum -1->Emitted(60, 5) Source(28, 19) + SourceIndex(3) -2 >Emitted(60, 16) Source(28, 31) + SourceIndex(3) -3 >Emitted(60, 28) Source(28, 43) + SourceIndex(3) ---- ->>> internalEnum[internalEnum["a"] = 0] = "a"; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^-> -1-> { -2 > a -3 > -1->Emitted(61, 9) Source(28, 46) + SourceIndex(3) -2 >Emitted(61, 50) Source(28, 47) + SourceIndex(3) -3 >Emitted(61, 51) Source(28, 47) + SourceIndex(3) ---- ->>> internalEnum[internalEnum["b"] = 1] = "b"; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^-> -1->, -2 > b -3 > -1->Emitted(62, 9) Source(28, 49) + SourceIndex(3) -2 >Emitted(62, 50) Source(28, 50) + SourceIndex(3) -3 >Emitted(62, 51) Source(28, 50) + SourceIndex(3) ---- ->>> internalEnum[internalEnum["c"] = 2] = "c"; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->, -2 > c -3 > -1->Emitted(63, 9) Source(28, 52) + SourceIndex(3) -2 >Emitted(63, 50) Source(28, 53) + SourceIndex(3) -3 >Emitted(63, 51) Source(28, 53) + SourceIndex(3) ---- ->>> })(internalEnum = normalN.internalEnum || (normalN.internalEnum = {})); -1->^^^^ -2 > ^ -3 > ^^ -4 > ^^^^^^^^^^^^ -5 > ^^^ -6 > ^^^^^^^^^^^^^^^^^^^^ -7 > ^^^^^ -8 > ^^^^^^^^^^^^^^^^^^^^ -9 > ^^^^^^^^ -1-> -2 > } -3 > -4 > internalEnum -5 > -6 > internalEnum -7 > -8 > internalEnum -9 > { a, b, c } -1->Emitted(64, 5) Source(28, 54) + SourceIndex(3) -2 >Emitted(64, 6) Source(28, 55) + SourceIndex(3) -3 >Emitted(64, 8) Source(28, 31) + SourceIndex(3) -4 >Emitted(64, 20) Source(28, 43) + SourceIndex(3) -5 >Emitted(64, 23) Source(28, 31) + SourceIndex(3) -6 >Emitted(64, 43) Source(28, 43) + SourceIndex(3) -7 >Emitted(64, 48) Source(28, 31) + SourceIndex(3) -8 >Emitted(64, 68) Source(28, 43) + SourceIndex(3) -9 >Emitted(64, 76) Source(28, 55) + SourceIndex(3) ---- ->>>})(normalN || (normalN = {})); -1 > -2 >^ -3 > ^^ -4 > ^^^^^^^ -5 > ^^^^^ -6 > ^^^^^^^ -7 > ^^^^^^^^ -8 > ^-> -1 > - > -2 >} -3 > -4 > normalN -5 > -6 > normalN -7 > { - > /*@internal*/ export class C { } - > /*@internal*/ export function foo() {} - > /*@internal*/ export namespace someNamespace { export class C {} } - > /*@internal*/ export namespace someOther.something { export class someClass {} } - > /*@internal*/ export import someImport = someNamespace.C; - > /*@internal*/ export type internalType = internalC; - > /*@internal*/ export const internalConst = 10; - > /*@internal*/ export enum internalEnum { a, b, c } - > } -1 >Emitted(65, 1) Source(29, 1) + SourceIndex(3) -2 >Emitted(65, 2) Source(29, 2) + SourceIndex(3) -3 >Emitted(65, 4) Source(20, 11) + SourceIndex(3) -4 >Emitted(65, 11) Source(20, 18) + SourceIndex(3) -5 >Emitted(65, 16) Source(20, 11) + SourceIndex(3) -6 >Emitted(65, 23) Source(20, 18) + SourceIndex(3) -7 >Emitted(65, 31) Source(29, 2) + SourceIndex(3) ---- ->>>var internalC = (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - >/*@internal*/ -1->Emitted(66, 1) Source(30, 15) + SourceIndex(3) ---- ->>> function internalC() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(67, 5) Source(30, 15) + SourceIndex(3) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^-> -1->class internalC { -2 > } -1->Emitted(68, 5) Source(30, 32) + SourceIndex(3) -2 >Emitted(68, 6) Source(30, 33) + SourceIndex(3) ---- ->>> return internalC; -1->^^^^ -2 > ^^^^^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(69, 5) Source(30, 32) + SourceIndex(3) -2 >Emitted(69, 21) Source(30, 33) + SourceIndex(3) ---- ->>>}()); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > class internalC {} -1 >Emitted(70, 1) Source(30, 32) + SourceIndex(3) -2 >Emitted(70, 2) Source(30, 33) + SourceIndex(3) -3 >Emitted(70, 2) Source(30, 15) + SourceIndex(3) -4 >Emitted(70, 6) Source(30, 33) + SourceIndex(3) ---- ->>>function internalfoo() { } -1-> -2 >^^^^^^^^^ -3 > ^^^^^^^^^^^ -4 > ^^^^^ -5 > ^ -1-> - >/*@internal*/ -2 >function -3 > internalfoo -4 > () { -5 > } -1->Emitted(71, 1) Source(31, 15) + SourceIndex(3) -2 >Emitted(71, 10) Source(31, 24) + SourceIndex(3) -3 >Emitted(71, 21) Source(31, 35) + SourceIndex(3) -4 >Emitted(71, 26) Source(31, 39) + SourceIndex(3) -5 >Emitted(71, 27) Source(31, 40) + SourceIndex(3) ---- ->>>var internalNamespace; -1 > -2 >^^^^ -3 > ^^^^^^^^^^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^-> -1 > - >/*@internal*/ -2 >namespace -3 > internalNamespace -4 > { export class someClass {} } -1 >Emitted(72, 1) Source(32, 15) + SourceIndex(3) -2 >Emitted(72, 5) Source(32, 25) + SourceIndex(3) -3 >Emitted(72, 22) Source(32, 42) + SourceIndex(3) -4 >Emitted(72, 23) Source(32, 72) + SourceIndex(3) ---- ->>>(function (internalNamespace) { -1-> -2 >^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^-> -1-> -2 >namespace -3 > internalNamespace -1->Emitted(73, 1) Source(32, 15) + SourceIndex(3) -2 >Emitted(73, 12) Source(32, 25) + SourceIndex(3) -3 >Emitted(73, 29) Source(32, 42) + SourceIndex(3) ---- ->>> var someClass = (function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> { -1->Emitted(74, 5) Source(32, 45) + SourceIndex(3) ---- ->>> function someClass() { -1->^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(75, 9) Source(32, 45) + SourceIndex(3) ---- ->>> } -1->^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^-> -1->export class someClass { -2 > } -1->Emitted(76, 9) Source(32, 69) + SourceIndex(3) -2 >Emitted(76, 10) Source(32, 70) + SourceIndex(3) ---- ->>> return someClass; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(77, 9) Source(32, 69) + SourceIndex(3) -2 >Emitted(77, 25) Source(32, 70) + SourceIndex(3) ---- ->>> }()); -1 >^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class someClass {} -1 >Emitted(78, 5) Source(32, 69) + SourceIndex(3) -2 >Emitted(78, 6) Source(32, 70) + SourceIndex(3) -3 >Emitted(78, 6) Source(32, 45) + SourceIndex(3) -4 >Emitted(78, 10) Source(32, 70) + SourceIndex(3) ---- ->>> internalNamespace.someClass = someClass; -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^^^^^^^^^^^^ -4 > ^ -5 > ^^^^^^^-> -1-> -2 > someClass -3 > {} -4 > -1->Emitted(79, 5) Source(32, 58) + SourceIndex(3) -2 >Emitted(79, 32) Source(32, 67) + SourceIndex(3) -3 >Emitted(79, 44) Source(32, 70) + SourceIndex(3) -4 >Emitted(79, 45) Source(32, 70) + SourceIndex(3) ---- ->>>})(internalNamespace || (internalNamespace = {})); -1-> -2 >^ -3 > ^^ -4 > ^^^^^^^^^^^^^^^^^ -5 > ^^^^^ -6 > ^^^^^^^^^^^^^^^^^ -7 > ^^^^^^^^ -1-> -2 >} -3 > -4 > internalNamespace -5 > -6 > internalNamespace -7 > { export class someClass {} } -1->Emitted(80, 1) Source(32, 71) + SourceIndex(3) -2 >Emitted(80, 2) Source(32, 72) + SourceIndex(3) -3 >Emitted(80, 4) Source(32, 25) + SourceIndex(3) -4 >Emitted(80, 21) Source(32, 42) + SourceIndex(3) -5 >Emitted(80, 26) Source(32, 25) + SourceIndex(3) -6 >Emitted(80, 43) Source(32, 42) + SourceIndex(3) -7 >Emitted(80, 51) Source(32, 72) + SourceIndex(3) ---- ->>>var internalOther; -1 > -2 >^^^^ -3 > ^^^^^^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^-> -1 > - >/*@internal*/ -2 >namespace -3 > internalOther -4 > .something { export class someClass {} } -1 >Emitted(81, 1) Source(33, 15) + SourceIndex(3) -2 >Emitted(81, 5) Source(33, 25) + SourceIndex(3) -3 >Emitted(81, 18) Source(33, 38) + SourceIndex(3) -4 >Emitted(81, 19) Source(33, 78) + SourceIndex(3) ---- ->>>(function (internalOther) { -1-> -2 >^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^ -1-> -2 >namespace -3 > internalOther -1->Emitted(82, 1) Source(33, 15) + SourceIndex(3) -2 >Emitted(82, 12) Source(33, 25) + SourceIndex(3) -3 >Emitted(82, 25) Source(33, 38) + SourceIndex(3) ---- ->>> var something; -1 >^^^^ -2 > ^^^^ -3 > ^^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^-> -1 >. -2 > -3 > something -4 > { export class someClass {} } -1 >Emitted(83, 5) Source(33, 39) + SourceIndex(3) -2 >Emitted(83, 9) Source(33, 39) + SourceIndex(3) -3 >Emitted(83, 18) Source(33, 48) + SourceIndex(3) -4 >Emitted(83, 19) Source(33, 78) + SourceIndex(3) ---- ->>> (function (something) { -1->^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^-> -1-> -2 > -3 > something -1->Emitted(84, 5) Source(33, 39) + SourceIndex(3) -2 >Emitted(84, 16) Source(33, 39) + SourceIndex(3) -3 >Emitted(84, 25) Source(33, 48) + SourceIndex(3) ---- ->>> var someClass = (function () { -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> { -1->Emitted(85, 9) Source(33, 51) + SourceIndex(3) ---- ->>> function someClass() { -1->^^^^^^^^^^^^ -2 > ^^-> -1-> -1->Emitted(86, 13) Source(33, 51) + SourceIndex(3) ---- ->>> } -1->^^^^^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^-> -1->export class someClass { -2 > } -1->Emitted(87, 13) Source(33, 75) + SourceIndex(3) -2 >Emitted(87, 14) Source(33, 76) + SourceIndex(3) ---- ->>> return someClass; -1->^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^ -1-> -2 > } -1->Emitted(88, 13) Source(33, 75) + SourceIndex(3) -2 >Emitted(88, 29) Source(33, 76) + SourceIndex(3) ---- ->>> }()); -1 >^^^^^^^^ -2 > ^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -3 > -4 > export class someClass {} -1 >Emitted(89, 9) Source(33, 75) + SourceIndex(3) -2 >Emitted(89, 10) Source(33, 76) + SourceIndex(3) -3 >Emitted(89, 10) Source(33, 51) + SourceIndex(3) -4 >Emitted(89, 14) Source(33, 76) + SourceIndex(3) ---- ->>> something.someClass = someClass; -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^ -3 > ^^^^^^^^^^^^ -4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 > someClass -3 > {} -4 > -1->Emitted(90, 9) Source(33, 64) + SourceIndex(3) -2 >Emitted(90, 28) Source(33, 73) + SourceIndex(3) -3 >Emitted(90, 40) Source(33, 76) + SourceIndex(3) -4 >Emitted(90, 41) Source(33, 76) + SourceIndex(3) ---- ->>> })(something = internalOther.something || (internalOther.something = {})); -1->^^^^ -2 > ^ -3 > ^^ -4 > ^^^^^^^^^ -5 > ^^^ -6 > ^^^^^^^^^^^^^^^^^^^^^^^ -7 > ^^^^^ -8 > ^^^^^^^^^^^^^^^^^^^^^^^ -9 > ^^^^^^^^ -1-> -2 > } -3 > -4 > something -5 > -6 > something -7 > -8 > something -9 > { export class someClass {} } -1->Emitted(91, 5) Source(33, 77) + SourceIndex(3) -2 >Emitted(91, 6) Source(33, 78) + SourceIndex(3) -3 >Emitted(91, 8) Source(33, 39) + SourceIndex(3) -4 >Emitted(91, 17) Source(33, 48) + SourceIndex(3) -5 >Emitted(91, 20) Source(33, 39) + SourceIndex(3) -6 >Emitted(91, 43) Source(33, 48) + SourceIndex(3) -7 >Emitted(91, 48) Source(33, 39) + SourceIndex(3) -8 >Emitted(91, 71) Source(33, 48) + SourceIndex(3) -9 >Emitted(91, 79) Source(33, 78) + SourceIndex(3) ---- ->>>})(internalOther || (internalOther = {})); -1 > -2 >^ -3 > ^^ -4 > ^^^^^^^^^^^^^ -5 > ^^^^^ -6 > ^^^^^^^^^^^^^ -7 > ^^^^^^^^ -8 > ^^^^^^^^-> -1 > -2 >} -3 > -4 > internalOther -5 > -6 > internalOther -7 > .something { export class someClass {} } -1 >Emitted(92, 1) Source(33, 77) + SourceIndex(3) -2 >Emitted(92, 2) Source(33, 78) + SourceIndex(3) -3 >Emitted(92, 4) Source(33, 25) + SourceIndex(3) -4 >Emitted(92, 17) Source(33, 38) + SourceIndex(3) -5 >Emitted(92, 22) Source(33, 25) + SourceIndex(3) -6 >Emitted(92, 35) Source(33, 38) + SourceIndex(3) -7 >Emitted(92, 43) Source(33, 78) + SourceIndex(3) ---- ->>>var internalImport = internalNamespace.someClass; -1-> -2 >^^^^ -3 > ^^^^^^^^^^^^^^ -4 > ^^^ -5 > ^^^^^^^^^^^^^^^^^ -6 > ^ -7 > ^^^^^^^^^ -8 > ^ -1-> - >/*@internal*/ -2 >import -3 > internalImport -4 > = -5 > internalNamespace -6 > . -7 > someClass -8 > ; -1->Emitted(93, 1) Source(34, 15) + SourceIndex(3) -2 >Emitted(93, 5) Source(34, 22) + SourceIndex(3) -3 >Emitted(93, 19) Source(34, 36) + SourceIndex(3) -4 >Emitted(93, 22) Source(34, 39) + SourceIndex(3) -5 >Emitted(93, 39) Source(34, 56) + SourceIndex(3) -6 >Emitted(93, 40) Source(34, 57) + SourceIndex(3) -7 >Emitted(93, 49) Source(34, 66) + SourceIndex(3) -8 >Emitted(93, 50) Source(34, 67) + SourceIndex(3) ---- ->>>var internalConst = 10; -1 > -2 >^^^^ -3 > ^^^^^^^^^^^^^ -4 > ^^^ -5 > ^^ -6 > ^ -1 > - >/*@internal*/ type internalType = internalC; - >/*@internal*/ -2 >const -3 > internalConst -4 > = -5 > 10 -6 > ; -1 >Emitted(94, 1) Source(36, 15) + SourceIndex(3) -2 >Emitted(94, 5) Source(36, 21) + SourceIndex(3) -3 >Emitted(94, 18) Source(36, 34) + SourceIndex(3) -4 >Emitted(94, 21) Source(36, 37) + SourceIndex(3) -5 >Emitted(94, 23) Source(36, 39) + SourceIndex(3) -6 >Emitted(94, 24) Source(36, 40) + SourceIndex(3) ---- ->>>var internalEnum; -1 > -2 >^^^^ -3 > ^^^^^^^^^^^^ -4 > ^^^^^^^^^^^-> -1 > - >/*@internal*/ -2 >enum -3 > internalEnum { a, b, c } -1 >Emitted(95, 1) Source(37, 15) + SourceIndex(3) -2 >Emitted(95, 5) Source(37, 20) + SourceIndex(3) -3 >Emitted(95, 17) Source(37, 44) + SourceIndex(3) ---- ->>>(function (internalEnum) { -1-> -2 >^^^^^^^^^^^ -3 > ^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> -2 >enum -3 > internalEnum -1->Emitted(96, 1) Source(37, 15) + SourceIndex(3) -2 >Emitted(96, 12) Source(37, 20) + SourceIndex(3) -3 >Emitted(96, 24) Source(37, 32) + SourceIndex(3) ---- ->>> internalEnum[internalEnum["a"] = 0] = "a"; -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^-> -1-> { -2 > a -3 > -1->Emitted(97, 5) Source(37, 35) + SourceIndex(3) -2 >Emitted(97, 46) Source(37, 36) + SourceIndex(3) -3 >Emitted(97, 47) Source(37, 36) + SourceIndex(3) ---- ->>> internalEnum[internalEnum["b"] = 1] = "b"; -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^-> -1->, -2 > b -3 > -1->Emitted(98, 5) Source(37, 38) + SourceIndex(3) -2 >Emitted(98, 46) Source(37, 39) + SourceIndex(3) -3 >Emitted(98, 47) Source(37, 39) + SourceIndex(3) ---- ->>> internalEnum[internalEnum["c"] = 2] = "c"; -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -1->, -2 > c -3 > -1->Emitted(99, 5) Source(37, 41) + SourceIndex(3) -2 >Emitted(99, 46) Source(37, 42) + SourceIndex(3) -3 >Emitted(99, 47) Source(37, 42) + SourceIndex(3) ---- ->>>})(internalEnum || (internalEnum = {})); -1 > -2 >^ -3 > ^^ -4 > ^^^^^^^^^^^^ -5 > ^^^^^ -6 > ^^^^^^^^^^^^ -7 > ^^^^^^^^ -1 > -2 >} -3 > -4 > internalEnum -5 > -6 > internalEnum -7 > { a, b, c } -1 >Emitted(100, 1) Source(37, 43) + SourceIndex(3) -2 >Emitted(100, 2) Source(37, 44) + SourceIndex(3) -3 >Emitted(100, 4) Source(37, 20) + SourceIndex(3) -4 >Emitted(100, 16) Source(37, 32) + SourceIndex(3) -5 >Emitted(100, 21) Source(37, 20) + SourceIndex(3) -6 >Emitted(100, 33) Source(37, 32) + SourceIndex(3) -7 >Emitted(100, 41) Source(37, 44) + SourceIndex(3) ---- -------------------------------------------------------------------- -emittedFile:/src/third/thirdjs/output/third-output.js -sourceFile:../../../second/second_part2.ts -------------------------------------------------------------------- ->>>var C = (function () { -1 > -2 >^^^^^^^^^^^^^^^^^^^-> -1 > -1 >Emitted(101, 1) Source(1, 1) + SourceIndex(4) ---- ->>> function C() { -1->^^^^ -2 > ^^-> -1-> -1->Emitted(102, 5) Source(1, 1) + SourceIndex(4) ---- ->>> } -1->^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->class C { - > doSomething() { - > console.log("something got done"); - > } - > -2 > } -1->Emitted(103, 5) Source(5, 1) + SourceIndex(4) -2 >Emitted(103, 6) Source(5, 2) + SourceIndex(4) ---- ->>> C.prototype.doSomething = function () { -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^^^ -4 > ^^^^^^^^^^^^^-> -1-> -2 > doSomething -3 > -1->Emitted(104, 5) Source(2, 5) + SourceIndex(4) -2 >Emitted(104, 28) Source(2, 16) + SourceIndex(4) -3 >Emitted(104, 31) Source(2, 5) + SourceIndex(4) ---- ->>> console.log("something got done"); -1->^^^^^^^^ -2 > ^^^^^^^ -3 > ^ -4 > ^^^ -5 > ^ -6 > ^^^^^^^^^^^^^^^^^^^^ -7 > ^ -8 > ^ -1->doSomething() { - > -2 > console -3 > . -4 > log -5 > ( -6 > "something got done" -7 > ) -8 > ; -1->Emitted(105, 9) Source(3, 9) + SourceIndex(4) -2 >Emitted(105, 16) Source(3, 16) + SourceIndex(4) -3 >Emitted(105, 17) Source(3, 17) + SourceIndex(4) -4 >Emitted(105, 20) Source(3, 20) + SourceIndex(4) -5 >Emitted(105, 21) Source(3, 21) + SourceIndex(4) -6 >Emitted(105, 41) Source(3, 41) + SourceIndex(4) -7 >Emitted(105, 42) Source(3, 42) + SourceIndex(4) -8 >Emitted(105, 43) Source(3, 43) + SourceIndex(4) ---- ->>> }; -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^-> -1 > - > -2 > } -1 >Emitted(106, 5) Source(4, 5) + SourceIndex(4) -2 >Emitted(106, 6) Source(4, 6) + SourceIndex(4) ---- ->>> return C; -1->^^^^ -2 > ^^^^^^^^ -1-> - > -2 > } -1->Emitted(107, 5) Source(5, 1) + SourceIndex(4) -2 >Emitted(107, 13) Source(5, 2) + SourceIndex(4) ---- ->>>}()); -1 > -2 >^ -3 > -4 > ^^^^ -5 > ^^^^^^^^^^^^-> -1 > -2 >} -3 > -4 > class C { - > doSomething() { - > console.log("something got done"); - > } - > } -1 >Emitted(108, 1) Source(5, 1) + SourceIndex(4) -2 >Emitted(108, 2) Source(5, 2) + SourceIndex(4) -3 >Emitted(108, 2) Source(1, 1) + SourceIndex(4) -4 >Emitted(108, 6) Source(5, 2) + SourceIndex(4) ---- -------------------------------------------------------------------- -emittedFile:/src/third/thirdjs/output/third-output.js -sourceFile:../../third_part1.ts -------------------------------------------------------------------- ->>>var c = new C(); -1-> -2 >^^^^ -3 > ^ -4 > ^^^ -5 > ^^^^ -6 > ^ -7 > ^^ -8 > ^ -9 > ^-> -1-> -2 >var -3 > c -4 > = -5 > new -6 > C -7 > () -8 > ; -1->Emitted(109, 1) Source(1, 1) + SourceIndex(5) -2 >Emitted(109, 5) Source(1, 5) + SourceIndex(5) -3 >Emitted(109, 6) Source(1, 6) + SourceIndex(5) -4 >Emitted(109, 9) Source(1, 9) + SourceIndex(5) -5 >Emitted(109, 13) Source(1, 13) + SourceIndex(5) -6 >Emitted(109, 14) Source(1, 14) + SourceIndex(5) -7 >Emitted(109, 16) Source(1, 16) + SourceIndex(5) -8 >Emitted(109, 17) Source(1, 17) + SourceIndex(5) ---- ->>>c.doSomething(); -1-> -2 >^ -3 > ^ -4 > ^^^^^^^^^^^ -5 > ^^ -6 > ^ -7 > ^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -2 >c -3 > . -4 > doSomething -5 > () -6 > ; -1->Emitted(110, 1) Source(2, 1) + SourceIndex(5) -2 >Emitted(110, 2) Source(2, 2) + SourceIndex(5) -3 >Emitted(110, 3) Source(2, 3) + SourceIndex(5) -4 >Emitted(110, 14) Source(2, 14) + SourceIndex(5) -5 >Emitted(110, 16) Source(2, 16) + SourceIndex(5) -6 >Emitted(110, 17) Source(2, 17) + SourceIndex(5) ---- ->>>//# sourceMappingURL=third-output.js.map - //// [/src/third/thirdjs/output/third-output.tsbuildinfo] { "bundle": { diff --git a/tests/baselines/reference/tsbuild/outfile-concat/initial-Build/baseline-sectioned-sourcemaps.js b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/baseline-sectioned-sourcemaps.js similarity index 93% rename from tests/baselines/reference/tsbuild/outfile-concat/initial-Build/baseline-sectioned-sourcemaps.js rename to tests/baselines/reference/tsbuild/outfile-concat/initial-build/baseline-sectioned-sourcemaps.js index dc954db7140c1..2b217d8a1d113 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/initial-Build/baseline-sectioned-sourcemaps.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/baseline-sectioned-sourcemaps.js @@ -1,3 +1,45 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/third --verbose +12:01:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:01:00 AM - Project 'src/first/tsconfig.json' is out of date because output file 'src/first/bin/first-output.js' does not exist + +12:01:00 AM - Building project '/src/first/tsconfig.json'... + +12:01:00 AM - Project 'src/second/tsconfig.json' is out of date because output file 'src/2/second-output.js' does not exist + +12:01:00 AM - Building project '/src/second/tsconfig.json'... + +12:01:00 AM - Project 'src/third/tsconfig.json' is out of date because output file 'src/third/thirdjs/output/third-output.js' does not exist + +12:01:00 AM - Building project '/src/third/tsconfig.json'... + +exitCode:: 0 +readFiles:: { + "/src/third/tsconfig.json": 1, + "/src/first/tsconfig.json": 1, + "/src/second/tsconfig.json": 1, + "/src/first/first_PART1.ts": 1, + "/src/first/first_part2.ts": 1, + "/src/first/first_part3.ts": 1, + "/src/second/second_part1.ts": 1, + "/src/second/second_part2.ts": 1, + "/src/first/bin/first-output.d.ts": 1, + "/src/2/second-output.d.ts": 1, + "/src/third/third_part1.ts": 1, + "/src/first/bin/first-output.tsbuildinfo": 1, + "/src/2/second-output.tsbuildinfo": 1, + "/src/first/bin/first-output.js": 1, + "/src/2/second-output.js": 1, + "/src/first/bin/first-output.js.map": 1, + "/src/2/second-output.js.map": 1, + "/src/first/bin/first-output.d.ts.map": 1, + "/src/2/second-output.d.ts.map": 1 +} + //// [/src/2/second-output.d.ts] declare namespace N { } diff --git a/tests/baselines/reference/tsbuild/outfile-concat/initial-Build/declarationMap-and-sourceMap-disabled.js b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/declarationMap-and-sourceMap-disabled.js similarity index 93% rename from tests/baselines/reference/tsbuild/outfile-concat/initial-Build/declarationMap-and-sourceMap-disabled.js rename to tests/baselines/reference/tsbuild/outfile-concat/initial-build/declarationMap-and-sourceMap-disabled.js index 71e66236a0a5d..41e8f94b4aa4d 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/initial-Build/declarationMap-and-sourceMap-disabled.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/declarationMap-and-sourceMap-disabled.js @@ -1,3 +1,25 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/third --verbose +12:00:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:00:00 AM - Project 'src/first/tsconfig.json' is out of date because output file 'src/first/bin/first-output.js' does not exist + +12:00:00 AM - Building project '/src/first/tsconfig.json'... + +12:00:00 AM - Project 'src/second/tsconfig.json' is out of date because output file 'src/2/second-output.js' does not exist + +12:00:00 AM - Building project '/src/second/tsconfig.json'... + +12:00:00 AM - Project 'src/third/tsconfig.json' is out of date because output file 'src/third/thirdjs/output/third-output.js' does not exist + +12:00:00 AM - Building project '/src/third/tsconfig.json'... + +exitCode:: 0 + + //// [/src/2/second-output.d.ts] declare namespace N { } diff --git a/tests/baselines/reference/tsbuild/outfile-concat/initial-Build/emitHelpers-in-all-projects.js b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/emitHelpers-in-all-projects.js similarity index 94% rename from tests/baselines/reference/tsbuild/outfile-concat/initial-Build/emitHelpers-in-all-projects.js rename to tests/baselines/reference/tsbuild/outfile-concat/initial-build/emitHelpers-in-all-projects.js index f005ab7855c76..7dbec0f66cf58 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/initial-Build/emitHelpers-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/emitHelpers-in-all-projects.js @@ -1,3 +1,45 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/third --verbose +12:01:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:01:00 AM - Project 'src/first/tsconfig.json' is out of date because output file 'src/first/bin/first-output.js' does not exist + +12:01:00 AM - Building project '/src/first/tsconfig.json'... + +12:01:00 AM - Project 'src/second/tsconfig.json' is out of date because output file 'src/2/second-output.js' does not exist + +12:01:00 AM - Building project '/src/second/tsconfig.json'... + +12:01:00 AM - Project 'src/third/tsconfig.json' is out of date because output file 'src/third/thirdjs/output/third-output.js' does not exist + +12:01:00 AM - Building project '/src/third/tsconfig.json'... + +exitCode:: 0 +readFiles:: { + "/src/third/tsconfig.json": 1, + "/src/first/tsconfig.json": 1, + "/src/second/tsconfig.json": 1, + "/src/first/first_PART1.ts": 1, + "/src/first/first_part2.ts": 1, + "/src/first/first_part3.ts": 1, + "/src/second/second_part1.ts": 1, + "/src/second/second_part2.ts": 1, + "/src/first/bin/first-output.d.ts": 1, + "/src/2/second-output.d.ts": 1, + "/src/third/third_part1.ts": 1, + "/src/first/bin/first-output.tsbuildinfo": 1, + "/src/2/second-output.tsbuildinfo": 1, + "/src/first/bin/first-output.js": 1, + "/src/2/second-output.js": 1, + "/src/first/bin/first-output.js.map": 1, + "/src/2/second-output.js.map": 1, + "/src/first/bin/first-output.d.ts.map": 1, + "/src/2/second-output.d.ts.map": 1 +} + //// [/src/2/second-output.d.ts] declare namespace N { } diff --git a/tests/baselines/reference/tsbuild/outfile-concat/initial-Build/emitHelpers-in-only-one-dependency-project.js b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/emitHelpers-in-only-one-dependency-project.js similarity index 95% rename from tests/baselines/reference/tsbuild/outfile-concat/initial-Build/emitHelpers-in-only-one-dependency-project.js rename to tests/baselines/reference/tsbuild/outfile-concat/initial-build/emitHelpers-in-only-one-dependency-project.js index a0903bec835ae..b946940addd93 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/initial-Build/emitHelpers-in-only-one-dependency-project.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/emitHelpers-in-only-one-dependency-project.js @@ -1,3 +1,25 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/third --verbose +12:01:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:01:00 AM - Project 'src/first/tsconfig.json' is out of date because output file 'src/first/bin/first-output.js' does not exist + +12:01:00 AM - Building project '/src/first/tsconfig.json'... + +12:01:00 AM - Project 'src/second/tsconfig.json' is out of date because output file 'src/2/second-output.js' does not exist + +12:01:00 AM - Building project '/src/second/tsconfig.json'... + +12:01:00 AM - Project 'src/third/tsconfig.json' is out of date because output file 'src/third/thirdjs/output/third-output.js' does not exist + +12:01:00 AM - Building project '/src/third/tsconfig.json'... + +exitCode:: 0 + + //// [/src/2/second-output.d.ts] declare namespace N { } diff --git a/tests/baselines/reference/tsbuild/outfile-concat/initial-Build/multiple-emitHelpers-in-all-projects.js b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/multiple-emitHelpers-in-all-projects.js similarity index 96% rename from tests/baselines/reference/tsbuild/outfile-concat/initial-Build/multiple-emitHelpers-in-all-projects.js rename to tests/baselines/reference/tsbuild/outfile-concat/initial-build/multiple-emitHelpers-in-all-projects.js index c9c46a617691c..242690d288548 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/initial-Build/multiple-emitHelpers-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/multiple-emitHelpers-in-all-projects.js @@ -1,3 +1,25 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/third --verbose +12:01:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:01:00 AM - Project 'src/first/tsconfig.json' is out of date because output file 'src/first/bin/first-output.js' does not exist + +12:01:00 AM - Building project '/src/first/tsconfig.json'... + +12:01:00 AM - Project 'src/second/tsconfig.json' is out of date because output file 'src/2/second-output.js' does not exist + +12:01:00 AM - Building project '/src/second/tsconfig.json'... + +12:01:00 AM - Project 'src/third/tsconfig.json' is out of date because output file 'src/third/thirdjs/output/third-output.js' does not exist + +12:01:00 AM - Building project '/src/third/tsconfig.json'... + +exitCode:: 0 + + //// [/src/2/second-output.d.ts] declare namespace N { } diff --git a/tests/baselines/reference/tsbuild/outfile-concat/initial-Build/multiple-emitHelpers-in-different-projects.js b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/multiple-emitHelpers-in-different-projects.js similarity index 95% rename from tests/baselines/reference/tsbuild/outfile-concat/initial-Build/multiple-emitHelpers-in-different-projects.js rename to tests/baselines/reference/tsbuild/outfile-concat/initial-build/multiple-emitHelpers-in-different-projects.js index a5a8082cb6e4b..93ba9fcc3e358 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/initial-Build/multiple-emitHelpers-in-different-projects.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/multiple-emitHelpers-in-different-projects.js @@ -1,3 +1,25 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/third --verbose +12:01:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:01:00 AM - Project 'src/first/tsconfig.json' is out of date because output file 'src/first/bin/first-output.js' does not exist + +12:01:00 AM - Building project '/src/first/tsconfig.json'... + +12:01:00 AM - Project 'src/second/tsconfig.json' is out of date because output file 'src/2/second-output.js' does not exist + +12:01:00 AM - Building project '/src/second/tsconfig.json'... + +12:01:00 AM - Project 'src/third/tsconfig.json' is out of date because output file 'src/third/thirdjs/output/third-output.js' does not exist + +12:01:00 AM - Building project '/src/third/tsconfig.json'... + +exitCode:: 0 + + //// [/src/2/second-output.d.ts] declare namespace N { } diff --git a/tests/baselines/reference/tsbuild/outfile-concat/initial-Build/multiple-prologues-in-all-projects.js b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/multiple-prologues-in-all-projects.js similarity index 94% rename from tests/baselines/reference/tsbuild/outfile-concat/initial-Build/multiple-prologues-in-all-projects.js rename to tests/baselines/reference/tsbuild/outfile-concat/initial-build/multiple-prologues-in-all-projects.js index 9f1174ea545a1..21f8943ae6b39 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/initial-Build/multiple-prologues-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/multiple-prologues-in-all-projects.js @@ -1,3 +1,45 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/third --verbose +12:01:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:01:00 AM - Project 'src/first/tsconfig.json' is out of date because output file 'src/first/bin/first-output.js' does not exist + +12:01:00 AM - Building project '/src/first/tsconfig.json'... + +12:01:00 AM - Project 'src/second/tsconfig.json' is out of date because output file 'src/2/second-output.js' does not exist + +12:01:00 AM - Building project '/src/second/tsconfig.json'... + +12:01:00 AM - Project 'src/third/tsconfig.json' is out of date because output file 'src/third/thirdjs/output/third-output.js' does not exist + +12:01:00 AM - Building project '/src/third/tsconfig.json'... + +exitCode:: 0 +readFiles:: { + "/src/third/tsconfig.json": 1, + "/src/first/tsconfig.json": 1, + "/src/second/tsconfig.json": 1, + "/src/first/first_PART1.ts": 1, + "/src/first/first_part2.ts": 1, + "/src/first/first_part3.ts": 1, + "/src/second/second_part1.ts": 1, + "/src/second/second_part2.ts": 1, + "/src/first/bin/first-output.d.ts": 1, + "/src/2/second-output.d.ts": 1, + "/src/third/third_part1.ts": 1, + "/src/first/bin/first-output.tsbuildinfo": 1, + "/src/2/second-output.tsbuildinfo": 1, + "/src/first/bin/first-output.js": 1, + "/src/2/second-output.js": 1, + "/src/first/bin/first-output.js.map": 1, + "/src/2/second-output.js.map": 1, + "/src/first/bin/first-output.d.ts.map": 1, + "/src/2/second-output.d.ts.map": 1 +} + //// [/src/2/second-output.d.ts] declare namespace N { } diff --git a/tests/baselines/reference/tsbuild/outfile-concat/initial-Build/multiple-prologues-in-different-projects.js b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/multiple-prologues-in-different-projects.js similarity index 95% rename from tests/baselines/reference/tsbuild/outfile-concat/initial-Build/multiple-prologues-in-different-projects.js rename to tests/baselines/reference/tsbuild/outfile-concat/initial-build/multiple-prologues-in-different-projects.js index ccd01c44d76b7..ea725d85d495d 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/initial-Build/multiple-prologues-in-different-projects.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/multiple-prologues-in-different-projects.js @@ -1,3 +1,25 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/third --verbose +12:01:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:01:00 AM - Project 'src/first/tsconfig.json' is out of date because output file 'src/first/bin/first-output.js' does not exist + +12:01:00 AM - Building project '/src/first/tsconfig.json'... + +12:01:00 AM - Project 'src/second/tsconfig.json' is out of date because output file 'src/2/second-output.js' does not exist + +12:01:00 AM - Building project '/src/second/tsconfig.json'... + +12:01:00 AM - Project 'src/third/tsconfig.json' is out of date because output file 'src/third/thirdjs/output/third-output.js' does not exist + +12:01:00 AM - Building project '/src/third/tsconfig.json'... + +exitCode:: 0 + + //// [/src/2/second-output.d.ts] declare namespace N { } diff --git a/tests/baselines/reference/tsbuild/outfile-concat/initial-Build/shebang-in-all-projects.js b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/shebang-in-all-projects.js similarity index 93% rename from tests/baselines/reference/tsbuild/outfile-concat/initial-Build/shebang-in-all-projects.js rename to tests/baselines/reference/tsbuild/outfile-concat/initial-build/shebang-in-all-projects.js index 8a9eddef3ebf8..b8adefd89761e 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/initial-Build/shebang-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/shebang-in-all-projects.js @@ -1,3 +1,45 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/third --verbose +12:01:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:01:00 AM - Project 'src/first/tsconfig.json' is out of date because output file 'src/first/bin/first-output.js' does not exist + +12:01:00 AM - Building project '/src/first/tsconfig.json'... + +12:01:00 AM - Project 'src/second/tsconfig.json' is out of date because output file 'src/2/second-output.js' does not exist + +12:01:00 AM - Building project '/src/second/tsconfig.json'... + +12:01:00 AM - Project 'src/third/tsconfig.json' is out of date because output file 'src/third/thirdjs/output/third-output.js' does not exist + +12:01:00 AM - Building project '/src/third/tsconfig.json'... + +exitCode:: 0 +readFiles:: { + "/src/third/tsconfig.json": 1, + "/src/first/tsconfig.json": 1, + "/src/second/tsconfig.json": 1, + "/src/first/first_PART1.ts": 1, + "/src/first/first_part2.ts": 1, + "/src/first/first_part3.ts": 1, + "/src/second/second_part1.ts": 1, + "/src/second/second_part2.ts": 1, + "/src/first/bin/first-output.d.ts": 1, + "/src/2/second-output.d.ts": 1, + "/src/third/third_part1.ts": 1, + "/src/first/bin/first-output.tsbuildinfo": 1, + "/src/2/second-output.tsbuildinfo": 1, + "/src/first/bin/first-output.js": 1, + "/src/first/bin/first-output.js.map": 1, + "/src/2/second-output.js.map": 1, + "/src/2/second-output.js": 1, + "/src/first/bin/first-output.d.ts.map": 1, + "/src/2/second-output.d.ts.map": 1 +} + //// [/src/2/second-output.d.ts] #!someshebang second second_part1 declare namespace N { diff --git a/tests/baselines/reference/tsbuild/outfile-concat/initial-Build/shebang-in-only-one-dependency-project.js b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/shebang-in-only-one-dependency-project.js similarity index 94% rename from tests/baselines/reference/tsbuild/outfile-concat/initial-Build/shebang-in-only-one-dependency-project.js rename to tests/baselines/reference/tsbuild/outfile-concat/initial-build/shebang-in-only-one-dependency-project.js index 6238d669fd9cd..bab82334961d5 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/initial-Build/shebang-in-only-one-dependency-project.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/shebang-in-only-one-dependency-project.js @@ -1,3 +1,25 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/third --verbose +12:01:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:01:00 AM - Project 'src/first/tsconfig.json' is out of date because output file 'src/first/bin/first-output.js' does not exist + +12:01:00 AM - Building project '/src/first/tsconfig.json'... + +12:01:00 AM - Project 'src/second/tsconfig.json' is out of date because output file 'src/2/second-output.js' does not exist + +12:01:00 AM - Building project '/src/second/tsconfig.json'... + +12:01:00 AM - Project 'src/third/tsconfig.json' is out of date because output file 'src/third/thirdjs/output/third-output.js' does not exist + +12:01:00 AM - Building project '/src/third/tsconfig.json'... + +exitCode:: 0 + + //// [/src/2/second-output.d.ts] #!someshebang second second_part1 declare namespace N { diff --git a/tests/baselines/reference/tsbuild/outfile-concat/initial-Build/strict-in-all-projects.js b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/strict-in-all-projects.js similarity index 93% rename from tests/baselines/reference/tsbuild/outfile-concat/initial-Build/strict-in-all-projects.js rename to tests/baselines/reference/tsbuild/outfile-concat/initial-build/strict-in-all-projects.js index a87a175f3f69f..1471bdb3090cb 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/initial-Build/strict-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/strict-in-all-projects.js @@ -1,3 +1,45 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/third --verbose +12:01:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:01:00 AM - Project 'src/first/tsconfig.json' is out of date because output file 'src/first/bin/first-output.js' does not exist + +12:01:00 AM - Building project '/src/first/tsconfig.json'... + +12:01:00 AM - Project 'src/second/tsconfig.json' is out of date because output file 'src/2/second-output.js' does not exist + +12:01:00 AM - Building project '/src/second/tsconfig.json'... + +12:01:00 AM - Project 'src/third/tsconfig.json' is out of date because output file 'src/third/thirdjs/output/third-output.js' does not exist + +12:01:00 AM - Building project '/src/third/tsconfig.json'... + +exitCode:: 0 +readFiles:: { + "/src/third/tsconfig.json": 1, + "/src/first/tsconfig.json": 1, + "/src/second/tsconfig.json": 1, + "/src/first/first_PART1.ts": 1, + "/src/first/first_part2.ts": 1, + "/src/first/first_part3.ts": 1, + "/src/second/second_part1.ts": 1, + "/src/second/second_part2.ts": 1, + "/src/first/bin/first-output.d.ts": 1, + "/src/2/second-output.d.ts": 1, + "/src/third/third_part1.ts": 1, + "/src/first/bin/first-output.tsbuildinfo": 1, + "/src/2/second-output.tsbuildinfo": 1, + "/src/first/bin/first-output.js": 1, + "/src/2/second-output.js": 1, + "/src/first/bin/first-output.js.map": 1, + "/src/2/second-output.js.map": 1, + "/src/first/bin/first-output.d.ts.map": 1, + "/src/2/second-output.d.ts.map": 1 +} + //// [/src/2/second-output.d.ts] declare namespace N { } diff --git a/tests/baselines/reference/tsbuild/outfile-concat/initial-Build/strict-in-one-dependency.js b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/strict-in-one-dependency.js similarity index 95% rename from tests/baselines/reference/tsbuild/outfile-concat/initial-Build/strict-in-one-dependency.js rename to tests/baselines/reference/tsbuild/outfile-concat/initial-build/strict-in-one-dependency.js index 5ad6a0c474275..8a4cce33dfc9b 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/initial-Build/strict-in-one-dependency.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/strict-in-one-dependency.js @@ -1,3 +1,25 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/third --verbose +12:01:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:01:00 AM - Project 'src/first/tsconfig.json' is out of date because output file 'src/first/bin/first-output.js' does not exist + +12:01:00 AM - Building project '/src/first/tsconfig.json'... + +12:01:00 AM - Project 'src/second/tsconfig.json' is out of date because output file 'src/2/second-output.js' does not exist + +12:01:00 AM - Building project '/src/second/tsconfig.json'... + +12:01:00 AM - Project 'src/third/tsconfig.json' is out of date because output file 'src/third/thirdjs/output/third-output.js' does not exist + +12:01:00 AM - Building project '/src/third/tsconfig.json'... + +exitCode:: 0 + + //// [/src/2/second-output.d.ts] declare namespace N { } diff --git a/tests/baselines/reference/tsbuild/outfile-concat/initial-Build/stripInternal-baseline-when-internal-is-inside-another-internal.js b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-baseline-when-internal-is-inside-another-internal.js similarity index 95% rename from tests/baselines/reference/tsbuild/outfile-concat/initial-Build/stripInternal-baseline-when-internal-is-inside-another-internal.js rename to tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-baseline-when-internal-is-inside-another-internal.js index 8d6722f4b78d6..5595b32ed5749 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/initial-Build/stripInternal-baseline-when-internal-is-inside-another-internal.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-baseline-when-internal-is-inside-another-internal.js @@ -1,3 +1,25 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/third --verbose +12:00:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:00:00 AM - Project 'src/first/tsconfig.json' is out of date because output file 'src/first/bin/first-output.js' does not exist + +12:00:00 AM - Building project '/src/first/tsconfig.json'... + +12:00:00 AM - Project 'src/second/tsconfig.json' is out of date because output file 'src/2/second-output.js' does not exist + +12:00:00 AM - Building project '/src/second/tsconfig.json'... + +12:00:00 AM - Project 'src/third/tsconfig.json' is out of date because output file 'src/third/thirdjs/output/third-output.js' does not exist + +12:00:00 AM - Building project '/src/third/tsconfig.json'... + +exitCode:: 0 + + //// [/src/2/second-output.d.ts] declare namespace N { } diff --git a/tests/baselines/reference/tsbuild/outfile-concat/initial-Build/stripInternal-jsdoc-style-comment-when-one-two-three-are-prepended-in-order.js b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-jsdoc-style-comment-when-one-two-three-are-prepended-in-order.js similarity index 96% rename from tests/baselines/reference/tsbuild/outfile-concat/initial-Build/stripInternal-jsdoc-style-comment-when-one-two-three-are-prepended-in-order.js rename to tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-jsdoc-style-comment-when-one-two-three-are-prepended-in-order.js index 7a5d6f628edcd..c341d9c5d2222 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/initial-Build/stripInternal-jsdoc-style-comment-when-one-two-three-are-prepended-in-order.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-jsdoc-style-comment-when-one-two-three-are-prepended-in-order.js @@ -1,3 +1,25 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/third --verbose +12:01:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:01:00 AM - Project 'src/first/tsconfig.json' is out of date because output file 'src/first/bin/first-output.js' does not exist + +12:01:00 AM - Building project '/src/first/tsconfig.json'... + +12:01:00 AM - Project 'src/second/tsconfig.json' is out of date because output file 'src/2/second-output.js' does not exist + +12:01:00 AM - Building project '/src/second/tsconfig.json'... + +12:01:00 AM - Project 'src/third/tsconfig.json' is out of date because output file 'src/third/thirdjs/output/third-output.js' does not exist + +12:01:00 AM - Building project '/src/third/tsconfig.json'... + +exitCode:: 0 + + //// [/src/2/second-output.d.ts] interface TheFirst { none: any; diff --git a/tests/baselines/reference/tsbuild/outfile-concat/initial-Build/stripInternal-jsdoc-style-comment.js b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-jsdoc-style-comment.js similarity index 96% rename from tests/baselines/reference/tsbuild/outfile-concat/initial-Build/stripInternal-jsdoc-style-comment.js rename to tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-jsdoc-style-comment.js index 6e4cd6c0d2641..709634ade2742 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/initial-Build/stripInternal-jsdoc-style-comment.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-jsdoc-style-comment.js @@ -1,3 +1,25 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/third --verbose +12:01:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:01:00 AM - Project 'src/first/tsconfig.json' is out of date because output file 'src/first/bin/first-output.js' does not exist + +12:01:00 AM - Building project '/src/first/tsconfig.json'... + +12:01:00 AM - Project 'src/second/tsconfig.json' is out of date because output file 'src/2/second-output.js' does not exist + +12:01:00 AM - Building project '/src/second/tsconfig.json'... + +12:01:00 AM - Project 'src/third/tsconfig.json' is out of date because output file 'src/third/thirdjs/output/third-output.js' does not exist + +12:01:00 AM - Building project '/src/third/tsconfig.json'... + +exitCode:: 0 + + //// [/src/2/second-output.d.ts] declare namespace N { } diff --git a/tests/baselines/reference/tsbuild/outfile-concat/initial-Build/stripInternal-jsdoc-style-with-comments-emit-enabled-when-one-two-three-are-prepended-in-order.js b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-jsdoc-style-with-comments-emit-enabled-when-one-two-three-are-prepended-in-order.js similarity index 96% rename from tests/baselines/reference/tsbuild/outfile-concat/initial-Build/stripInternal-jsdoc-style-with-comments-emit-enabled-when-one-two-three-are-prepended-in-order.js rename to tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-jsdoc-style-with-comments-emit-enabled-when-one-two-three-are-prepended-in-order.js index 0890b8d81889c..81653bf15bbec 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/initial-Build/stripInternal-jsdoc-style-with-comments-emit-enabled-when-one-two-three-are-prepended-in-order.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-jsdoc-style-with-comments-emit-enabled-when-one-two-three-are-prepended-in-order.js @@ -1,3 +1,25 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/third --verbose +12:01:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:01:00 AM - Project 'src/first/tsconfig.json' is out of date because output file 'src/first/bin/first-output.js' does not exist + +12:01:00 AM - Building project '/src/first/tsconfig.json'... + +12:01:00 AM - Project 'src/second/tsconfig.json' is out of date because output file 'src/2/second-output.js' does not exist + +12:01:00 AM - Building project '/src/second/tsconfig.json'... + +12:01:00 AM - Project 'src/third/tsconfig.json' is out of date because output file 'src/third/thirdjs/output/third-output.js' does not exist + +12:01:00 AM - Building project '/src/third/tsconfig.json'... + +exitCode:: 0 + + //// [/src/2/second-output.d.ts] /**@internal*/ interface TheFirst { none: any; diff --git a/tests/baselines/reference/tsbuild/outfile-concat/initial-Build/stripInternal-jsdoc-style-with-comments-emit-enabled.js b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-jsdoc-style-with-comments-emit-enabled.js similarity index 96% rename from tests/baselines/reference/tsbuild/outfile-concat/initial-Build/stripInternal-jsdoc-style-with-comments-emit-enabled.js rename to tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-jsdoc-style-with-comments-emit-enabled.js index 87badd920395e..e86999f7bf452 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/initial-Build/stripInternal-jsdoc-style-with-comments-emit-enabled.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-jsdoc-style-with-comments-emit-enabled.js @@ -1,3 +1,25 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/third --verbose +12:01:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:01:00 AM - Project 'src/first/tsconfig.json' is out of date because output file 'src/first/bin/first-output.js' does not exist + +12:01:00 AM - Building project '/src/first/tsconfig.json'... + +12:01:00 AM - Project 'src/second/tsconfig.json' is out of date because output file 'src/2/second-output.js' does not exist + +12:01:00 AM - Building project '/src/second/tsconfig.json'... + +12:01:00 AM - Project 'src/third/tsconfig.json' is out of date because output file 'src/third/thirdjs/output/third-output.js' does not exist + +12:01:00 AM - Building project '/src/third/tsconfig.json'... + +exitCode:: 0 + + //// [/src/2/second-output.d.ts] declare namespace N { } diff --git a/tests/baselines/reference/tsbuild/outfile-concat/initial-Build/stripInternal-when-few-members-of-enum-are-internal.js b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-when-few-members-of-enum-are-internal.js similarity index 96% rename from tests/baselines/reference/tsbuild/outfile-concat/initial-Build/stripInternal-when-few-members-of-enum-are-internal.js rename to tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-when-few-members-of-enum-are-internal.js index 91558992f041c..91cf996eddde7 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/initial-Build/stripInternal-when-few-members-of-enum-are-internal.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-when-few-members-of-enum-are-internal.js @@ -1,3 +1,25 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/third --verbose +12:00:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:00:00 AM - Project 'src/first/tsconfig.json' is out of date because output file 'src/first/bin/first-output.js' does not exist + +12:00:00 AM - Building project '/src/first/tsconfig.json'... + +12:00:00 AM - Project 'src/second/tsconfig.json' is out of date because output file 'src/2/second-output.js' does not exist + +12:00:00 AM - Building project '/src/second/tsconfig.json'... + +12:00:00 AM - Project 'src/third/tsconfig.json' is out of date because output file 'src/third/thirdjs/output/third-output.js' does not exist + +12:00:00 AM - Building project '/src/third/tsconfig.json'... + +exitCode:: 0 + + //// [/src/2/second-output.d.ts] declare namespace N { } diff --git a/tests/baselines/reference/tsbuild/outfile-concat/initial-Build/stripInternal-when-one-two-three-are-prepended-in-order.js b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-when-one-two-three-are-prepended-in-order.js similarity index 96% rename from tests/baselines/reference/tsbuild/outfile-concat/initial-Build/stripInternal-when-one-two-three-are-prepended-in-order.js rename to tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-when-one-two-three-are-prepended-in-order.js index 8986286317040..a858a1e27d8a9 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/initial-Build/stripInternal-when-one-two-three-are-prepended-in-order.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-when-one-two-three-are-prepended-in-order.js @@ -1,3 +1,45 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/third --verbose +12:01:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:01:00 AM - Project 'src/first/tsconfig.json' is out of date because output file 'src/first/bin/first-output.js' does not exist + +12:01:00 AM - Building project '/src/first/tsconfig.json'... + +12:01:00 AM - Project 'src/second/tsconfig.json' is out of date because output file 'src/2/second-output.js' does not exist + +12:01:00 AM - Building project '/src/second/tsconfig.json'... + +12:01:00 AM - Project 'src/third/tsconfig.json' is out of date because output file 'src/third/thirdjs/output/third-output.js' does not exist + +12:01:00 AM - Building project '/src/third/tsconfig.json'... + +exitCode:: 0 +readFiles:: { + "/src/third/tsconfig.json": 1, + "/src/second/tsconfig.json": 1, + "/src/first/tsconfig.json": 1, + "/src/first/first_PART1.ts": 1, + "/src/first/first_part2.ts": 1, + "/src/first/first_part3.ts": 1, + "/src/first/bin/first-output.d.ts": 1, + "/src/second/second_part1.ts": 1, + "/src/second/second_part2.ts": 1, + "/src/first/bin/first-output.tsbuildinfo": 1, + "/src/first/bin/first-output.js": 1, + "/src/first/bin/first-output.js.map": 1, + "/src/first/bin/first-output.d.ts.map": 1, + "/src/2/second-output.d.ts": 1, + "/src/third/third_part1.ts": 1, + "/src/2/second-output.tsbuildinfo": 1, + "/src/2/second-output.js": 1, + "/src/2/second-output.js.map": 1, + "/src/2/second-output.d.ts.map": 1 +} + //// [/src/2/second-output.d.ts] interface TheFirst { none: any; diff --git a/tests/baselines/reference/tsbuild/outfile-concat/initial-Build/stripInternal-with-comments-emit-enabled-when-one-two-three-are-prepended-in-order.js b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-with-comments-emit-enabled-when-one-two-three-are-prepended-in-order.js similarity index 96% rename from tests/baselines/reference/tsbuild/outfile-concat/initial-Build/stripInternal-with-comments-emit-enabled-when-one-two-three-are-prepended-in-order.js rename to tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-with-comments-emit-enabled-when-one-two-three-are-prepended-in-order.js index 5d2941abca299..fa4c05b80fe0e 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/initial-Build/stripInternal-with-comments-emit-enabled-when-one-two-three-are-prepended-in-order.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-with-comments-emit-enabled-when-one-two-three-are-prepended-in-order.js @@ -1,3 +1,25 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/third --verbose +12:01:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:01:00 AM - Project 'src/first/tsconfig.json' is out of date because output file 'src/first/bin/first-output.js' does not exist + +12:01:00 AM - Building project '/src/first/tsconfig.json'... + +12:01:00 AM - Project 'src/second/tsconfig.json' is out of date because output file 'src/2/second-output.js' does not exist + +12:01:00 AM - Building project '/src/second/tsconfig.json'... + +12:01:00 AM - Project 'src/third/tsconfig.json' is out of date because output file 'src/third/thirdjs/output/third-output.js' does not exist + +12:01:00 AM - Building project '/src/third/tsconfig.json'... + +exitCode:: 0 + + //// [/src/2/second-output.d.ts] interface TheFirst { none: any; diff --git a/tests/baselines/reference/tsbuild/outfile-concat/initial-Build/stripInternal-with-comments-emit-enabled.js b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-with-comments-emit-enabled.js similarity index 96% rename from tests/baselines/reference/tsbuild/outfile-concat/initial-Build/stripInternal-with-comments-emit-enabled.js rename to tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-with-comments-emit-enabled.js index 2475d4e4eda78..d681812289135 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/initial-Build/stripInternal-with-comments-emit-enabled.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-with-comments-emit-enabled.js @@ -1,3 +1,25 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/third --verbose +12:01:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:01:00 AM - Project 'src/first/tsconfig.json' is out of date because output file 'src/first/bin/first-output.js' does not exist + +12:01:00 AM - Building project '/src/first/tsconfig.json'... + +12:01:00 AM - Project 'src/second/tsconfig.json' is out of date because output file 'src/2/second-output.js' does not exist + +12:01:00 AM - Building project '/src/second/tsconfig.json'... + +12:01:00 AM - Project 'src/third/tsconfig.json' is out of date because output file 'src/third/thirdjs/output/third-output.js' does not exist + +12:01:00 AM - Building project '/src/third/tsconfig.json'... + +exitCode:: 0 + + //// [/src/2/second-output.d.ts] declare namespace N { } diff --git a/tests/baselines/reference/tsbuild/outfile-concat/initial-Build/stripInternal.js b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal.js similarity index 96% rename from tests/baselines/reference/tsbuild/outfile-concat/initial-Build/stripInternal.js rename to tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal.js index 7ac42063f7d1a..0f0cf474ca703 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/initial-Build/stripInternal.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal.js @@ -1,3 +1,45 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/third --verbose +12:01:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:01:00 AM - Project 'src/first/tsconfig.json' is out of date because output file 'src/first/bin/first-output.js' does not exist + +12:01:00 AM - Building project '/src/first/tsconfig.json'... + +12:01:00 AM - Project 'src/second/tsconfig.json' is out of date because output file 'src/2/second-output.js' does not exist + +12:01:00 AM - Building project '/src/second/tsconfig.json'... + +12:01:00 AM - Project 'src/third/tsconfig.json' is out of date because output file 'src/third/thirdjs/output/third-output.js' does not exist + +12:01:00 AM - Building project '/src/third/tsconfig.json'... + +exitCode:: 0 +readFiles:: { + "/src/third/tsconfig.json": 1, + "/src/first/tsconfig.json": 1, + "/src/second/tsconfig.json": 1, + "/src/first/first_PART1.ts": 1, + "/src/first/first_part2.ts": 1, + "/src/first/first_part3.ts": 1, + "/src/second/second_part1.ts": 1, + "/src/second/second_part2.ts": 1, + "/src/first/bin/first-output.d.ts": 1, + "/src/2/second-output.d.ts": 1, + "/src/third/third_part1.ts": 1, + "/src/first/bin/first-output.tsbuildinfo": 1, + "/src/2/second-output.tsbuildinfo": 1, + "/src/first/bin/first-output.js": 1, + "/src/2/second-output.js": 1, + "/src/first/bin/first-output.js.map": 1, + "/src/2/second-output.js.map": 1, + "/src/first/bin/first-output.d.ts.map": 1, + "/src/2/second-output.d.ts.map": 1 +} + //// [/src/2/second-output.d.ts] declare namespace N { } diff --git a/tests/baselines/reference/tsbuild/outfile-concat/initial-Build/triple-slash-refs-in-all-projects.js b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/triple-slash-refs-in-all-projects.js similarity index 94% rename from tests/baselines/reference/tsbuild/outfile-concat/initial-Build/triple-slash-refs-in-all-projects.js rename to tests/baselines/reference/tsbuild/outfile-concat/initial-build/triple-slash-refs-in-all-projects.js index 9310b004ec356..c8efbd205e624 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/initial-Build/triple-slash-refs-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/triple-slash-refs-in-all-projects.js @@ -1,3 +1,48 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/third --verbose +12:01:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:01:00 AM - Project 'src/first/tsconfig.json' is out of date because output file 'src/first/bin/first-output.js' does not exist + +12:01:00 AM - Building project '/src/first/tsconfig.json'... + +12:01:00 AM - Project 'src/second/tsconfig.json' is out of date because output file 'src/2/second-output.js' does not exist + +12:01:00 AM - Building project '/src/second/tsconfig.json'... + +12:01:00 AM - Project 'src/third/tsconfig.json' is out of date because output file 'src/third/thirdjs/output/third-output.js' does not exist + +12:01:00 AM - Building project '/src/third/tsconfig.json'... + +exitCode:: 0 +readFiles:: { + "/src/third/tsconfig.json": 1, + "/src/first/tsconfig.json": 1, + "/src/second/tsconfig.json": 1, + "/src/first/first_PART1.ts": 1, + "/src/first/first_part2.ts": 1, + "/src/first/tripleRef.d.ts": 1, + "/src/first/first_part3.ts": 1, + "/src/second/second_part1.ts": 1, + "/src/second/tripleRef.d.ts": 1, + "/src/second/second_part2.ts": 1, + "/src/first/bin/first-output.d.ts": 1, + "/src/2/second-output.d.ts": 1, + "/src/third/third_part1.ts": 1, + "/src/third/tripleRef.d.ts": 1, + "/src/first/bin/first-output.tsbuildinfo": 1, + "/src/2/second-output.tsbuildinfo": 1, + "/src/first/bin/first-output.js": 1, + "/src/2/second-output.js": 1, + "/src/first/bin/first-output.js.map": 1, + "/src/2/second-output.js.map": 1, + "/src/first/bin/first-output.d.ts.map": 1, + "/src/2/second-output.d.ts.map": 1 +} + //// [/src/2/second-output.d.ts] /// declare const second_part1Const: secondsecond_part1; diff --git a/tests/baselines/reference/tsbuild/outfile-concat/initial-Build/triple-slash-refs-in-one-project.js b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/triple-slash-refs-in-one-project.js similarity index 95% rename from tests/baselines/reference/tsbuild/outfile-concat/initial-Build/triple-slash-refs-in-one-project.js rename to tests/baselines/reference/tsbuild/outfile-concat/initial-build/triple-slash-refs-in-one-project.js index 9a0bc7227429c..471309f35f0ac 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/initial-Build/triple-slash-refs-in-one-project.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/triple-slash-refs-in-one-project.js @@ -1,3 +1,25 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/third --verbose +12:01:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:01:00 AM - Project 'src/first/tsconfig.json' is out of date because output file 'src/first/bin/first-output.js' does not exist + +12:01:00 AM - Building project '/src/first/tsconfig.json'... + +12:01:00 AM - Project 'src/second/tsconfig.json' is out of date because output file 'src/2/second-output.js' does not exist + +12:01:00 AM - Building project '/src/second/tsconfig.json'... + +12:01:00 AM - Project 'src/third/tsconfig.json' is out of date because output file 'src/third/thirdjs/output/third-output.js' does not exist + +12:01:00 AM - Building project '/src/third/tsconfig.json'... + +exitCode:: 0 + + //// [/src/2/second-output.d.ts] /// declare const second_part1Const: secondsecond_part1; diff --git a/tests/baselines/reference/tsbuild/outfile-concat/initial-Build/when-final-project-is-not-composite-but-incremental.js b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/when-final-project-is-not-composite-but-incremental.js similarity index 94% rename from tests/baselines/reference/tsbuild/outfile-concat/initial-Build/when-final-project-is-not-composite-but-incremental.js rename to tests/baselines/reference/tsbuild/outfile-concat/initial-build/when-final-project-is-not-composite-but-incremental.js index 77755214958de..81bec95d4f6c8 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/initial-Build/when-final-project-is-not-composite-but-incremental.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/when-final-project-is-not-composite-but-incremental.js @@ -1,3 +1,25 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/third --verbose +12:00:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:00:00 AM - Project 'src/first/tsconfig.json' is out of date because output file 'src/first/bin/first-output.js' does not exist + +12:00:00 AM - Building project '/src/first/tsconfig.json'... + +12:00:00 AM - Project 'src/second/tsconfig.json' is out of date because output file 'src/2/second-output.js' does not exist + +12:00:00 AM - Building project '/src/second/tsconfig.json'... + +12:00:00 AM - Project 'src/third/tsconfig.json' is out of date because output file 'src/third/thirdjs/output/third-output.js' does not exist + +12:00:00 AM - Building project '/src/third/tsconfig.json'... + +exitCode:: 0 + + //// [/src/2/second-output.d.ts] declare namespace N { } diff --git a/tests/baselines/reference/tsbuild/outfile-concat/initial-Build/when-final-project-is-not-composite-but-uses-project-references.js b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/when-final-project-is-not-composite-but-uses-project-references.js similarity index 94% rename from tests/baselines/reference/tsbuild/outfile-concat/initial-Build/when-final-project-is-not-composite-but-uses-project-references.js rename to tests/baselines/reference/tsbuild/outfile-concat/initial-build/when-final-project-is-not-composite-but-uses-project-references.js index 2564a1ae67ede..2e7b1f1663fad 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/initial-Build/when-final-project-is-not-composite-but-uses-project-references.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/when-final-project-is-not-composite-but-uses-project-references.js @@ -1,3 +1,25 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/third --verbose +12:01:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:01:00 AM - Project 'src/first/tsconfig.json' is out of date because output file 'src/first/bin/first-output.js' does not exist + +12:01:00 AM - Building project '/src/first/tsconfig.json'... + +12:01:00 AM - Project 'src/second/tsconfig.json' is out of date because output file 'src/2/second-output.js' does not exist + +12:01:00 AM - Building project '/src/second/tsconfig.json'... + +12:01:00 AM - Project 'src/third/tsconfig.json' is out of date because output file 'src/third/thirdjs/output/third-output.js' does not exist + +12:01:00 AM - Building project '/src/third/tsconfig.json'... + +exitCode:: 0 + + //// [/src/2/second-output.d.ts] declare namespace N { } diff --git a/tests/baselines/reference/tsbuild/outfile-concat/initial-Build/when-final-project-specifies-tsBuildInfoFile.js b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/when-final-project-specifies-tsBuildInfoFile.js similarity index 94% rename from tests/baselines/reference/tsbuild/outfile-concat/initial-Build/when-final-project-specifies-tsBuildInfoFile.js rename to tests/baselines/reference/tsbuild/outfile-concat/initial-build/when-final-project-specifies-tsBuildInfoFile.js index 288f507f70b7a..b0131b6af56e0 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/initial-Build/when-final-project-specifies-tsBuildInfoFile.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/when-final-project-specifies-tsBuildInfoFile.js @@ -1,3 +1,25 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/third --verbose +12:00:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:00:00 AM - Project 'src/first/tsconfig.json' is out of date because output file 'src/first/bin/first-output.js' does not exist + +12:00:00 AM - Building project '/src/first/tsconfig.json'... + +12:00:00 AM - Project 'src/second/tsconfig.json' is out of date because output file 'src/2/second-output.js' does not exist + +12:00:00 AM - Building project '/src/second/tsconfig.json'... + +12:00:00 AM - Project 'src/third/tsconfig.json' is out of date because output file 'src/third/thirdjs/output/third-output.js' does not exist + +12:00:00 AM - Building project '/src/third/tsconfig.json'... + +exitCode:: 0 + + //// [/src/2/second-output.d.ts] declare namespace N { } diff --git a/tests/baselines/reference/tsbuild/outfile-concat/initial-Build/when-source-files-are-empty-in-the-own-file.js b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/when-source-files-are-empty-in-the-own-file.js similarity index 94% rename from tests/baselines/reference/tsbuild/outfile-concat/initial-Build/when-source-files-are-empty-in-the-own-file.js rename to tests/baselines/reference/tsbuild/outfile-concat/initial-build/when-source-files-are-empty-in-the-own-file.js index 7269a7ca7447d..deb7dbd86e6f2 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/initial-Build/when-source-files-are-empty-in-the-own-file.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/when-source-files-are-empty-in-the-own-file.js @@ -1,3 +1,25 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/third --verbose +12:01:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:01:00 AM - Project 'src/first/tsconfig.json' is out of date because output file 'src/first/bin/first-output.js' does not exist + +12:01:00 AM - Building project '/src/first/tsconfig.json'... + +12:01:00 AM - Project 'src/second/tsconfig.json' is out of date because output file 'src/2/second-output.js' does not exist + +12:01:00 AM - Building project '/src/second/tsconfig.json'... + +12:01:00 AM - Project 'src/third/tsconfig.json' is out of date because output file 'src/third/thirdjs/output/third-output.js' does not exist + +12:01:00 AM - Building project '/src/third/tsconfig.json'... + +exitCode:: 0 + + //// [/src/2/second-output.d.ts] declare namespace N { } diff --git a/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/sample.js b/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/sample.js index f1124ae44eb79..94a962ebe027a 100644 --- a/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/sample.js +++ b/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/sample.js @@ -1,3 +1,43 @@ +//// [/lib/incremental-declaration-changesOutput.txt] +/lib/tsc --b /src/tests --verbose +12:04:00 AM - Projects in this build: + * src/core/tsconfig.json + * src/logic/tsconfig.json + * src/tests/tsconfig.json + +12:04:00 AM - Project 'src/core/tsconfig.json' is out of date because oldest output 'src/core/anotherModule.js' is older than newest input 'src/core/index.ts' + +12:04:00 AM - Building project '/src/core/tsconfig.json'... + +12:04:00 AM - Updating unchanged output timestamps of project '/src/core/tsconfig.json'... + +12:04:00 AM - Project 'src/logic/tsconfig.json' is out of date because oldest output 'src/logic/index.js' is older than newest input 'src/core' + +12:04:00 AM - Building project '/src/logic/tsconfig.json'... + +12:04:00 AM - Project 'src/tests/tsconfig.json' is out of date because oldest output 'src/tests/index.js' is older than newest input 'src/core' + +12:04:00 AM - Building project '/src/tests/tsconfig.json'... + +exitCode:: 0 +readFiles:: { + "/src/tests/tsconfig.json": 1, + "/src/core/tsconfig.json": 1, + "/src/logic/tsconfig.json": 1, + "/src/core/tsconfig.tsbuildinfo": 1, + "/src/core/anotherModule.ts": 1, + "/src/core/index.ts": 1, + "/src/core/some_decl.d.ts": 1, + "/src/core/index.d.ts": 2, + "/src/logic/tsconfig.tsbuildinfo": 1, + "/src/logic/index.ts": 1, + "/src/core/anotherModule.d.ts": 1, + "/src/logic/index.d.ts": 1, + "/src/tests/tsconfig.tsbuildinfo": 1, + "/src/tests/index.ts": 1, + "/src/tests/index.d.ts": 1 +} + //// [/src/core/index.d.ts] export declare const someString: string; export declare function leftPad(s: string, n: number): string; @@ -207,6 +247,10 @@ export class someClass { } "version": "FakeTSVersion" } +//// [/src/logic/index.d.ts] file written with same contents +//// [/src/logic/index.js] file written with same contents +//// [/src/logic/index.js.map] file written with same contents +//// [/src/logic/index.js.map.baseline.txt] file written with same contents //// [/src/logic/tsconfig.tsbuildinfo] { "program": { @@ -257,6 +301,8 @@ export class someClass { } "version": "FakeTSVersion" } +//// [/src/tests/index.d.ts] file written with same contents +//// [/src/tests/index.js] file written with same contents //// [/src/tests/tsconfig.tsbuildinfo] { "program": { diff --git a/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/when-declaration-option-changes.js b/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/when-declaration-option-changes.js index 8a87cafe69ea0..2311e64ef2b66 100644 --- a/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/when-declaration-option-changes.js +++ b/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/when-declaration-option-changes.js @@ -1,13 +1,27 @@ +//// [/lib/incremental-declaration-changesOutput.txt] +/lib/tsc --b /src/core --verbose +12:04:00 AM - Projects in this build: + * src/core/tsconfig.json + +12:04:00 AM - Project 'src/core/tsconfig.json' is out of date because output file 'src/core/anotherModule.d.ts' does not exist + +12:04:00 AM - Building project '/src/core/tsconfig.json'... + +exitCode:: 0 + + //// [/src/core/anotherModule.d.ts] export declare const World = "hello"; +//// [/src/core/anotherModule.js] file written with same contents //// [/src/core/index.d.ts] export declare const someString: string; export declare function leftPad(s: string, n: number): string; export declare function multiply(a: number, b: number): number; +//// [/src/core/index.js] file written with same contents //// [/src/core/tsconfig.json] { "compilerOptions": { diff --git a/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/when-esModuleInterop-option-changes.js b/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/when-esModuleInterop-option-changes.js index ce9044faa05ca..dd48841c8afe0 100644 --- a/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/when-esModuleInterop-option-changes.js +++ b/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/when-esModuleInterop-option-changes.js @@ -1,3 +1,22 @@ +//// [/lib/incremental-declaration-changesOutput.txt] +/lib/tsc --b /src/tests --verbose +12:04:00 AM - Projects in this build: + * src/core/tsconfig.json + * src/logic/tsconfig.json + * src/tests/tsconfig.json + +12:04:00 AM - Project 'src/core/tsconfig.json' is up to date because newest input 'src/core/anotherModule.ts' is older than oldest output 'src/core/anotherModule.js' + +12:04:00 AM - Project 'src/logic/tsconfig.json' is up to date because newest input 'src/logic/index.ts' is older than oldest output 'src/logic/index.js' + +12:04:00 AM - Project 'src/tests/tsconfig.json' is out of date because oldest output 'src/tests/index.js' is older than newest input 'src/tests/tsconfig.json' + +12:04:00 AM - Building project '/src/tests/tsconfig.json'... + +exitCode:: 0 + + +//// [/src/tests/index.d.ts] file written with same contents //// [/src/tests/index.js] "use strict"; var __importStar = (this && this.__importStar) || function (mod) { diff --git a/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/when-logic-config-changes-declaration-dir.js b/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/when-logic-config-changes-declaration-dir.js index 13d6ef5c3ba1e..da943e101e256 100644 --- a/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/when-logic-config-changes-declaration-dir.js +++ b/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/when-logic-config-changes-declaration-dir.js @@ -1,9 +1,45 @@ +//// [/lib/incremental-declaration-changesOutput.txt] +/lib/tsc --b /src/tests --verbose +12:12:00 AM - Projects in this build: + * src/core/tsconfig.json + * src/logic/tsconfig.json + * src/tests/tsconfig.json + +12:12:00 AM - Project 'src/core/tsconfig.json' is up to date because newest input 'src/core/anotherModule.ts' is older than oldest output 'src/core/anotherModule.js' + +12:12:00 AM - Project 'src/logic/tsconfig.json' is out of date because output file 'src/logic/decls/index.d.ts' does not exist + +12:12:00 AM - Building project '/src/logic/tsconfig.json'... + +12:12:00 AM - Project 'src/tests/tsconfig.json' is out of date because oldest output 'src/tests/index.js' is older than newest input 'src/logic' + +12:12:00 AM - Building project '/src/tests/tsconfig.json'... + +exitCode:: 0 +readFiles:: { + "/src/tests/tsconfig.json": 1, + "/src/core/tsconfig.json": 1, + "/src/logic/tsconfig.json": 1, + "/src/core/tsconfig.tsbuildinfo": 1, + "/src/logic/tsconfig.tsbuildinfo": 1, + "/src/logic/index.ts": 1, + "/src/core/index.d.ts": 1, + "/src/core/anotherModule.d.ts": 1, + "/src/tests/tsconfig.tsbuildinfo": 1, + "/src/tests/index.ts": 1, + "/src/logic/decls/index.d.ts": 1, + "/src/tests/index.d.ts": 1 +} + //// [/src/logic/decls/index.d.ts] export declare function getSecondsInDay(): number; import * as mod from '../core/anotherModule'; export declare const m: typeof mod; +//// [/src/logic/index.js] file written with same contents +//// [/src/logic/index.js.map] file written with same contents +//// [/src/logic/index.js.map.baseline.txt] file written with same contents //// [/src/logic/tsconfig.json] { "compilerOptions": { @@ -71,6 +107,8 @@ export declare const m: typeof mod; "version": "FakeTSVersion" } +//// [/src/tests/index.d.ts] file written with same contents +//// [/src/tests/index.js] file written with same contents //// [/src/tests/tsconfig.tsbuildinfo] { "program": { diff --git a/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/when-module-option-changes.js b/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/when-module-option-changes.js index d6c6fb4d8770c..0a801843705d2 100644 --- a/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/when-module-option-changes.js +++ b/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/when-module-option-changes.js @@ -1,3 +1,15 @@ +//// [/lib/incremental-declaration-changesOutput.txt] +/lib/tsc --b /src/core --verbose +12:04:00 AM - Projects in this build: + * src/core/tsconfig.json + +12:04:00 AM - Project 'src/core/tsconfig.json' is out of date because oldest output 'src/core/anotherModule.js' is older than newest input 'src/core/tsconfig.json' + +12:04:00 AM - Building project '/src/core/tsconfig.json'... + +exitCode:: 0 + + //// [/src/core/anotherModule.js] define(["require", "exports"], function (require, exports) { "use strict"; diff --git a/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/when-target-option-changes.js b/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/when-target-option-changes.js index 0dc8156158d07..bc3a79219937c 100644 --- a/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/when-target-option-changes.js +++ b/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/when-target-option-changes.js @@ -1,3 +1,23 @@ +//// [/lib/incremental-declaration-changesOutput.txt] +/lib/tsc --b /src/core --verbose +12:04:00 AM - Projects in this build: + * src/core/tsconfig.json + +12:04:00 AM - Project 'src/core/tsconfig.json' is out of date because oldest output 'src/core/anotherModule.js' is older than newest input 'src/core/tsconfig.json' + +12:04:00 AM - Building project '/src/core/tsconfig.json'... + +TSFILE: /src/core/anotherModule.js +TSFILE: /src/core/index.js +TSFILE: /src/core/tsconfig.tsbuildinfo +/lib/lib.d.ts +/lib/lib.esnext.d.ts +/src/core/anotherModule.ts +/src/core/index.ts +/src/core/some_decl.d.ts +exitCode:: 0 + + //// [/src/core/anotherModule.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/tests/baselines/reference/tsbuild/sample1/incremental-declaration-doesnt-change/sample.js b/tests/baselines/reference/tsbuild/sample1/incremental-declaration-doesnt-change/sample.js index 82e64bc933046..a2d9e5a8564a5 100644 --- a/tests/baselines/reference/tsbuild/sample1/incremental-declaration-doesnt-change/sample.js +++ b/tests/baselines/reference/tsbuild/sample1/incremental-declaration-doesnt-change/sample.js @@ -1,3 +1,41 @@ +//// [/lib/incremental-declaration-doesnt-changeOutput.txt] +/lib/tsc --b /src/tests --verbose +12:08:00 AM - Projects in this build: + * src/core/tsconfig.json + * src/logic/tsconfig.json + * src/tests/tsconfig.json + +12:08:00 AM - Project 'src/core/tsconfig.json' is out of date because oldest output 'src/core/anotherModule.js' is older than newest input 'src/core/index.ts' + +12:08:00 AM - Building project '/src/core/tsconfig.json'... + +12:08:00 AM - Updating unchanged output timestamps of project '/src/core/tsconfig.json'... + +12:08:00 AM - Project 'src/logic/tsconfig.json' is up to date with .d.ts files from its dependencies + +12:08:00 AM - Updating output timestamps of project '/src/logic/tsconfig.json'... + +12:08:00 AM - Project 'src/tests/tsconfig.json' is up to date with .d.ts files from its dependencies + +12:08:00 AM - Updating output timestamps of project '/src/tests/tsconfig.json'... + +exitCode:: 0 +readFiles:: { + "/src/tests/tsconfig.json": 1, + "/src/core/tsconfig.json": 1, + "/src/logic/tsconfig.json": 1, + "/src/core/tsconfig.tsbuildinfo": 1, + "/src/core/anotherModule.ts": 1, + "/src/core/index.ts": 1, + "/src/core/some_decl.d.ts": 1, + "/src/core/index.d.ts": 1, + "/src/logic/tsconfig.tsbuildinfo": 1, + "/src/tests/tsconfig.tsbuildinfo": 1 +} + +//// [/src/core/index.d.ts] file written with same contents +//// [/src/core/index.d.ts.map] file written with same contents +//// [/src/core/index.d.ts.map.baseline.txt] file written with same contents //// [/src/core/index.js] "use strict"; exports.__esModule = true; diff --git a/tests/baselines/reference/tsbuild/sample1/initial-Build/when-logic-config-changes-declaration-dir.js b/tests/baselines/reference/tsbuild/sample1/initial-Build/when-logic-config-changes-declaration-dir.js deleted file mode 100644 index 7a9f9a2ea9572..0000000000000 --- a/tests/baselines/reference/tsbuild/sample1/initial-Build/when-logic-config-changes-declaration-dir.js +++ /dev/null @@ -1,494 +0,0 @@ -//// [/src/core/anotherModule.d.ts] -export declare const World = "hello"; -//# sourceMappingURL=anotherModule.d.ts.map - -//// [/src/core/anotherModule.d.ts.map] -{"version":3,"file":"anotherModule.d.ts","sourceRoot":"","sources":["anotherModule.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,KAAK,UAAU,CAAC"} - -//// [/src/core/anotherModule.d.ts.map.baseline.txt] -=================================================================== -JsFile: anotherModule.d.ts -mapUrl: anotherModule.d.ts.map -sourceRoot: -sources: anotherModule.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:/src/core/anotherModule.d.ts -sourceFile:anotherModule.ts -------------------------------------------------------------------- ->>>export declare const World = "hello"; -1 > -2 >^^^^^^^^^^^^^^^ -3 > ^^^^^^ -4 > ^^^^^ -5 > ^^^^^^^^^^ -6 > ^ -7 > ^^^^^-> -1 > -2 >export -3 > const -4 > World -5 > = "hello" -6 > ; -1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -2 >Emitted(1, 16) Source(1, 8) + SourceIndex(0) -3 >Emitted(1, 22) Source(1, 14) + SourceIndex(0) -4 >Emitted(1, 27) Source(1, 19) + SourceIndex(0) -5 >Emitted(1, 37) Source(1, 29) + SourceIndex(0) -6 >Emitted(1, 38) Source(1, 30) + SourceIndex(0) ---- ->>>//# sourceMappingURL=anotherModule.d.ts.map - -//// [/src/core/anotherModule.js] -"use strict"; -exports.__esModule = true; -exports.World = "hello"; - - -//// [/src/core/index.d.ts] -export declare const someString: string; -export declare function leftPad(s: string, n: number): string; -export declare function multiply(a: number, b: number): number; -//# sourceMappingURL=index.d.ts.map - -//// [/src/core/index.d.ts.map] -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,EAAE,MAAsB,CAAC;AAChD,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB;AAC/D,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB"} - -//// [/src/core/index.d.ts.map.baseline.txt] -=================================================================== -JsFile: index.d.ts -mapUrl: index.d.ts.map -sourceRoot: -sources: index.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:/src/core/index.d.ts -sourceFile:index.ts -------------------------------------------------------------------- ->>>export declare const someString: string; -1 > -2 >^^^^^^^^^^^^^^^ -3 > ^^^^^^ -4 > ^^^^^^^^^^ -5 > ^^ -6 > ^^^^^^ -7 > ^ -8 > ^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >export -3 > const -4 > someString -5 > : -6 > string = "HELLO WORLD" -7 > ; -1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -2 >Emitted(1, 16) Source(1, 8) + SourceIndex(0) -3 >Emitted(1, 22) Source(1, 14) + SourceIndex(0) -4 >Emitted(1, 32) Source(1, 24) + SourceIndex(0) -5 >Emitted(1, 34) Source(1, 26) + SourceIndex(0) -6 >Emitted(1, 40) Source(1, 48) + SourceIndex(0) -7 >Emitted(1, 41) Source(1, 49) + SourceIndex(0) ---- ->>>export declare function leftPad(s: string, n: number): string; -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^^^^^^^ -4 > ^ -5 > ^ -6 > ^^ -7 > ^^^^^^ -8 > ^^ -9 > ^ -10> ^^ -11> ^^^^^^ -12> ^^^^^^^^^^ -13> ^^-> -1-> - > -2 >export function -3 > leftPad -4 > ( -5 > s -6 > : -7 > string -8 > , -9 > n -10> : -11> number -12> ) { return s + n; } -1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(2, 25) Source(2, 17) + SourceIndex(0) -3 >Emitted(2, 32) Source(2, 24) + SourceIndex(0) -4 >Emitted(2, 33) Source(2, 25) + SourceIndex(0) -5 >Emitted(2, 34) Source(2, 26) + SourceIndex(0) -6 >Emitted(2, 36) Source(2, 28) + SourceIndex(0) -7 >Emitted(2, 42) Source(2, 34) + SourceIndex(0) -8 >Emitted(2, 44) Source(2, 36) + SourceIndex(0) -9 >Emitted(2, 45) Source(2, 37) + SourceIndex(0) -10>Emitted(2, 47) Source(2, 39) + SourceIndex(0) -11>Emitted(2, 53) Source(2, 45) + SourceIndex(0) -12>Emitted(2, 63) Source(2, 64) + SourceIndex(0) ---- ->>>export declare function multiply(a: number, b: number): number; -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^^^^^^^^ -4 > ^ -5 > ^ -6 > ^^ -7 > ^^^^^^ -8 > ^^ -9 > ^ -10> ^^ -11> ^^^^^^ -12> ^^^^^^^^^^ -1-> - > -2 >export function -3 > multiply -4 > ( -5 > a -6 > : -7 > number -8 > , -9 > b -10> : -11> number -12> ) { return a * b; } -1->Emitted(3, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(3, 25) Source(3, 17) + SourceIndex(0) -3 >Emitted(3, 33) Source(3, 25) + SourceIndex(0) -4 >Emitted(3, 34) Source(3, 26) + SourceIndex(0) -5 >Emitted(3, 35) Source(3, 27) + SourceIndex(0) -6 >Emitted(3, 37) Source(3, 29) + SourceIndex(0) -7 >Emitted(3, 43) Source(3, 35) + SourceIndex(0) -8 >Emitted(3, 45) Source(3, 37) + SourceIndex(0) -9 >Emitted(3, 46) Source(3, 38) + SourceIndex(0) -10>Emitted(3, 48) Source(3, 40) + SourceIndex(0) -11>Emitted(3, 54) Source(3, 46) + SourceIndex(0) -12>Emitted(3, 64) Source(3, 65) + SourceIndex(0) ---- ->>>//# sourceMappingURL=index.d.ts.map - -//// [/src/core/index.js] -"use strict"; -exports.__esModule = true; -exports.someString = "HELLO WORLD"; -function leftPad(s, n) { return s + n; } -exports.leftPad = leftPad; -function multiply(a, b) { return a * b; } -exports.multiply = multiply; - - -//// [/src/core/tsconfig.tsbuildinfo] -{ - "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; };", - "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; };" - }, - "./anothermodule.ts": { - "version": "-2676574883-export const World = \"hello\";\r\n", - "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map" - }, - "./index.ts": { - "version": "-18749805970-export const someString: string = \"HELLO WORLD\";\r\nexport function leftPad(s: string, n: number) { return s + n; }\r\nexport function multiply(a: number, b: number) { return a * b; }\r\n", - "signature": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map" - }, - "./some_decl.d.ts": { - "version": "-9253692965-declare const dts: any;\r\n", - "signature": "-9253692965-declare const dts: any;\r\n" - } - }, - "options": { - "composite": true, - "declaration": true, - "declarationMap": true, - "skipDefaultLibCheck": true, - "configFilePath": "./tsconfig.json" - }, - "referencedMap": {}, - "exportedModulesMap": {}, - "semanticDiagnosticsPerFile": [ - "../../lib/lib.d.ts", - "./anothermodule.ts", - "./index.ts", - "./some_decl.d.ts" - ] - }, - "version": "FakeTSVersion" -} - -//// [/src/logic/index.d.ts] -export declare function getSecondsInDay(): number; -import * as mod from '../core/anotherModule'; -export declare const m: typeof mod; - - -//// [/src/logic/index.js] -"use strict"; -exports.__esModule = true; -var c = require("../core/index"); -function getSecondsInDay() { - return c.multiply(10, 15); -} -exports.getSecondsInDay = getSecondsInDay; -var mod = require("../core/anotherModule"); -exports.m = mod; -//# sourceMappingURL=index.js.map - -//// [/src/logic/index.js.map] -{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAAA,iCAAmC;AACnC,SAAgB,eAAe;IAC3B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAC9B,CAAC;AAFD,0CAEC;AACD,2CAA6C;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} - -//// [/src/logic/index.js.map.baseline.txt] -=================================================================== -JsFile: index.js -mapUrl: index.js.map -sourceRoot: -sources: index.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:/src/logic/index.js -sourceFile:index.ts -------------------------------------------------------------------- ->>>"use strict"; ->>>exports.__esModule = true; ->>>var c = require("../core/index"); -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 > -2 >import * as c from '../core/index'; -1 >Emitted(3, 1) Source(1, 1) + SourceIndex(0) -2 >Emitted(3, 34) Source(1, 36) + SourceIndex(0) ---- ->>>function getSecondsInDay() { -1 > -2 >^^^^^^^^^ -3 > ^^^^^^^^^^^^^^^ -4 > ^^^^^^^-> -1 > - > -2 >export function -3 > getSecondsInDay -1 >Emitted(4, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(4, 10) Source(2, 17) + SourceIndex(0) -3 >Emitted(4, 25) Source(2, 32) + SourceIndex(0) ---- ->>> return c.multiply(10, 15); -1->^^^^ -2 > ^^^^^^^ -3 > ^ -4 > ^ -5 > ^^^^^^^^ -6 > ^ -7 > ^^ -8 > ^^ -9 > ^^ -10> ^ -11> ^ -1->() { - > -2 > return -3 > c -4 > . -5 > multiply -6 > ( -7 > 10 -8 > , -9 > 15 -10> ) -11> ; -1->Emitted(5, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(5, 12) Source(3, 12) + SourceIndex(0) -3 >Emitted(5, 13) Source(3, 13) + SourceIndex(0) -4 >Emitted(5, 14) Source(3, 14) + SourceIndex(0) -5 >Emitted(5, 22) Source(3, 22) + SourceIndex(0) -6 >Emitted(5, 23) Source(3, 23) + SourceIndex(0) -7 >Emitted(5, 25) Source(3, 25) + SourceIndex(0) -8 >Emitted(5, 27) Source(3, 27) + SourceIndex(0) -9 >Emitted(5, 29) Source(3, 29) + SourceIndex(0) -10>Emitted(5, 30) Source(3, 30) + SourceIndex(0) -11>Emitted(5, 31) Source(3, 31) + SourceIndex(0) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(6, 1) Source(4, 1) + SourceIndex(0) -2 >Emitted(6, 2) Source(4, 2) + SourceIndex(0) ---- ->>>exports.getSecondsInDay = getSecondsInDay; -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^^-> -1-> -2 >export function getSecondsInDay() { - > return c.multiply(10, 15); - >} -1->Emitted(7, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(7, 43) Source(4, 2) + SourceIndex(0) ---- ->>>var mod = require("../core/anotherModule"); -1-> -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1-> - > -2 >import * as mod from '../core/anotherModule'; -1->Emitted(8, 1) Source(5, 1) + SourceIndex(0) -2 >Emitted(8, 44) Source(5, 46) + SourceIndex(0) ---- ->>>exports.m = mod; -1 > -2 >^^^^^^^^ -3 > ^ -4 > ^^^ -5 > ^^^ -6 > ^ -7 > ^^^^^^^^^^^^^^^^-> -1 > - >export const -2 > -3 > m -4 > = -5 > mod -6 > ; -1 >Emitted(9, 1) Source(6, 14) + SourceIndex(0) -2 >Emitted(9, 9) Source(6, 14) + SourceIndex(0) -3 >Emitted(9, 10) Source(6, 15) + SourceIndex(0) -4 >Emitted(9, 13) Source(6, 18) + SourceIndex(0) -5 >Emitted(9, 16) Source(6, 21) + SourceIndex(0) -6 >Emitted(9, 17) Source(6, 22) + SourceIndex(0) ---- ->>>//# sourceMappingURL=index.js.map - -//// [/src/logic/tsconfig.tsbuildinfo] -{ - "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; };", - "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; };" - }, - "../core/index.ts": { - "version": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map", - "signature": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map" - }, - "../core/anothermodule.ts": { - "version": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", - "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map" - }, - "./index.ts": { - "version": "-5786964698-import * as c from '../core/index';\r\nexport function getSecondsInDay() {\r\n return c.multiply(10, 15);\r\n}\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", - "signature": "-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n" - } - }, - "options": { - "composite": true, - "declaration": true, - "sourceMap": true, - "forceConsistentCasingInFileNames": true, - "skipDefaultLibCheck": true, - "configFilePath": "./tsconfig.json" - }, - "referencedMap": { - "./index.ts": [ - "../core/anothermodule.d.ts", - "../core/index.d.ts" - ] - }, - "exportedModulesMap": { - "./index.ts": [ - "../core/anothermodule.d.ts" - ] - }, - "semanticDiagnosticsPerFile": [ - "../../lib/lib.d.ts", - "../core/anothermodule.ts", - "../core/index.ts", - "./index.ts" - ] - }, - "version": "FakeTSVersion" -} - -//// [/src/tests/index.d.ts] -import * as mod from '../core/anotherModule'; -export declare const m: typeof mod; - - -//// [/src/tests/index.js] -"use strict"; -exports.__esModule = true; -var c = require("../core/index"); -var logic = require("../logic/index"); -c.leftPad("", 10); -logic.getSecondsInDay(); -var mod = require("../core/anotherModule"); -exports.m = mod; - - -//// [/src/tests/tsconfig.tsbuildinfo] -{ - "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; };", - "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; };" - }, - "../core/index.ts": { - "version": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map", - "signature": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map" - }, - "../core/anothermodule.ts": { - "version": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", - "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map" - }, - "../logic/index.ts": { - "version": "-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n", - "signature": "-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n" - }, - "./index.ts": { - "version": "12336236525-import * as c from '../core/index';\r\nimport * as logic from '../logic/index';\r\n\r\nc.leftPad(\"\", 10);\r\nlogic.getSecondsInDay();\r\n\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", - "signature": "-9209611-import * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n" - } - }, - "options": { - "composite": true, - "declaration": true, - "forceConsistentCasingInFileNames": true, - "skipDefaultLibCheck": true, - "configFilePath": "./tsconfig.json" - }, - "referencedMap": { - "../logic/index.ts": [ - "../core/anothermodule.d.ts" - ], - "./index.ts": [ - "../core/anothermodule.d.ts", - "../core/index.d.ts", - "../logic/index.d.ts" - ] - }, - "exportedModulesMap": { - "../logic/index.ts": [ - "../core/anothermodule.d.ts" - ], - "./index.ts": [ - "../core/anothermodule.d.ts" - ] - }, - "semanticDiagnosticsPerFile": [ - "../../lib/lib.d.ts", - "../core/anothermodule.ts", - "../core/index.ts", - "../logic/index.ts", - "./index.ts" - ] - }, - "version": "FakeTSVersion" -} - diff --git a/tests/baselines/reference/tsbuild/sample1/initial-Build/sample.js b/tests/baselines/reference/tsbuild/sample1/initial-build/sample.js similarity index 92% rename from tests/baselines/reference/tsbuild/sample1/initial-Build/sample.js rename to tests/baselines/reference/tsbuild/sample1/initial-build/sample.js index 7a9f9a2ea9572..00228056483cd 100644 --- a/tests/baselines/reference/tsbuild/sample1/initial-Build/sample.js +++ b/tests/baselines/reference/tsbuild/sample1/initial-build/sample.js @@ -1,3 +1,40 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/tests --verbose +12:01:00 AM - Projects in this build: + * src/core/tsconfig.json + * src/logic/tsconfig.json + * src/tests/tsconfig.json + +12:01:00 AM - Project 'src/core/tsconfig.json' is out of date because output file 'src/core/anotherModule.js' does not exist + +12:01:00 AM - Building project '/src/core/tsconfig.json'... + +12:01:00 AM - Project 'src/logic/tsconfig.json' is out of date because output file 'src/logic/index.js' does not exist + +12:01:00 AM - Building project '/src/logic/tsconfig.json'... + +12:01:00 AM - Project 'src/tests/tsconfig.json' is out of date because output file 'src/tests/index.js' does not exist + +12:01:00 AM - Building project '/src/tests/tsconfig.json'... + +exitCode:: 0 +readFiles:: { + "/src/tests/tsconfig.json": 1, + "/src/core/tsconfig.json": 1, + "/src/logic/tsconfig.json": 1, + "/src/core/tsconfig.tsbuildinfo": 1, + "/src/core/anotherModule.ts": 1, + "/src/core/index.ts": 1, + "/src/core/some_decl.d.ts": 1, + "/src/logic/tsconfig.tsbuildinfo": 1, + "/src/logic/index.ts": 1, + "/src/core/index.d.ts": 1, + "/src/core/anotherModule.d.ts": 1, + "/src/tests/tsconfig.tsbuildinfo": 1, + "/src/tests/index.ts": 1, + "/src/logic/index.d.ts": 1 +} + //// [/src/core/anotherModule.d.ts] export declare const World = "hello"; //# sourceMappingURL=anotherModule.d.ts.map diff --git a/tests/baselines/reference/tsbuild/sample1/initial-Build/when-declaration-option-changes.js b/tests/baselines/reference/tsbuild/sample1/initial-build/when-declaration-option-changes.js similarity index 87% rename from tests/baselines/reference/tsbuild/sample1/initial-Build/when-declaration-option-changes.js rename to tests/baselines/reference/tsbuild/sample1/initial-build/when-declaration-option-changes.js index 61e87a815aa89..6fcba548d3b10 100644 --- a/tests/baselines/reference/tsbuild/sample1/initial-Build/when-declaration-option-changes.js +++ b/tests/baselines/reference/tsbuild/sample1/initial-build/when-declaration-option-changes.js @@ -1,3 +1,15 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/core --verbose +12:01:00 AM - Projects in this build: + * src/core/tsconfig.json + +12:01:00 AM - Project 'src/core/tsconfig.json' is out of date because output file 'src/core/anotherModule.js' does not exist + +12:01:00 AM - Building project '/src/core/tsconfig.json'... + +exitCode:: 0 + + //// [/src/core/anotherModule.js] "use strict"; exports.__esModule = true; diff --git a/tests/baselines/reference/tsbuild/sample1/initial-Build/when-esModuleInterop-option-changes.js b/tests/baselines/reference/tsbuild/sample1/initial-build/when-esModuleInterop-option-changes.js similarity index 92% rename from tests/baselines/reference/tsbuild/sample1/initial-Build/when-esModuleInterop-option-changes.js rename to tests/baselines/reference/tsbuild/sample1/initial-build/when-esModuleInterop-option-changes.js index e24ade14d9d15..0f1ea65c5e4d3 100644 --- a/tests/baselines/reference/tsbuild/sample1/initial-Build/when-esModuleInterop-option-changes.js +++ b/tests/baselines/reference/tsbuild/sample1/initial-build/when-esModuleInterop-option-changes.js @@ -1,3 +1,25 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/tests --verbose +12:01:00 AM - Projects in this build: + * src/core/tsconfig.json + * src/logic/tsconfig.json + * src/tests/tsconfig.json + +12:01:00 AM - Project 'src/core/tsconfig.json' is out of date because output file 'src/core/anotherModule.js' does not exist + +12:01:00 AM - Building project '/src/core/tsconfig.json'... + +12:01:00 AM - Project 'src/logic/tsconfig.json' is out of date because output file 'src/logic/index.js' does not exist + +12:01:00 AM - Building project '/src/logic/tsconfig.json'... + +12:01:00 AM - Project 'src/tests/tsconfig.json' is out of date because output file 'src/tests/index.js' does not exist + +12:01:00 AM - Building project '/src/tests/tsconfig.json'... + +exitCode:: 0 + + //// [/src/core/anotherModule.d.ts] export declare const World = "hello"; //# sourceMappingURL=anotherModule.d.ts.map diff --git a/tests/baselines/reference/tsbuild/sample1/initial-Build/when-logic-specifies-tsBuildInfoFile.js b/tests/baselines/reference/tsbuild/sample1/initial-build/when-logic-specifies-tsBuildInfoFile.js similarity index 92% rename from tests/baselines/reference/tsbuild/sample1/initial-Build/when-logic-specifies-tsBuildInfoFile.js rename to tests/baselines/reference/tsbuild/sample1/initial-build/when-logic-specifies-tsBuildInfoFile.js index b7623e1af5670..fe60d8093d410 100644 --- a/tests/baselines/reference/tsbuild/sample1/initial-Build/when-logic-specifies-tsBuildInfoFile.js +++ b/tests/baselines/reference/tsbuild/sample1/initial-build/when-logic-specifies-tsBuildInfoFile.js @@ -1,3 +1,40 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/tests --verbose +12:00:00 AM - Projects in this build: + * src/core/tsconfig.json + * src/logic/tsconfig.json + * src/tests/tsconfig.json + +12:00:00 AM - Project 'src/core/tsconfig.json' is out of date because output file 'src/core/anotherModule.js' does not exist + +12:00:00 AM - Building project '/src/core/tsconfig.json'... + +12:00:00 AM - Project 'src/logic/tsconfig.json' is out of date because output file 'src/logic/index.js' does not exist + +12:00:00 AM - Building project '/src/logic/tsconfig.json'... + +12:00:00 AM - Project 'src/tests/tsconfig.json' is out of date because output file 'src/tests/index.js' does not exist + +12:00:00 AM - Building project '/src/tests/tsconfig.json'... + +exitCode:: 0 +readFiles:: { + "/src/tests/tsconfig.json": 1, + "/src/core/tsconfig.json": 1, + "/src/logic/tsconfig.json": 1, + "/src/core/tsconfig.tsbuildinfo": 1, + "/src/core/anotherModule.ts": 1, + "/src/core/index.ts": 1, + "/src/core/some_decl.d.ts": 1, + "/src/logic/ownFile.tsbuildinfo": 1, + "/src/logic/index.ts": 1, + "/src/core/index.d.ts": 1, + "/src/core/anotherModule.d.ts": 1, + "/src/tests/tsconfig.tsbuildinfo": 1, + "/src/tests/index.ts": 1, + "/src/logic/index.d.ts": 1 +} + //// [/src/core/anotherModule.d.ts] export declare const World = "hello"; //# sourceMappingURL=anotherModule.d.ts.map diff --git a/tests/baselines/reference/tsbuild/sample1/initial-Build/when-module-option-changes.js b/tests/baselines/reference/tsbuild/sample1/initial-build/when-module-option-changes.js similarity index 87% rename from tests/baselines/reference/tsbuild/sample1/initial-Build/when-module-option-changes.js rename to tests/baselines/reference/tsbuild/sample1/initial-build/when-module-option-changes.js index ad19329a2e08e..c890f0d576609 100644 --- a/tests/baselines/reference/tsbuild/sample1/initial-Build/when-module-option-changes.js +++ b/tests/baselines/reference/tsbuild/sample1/initial-build/when-module-option-changes.js @@ -1,3 +1,15 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/core --verbose +12:01:00 AM - Projects in this build: + * src/core/tsconfig.json + +12:01:00 AM - Project 'src/core/tsconfig.json' is out of date because output file 'src/core/anotherModule.js' does not exist + +12:01:00 AM - Building project '/src/core/tsconfig.json'... + +exitCode:: 0 + + //// [/src/core/anotherModule.js] "use strict"; exports.__esModule = true; diff --git a/tests/baselines/reference/tsbuild/sample1/initial-Build/when-target-option-changes.js b/tests/baselines/reference/tsbuild/sample1/initial-build/when-target-option-changes.js similarity index 85% rename from tests/baselines/reference/tsbuild/sample1/initial-Build/when-target-option-changes.js rename to tests/baselines/reference/tsbuild/sample1/initial-build/when-target-option-changes.js index c8fc2b1fbdebe..c615f77eb86df 100644 --- a/tests/baselines/reference/tsbuild/sample1/initial-Build/when-target-option-changes.js +++ b/tests/baselines/reference/tsbuild/sample1/initial-build/when-target-option-changes.js @@ -1,3 +1,23 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/core --verbose +12:01:00 AM - Projects in this build: + * src/core/tsconfig.json + +12:01:00 AM - Project 'src/core/tsconfig.json' is out of date because output file 'src/core/anotherModule.js' does not exist + +12:01:00 AM - Building project '/src/core/tsconfig.json'... + +TSFILE: /src/core/anotherModule.js +TSFILE: /src/core/index.js +TSFILE: /src/core/tsconfig.tsbuildinfo +/lib/lib.esnext.d.ts +/lib/lib.esnext.full.d.ts +/src/core/anotherModule.ts +/src/core/index.ts +/src/core/some_decl.d.ts +exitCode:: 0 + + //// [/lib/lib.d.ts] /// /// diff --git a/tests/baselines/reference/tsxAttributeResolution1.errors.txt b/tests/baselines/reference/tsxAttributeResolution1.errors.txt index 9fc3e8f94da18..46ccb39e7044c 100644 --- a/tests/baselines/reference/tsxAttributeResolution1.errors.txt +++ b/tests/baselines/reference/tsxAttributeResolution1.errors.txt @@ -1,10 +1,10 @@ tests/cases/conformance/jsx/file.tsx(23,8): error TS2322: Type 'string' is not assignable to type 'number'. -tests/cases/conformance/jsx/file.tsx(24,2): error TS2322: Type '{ y: number; }' is not assignable to type 'Attribs1'. +tests/cases/conformance/jsx/file.tsx(24,8): error TS2322: Type '{ y: number; }' is not assignable to type 'Attribs1'. Property 'y' does not exist on type 'Attribs1'. -tests/cases/conformance/jsx/file.tsx(25,2): error TS2322: Type '{ y: string; }' is not assignable to type 'Attribs1'. +tests/cases/conformance/jsx/file.tsx(25,8): error TS2322: Type '{ y: string; }' is not assignable to type 'Attribs1'. Property 'y' does not exist on type 'Attribs1'. tests/cases/conformance/jsx/file.tsx(26,8): error TS2322: Type 'string' is not assignable to type 'number'. -tests/cases/conformance/jsx/file.tsx(27,2): error TS2322: Type '{ var: string; }' is not assignable to type 'Attribs1'. +tests/cases/conformance/jsx/file.tsx(27,8): error TS2322: Type '{ var: string; }' is not assignable to type 'Attribs1'. Property 'var' does not exist on type 'Attribs1'. tests/cases/conformance/jsx/file.tsx(29,2): error TS2741: Property 'reqd' is missing in type '{}' but required in type '{ reqd: string; }'. tests/cases/conformance/jsx/file.tsx(30,8): error TS2322: Type 'number' is not assignable to type 'string'. @@ -38,11 +38,11 @@ tests/cases/conformance/jsx/file.tsx(30,8): error TS2322: Type 'number' is not a !!! error TS2322: Type 'string' is not assignable to type 'number'. !!! related TS6500 tests/cases/conformance/jsx/file.tsx:10:2: The expected type comes from property 'x' which is declared here on type 'Attribs1' ; // Error, no property "y" - ~~~~~ + ~ !!! error TS2322: Type '{ y: number; }' is not assignable to type 'Attribs1'. !!! error TS2322: Property 'y' does not exist on type 'Attribs1'. ; // Error, no property "y" - ~~~~~ + ~ !!! error TS2322: Type '{ y: string; }' is not assignable to type 'Attribs1'. !!! error TS2322: Property 'y' does not exist on type 'Attribs1'. ; // Error, "32" is not number @@ -50,7 +50,7 @@ tests/cases/conformance/jsx/file.tsx(30,8): error TS2322: Type 'number' is not a !!! error TS2322: Type 'string' is not assignable to type 'number'. !!! related TS6500 tests/cases/conformance/jsx/file.tsx:10:2: The expected type comes from property 'x' which is declared here on type 'Attribs1' ; // Error, no 'var' property - ~~~~~ + ~~~ !!! error TS2322: Type '{ var: string; }' is not assignable to type 'Attribs1'. !!! error TS2322: Property 'var' does not exist on type 'Attribs1'. diff --git a/tests/baselines/reference/tsxAttributeResolution11.errors.txt b/tests/baselines/reference/tsxAttributeResolution11.errors.txt index 6c6a23a9b707f..d490faad3147f 100644 --- a/tests/baselines/reference/tsxAttributeResolution11.errors.txt +++ b/tests/baselines/reference/tsxAttributeResolution11.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/jsx/file.tsx(11,10): error TS2322: Type '{ bar: string; }' is not assignable to type 'IntrinsicAttributes & { ref?: string; }'. +tests/cases/conformance/jsx/file.tsx(11,22): error TS2322: Type '{ bar: string; }' is not assignable to type 'IntrinsicAttributes & { ref?: string; }'. Property 'bar' does not exist on type 'IntrinsicAttributes & { ref?: string; }'. @@ -27,7 +27,7 @@ tests/cases/conformance/jsx/file.tsx(11,10): error TS2322: Type '{ bar: string; // Should be an OK var x = ; - ~~~~~~~~~~~ + ~~~ !!! error TS2322: Type '{ bar: string; }' is not assignable to type 'IntrinsicAttributes & { ref?: string; }'. !!! error TS2322: Property 'bar' does not exist on type 'IntrinsicAttributes & { ref?: string; }'. diff --git a/tests/baselines/reference/tsxAttributeResolution15.errors.txt b/tests/baselines/reference/tsxAttributeResolution15.errors.txt index ca86178b57863..7ec97ba46757d 100644 --- a/tests/baselines/reference/tsxAttributeResolution15.errors.txt +++ b/tests/baselines/reference/tsxAttributeResolution15.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/jsx/file.tsx(11,10): error TS2322: Type '{ prop1: string; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes & { children?: ReactNode; }'. +tests/cases/conformance/jsx/file.tsx(11,21): error TS2322: Type '{ prop1: string; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes & { children?: ReactNode; }'. Property 'prop1' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes & { children?: ReactNode; }'. tests/cases/conformance/jsx/file.tsx(14,44): error TS7017: Element implicitly has an 'any' type because type 'typeof globalThis' has no index signature. @@ -15,7 +15,7 @@ tests/cases/conformance/jsx/file.tsx(14,44): error TS7017: Element implicitly ha // Error let a = - ~~~~~~~~~~ + ~~~~~ !!! error TS2322: Type '{ prop1: string; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes & { children?: ReactNode; }'. !!! error TS2322: Property 'prop1' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes & { children?: ReactNode; }'. diff --git a/tests/baselines/reference/tsxElementResolution11.errors.txt b/tests/baselines/reference/tsxElementResolution11.errors.txt index d08a6ed2721c9..cc032610e2b94 100644 --- a/tests/baselines/reference/tsxElementResolution11.errors.txt +++ b/tests/baselines/reference/tsxElementResolution11.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/jsx/file.tsx(17,2): error TS2322: Type '{ x: number; }' is not assignable to type '{ q?: number; }'. +tests/cases/conformance/jsx/file.tsx(17,7): error TS2322: Type '{ x: number; }' is not assignable to type '{ q?: number; }'. Property 'x' does not exist on type '{ q?: number; }'. @@ -20,7 +20,7 @@ tests/cases/conformance/jsx/file.tsx(17,2): error TS2322: Type '{ x: number; }' } var Obj2: Obj2type; ; // Error - ~~~~ + ~ !!! error TS2322: Type '{ x: number; }' is not assignable to type '{ q?: number; }'. !!! error TS2322: Property 'x' does not exist on type '{ q?: number; }'. diff --git a/tests/baselines/reference/tsxElementResolution3.errors.txt b/tests/baselines/reference/tsxElementResolution3.errors.txt index f220dbd8a5bdd..8f8679b38572e 100644 --- a/tests/baselines/reference/tsxElementResolution3.errors.txt +++ b/tests/baselines/reference/tsxElementResolution3.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/jsx/file.tsx(12,2): error TS2322: Type '{ w: string; }' is not assignable to type '{ n: string; }'. +tests/cases/conformance/jsx/file.tsx(12,7): error TS2322: Type '{ w: string; }' is not assignable to type '{ n: string; }'. Property 'w' does not exist on type '{ n: string; }'. @@ -15,6 +15,6 @@ tests/cases/conformance/jsx/file.tsx(12,2): error TS2322: Type '{ w: string; }' // Error ; - ~~~~ + ~ !!! error TS2322: Type '{ w: string; }' is not assignable to type '{ n: string; }'. !!! error TS2322: Property 'w' does not exist on type '{ n: string; }'. \ No newline at end of file diff --git a/tests/baselines/reference/tsxElementResolution4.errors.txt b/tests/baselines/reference/tsxElementResolution4.errors.txt index f76925030f27b..235adbb199a16 100644 --- a/tests/baselines/reference/tsxElementResolution4.errors.txt +++ b/tests/baselines/reference/tsxElementResolution4.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/jsx/file.tsx(16,2): error TS2322: Type '{ q: string; }' is not assignable to type '{ m: string; }'. +tests/cases/conformance/jsx/file.tsx(16,7): error TS2322: Type '{ q: string; }' is not assignable to type '{ m: string; }'. Property 'q' does not exist on type '{ m: string; }'. @@ -19,7 +19,7 @@ tests/cases/conformance/jsx/file.tsx(16,2): error TS2322: Type '{ q: string; }' // Error ; - ~~~~ + ~ !!! error TS2322: Type '{ q: string; }' is not assignable to type '{ m: string; }'. !!! error TS2322: Property 'q' does not exist on type '{ m: string; }'. \ No newline at end of file diff --git a/tests/baselines/reference/tsxLibraryManagedAttributes.errors.txt b/tests/baselines/reference/tsxLibraryManagedAttributes.errors.txt index b34ee77d1fbc5..4b4448e42f6f4 100644 --- a/tests/baselines/reference/tsxLibraryManagedAttributes.errors.txt +++ b/tests/baselines/reference/tsxLibraryManagedAttributes.errors.txt @@ -1,22 +1,22 @@ tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(55,12): error TS2322: Type '{ foo: number; }' is not assignable to type 'Defaultize; bar: PropTypeChecker; baz: PropTypeChecker; }>, { foo: number; }>'. Type '{ foo: number; }' is missing the following properties from type '{ bar: string | number | ReactComponent<{}, {}> | null | undefined; baz: string; }': bar, baz -tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(57,12): error TS2322: Type '{ bar: string; baz: string; bat: string; }' is not assignable to type 'Defaultize; bar: PropTypeChecker; baz: PropTypeChecker; }>, { foo: number; }>'. +tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(57,41): error TS2322: Type '{ bar: string; baz: string; bat: string; }' is not assignable to type 'Defaultize; bar: PropTypeChecker; baz: PropTypeChecker; }>, { foo: number; }>'. Property 'bat' does not exist on type 'Defaultize; bar: PropTypeChecker; baz: PropTypeChecker; }>, { foo: number; }>'. tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(59,42): error TS2322: Type 'null' is not assignable to type 'string'. tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(69,26): error TS2322: Type 'string' is not assignable to type 'number | null | undefined'. tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(71,35): error TS2322: Type 'null' is not assignable to type 'ReactNode'. -tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(80,12): error TS2322: Type '{ foo: number; bar: string; }' is not assignable to type 'Defaultize<{}, { foo: number; }>'. +tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(80,38): error TS2322: Type '{ foo: number; bar: string; }' is not assignable to type 'Defaultize<{}, { foo: number; }>'. Property 'bar' does not exist on type 'Defaultize<{}, { foo: number; }>'. tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(81,29): error TS2322: Type 'string' is not assignable to type 'number | undefined'. tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(98,12): error TS2322: Type '{ foo: string; }' is not assignable to type 'Defaultize; bar: PropTypeChecker; baz: PropTypeChecker; }>, { foo: string; }>'. Type '{ foo: string; }' is missing the following properties from type '{ bar: string | number | ReactComponent<{}, {}> | null | undefined; baz: number; }': bar, baz -tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(100,12): error TS2322: Type '{ bar: string; baz: number; bat: string; }' is not assignable to type 'Defaultize; bar: PropTypeChecker; baz: PropTypeChecker; }>, { foo: string; }>'. +tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(100,56): error TS2322: Type '{ bar: string; baz: number; bat: string; }' is not assignable to type 'Defaultize; bar: PropTypeChecker; baz: PropTypeChecker; }>, { foo: string; }>'. Property 'bat' does not exist on type 'Defaultize; bar: PropTypeChecker; baz: PropTypeChecker; }>, { foo: string; }>'. tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(102,57): error TS2322: Type 'null' is not assignable to type 'number'. tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(111,46): error TS2322: Type 'number' is not assignable to type 'string'. tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(112,46): error TS2322: Type 'null' is not assignable to type 'string'. tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(113,57): error TS2322: Type 'null' is not assignable to type 'ReactNode'. -tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(122,12): error TS2322: Type '{ foo: string; bar: string; }' is not assignable to type 'Defaultize'. +tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(122,58): error TS2322: Type '{ foo: string; bar: string; }' is not assignable to type 'Defaultize'. Property 'bar' does not exist on type 'Defaultize'. tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(123,49): error TS2322: Type 'number' is not assignable to type 'string | undefined'. @@ -82,7 +82,7 @@ tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(123,49): error TS232 !!! error TS2322: Type '{ foo: number; }' is missing the following properties from type '{ bar: string | number | ReactComponent<{}, {}> | null | undefined; baz: string; }': bar, baz const c = ; const d = ; // Error, baz not a valid prop - ~~~~~~~~~ + ~~~ !!! error TS2322: Type '{ bar: string; baz: string; bat: string; }' is not assignable to type 'Defaultize; bar: PropTypeChecker; baz: PropTypeChecker; }>, { foo: number; }>'. !!! error TS2322: Property 'bat' does not exist on type 'Defaultize; bar: PropTypeChecker; baz: PropTypeChecker; }>, { foo: number; }>'. const e = ; // bar is nullable/undefinable since it's not marked `isRequired` @@ -116,7 +116,7 @@ tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(123,49): error TS232 const k = ; const l = ; // error, no prop named bar - ~~~~~~~~~~~~~~~~ + ~~~ !!! error TS2322: Type '{ foo: number; bar: string; }' is not assignable to type 'Defaultize<{}, { foo: number; }>'. !!! error TS2322: Property 'bar' does not exist on type 'Defaultize<{}, { foo: number; }>'. const m = ; // error, wrong type @@ -145,7 +145,7 @@ tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(123,49): error TS232 !!! error TS2322: Type '{ foo: string; }' is missing the following properties from type '{ bar: string | number | ReactComponent<{}, {}> | null | undefined; baz: number; }': bar, baz const p = ; const q = ; // Error, baz not a valid prop - ~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS2322: Type '{ bar: string; baz: number; bat: string; }' is not assignable to type 'Defaultize; bar: PropTypeChecker; baz: PropTypeChecker; }>, { foo: string; }>'. !!! error TS2322: Property 'bat' does not exist on type 'Defaultize; bar: PropTypeChecker; baz: PropTypeChecker; }>, { foo: string; }>'. const r = ; // bar is nullable/undefinable since it's not marked `isRequired` @@ -181,7 +181,7 @@ tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(123,49): error TS232 const x = ; const y = ; // error, no prop named bar - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS2322: Type '{ foo: string; bar: string; }' is not assignable to type 'Defaultize'. !!! error TS2322: Property 'bar' does not exist on type 'Defaultize'. const z = ; // error, wrong type diff --git a/tests/baselines/reference/tsxSpreadAttributesResolution14.errors.txt b/tests/baselines/reference/tsxSpreadAttributesResolution14.errors.txt index 67beb30ccb021..f000257b9d543 100644 --- a/tests/baselines/reference/tsxSpreadAttributesResolution14.errors.txt +++ b/tests/baselines/reference/tsxSpreadAttributesResolution14.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/jsx/file.tsx(11,10): error TS2322: Type '{ Property1: true; property1: string; property2: number; }' is not assignable to type 'IntrinsicAttributes & AnotherComponentProps'. +tests/cases/conformance/jsx/file.tsx(11,38): error TS2322: Type '{ Property1: true; property1: string; property2: number; }' is not assignable to type 'IntrinsicAttributes & AnotherComponentProps'. Property 'Property1' does not exist on type 'IntrinsicAttributes & AnotherComponentProps'. @@ -14,7 +14,7 @@ tests/cases/conformance/jsx/file.tsx(11,10): error TS2322: Type '{ Property1: tr return ( // Error extra property - ~~~~~~~~~~~~~~~~ + ~~~~~~~~~ !!! error TS2322: Type '{ Property1: true; property1: string; property2: number; }' is not assignable to type 'IntrinsicAttributes & AnotherComponentProps'. !!! error TS2322: Property 'Property1' does not exist on type 'IntrinsicAttributes & AnotherComponentProps'. ); diff --git a/tests/baselines/reference/tsxSpreadAttributesResolution2.errors.txt b/tests/baselines/reference/tsxSpreadAttributesResolution2.errors.txt index d9748382f25b9..a5f36e5ed0844 100644 --- a/tests/baselines/reference/tsxSpreadAttributesResolution2.errors.txt +++ b/tests/baselines/reference/tsxSpreadAttributesResolution2.errors.txt @@ -5,7 +5,7 @@ tests/cases/conformance/jsx/file.tsx(22,21): error TS2322: Type 'true' is not as tests/cases/conformance/jsx/file.tsx(23,10): error TS2322: Type '{ x: number; y: "2"; }' is not assignable to type 'PoisonedProp'. Types of property 'x' are incompatible. Type 'number' is not assignable to type 'string'. -tests/cases/conformance/jsx/file.tsx(24,11): error TS2322: Type '{ X: string; x: number; y: "2"; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes & PoisonedProp & { children?: ReactNode; }'. +tests/cases/conformance/jsx/file.tsx(24,40): error TS2322: Type '{ X: string; x: number; y: "2"; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes & PoisonedProp & { children?: ReactNode; }'. Property 'X' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes & PoisonedProp & { children?: ReactNode; }'. @@ -48,6 +48,6 @@ tests/cases/conformance/jsx/file.tsx(24,11): error TS2322: Type '{ X: string; x: !!! error TS2322: Types of property 'x' are incompatible. !!! error TS2322: Type 'number' is not assignable to type 'string'. let w1 = ; - ~~~~~~~~ + ~ !!! error TS2322: Type '{ X: string; x: number; y: "2"; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes & PoisonedProp & { children?: ReactNode; }'. !!! error TS2322: Property 'X' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes & PoisonedProp & { children?: ReactNode; }'. \ No newline at end of file diff --git a/tests/baselines/reference/tsxStatelessFunctionComponentOverload4.errors.txt b/tests/baselines/reference/tsxStatelessFunctionComponentOverload4.errors.txt index 5318c77efaec9..3a47e329162a8 100644 --- a/tests/baselines/reference/tsxStatelessFunctionComponentOverload4.errors.txt +++ b/tests/baselines/reference/tsxStatelessFunctionComponentOverload4.errors.txt @@ -1,23 +1,23 @@ -tests/cases/conformance/jsx/file.tsx(12,13): error TS2769: No overload matches this call. +tests/cases/conformance/jsx/file.tsx(12,22): error TS2769: No overload matches this call. Overload 1 of 2, '(): Element', gave the following error. Type '{ extraProp: true; }' is not assignable to type 'IntrinsicAttributes'. Property 'extraProp' does not exist on type 'IntrinsicAttributes'. Overload 2 of 2, '(l: { yy: number; yy1: string; }): Element', gave the following error. Type '{ extraProp: true; }' is not assignable to type 'IntrinsicAttributes & { yy: number; yy1: string; }'. Property 'extraProp' does not exist on type 'IntrinsicAttributes & { yy: number; yy1: string; }'. -tests/cases/conformance/jsx/file.tsx(13,13): error TS2769: No overload matches this call. +tests/cases/conformance/jsx/file.tsx(13,12): error TS2769: No overload matches this call. Overload 1 of 2, '(): Element', gave the following error. Type '{ yy: number; }' is not assignable to type 'IntrinsicAttributes'. Property 'yy' does not exist on type 'IntrinsicAttributes'. Overload 2 of 2, '(l: { yy: number; yy1: string; }): Element', gave the following error. Property 'yy1' is missing in type '{ yy: number; }' but required in type '{ yy: number; yy1: string; }'. -tests/cases/conformance/jsx/file.tsx(14,12): error TS2769: No overload matches this call. +tests/cases/conformance/jsx/file.tsx(14,31): error TS2769: No overload matches this call. Overload 1 of 2, '(): Element', gave the following error. Type '{ yy1: true; yy: number; }' is not assignable to type 'IntrinsicAttributes'. Property 'yy1' does not exist on type 'IntrinsicAttributes'. Overload 2 of 2, '(l: { yy: number; yy1: string; }): Element', gave the following error. Type 'true' is not assignable to type 'string'. -tests/cases/conformance/jsx/file.tsx(16,13): error TS2769: No overload matches this call. +tests/cases/conformance/jsx/file.tsx(16,31): error TS2769: No overload matches this call. Overload 1 of 2, '(): Element', gave the following error. Type '{ y1: number; yy: number; yy1: string; }' is not assignable to type 'IntrinsicAttributes'. Property 'y1' does not exist on type 'IntrinsicAttributes'. @@ -89,7 +89,7 @@ tests/cases/conformance/jsx/file.tsx(36,12): error TS2769: No overload matches t // Error const c0 = ; // extra property; - ~~~~~~~~ + ~~~~~~~~~ !!! error TS2769: No overload matches this call. !!! error TS2769: Overload 1 of 2, '(): Element', gave the following error. !!! error TS2769: Type '{ extraProp: true; }' is not assignable to type 'IntrinsicAttributes'. @@ -98,7 +98,7 @@ tests/cases/conformance/jsx/file.tsx(36,12): error TS2769: No overload matches t !!! error TS2769: Type '{ extraProp: true; }' is not assignable to type 'IntrinsicAttributes & { yy: number; yy1: string; }'. !!! error TS2769: Property 'extraProp' does not exist on type 'IntrinsicAttributes & { yy: number; yy1: string; }'. const c1 = ; // missing property; - ~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~ !!! error TS2769: No overload matches this call. !!! error TS2769: Overload 1 of 2, '(): Element', gave the following error. !!! error TS2769: Type '{ yy: number; }' is not assignable to type 'IntrinsicAttributes'. @@ -107,7 +107,7 @@ tests/cases/conformance/jsx/file.tsx(36,12): error TS2769: No overload matches t !!! error TS2769: Property 'yy1' is missing in type '{ yy: number; }' but required in type '{ yy: number; yy1: string; }'. !!! related TS2728 tests/cases/conformance/jsx/file.tsx:3:43: 'yy1' is declared here. const c2 = ; // type incompatible; - ~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS2769: No overload matches this call. !!! error TS2769: Overload 1 of 2, '(): Element', gave the following error. !!! error TS2769: Type '{ yy1: true; yy: number; }' is not assignable to type 'IntrinsicAttributes'. @@ -117,7 +117,7 @@ tests/cases/conformance/jsx/file.tsx(36,12): error TS2769: No overload matches t !!! related TS6500 tests/cases/conformance/jsx/file.tsx:3:43: The expected type comes from property 'yy1' which is declared here on type 'IntrinsicAttributes & { yy: number; yy1: string; }' const c3 = ; // This is OK becuase all attribute are spread const c4 = ; // extra property; - ~~~~~~~~ + ~~ !!! error TS2769: No overload matches this call. !!! error TS2769: Overload 1 of 2, '(): Element', gave the following error. !!! error TS2769: Type '{ y1: number; yy: number; yy1: string; }' is not assignable to type 'IntrinsicAttributes'. diff --git a/tests/baselines/reference/tsxStatelessFunctionComponentOverload5.errors.txt b/tests/baselines/reference/tsxStatelessFunctionComponentOverload5.errors.txt index faf129dda4bad..aa2e4fe19c6d8 100644 --- a/tests/baselines/reference/tsxStatelessFunctionComponentOverload5.errors.txt +++ b/tests/baselines/reference/tsxStatelessFunctionComponentOverload5.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/jsx/file.tsx(48,13): error TS2769: No overload matches this call. +tests/cases/conformance/jsx/file.tsx(48,12): error TS2769: No overload matches this call. Overload 1 of 3, '(buttonProps: ButtonProps): Element', gave the following error. Type '{ children: string; to: string; onClick: (e: MouseEvent) => void; }' is not assignable to type 'IntrinsicAttributes & ButtonProps'. Property 'to' does not exist on type 'IntrinsicAttributes & ButtonProps'. @@ -80,7 +80,7 @@ tests/cases/conformance/jsx/file.tsx(56,12): error TS2769: No overload matches t // Error const b0 = {}}>GO; // extra property; - ~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2769: No overload matches this call. !!! error TS2769: Overload 1 of 3, '(buttonProps: ButtonProps): Element', gave the following error. !!! error TS2769: Type '{ children: string; to: string; onClick: (e: MouseEvent) => void; }' is not assignable to type 'IntrinsicAttributes & ButtonProps'. diff --git a/tests/baselines/reference/tsxStatelessFunctionComponents1.errors.txt b/tests/baselines/reference/tsxStatelessFunctionComponents1.errors.txt index 2ca7adfbc3e69..7827c0625a45f 100644 --- a/tests/baselines/reference/tsxStatelessFunctionComponents1.errors.txt +++ b/tests/baselines/reference/tsxStatelessFunctionComponents1.errors.txt @@ -1,12 +1,12 @@ -tests/cases/conformance/jsx/file.tsx(19,10): error TS2322: Type '{ naaame: string; }' is not assignable to type 'IntrinsicAttributes & { name: string; }'. +tests/cases/conformance/jsx/file.tsx(19,16): error TS2322: Type '{ naaame: string; }' is not assignable to type 'IntrinsicAttributes & { name: string; }'. Property 'naaame' does not exist on type 'IntrinsicAttributes & { name: string; }'. tests/cases/conformance/jsx/file.tsx(27,15): error TS2322: Type 'number' is not assignable to type 'string'. -tests/cases/conformance/jsx/file.tsx(29,10): error TS2322: Type '{ naaaaaaame: string; }' is not assignable to type 'IntrinsicAttributes & { name?: string; }'. +tests/cases/conformance/jsx/file.tsx(29,15): error TS2322: Type '{ naaaaaaame: string; }' is not assignable to type 'IntrinsicAttributes & { name?: string; }'. Property 'naaaaaaame' does not exist on type 'IntrinsicAttributes & { name?: string; }'. tests/cases/conformance/jsx/file.tsx(34,10): error TS2741: Property '"prop-name"' is missing in type '{ extra-prop-name: string; }' but required in type '{ "prop-name": string; }'. -tests/cases/conformance/jsx/file.tsx(37,10): error TS2322: Type '{ prop1: true; }' is not assignable to type 'IntrinsicAttributes'. +tests/cases/conformance/jsx/file.tsx(37,23): error TS2322: Type '{ prop1: true; }' is not assignable to type 'IntrinsicAttributes'. Property 'prop1' does not exist on type 'IntrinsicAttributes'. -tests/cases/conformance/jsx/file.tsx(38,11): error TS2322: Type '{ ref: (x: any) => any; }' is not assignable to type 'IntrinsicAttributes'. +tests/cases/conformance/jsx/file.tsx(38,24): error TS2322: Type '{ ref: (x: any) => any; }' is not assignable to type 'IntrinsicAttributes'. Property 'ref' does not exist on type 'IntrinsicAttributes'. tests/cases/conformance/jsx/file.tsx(41,16): error TS1005: ',' expected. tests/cases/conformance/jsx/file.tsx(45,11): error TS2559: Type '{ prop1: boolean; }' has no properties in common with type 'IntrinsicAttributes'. @@ -32,7 +32,7 @@ tests/cases/conformance/jsx/file.tsx(45,11): error TS2559: Type '{ prop1: boolea let a1 = ; // Error let b = ; - ~~~~~ + ~~~~~~ !!! error TS2322: Type '{ naaame: string; }' is not assignable to type 'IntrinsicAttributes & { name: string; }'. !!! error TS2322: Property 'naaame' does not exist on type 'IntrinsicAttributes & { name: string; }'. @@ -47,7 +47,7 @@ tests/cases/conformance/jsx/file.tsx(45,11): error TS2559: Type '{ prop1: boolea !!! error TS2322: Type 'number' is not assignable to type 'string'. // Error let f = ; - ~~~~ + ~~~~~~~~~~ !!! error TS2322: Type '{ naaaaaaame: string; }' is not assignable to type 'IntrinsicAttributes & { name?: string; }'. !!! error TS2322: Property 'naaaaaaame' does not exist on type 'IntrinsicAttributes & { name?: string; }'. @@ -61,11 +61,11 @@ tests/cases/conformance/jsx/file.tsx(45,11): error TS2559: Type '{ prop1: boolea // Error let i = - ~~~~~~~~~~~~ + ~~~~~ !!! error TS2322: Type '{ prop1: true; }' is not assignable to type 'IntrinsicAttributes'. !!! error TS2322: Property 'prop1' does not exist on type 'IntrinsicAttributes'. let i1 = x.greeting.substr(10)} /> - ~~~~~~~~~~~~ + ~~~ !!! error TS2322: Type '{ ref: (x: any) => any; }' is not assignable to type 'IntrinsicAttributes'. !!! error TS2322: Property 'ref' does not exist on type 'IntrinsicAttributes'. diff --git a/tests/baselines/reference/tsxStatelessFunctionComponents2.errors.txt b/tests/baselines/reference/tsxStatelessFunctionComponents2.errors.txt index 551d0e7252391..b6727eb5ca81a 100644 --- a/tests/baselines/reference/tsxStatelessFunctionComponents2.errors.txt +++ b/tests/baselines/reference/tsxStatelessFunctionComponents2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/jsx/file.tsx(19,10): error TS2322: Type '{ ref: string; }' is not assignable to type 'IntrinsicAttributes & { name?: string; }'. +tests/cases/conformance/jsx/file.tsx(19,16): error TS2322: Type '{ ref: string; }' is not assignable to type 'IntrinsicAttributes & { name?: string; }'. Property 'ref' does not exist on type 'IntrinsicAttributes & { name?: string; }'. tests/cases/conformance/jsx/file.tsx(25,42): error TS2551: Property 'subtr' does not exist on type 'string'. Did you mean 'substr'? tests/cases/conformance/jsx/file.tsx(27,33): error TS2339: Property 'notARealProperty' does not exist on type 'BigGreeter'. @@ -25,7 +25,7 @@ tests/cases/conformance/jsx/file.tsx(35,26): error TS2339: Property 'propertyNot let b = ; // Error - not allowed to specify 'ref' on SFCs let c = ; - ~~~~~ + ~~~ !!! error TS2322: Type '{ ref: string; }' is not assignable to type 'IntrinsicAttributes & { name?: string; }'. !!! error TS2322: Property 'ref' does not exist on type 'IntrinsicAttributes & { name?: string; }'. diff --git a/tests/baselines/reference/tsxUnionElementType4.errors.txt b/tests/baselines/reference/tsxUnionElementType4.errors.txt index bca0229de54cf..40463bcbb7970 100644 --- a/tests/baselines/reference/tsxUnionElementType4.errors.txt +++ b/tests/baselines/reference/tsxUnionElementType4.errors.txt @@ -1,7 +1,7 @@ tests/cases/conformance/jsx/file.tsx(32,17): error TS2322: Type 'true' is not assignable to type 'never'. -tests/cases/conformance/jsx/file.tsx(33,10): error TS2322: Type '{ x: number; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes & { children?: ReactNode; }'. +tests/cases/conformance/jsx/file.tsx(33,21): error TS2322: Type '{ x: number; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes & { children?: ReactNode; }'. Property 'x' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes & { children?: ReactNode; }'. -tests/cases/conformance/jsx/file.tsx(34,10): error TS2322: Type '{ prop: true; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes & { children?: ReactNode; }'. +tests/cases/conformance/jsx/file.tsx(34,22): error TS2322: Type '{ prop: true; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes & { children?: ReactNode; }'. Property 'prop' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes & { children?: ReactNode; }'. @@ -42,11 +42,11 @@ tests/cases/conformance/jsx/file.tsx(34,10): error TS2322: Type '{ prop: true; } !!! error TS2322: Type 'true' is not assignable to type 'never'. !!! related TS6500 tests/cases/conformance/jsx/file.tsx:3:36: The expected type comes from property 'x' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes & { x: number; } & { children?: ReactNode; } & { x: string; } & { children?: ReactNode; }' let b = - ~~~~~~~~~~ + ~ !!! error TS2322: Type '{ x: number; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes & { children?: ReactNode; }'. !!! error TS2322: Property 'x' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes & { children?: ReactNode; }'. let c = ; - ~~~~~~~~~~~ + ~~~~ !!! error TS2322: Type '{ prop: true; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes & { children?: ReactNode; }'. !!! error TS2322: Property 'prop' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes & { children?: ReactNode; }'. \ No newline at end of file diff --git a/tests/baselines/reference/tsxUnionElementType6.errors.txt b/tests/baselines/reference/tsxUnionElementType6.errors.txt index 790285f2978c1..cad93a38ae9b9 100644 --- a/tests/baselines/reference/tsxUnionElementType6.errors.txt +++ b/tests/baselines/reference/tsxUnionElementType6.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/jsx/file.tsx(18,10): error TS2322: Type '{ x: true; }' is not assignable to type 'IntrinsicAttributes'. +tests/cases/conformance/jsx/file.tsx(18,23): error TS2322: Type '{ x: true; }' is not assignable to type 'IntrinsicAttributes'. Property 'x' does not exist on type 'IntrinsicAttributes'. tests/cases/conformance/jsx/file.tsx(19,27): error TS2322: Type 'string' is not assignable to type 'boolean'. tests/cases/conformance/jsx/file.tsx(20,10): error TS2741: Property 'x' is missing in type '{}' but required in type '{ x: boolean; }'. @@ -24,7 +24,7 @@ tests/cases/conformance/jsx/file.tsx(21,10): error TS2741: Property 'x' is missi var SFC2AndEmptyComp = SFC2 || EmptySFC1; // Error let a = ; - ~~~~~~~~~~~~ + ~ !!! error TS2322: Type '{ x: true; }' is not assignable to type 'IntrinsicAttributes'. !!! error TS2322: Property 'x' does not exist on type 'IntrinsicAttributes'. let b = ; diff --git a/tests/baselines/reference/twiceNestedKeyofIndexInference.js b/tests/baselines/reference/twiceNestedKeyofIndexInference.js new file mode 100644 index 0000000000000..ed4f0c6bfb5de --- /dev/null +++ b/tests/baselines/reference/twiceNestedKeyofIndexInference.js @@ -0,0 +1,43 @@ +//// [twiceNestedKeyofIndexInference.ts] +type Set1 = T extends any[] ? T : Pick> & { + [SK1 in K1]-?: Required>; +}[K1]; + +type Set2 = T extends any[] ? T : Pick> & { + [SK1 in K1]-?: Required<{ + [key in K1]: Set1; + }>; +}[K1]; + +declare function set(source: T, path: [K1], value: T[K1]): Set1; + +declare function set(source: T, path: [K1, K2], value: T[K1][K2]): Set2; + + +interface State { + a: { + b: string; + c: number; + }; + d: boolean; +} + +const state: State = { + a: { + b: "", + c: 0, + }, + d: false, +}; + +const newState: State = set(state, ["a", 'b'], 'why'); // shouldn't be an error + +//// [twiceNestedKeyofIndexInference.js] +var state = { + a: { + b: "", + c: 0 + }, + d: false +}; +var newState = set(state, ["a", 'b'], 'why'); // shouldn't be an error diff --git a/tests/baselines/reference/twiceNestedKeyofIndexInference.symbols b/tests/baselines/reference/twiceNestedKeyofIndexInference.symbols new file mode 100644 index 0000000000000..57fa8e738b294 --- /dev/null +++ b/tests/baselines/reference/twiceNestedKeyofIndexInference.symbols @@ -0,0 +1,139 @@ +=== tests/cases/compiler/twiceNestedKeyofIndexInference.ts === +type Set1 = T extends any[] ? T : Pick> & { +>Set1 : Symbol(Set1, Decl(twiceNestedKeyofIndexInference.ts, 0, 0)) +>T : Symbol(T, Decl(twiceNestedKeyofIndexInference.ts, 0, 10)) +>K1 : Symbol(K1, Decl(twiceNestedKeyofIndexInference.ts, 0, 12)) +>T : Symbol(T, Decl(twiceNestedKeyofIndexInference.ts, 0, 10)) +>T : Symbol(T, Decl(twiceNestedKeyofIndexInference.ts, 0, 10)) +>T : Symbol(T, Decl(twiceNestedKeyofIndexInference.ts, 0, 10)) +>Pick : Symbol(Pick, Decl(lib.es5.d.ts, --, --)) +>T : Symbol(T, Decl(twiceNestedKeyofIndexInference.ts, 0, 10)) +>Exclude : Symbol(Exclude, Decl(lib.es5.d.ts, --, --)) +>T : Symbol(T, Decl(twiceNestedKeyofIndexInference.ts, 0, 10)) +>K1 : Symbol(K1, Decl(twiceNestedKeyofIndexInference.ts, 0, 12)) + + [SK1 in K1]-?: Required>; +>SK1 : Symbol(SK1, Decl(twiceNestedKeyofIndexInference.ts, 1, 5)) +>K1 : Symbol(K1, Decl(twiceNestedKeyofIndexInference.ts, 0, 12)) +>Required : Symbol(Required, Decl(lib.es5.d.ts, --, --)) +>Pick : Symbol(Pick, Decl(lib.es5.d.ts, --, --)) +>T : Symbol(T, Decl(twiceNestedKeyofIndexInference.ts, 0, 10)) +>SK1 : Symbol(SK1, Decl(twiceNestedKeyofIndexInference.ts, 1, 5)) + +}[K1]; +>K1 : Symbol(K1, Decl(twiceNestedKeyofIndexInference.ts, 0, 12)) + +type Set2 = T extends any[] ? T : Pick> & { +>Set2 : Symbol(Set2, Decl(twiceNestedKeyofIndexInference.ts, 2, 6)) +>T : Symbol(T, Decl(twiceNestedKeyofIndexInference.ts, 4, 10)) +>K1 : Symbol(K1, Decl(twiceNestedKeyofIndexInference.ts, 4, 12)) +>T : Symbol(T, Decl(twiceNestedKeyofIndexInference.ts, 4, 10)) +>K2 : Symbol(K2, Decl(twiceNestedKeyofIndexInference.ts, 4, 32)) +>T : Symbol(T, Decl(twiceNestedKeyofIndexInference.ts, 4, 10)) +>K1 : Symbol(K1, Decl(twiceNestedKeyofIndexInference.ts, 4, 12)) +>T : Symbol(T, Decl(twiceNestedKeyofIndexInference.ts, 4, 10)) +>T : Symbol(T, Decl(twiceNestedKeyofIndexInference.ts, 4, 10)) +>Pick : Symbol(Pick, Decl(lib.es5.d.ts, --, --)) +>T : Symbol(T, Decl(twiceNestedKeyofIndexInference.ts, 4, 10)) +>Exclude : Symbol(Exclude, Decl(lib.es5.d.ts, --, --)) +>T : Symbol(T, Decl(twiceNestedKeyofIndexInference.ts, 4, 10)) +>K1 : Symbol(K1, Decl(twiceNestedKeyofIndexInference.ts, 4, 12)) + + [SK1 in K1]-?: Required<{ +>SK1 : Symbol(SK1, Decl(twiceNestedKeyofIndexInference.ts, 5, 5)) +>K1 : Symbol(K1, Decl(twiceNestedKeyofIndexInference.ts, 4, 12)) +>Required : Symbol(Required, Decl(lib.es5.d.ts, --, --)) + + [key in K1]: Set1; +>key : Symbol(key, Decl(twiceNestedKeyofIndexInference.ts, 6, 9)) +>K1 : Symbol(K1, Decl(twiceNestedKeyofIndexInference.ts, 4, 12)) +>Set1 : Symbol(Set1, Decl(twiceNestedKeyofIndexInference.ts, 0, 0)) +>T : Symbol(T, Decl(twiceNestedKeyofIndexInference.ts, 4, 10)) +>K1 : Symbol(K1, Decl(twiceNestedKeyofIndexInference.ts, 4, 12)) +>K2 : Symbol(K2, Decl(twiceNestedKeyofIndexInference.ts, 4, 32)) + + }>; +}[K1]; +>K1 : Symbol(K1, Decl(twiceNestedKeyofIndexInference.ts, 4, 12)) + +declare function set(source: T, path: [K1], value: T[K1]): Set1; +>set : Symbol(set, Decl(twiceNestedKeyofIndexInference.ts, 8, 6), Decl(twiceNestedKeyofIndexInference.ts, 10, 94)) +>T : Symbol(T, Decl(twiceNestedKeyofIndexInference.ts, 10, 21)) +>K1 : Symbol(K1, Decl(twiceNestedKeyofIndexInference.ts, 10, 23)) +>T : Symbol(T, Decl(twiceNestedKeyofIndexInference.ts, 10, 21)) +>source : Symbol(source, Decl(twiceNestedKeyofIndexInference.ts, 10, 44)) +>T : Symbol(T, Decl(twiceNestedKeyofIndexInference.ts, 10, 21)) +>path : Symbol(path, Decl(twiceNestedKeyofIndexInference.ts, 10, 54)) +>K1 : Symbol(K1, Decl(twiceNestedKeyofIndexInference.ts, 10, 23)) +>value : Symbol(value, Decl(twiceNestedKeyofIndexInference.ts, 10, 66)) +>T : Symbol(T, Decl(twiceNestedKeyofIndexInference.ts, 10, 21)) +>K1 : Symbol(K1, Decl(twiceNestedKeyofIndexInference.ts, 10, 23)) +>Set1 : Symbol(Set1, Decl(twiceNestedKeyofIndexInference.ts, 0, 0)) +>T : Symbol(T, Decl(twiceNestedKeyofIndexInference.ts, 10, 21)) +>K1 : Symbol(K1, Decl(twiceNestedKeyofIndexInference.ts, 10, 23)) + +declare function set(source: T, path: [K1, K2], value: T[K1][K2]): Set2; +>set : Symbol(set, Decl(twiceNestedKeyofIndexInference.ts, 8, 6), Decl(twiceNestedKeyofIndexInference.ts, 10, 94)) +>T : Symbol(T, Decl(twiceNestedKeyofIndexInference.ts, 12, 21)) +>K1 : Symbol(K1, Decl(twiceNestedKeyofIndexInference.ts, 12, 23)) +>T : Symbol(T, Decl(twiceNestedKeyofIndexInference.ts, 12, 21)) +>K2 : Symbol(K2, Decl(twiceNestedKeyofIndexInference.ts, 12, 43)) +>T : Symbol(T, Decl(twiceNestedKeyofIndexInference.ts, 12, 21)) +>K1 : Symbol(K1, Decl(twiceNestedKeyofIndexInference.ts, 12, 23)) +>source : Symbol(source, Decl(twiceNestedKeyofIndexInference.ts, 12, 68)) +>T : Symbol(T, Decl(twiceNestedKeyofIndexInference.ts, 12, 21)) +>path : Symbol(path, Decl(twiceNestedKeyofIndexInference.ts, 12, 78)) +>K1 : Symbol(K1, Decl(twiceNestedKeyofIndexInference.ts, 12, 23)) +>K2 : Symbol(K2, Decl(twiceNestedKeyofIndexInference.ts, 12, 43)) +>value : Symbol(value, Decl(twiceNestedKeyofIndexInference.ts, 12, 94)) +>T : Symbol(T, Decl(twiceNestedKeyofIndexInference.ts, 12, 21)) +>K1 : Symbol(K1, Decl(twiceNestedKeyofIndexInference.ts, 12, 23)) +>K2 : Symbol(K2, Decl(twiceNestedKeyofIndexInference.ts, 12, 43)) +>Set2 : Symbol(Set2, Decl(twiceNestedKeyofIndexInference.ts, 2, 6)) +>T : Symbol(T, Decl(twiceNestedKeyofIndexInference.ts, 12, 21)) +>K1 : Symbol(K1, Decl(twiceNestedKeyofIndexInference.ts, 12, 23)) +>K2 : Symbol(K2, Decl(twiceNestedKeyofIndexInference.ts, 12, 43)) + + +interface State { +>State : Symbol(State, Decl(twiceNestedKeyofIndexInference.ts, 12, 130)) + + a: { +>a : Symbol(State.a, Decl(twiceNestedKeyofIndexInference.ts, 15, 17)) + + b: string; +>b : Symbol(b, Decl(twiceNestedKeyofIndexInference.ts, 16, 8)) + + c: number; +>c : Symbol(c, Decl(twiceNestedKeyofIndexInference.ts, 17, 18)) + + }; + d: boolean; +>d : Symbol(State.d, Decl(twiceNestedKeyofIndexInference.ts, 19, 6)) +} + +const state: State = { +>state : Symbol(state, Decl(twiceNestedKeyofIndexInference.ts, 23, 5)) +>State : Symbol(State, Decl(twiceNestedKeyofIndexInference.ts, 12, 130)) + + a: { +>a : Symbol(a, Decl(twiceNestedKeyofIndexInference.ts, 23, 22)) + + b: "", +>b : Symbol(b, Decl(twiceNestedKeyofIndexInference.ts, 24, 8)) + + c: 0, +>c : Symbol(c, Decl(twiceNestedKeyofIndexInference.ts, 25, 14)) + + }, + d: false, +>d : Symbol(d, Decl(twiceNestedKeyofIndexInference.ts, 27, 6)) + +}; + +const newState: State = set(state, ["a", 'b'], 'why'); // shouldn't be an error +>newState : Symbol(newState, Decl(twiceNestedKeyofIndexInference.ts, 31, 5)) +>State : Symbol(State, Decl(twiceNestedKeyofIndexInference.ts, 12, 130)) +>set : Symbol(set, Decl(twiceNestedKeyofIndexInference.ts, 8, 6), Decl(twiceNestedKeyofIndexInference.ts, 10, 94)) +>state : Symbol(state, Decl(twiceNestedKeyofIndexInference.ts, 23, 5)) + diff --git a/tests/baselines/reference/twiceNestedKeyofIndexInference.types b/tests/baselines/reference/twiceNestedKeyofIndexInference.types new file mode 100644 index 0000000000000..68622038e72c3 --- /dev/null +++ b/tests/baselines/reference/twiceNestedKeyofIndexInference.types @@ -0,0 +1,76 @@ +=== tests/cases/compiler/twiceNestedKeyofIndexInference.ts === +type Set1 = T extends any[] ? T : Pick> & { +>Set1 : Set1 + + [SK1 in K1]-?: Required>; +}[K1]; + +type Set2 = T extends any[] ? T : Pick> & { +>Set2 : Set2 + + [SK1 in K1]-?: Required<{ + [key in K1]: Set1; + }>; +}[K1]; + +declare function set(source: T, path: [K1], value: T[K1]): Set1; +>set : { (source: T, path: [K1], value: T[K1]): Set1; (source: T, path: [K1, K2], value: T[K1][K2]): Set2; } +>source : T +>path : [K1] +>value : T[K1] + +declare function set(source: T, path: [K1, K2], value: T[K1][K2]): Set2; +>set : { (source: T, path: [K1], value: T[K1]): Set1; (source: T, path: [K1, K2], value: T[K1][K2]): Set2; } +>source : T +>path : [K1, K2] +>value : T[K1][K2] + + +interface State { + a: { +>a : { b: string; c: number; } + + b: string; +>b : string + + c: number; +>c : number + + }; + d: boolean; +>d : boolean +} + +const state: State = { +>state : State +>{ a: { b: "", c: 0, }, d: false,} : { a: { b: string; c: number; }; d: false; } + + a: { +>a : { b: string; c: number; } +>{ b: "", c: 0, } : { b: string; c: number; } + + b: "", +>b : string +>"" : "" + + c: 0, +>c : number +>0 : 0 + + }, + d: false, +>d : false +>false : false + +}; + +const newState: State = set(state, ["a", 'b'], 'why'); // shouldn't be an error +>newState : State +>set(state, ["a", 'b'], 'why') : Pick & Required<{ a: Pick<{ b: string; c: number; }, "c"> & Required>; }> +>set : { (source: T, path: [K1], value: T[K1]): Set1; (source: T, path: [K1, K2], value: T[K1][K2]): Set2; } +>state : State +>["a", 'b'] : ["a", "b"] +>"a" : "a" +>'b' : "b" +>'why' : "why" + diff --git a/tests/baselines/reference/twoGenericInterfacesWithDifferentConstraints.errors.txt b/tests/baselines/reference/twoGenericInterfacesWithDifferentConstraints.errors.txt index 21a35e0553b4c..edc33d6b1ba44 100644 --- a/tests/baselines/reference/twoGenericInterfacesWithDifferentConstraints.errors.txt +++ b/tests/baselines/reference/twoGenericInterfacesWithDifferentConstraints.errors.txt @@ -4,11 +4,9 @@ tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithDi tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithDifferentConstraints.ts(14,15): error TS2428: All declarations of 'B' must have identical type parameters. tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithDifferentConstraints.ts(32,22): error TS2428: All declarations of 'A' must have identical type parameters. tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithDifferentConstraints.ts(38,22): error TS2428: All declarations of 'A' must have identical type parameters. -tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithDifferentConstraints.ts(53,11): error TS2428: All declarations of 'C' must have identical type parameters. -tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithDifferentConstraints.ts(57,11): error TS2428: All declarations of 'C' must have identical type parameters. -==== tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithDifferentConstraints.ts (8 errors) ==== +==== tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithDifferentConstraints.ts (6 errors) ==== interface A { ~ !!! error TS2428: All declarations of 'A' must have identical type parameters. @@ -74,14 +72,10 @@ tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithDi } interface C { - ~ -!!! error TS2428: All declarations of 'C' must have identical type parameters. x: T; } - interface C { // error - ~ -!!! error TS2428: All declarations of 'C' must have identical type parameters. + interface C { // ok y: T; } diff --git a/tests/baselines/reference/twoGenericInterfacesWithDifferentConstraints.js b/tests/baselines/reference/twoGenericInterfacesWithDifferentConstraints.js index 5b1964b2891ec..7e62915cb542e 100644 --- a/tests/baselines/reference/twoGenericInterfacesWithDifferentConstraints.js +++ b/tests/baselines/reference/twoGenericInterfacesWithDifferentConstraints.js @@ -55,7 +55,7 @@ interface C { x: T; } -interface C { // error +interface C { // ok y: T; } diff --git a/tests/baselines/reference/twoGenericInterfacesWithDifferentConstraints.symbols b/tests/baselines/reference/twoGenericInterfacesWithDifferentConstraints.symbols index a1ad41441bda4..6dd5de33354f6 100644 --- a/tests/baselines/reference/twoGenericInterfacesWithDifferentConstraints.symbols +++ b/tests/baselines/reference/twoGenericInterfacesWithDifferentConstraints.symbols @@ -137,7 +137,7 @@ interface C { >T : Symbol(T, Decl(twoGenericInterfacesWithDifferentConstraints.ts, 52, 12), Decl(twoGenericInterfacesWithDifferentConstraints.ts, 56, 12)) } -interface C { // error +interface C { // ok >C : Symbol(C, Decl(twoGenericInterfacesWithDifferentConstraints.ts, 50, 1), Decl(twoGenericInterfacesWithDifferentConstraints.ts, 54, 1)) >T : Symbol(T, Decl(twoGenericInterfacesWithDifferentConstraints.ts, 52, 12), Decl(twoGenericInterfacesWithDifferentConstraints.ts, 56, 12)) diff --git a/tests/baselines/reference/twoGenericInterfacesWithDifferentConstraints.types b/tests/baselines/reference/twoGenericInterfacesWithDifferentConstraints.types index 70a8be8cb3aa6..87877311b5376 100644 --- a/tests/baselines/reference/twoGenericInterfacesWithDifferentConstraints.types +++ b/tests/baselines/reference/twoGenericInterfacesWithDifferentConstraints.types @@ -70,7 +70,7 @@ interface C { >x : T } -interface C { // error +interface C { // ok y: T; >y : T } diff --git a/tests/baselines/reference/typeParameterArgumentEquivalence5.errors.txt b/tests/baselines/reference/typeParameterArgumentEquivalence5.errors.txt index e5196d3d4a50d..b832ce6cb7c0b 100644 --- a/tests/baselines/reference/typeParameterArgumentEquivalence5.errors.txt +++ b/tests/baselines/reference/typeParameterArgumentEquivalence5.errors.txt @@ -1,9 +1,9 @@ tests/cases/compiler/typeParameterArgumentEquivalence5.ts(4,5): error TS2322: Type '() => (item: any) => T' is not assignable to type '() => (item: any) => U'. - Type '(item: any) => T' is not assignable to type '(item: any) => U'. + Call signature return types '(item: any) => T' and '(item: any) => U' are incompatible. Type 'T' is not assignable to type 'U'. 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. tests/cases/compiler/typeParameterArgumentEquivalence5.ts(5,5): error TS2322: Type '() => (item: any) => U' is not assignable to type '() => (item: any) => T'. - Type '(item: any) => U' is not assignable to type '(item: any) => T'. + Call signature return types '(item: any) => U' and '(item: any) => T' are incompatible. Type 'U' is not assignable to type 'T'. 'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. @@ -15,13 +15,13 @@ tests/cases/compiler/typeParameterArgumentEquivalence5.ts(5,5): error TS2322: Ty x = y; // Should be an error ~ !!! error TS2322: Type '() => (item: any) => T' is not assignable to type '() => (item: any) => U'. -!!! error TS2322: Type '(item: any) => T' is not assignable to type '(item: any) => U'. +!!! error TS2322: Call signature return types '(item: any) => T' and '(item: any) => U' are incompatible. !!! error TS2322: Type 'T' is not assignable to type 'U'. !!! error TS2322: 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. y = x; // Shound be an error ~ !!! error TS2322: Type '() => (item: any) => U' is not assignable to type '() => (item: any) => T'. -!!! error TS2322: Type '(item: any) => U' is not assignable to type '(item: any) => T'. +!!! error TS2322: Call signature return types '(item: any) => U' and '(item: any) => T' are incompatible. !!! error TS2322: Type 'U' is not assignable to type 'T'. !!! error TS2322: 'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. } diff --git a/tests/baselines/reference/typeParameterExtendsUnionConstraintDistributed.js b/tests/baselines/reference/typeParameterExtendsUnionConstraintDistributed.js new file mode 100644 index 0000000000000..ea8ac9270618f --- /dev/null +++ b/tests/baselines/reference/typeParameterExtendsUnionConstraintDistributed.js @@ -0,0 +1,11 @@ +//// [typeParameterExtendsUnionConstraintDistributed.ts] +type A = 1 | 2; +function f(a: T): A & T { return a; } // Shouldn't error + +type B = 2 | 3; +function f2(ab: T & U): (A | B) & T & U { return ab; } // Also shouldn't error + + +//// [typeParameterExtendsUnionConstraintDistributed.js] +function f(a) { return a; } // Shouldn't error +function f2(ab) { return ab; } // Also shouldn't error diff --git a/tests/baselines/reference/typeParameterExtendsUnionConstraintDistributed.symbols b/tests/baselines/reference/typeParameterExtendsUnionConstraintDistributed.symbols new file mode 100644 index 0000000000000..2d47ed96e14d2 --- /dev/null +++ b/tests/baselines/reference/typeParameterExtendsUnionConstraintDistributed.symbols @@ -0,0 +1,32 @@ +=== tests/cases/conformance/jsdoc/typeParameterExtendsUnionConstraintDistributed.ts === +type A = 1 | 2; +>A : Symbol(A, Decl(typeParameterExtendsUnionConstraintDistributed.ts, 0, 0)) + +function f(a: T): A & T { return a; } // Shouldn't error +>f : Symbol(f, Decl(typeParameterExtendsUnionConstraintDistributed.ts, 0, 15)) +>T : Symbol(T, Decl(typeParameterExtendsUnionConstraintDistributed.ts, 1, 11)) +>A : Symbol(A, Decl(typeParameterExtendsUnionConstraintDistributed.ts, 0, 0)) +>a : Symbol(a, Decl(typeParameterExtendsUnionConstraintDistributed.ts, 1, 24)) +>T : Symbol(T, Decl(typeParameterExtendsUnionConstraintDistributed.ts, 1, 11)) +>A : Symbol(A, Decl(typeParameterExtendsUnionConstraintDistributed.ts, 0, 0)) +>T : Symbol(T, Decl(typeParameterExtendsUnionConstraintDistributed.ts, 1, 11)) +>a : Symbol(a, Decl(typeParameterExtendsUnionConstraintDistributed.ts, 1, 24)) + +type B = 2 | 3; +>B : Symbol(B, Decl(typeParameterExtendsUnionConstraintDistributed.ts, 1, 50)) + +function f2(ab: T & U): (A | B) & T & U { return ab; } // Also shouldn't error +>f2 : Symbol(f2, Decl(typeParameterExtendsUnionConstraintDistributed.ts, 3, 15)) +>T : Symbol(T, Decl(typeParameterExtendsUnionConstraintDistributed.ts, 4, 12)) +>A : Symbol(A, Decl(typeParameterExtendsUnionConstraintDistributed.ts, 0, 0)) +>U : Symbol(U, Decl(typeParameterExtendsUnionConstraintDistributed.ts, 4, 24)) +>B : Symbol(B, Decl(typeParameterExtendsUnionConstraintDistributed.ts, 1, 50)) +>ab : Symbol(ab, Decl(typeParameterExtendsUnionConstraintDistributed.ts, 4, 38)) +>T : Symbol(T, Decl(typeParameterExtendsUnionConstraintDistributed.ts, 4, 12)) +>U : Symbol(U, Decl(typeParameterExtendsUnionConstraintDistributed.ts, 4, 24)) +>A : Symbol(A, Decl(typeParameterExtendsUnionConstraintDistributed.ts, 0, 0)) +>B : Symbol(B, Decl(typeParameterExtendsUnionConstraintDistributed.ts, 1, 50)) +>T : Symbol(T, Decl(typeParameterExtendsUnionConstraintDistributed.ts, 4, 12)) +>U : Symbol(U, Decl(typeParameterExtendsUnionConstraintDistributed.ts, 4, 24)) +>ab : Symbol(ab, Decl(typeParameterExtendsUnionConstraintDistributed.ts, 4, 38)) + diff --git a/tests/baselines/reference/typeParameterExtendsUnionConstraintDistributed.types b/tests/baselines/reference/typeParameterExtendsUnionConstraintDistributed.types new file mode 100644 index 0000000000000..4e81c9728c44c --- /dev/null +++ b/tests/baselines/reference/typeParameterExtendsUnionConstraintDistributed.types @@ -0,0 +1,17 @@ +=== tests/cases/conformance/jsdoc/typeParameterExtendsUnionConstraintDistributed.ts === +type A = 1 | 2; +>A : A + +function f(a: T): A & T { return a; } // Shouldn't error +>f : (a: T) => (1 & T) | (2 & T) +>a : T +>a : T + +type B = 2 | 3; +>B : B + +function f2(ab: T & U): (A | B) & T & U { return ab; } // Also shouldn't error +>f2 : (ab: T & U) => (1 & T & U) | (2 & T & U) | (3 & T & U) +>ab : T & U +>ab : T & U + diff --git a/tests/baselines/reference/types.asyncGenerators.es2018.1.symbols b/tests/baselines/reference/types.asyncGenerators.es2018.1.symbols index 3a0e33ce1b1d1..5cf681477e586 100644 --- a/tests/baselines/reference/types.asyncGenerators.es2018.1.symbols +++ b/tests/baselines/reference/types.asyncGenerators.es2018.1.symbols @@ -289,4 +289,13 @@ async function * awaitedType2() { >Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) } +async function * nextType1(): { next(...args: [] | [number | PromiseLike]): any } { +>nextType1 : Symbol(nextType1, Decl(types.asyncGenerators.es2018.1.ts, 122, 1)) +>next : Symbol(next, Decl(types.asyncGenerators.es2018.1.ts, 123, 31)) +>args : Symbol(args, Decl(types.asyncGenerators.es2018.1.ts, 123, 37)) +>PromiseLike : Symbol(PromiseLike, Decl(lib.es5.d.ts, --, --)) + + const x = yield; // `number | PromiseLike` (should not await TNext) +>x : Symbol(x, Decl(types.asyncGenerators.es2018.1.ts, 124, 9)) +} diff --git a/tests/baselines/reference/types.asyncGenerators.es2018.1.types b/tests/baselines/reference/types.asyncGenerators.es2018.1.types index 54db9b890ecd7..3c6e51c56d220 100644 --- a/tests/baselines/reference/types.asyncGenerators.es2018.1.types +++ b/tests/baselines/reference/types.asyncGenerators.es2018.1.types @@ -430,4 +430,13 @@ async function * awaitedType2() { >resolve : { (value: T | PromiseLike): Promise; (): Promise; } >1 : 1 } +async function * nextType1(): { next(...args: [] | [number | PromiseLike]): any } { +>nextType1 : () => { next(...args: [] | [number | PromiseLike]): any; } +>next : (...args: [] | [number | PromiseLike]) => any +>args : [] | [number | PromiseLike] + + const x = yield; // `number | PromiseLike` (should not await TNext) +>x : number | PromiseLike +>yield : number | PromiseLike +} diff --git a/tests/baselines/reference/types.asyncGenerators.es2018.2.errors.txt b/tests/baselines/reference/types.asyncGenerators.es2018.2.errors.txt index d7ec011bcedc1..3d588abf1ee84 100644 --- a/tests/baselines/reference/types.asyncGenerators.es2018.2.errors.txt +++ b/tests/baselines/reference/types.asyncGenerators.es2018.2.errors.txt @@ -1,39 +1,29 @@ tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.2.ts(2,12): error TS2504: Type '{}' must have a '[Symbol.asyncIterator]()' method that returns an async iterator. tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.2.ts(8,12): error TS2504: Type 'Promise' must have a '[Symbol.asyncIterator]()' method that returns an async iterator. tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.2.ts(10,7): error TS2322: Type '() => AsyncGenerator' is not assignable to type '() => AsyncIterableIterator'. - Type 'AsyncGenerator' is not assignable to type 'AsyncIterableIterator'. - Types of property 'next' are incompatible. - Type '(...args: [] | [PromiseLike]) => Promise>' is not assignable to type '(...args: [] | [PromiseLike]) => Promise>'. - Type 'Promise>' is not assignable to type 'Promise>'. - Type 'IteratorResult' is not assignable to type 'IteratorResult'. - Type 'IteratorYieldResult' is not assignable to type 'IteratorResult'. - Type 'IteratorYieldResult' is not assignable to type 'IteratorYieldResult'. - Type 'string' is not assignable to type 'number'. + Call signature return types 'AsyncGenerator' and 'AsyncIterableIterator' are incompatible. + The types returned by 'next(...)' are incompatible between these types. + Type 'Promise>' is not assignable to type 'Promise>'. + Type 'IteratorResult' is not assignable to type 'IteratorResult'. + Type 'IteratorYieldResult' is not assignable to type 'IteratorResult'. + Type 'IteratorYieldResult' is not assignable to type 'IteratorYieldResult'. + Type 'string' is not assignable to type 'number'. tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.2.ts(13,7): error TS2322: Type '() => AsyncGenerator' is not assignable to type '() => AsyncIterableIterator'. Type 'AsyncGenerator' is not assignable to type 'AsyncIterableIterator'. tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.2.ts(16,7): error TS2322: Type '() => AsyncGenerator' is not assignable to type '() => AsyncIterableIterator'. - Type 'AsyncGenerator' is not assignable to type 'AsyncIterableIterator'. - Types of property 'next' are incompatible. - Type '(...args: [] | [unknown]) => Promise>' is not assignable to type '(...args: [] | [PromiseLike]) => Promise>'. - Type 'Promise>' is not assignable to type 'Promise>'. + Call signature return types 'AsyncGenerator' and 'AsyncIterableIterator' are incompatible. + The types returned by 'next(...)' are incompatible between these types. + Type 'Promise>' is not assignable to type 'Promise>'. tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.2.ts(19,7): error TS2322: Type '() => AsyncGenerator' is not assignable to type '() => AsyncIterable'. - Type 'AsyncGenerator' is not assignable to type 'AsyncIterable'. - Types of property '[Symbol.asyncIterator]' are incompatible. - Type '() => AsyncGenerator' is not assignable to type '() => AsyncIterator'. - Type 'AsyncGenerator' is not assignable to type 'AsyncIterator'. - Types of property 'next' are incompatible. - Type '(...args: [] | [PromiseLike]) => Promise>' is not assignable to type '(...args: [] | [PromiseLike]) => Promise>'. - Type 'Promise>' is not assignable to type 'Promise>'. + Call signature return types 'AsyncGenerator' and 'AsyncIterable' are incompatible. + The types returned by '[Symbol.asyncIterator]().next(...)' are incompatible between these types. + Type 'Promise>' is not assignable to type 'Promise>'. tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.2.ts(22,7): error TS2322: Type '() => AsyncGenerator' is not assignable to type '() => AsyncIterable'. Type 'AsyncGenerator' is not assignable to type 'AsyncIterable'. tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.2.ts(25,7): error TS2322: Type '() => AsyncGenerator' is not assignable to type '() => AsyncIterable'. - Type 'AsyncGenerator' is not assignable to type 'AsyncIterable'. - Types of property '[Symbol.asyncIterator]' are incompatible. - Type '() => AsyncGenerator' is not assignable to type '() => AsyncIterator'. - Type 'AsyncGenerator' is not assignable to type 'AsyncIterator'. - Types of property 'next' are incompatible. - Type '(...args: [] | [unknown]) => Promise>' is not assignable to type '(...args: [] | [PromiseLike]) => Promise>'. - Type 'Promise>' is not assignable to type 'Promise>'. + Call signature return types 'AsyncGenerator' and 'AsyncIterable' are incompatible. + The types returned by '[Symbol.asyncIterator]().next(...)' are incompatible between these types. + Type 'Promise>' is not assignable to type 'Promise>'. tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.2.ts(28,7): error TS2322: Type '() => AsyncGenerator' is not assignable to type '() => AsyncIterator'. Type 'AsyncGenerator' is not assignable to type 'AsyncIterator'. tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.2.ts(31,7): error TS2322: Type '() => AsyncGenerator' is not assignable to type '() => AsyncIterator'. @@ -52,10 +42,9 @@ tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.2.ts( tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.2.ts(64,42): error TS2741: Property '[Symbol.iterator]' is missing in type 'AsyncGenerator' but required in type 'IterableIterator'. tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.2.ts(67,42): error TS2741: Property '[Symbol.iterator]' is missing in type 'AsyncGenerator' but required in type 'Iterable'. tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.2.ts(70,42): error TS2322: Type 'AsyncGenerator' is not assignable to type 'Iterator'. - Types of property 'next' are incompatible. - Type '(...args: [] | [PromiseLike]) => Promise>' is not assignable to type '(...args: [] | [undefined]) => IteratorResult'. - Type 'Promise>' is not assignable to type 'IteratorResult'. - Property 'value' is missing in type 'Promise>' but required in type 'IteratorYieldResult'. + The types returned by 'next(...)' are incompatible between these types. + Type 'Promise>' is not assignable to type 'IteratorResult'. + Property 'value' is missing in type 'Promise>' but required in type 'IteratorYieldResult'. tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.2.ts(74,12): error TS2504: Type '{}' must have a '[Symbol.asyncIterator]()' method that returns an async iterator. @@ -77,14 +66,13 @@ tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.2.ts( const assignability1: () => AsyncIterableIterator = async function * () { ~~~~~~~~~~~~~~ !!! error TS2322: Type '() => AsyncGenerator' is not assignable to type '() => AsyncIterableIterator'. -!!! error TS2322: Type 'AsyncGenerator' is not assignable to type 'AsyncIterableIterator'. -!!! error TS2322: Types of property 'next' are incompatible. -!!! error TS2322: Type '(...args: [] | [PromiseLike]) => Promise>' is not assignable to type '(...args: [] | [PromiseLike]) => Promise>'. -!!! error TS2322: Type 'Promise>' is not assignable to type 'Promise>'. -!!! error TS2322: Type 'IteratorResult' is not assignable to type 'IteratorResult'. -!!! error TS2322: Type 'IteratorYieldResult' is not assignable to type 'IteratorResult'. -!!! error TS2322: Type 'IteratorYieldResult' is not assignable to type 'IteratorYieldResult'. -!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! error TS2322: Call signature return types 'AsyncGenerator' and 'AsyncIterableIterator' are incompatible. +!!! error TS2322: The types returned by 'next(...)' are incompatible between these types. +!!! error TS2322: Type 'Promise>' is not assignable to type 'Promise>'. +!!! error TS2322: Type 'IteratorResult' is not assignable to type 'IteratorResult'. +!!! error TS2322: Type 'IteratorYieldResult' is not assignable to type 'IteratorResult'. +!!! error TS2322: Type 'IteratorYieldResult' is not assignable to type 'IteratorYieldResult'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. yield "a"; }; const assignability2: () => AsyncIterableIterator = async function * () { @@ -96,22 +84,17 @@ tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.2.ts( const assignability3: () => AsyncIterableIterator = async function * () { ~~~~~~~~~~~~~~ !!! error TS2322: Type '() => AsyncGenerator' is not assignable to type '() => AsyncIterableIterator'. -!!! error TS2322: Type 'AsyncGenerator' is not assignable to type 'AsyncIterableIterator'. -!!! error TS2322: Types of property 'next' are incompatible. -!!! error TS2322: Type '(...args: [] | [unknown]) => Promise>' is not assignable to type '(...args: [] | [PromiseLike]) => Promise>'. -!!! error TS2322: Type 'Promise>' is not assignable to type 'Promise>'. +!!! error TS2322: Call signature return types 'AsyncGenerator' and 'AsyncIterableIterator' are incompatible. +!!! error TS2322: The types returned by 'next(...)' are incompatible between these types. +!!! error TS2322: Type 'Promise>' is not assignable to type 'Promise>'. yield* (async function * () { yield "a"; })(); }; const assignability4: () => AsyncIterable = async function * () { ~~~~~~~~~~~~~~ !!! error TS2322: Type '() => AsyncGenerator' is not assignable to type '() => AsyncIterable'. -!!! error TS2322: Type 'AsyncGenerator' is not assignable to type 'AsyncIterable'. -!!! error TS2322: Types of property '[Symbol.asyncIterator]' are incompatible. -!!! error TS2322: Type '() => AsyncGenerator' is not assignable to type '() => AsyncIterator'. -!!! error TS2322: Type 'AsyncGenerator' is not assignable to type 'AsyncIterator'. -!!! error TS2322: Types of property 'next' are incompatible. -!!! error TS2322: Type '(...args: [] | [PromiseLike]) => Promise>' is not assignable to type '(...args: [] | [PromiseLike]) => Promise>'. -!!! error TS2322: Type 'Promise>' is not assignable to type 'Promise>'. +!!! error TS2322: Call signature return types 'AsyncGenerator' and 'AsyncIterable' are incompatible. +!!! error TS2322: The types returned by '[Symbol.asyncIterator]().next(...)' are incompatible between these types. +!!! error TS2322: Type 'Promise>' is not assignable to type 'Promise>'. yield "a"; }; const assignability5: () => AsyncIterable = async function * () { @@ -123,13 +106,9 @@ tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.2.ts( const assignability6: () => AsyncIterable = async function * () { ~~~~~~~~~~~~~~ !!! error TS2322: Type '() => AsyncGenerator' is not assignable to type '() => AsyncIterable'. -!!! error TS2322: Type 'AsyncGenerator' is not assignable to type 'AsyncIterable'. -!!! error TS2322: Types of property '[Symbol.asyncIterator]' are incompatible. -!!! error TS2322: Type '() => AsyncGenerator' is not assignable to type '() => AsyncIterator'. -!!! error TS2322: Type 'AsyncGenerator' is not assignable to type 'AsyncIterator'. -!!! error TS2322: Types of property 'next' are incompatible. -!!! error TS2322: Type '(...args: [] | [unknown]) => Promise>' is not assignable to type '(...args: [] | [PromiseLike]) => Promise>'. -!!! error TS2322: Type 'Promise>' is not assignable to type 'Promise>'. +!!! error TS2322: Call signature return types 'AsyncGenerator' and 'AsyncIterable' are incompatible. +!!! error TS2322: The types returned by '[Symbol.asyncIterator]().next(...)' are incompatible between these types. +!!! error TS2322: Type 'Promise>' is not assignable to type 'Promise>'. yield* (async function * () { yield "a"; })(); }; const assignability7: () => AsyncIterator = async function * () { @@ -210,10 +189,9 @@ tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.2.ts( async function * explicitReturnType12(): Iterator { ~~~~~~~~~~~~~~~~ !!! error TS2322: Type 'AsyncGenerator' is not assignable to type 'Iterator'. -!!! error TS2322: Types of property 'next' are incompatible. -!!! error TS2322: Type '(...args: [] | [PromiseLike]) => Promise>' is not assignable to type '(...args: [] | [undefined]) => IteratorResult'. -!!! error TS2322: Type 'Promise>' is not assignable to type 'IteratorResult'. -!!! error TS2322: Property 'value' is missing in type 'Promise>' but required in type 'IteratorYieldResult'. +!!! error TS2322: The types returned by 'next(...)' are incompatible between these types. +!!! error TS2322: Type 'Promise>' is not assignable to type 'IteratorResult'. +!!! error TS2322: Property 'value' is missing in type 'Promise>' but required in type 'IteratorYieldResult'. !!! related TS2728 /.ts/lib.es2015.iterable.d.ts:33:5: 'value' is declared here. yield 1; } diff --git a/tests/baselines/reference/unknownType2.errors.txt b/tests/baselines/reference/unknownType2.errors.txt index 5f08804b9e048..1469526182be5 100644 --- a/tests/baselines/reference/unknownType2.errors.txt +++ b/tests/baselines/reference/unknownType2.errors.txt @@ -228,4 +228,41 @@ tests/cases/conformance/types/unknown/unknownType2.ts(216,13): error TS2322: Typ // Arguably this should be never. type End = isTrue> } + + // Repro from #33483 + + function f2(x: unknown): string | undefined { + if (x !== undefined && typeof x !== 'string') { + throw new Error(); + } + return x; + } + + function notNotEquals(u: unknown) { + if (u !== NumberEnum) { } + else { + const o: object = u; + } + + if (u !== NumberEnum.A) { } + else { + const a: NumberEnum.A = u; + } + + + if (u !== NumberEnum.A && u !== NumberEnum.B && u !== StringEnum.A) { } + else { + const aOrB: NumberEnum.A | NumberEnum.B | StringEnum.A = u; + } + + // equivalent to + if (!(u === NumberEnum.A || u === NumberEnum.B || u === StringEnum.A)) { } + else { + const aOrB: NumberEnum.A | NumberEnum.B | StringEnum.A = u; + } + } + + + + \ No newline at end of file diff --git a/tests/baselines/reference/unknownType2.js b/tests/baselines/reference/unknownType2.js index 2ec5b3ed20589..cb1b0a58029f7 100644 --- a/tests/baselines/reference/unknownType2.js +++ b/tests/baselines/reference/unknownType2.js @@ -221,6 +221,43 @@ function switchResponseWrong(x: unknown): SomeResponse { // Arguably this should be never. type End = isTrue> } + +// Repro from #33483 + +function f2(x: unknown): string | undefined { + if (x !== undefined && typeof x !== 'string') { + throw new Error(); + } + return x; +} + +function notNotEquals(u: unknown) { + if (u !== NumberEnum) { } + else { + const o: object = u; + } + + if (u !== NumberEnum.A) { } + else { + const a: NumberEnum.A = u; + } + + + if (u !== NumberEnum.A && u !== NumberEnum.B && u !== StringEnum.A) { } + else { + const aOrB: NumberEnum.A | NumberEnum.B | StringEnum.A = u; + } + + // equivalent to + if (!(u === NumberEnum.A || u === NumberEnum.B || u === StringEnum.A)) { } + else { + const aOrB: NumberEnum.A | NumberEnum.B | StringEnum.A = u; + } +} + + + + //// [unknownType2.js] @@ -388,3 +425,29 @@ function switchResponseWrong(x) { throw new Error('Can you repeat the question?'); } } +// Repro from #33483 +function f2(x) { + if (x !== undefined && typeof x !== 'string') { + throw new Error(); + } + return x; +} +function notNotEquals(u) { + if (u !== NumberEnum) { } + else { + var o = u; + } + if (u !== NumberEnum.A) { } + else { + var a = u; + } + if (u !== NumberEnum.A && u !== NumberEnum.B && u !== StringEnum.A) { } + else { + var aOrB = u; + } + // equivalent to + if (!(u === NumberEnum.A || u === NumberEnum.B || u === StringEnum.A)) { } + else { + var aOrB = u; + } +} diff --git a/tests/baselines/reference/unknownType2.symbols b/tests/baselines/reference/unknownType2.symbols index 6e871bd4de40e..19a1c7fca6eaf 100644 --- a/tests/baselines/reference/unknownType2.symbols +++ b/tests/baselines/reference/unknownType2.symbols @@ -582,3 +582,108 @@ function switchResponseWrong(x: unknown): SomeResponse { >x : Symbol(x, Decl(unknownType2.ts, 210, 29)) } +// Repro from #33483 + +function f2(x: unknown): string | undefined { +>f2 : Symbol(f2, Decl(unknownType2.ts, 221, 1)) +>x : Symbol(x, Decl(unknownType2.ts, 225, 12)) + + if (x !== undefined && typeof x !== 'string') { +>x : Symbol(x, Decl(unknownType2.ts, 225, 12)) +>undefined : Symbol(undefined) +>x : Symbol(x, Decl(unknownType2.ts, 225, 12)) + + throw new Error(); +>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + } + return x; +>x : Symbol(x, Decl(unknownType2.ts, 225, 12)) +} + +function notNotEquals(u: unknown) { +>notNotEquals : Symbol(notNotEquals, Decl(unknownType2.ts, 230, 1)) +>u : Symbol(u, Decl(unknownType2.ts, 232, 22)) + + if (u !== NumberEnum) { } +>u : Symbol(u, Decl(unknownType2.ts, 232, 22)) +>NumberEnum : Symbol(NumberEnum, Decl(unknownType2.ts, 90, 1)) + + else { + const o: object = u; +>o : Symbol(o, Decl(unknownType2.ts, 235, 13)) +>u : Symbol(u, Decl(unknownType2.ts, 232, 22)) + } + + if (u !== NumberEnum.A) { } +>u : Symbol(u, Decl(unknownType2.ts, 232, 22)) +>NumberEnum.A : Symbol(NumberEnum.A, Decl(unknownType2.ts, 92, 17)) +>NumberEnum : Symbol(NumberEnum, Decl(unknownType2.ts, 90, 1)) +>A : Symbol(NumberEnum.A, Decl(unknownType2.ts, 92, 17)) + + else { + const a: NumberEnum.A = u; +>a : Symbol(a, Decl(unknownType2.ts, 240, 13)) +>NumberEnum : Symbol(NumberEnum, Decl(unknownType2.ts, 90, 1)) +>A : Symbol(NumberEnum.A, Decl(unknownType2.ts, 92, 17)) +>u : Symbol(u, Decl(unknownType2.ts, 232, 22)) + } + + + if (u !== NumberEnum.A && u !== NumberEnum.B && u !== StringEnum.A) { } +>u : Symbol(u, Decl(unknownType2.ts, 232, 22)) +>NumberEnum.A : Symbol(NumberEnum.A, Decl(unknownType2.ts, 92, 17)) +>NumberEnum : Symbol(NumberEnum, Decl(unknownType2.ts, 90, 1)) +>A : Symbol(NumberEnum.A, Decl(unknownType2.ts, 92, 17)) +>u : Symbol(u, Decl(unknownType2.ts, 232, 22)) +>NumberEnum.B : Symbol(NumberEnum.B, Decl(unknownType2.ts, 93, 6)) +>NumberEnum : Symbol(NumberEnum, Decl(unknownType2.ts, 90, 1)) +>B : Symbol(NumberEnum.B, Decl(unknownType2.ts, 93, 6)) +>u : Symbol(u, Decl(unknownType2.ts, 232, 22)) +>StringEnum.A : Symbol(StringEnum.A, Decl(unknownType2.ts, 98, 17)) +>StringEnum : Symbol(StringEnum, Decl(unknownType2.ts, 96, 1)) +>A : Symbol(StringEnum.A, Decl(unknownType2.ts, 98, 17)) + + else { + const aOrB: NumberEnum.A | NumberEnum.B | StringEnum.A = u; +>aOrB : Symbol(aOrB, Decl(unknownType2.ts, 246, 13)) +>NumberEnum : Symbol(NumberEnum, Decl(unknownType2.ts, 90, 1)) +>A : Symbol(NumberEnum.A, Decl(unknownType2.ts, 92, 17)) +>NumberEnum : Symbol(NumberEnum, Decl(unknownType2.ts, 90, 1)) +>B : Symbol(NumberEnum.B, Decl(unknownType2.ts, 93, 6)) +>StringEnum : Symbol(StringEnum, Decl(unknownType2.ts, 96, 1)) +>A : Symbol(StringEnum.A, Decl(unknownType2.ts, 98, 17)) +>u : Symbol(u, Decl(unknownType2.ts, 232, 22)) + } + + // equivalent to + if (!(u === NumberEnum.A || u === NumberEnum.B || u === StringEnum.A)) { } +>u : Symbol(u, Decl(unknownType2.ts, 232, 22)) +>NumberEnum.A : Symbol(NumberEnum.A, Decl(unknownType2.ts, 92, 17)) +>NumberEnum : Symbol(NumberEnum, Decl(unknownType2.ts, 90, 1)) +>A : Symbol(NumberEnum.A, Decl(unknownType2.ts, 92, 17)) +>u : Symbol(u, Decl(unknownType2.ts, 232, 22)) +>NumberEnum.B : Symbol(NumberEnum.B, Decl(unknownType2.ts, 93, 6)) +>NumberEnum : Symbol(NumberEnum, Decl(unknownType2.ts, 90, 1)) +>B : Symbol(NumberEnum.B, Decl(unknownType2.ts, 93, 6)) +>u : Symbol(u, Decl(unknownType2.ts, 232, 22)) +>StringEnum.A : Symbol(StringEnum.A, Decl(unknownType2.ts, 98, 17)) +>StringEnum : Symbol(StringEnum, Decl(unknownType2.ts, 96, 1)) +>A : Symbol(StringEnum.A, Decl(unknownType2.ts, 98, 17)) + + else { + const aOrB: NumberEnum.A | NumberEnum.B | StringEnum.A = u; +>aOrB : Symbol(aOrB, Decl(unknownType2.ts, 252, 13)) +>NumberEnum : Symbol(NumberEnum, Decl(unknownType2.ts, 90, 1)) +>A : Symbol(NumberEnum.A, Decl(unknownType2.ts, 92, 17)) +>NumberEnum : Symbol(NumberEnum, Decl(unknownType2.ts, 90, 1)) +>B : Symbol(NumberEnum.B, Decl(unknownType2.ts, 93, 6)) +>StringEnum : Symbol(StringEnum, Decl(unknownType2.ts, 96, 1)) +>A : Symbol(StringEnum.A, Decl(unknownType2.ts, 98, 17)) +>u : Symbol(u, Decl(unknownType2.ts, 232, 22)) + } +} + + + + + diff --git a/tests/baselines/reference/unknownType2.types b/tests/baselines/reference/unknownType2.types index 7fc3c3d10386b..ce3332138d55f 100644 --- a/tests/baselines/reference/unknownType2.types +++ b/tests/baselines/reference/unknownType2.types @@ -627,3 +627,121 @@ function switchResponseWrong(x: unknown): SomeResponse { >x : unknown } +// Repro from #33483 + +function f2(x: unknown): string | undefined { +>f2 : (x: unknown) => string | undefined +>x : unknown + + if (x !== undefined && typeof x !== 'string') { +>x !== undefined && typeof x !== 'string' : boolean +>x !== undefined : boolean +>x : unknown +>undefined : undefined +>typeof x !== 'string' : boolean +>typeof x : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" +>x : unknown +>'string' : "string" + + throw new Error(); +>new Error() : Error +>Error : ErrorConstructor + } + return x; +>x : string | undefined +} + +function notNotEquals(u: unknown) { +>notNotEquals : (u: unknown) => void +>u : unknown + + if (u !== NumberEnum) { } +>u !== NumberEnum : boolean +>u : unknown +>NumberEnum : typeof NumberEnum + + else { + const o: object = u; +>o : object +>u : object + } + + if (u !== NumberEnum.A) { } +>u !== NumberEnum.A : boolean +>u : unknown +>NumberEnum.A : NumberEnum.A +>NumberEnum : typeof NumberEnum +>A : NumberEnum.A + + else { + const a: NumberEnum.A = u; +>a : NumberEnum.A +>NumberEnum : any +>u : NumberEnum.A + } + + + if (u !== NumberEnum.A && u !== NumberEnum.B && u !== StringEnum.A) { } +>u !== NumberEnum.A && u !== NumberEnum.B && u !== StringEnum.A : boolean +>u !== NumberEnum.A && u !== NumberEnum.B : boolean +>u !== NumberEnum.A : boolean +>u : unknown +>NumberEnum.A : NumberEnum.A +>NumberEnum : typeof NumberEnum +>A : NumberEnum.A +>u !== NumberEnum.B : boolean +>u : unknown +>NumberEnum.B : NumberEnum.B +>NumberEnum : typeof NumberEnum +>B : NumberEnum.B +>u !== StringEnum.A : boolean +>u : unknown +>StringEnum.A : StringEnum.A +>StringEnum : typeof StringEnum +>A : StringEnum.A + + else { + const aOrB: NumberEnum.A | NumberEnum.B | StringEnum.A = u; +>aOrB : NumberEnum.A | NumberEnum.B | StringEnum.A +>NumberEnum : any +>NumberEnum : any +>StringEnum : any +>u : NumberEnum.A | NumberEnum.B | StringEnum.A + } + + // equivalent to + if (!(u === NumberEnum.A || u === NumberEnum.B || u === StringEnum.A)) { } +>!(u === NumberEnum.A || u === NumberEnum.B || u === StringEnum.A) : boolean +>(u === NumberEnum.A || u === NumberEnum.B || u === StringEnum.A) : boolean +>u === NumberEnum.A || u === NumberEnum.B || u === StringEnum.A : boolean +>u === NumberEnum.A || u === NumberEnum.B : boolean +>u === NumberEnum.A : boolean +>u : unknown +>NumberEnum.A : NumberEnum.A +>NumberEnum : typeof NumberEnum +>A : NumberEnum.A +>u === NumberEnum.B : boolean +>u : unknown +>NumberEnum.B : NumberEnum.B +>NumberEnum : typeof NumberEnum +>B : NumberEnum.B +>u === StringEnum.A : boolean +>u : unknown +>StringEnum.A : StringEnum.A +>StringEnum : typeof StringEnum +>A : StringEnum.A + + else { + const aOrB: NumberEnum.A | NumberEnum.B | StringEnum.A = u; +>aOrB : NumberEnum.A | NumberEnum.B | StringEnum.A +>NumberEnum : any +>NumberEnum : any +>StringEnum : any +>u : NumberEnum.A | NumberEnum.B | StringEnum.A + } +} + + + + + diff --git a/tests/baselines/reference/user/TypeScript-WeChat-Starter.log b/tests/baselines/reference/user/TypeScript-WeChat-Starter.log new file mode 100644 index 0000000000000..825eae70a538a --- /dev/null +++ b/tests/baselines/reference/user/TypeScript-WeChat-Starter.log @@ -0,0 +1,17 @@ +Exit Code: 1 +Standard output: +src/App.test.tsx(5,1): error TS2593: Cannot find name 'it'. Do you need to install type definitions for a test runner? Try `npm i @types/jest` or `npm i @types/mocha` and then add `jest` or `mocha` to the types field in your tsconfig. +src/components/Hello.test.tsx(5,1): error TS2593: Cannot find name 'it'. Do you need to install type definitions for a test runner? Try `npm i @types/jest` or `npm i @types/mocha` and then add `jest` or `mocha` to the types field in your tsconfig. +src/components/Hello.test.tsx(7,3): error TS2304: Cannot find name 'expect'. +src/components/Hello.test.tsx(10,1): error TS2593: Cannot find name 'it'. Do you need to install type definitions for a test runner? Try `npm i @types/jest` or `npm i @types/mocha` and then add `jest` or `mocha` to the types field in your tsconfig. +src/components/Hello.test.tsx(12,3): error TS2304: Cannot find name 'expect'. +src/components/Hello.test.tsx(15,1): error TS2593: Cannot find name 'it'. Do you need to install type definitions for a test runner? Try `npm i @types/jest` or `npm i @types/mocha` and then add `jest` or `mocha` to the types field in your tsconfig. +src/components/Hello.test.tsx(17,3): error TS2304: Cannot find name 'expect'. +src/components/Hello.test.tsx(20,1): error TS2593: Cannot find name 'it'. Do you need to install type definitions for a test runner? Try `npm i @types/jest` or `npm i @types/mocha` and then add `jest` or `mocha` to the types field in your tsconfig. +src/components/Hello.test.tsx(21,3): error TS2304: Cannot find name 'expect'. +src/components/Hello.test.tsx(26,1): error TS2593: Cannot find name 'it'. Do you need to install type definitions for a test runner? Try `npm i @types/jest` or `npm i @types/mocha` and then add `jest` or `mocha` to the types field in your tsconfig. +src/components/Hello.test.tsx(27,3): error TS2304: Cannot find name 'expect'. + + + +Standard error: diff --git a/tests/baselines/reference/user/assert.log b/tests/baselines/reference/user/assert.log index 4b00cccc6ab64..ce8e6cc19d06e 100644 --- a/tests/baselines/reference/user/assert.log +++ b/tests/baselines/reference/user/assert.log @@ -1,34 +1,34 @@ Exit Code: 1 Standard output: node_modules/assert/test.js(25,5): error TS2367: This condition will always return 'false' since the types 'string | undefined' and 'boolean' have no overlap. -node_modules/assert/test.js(39,5): error TS2552: Cannot find name 'test'. Did you mean 'tests'? -node_modules/assert/test.js(55,5): error TS2552: Cannot find name 'test'. Did you mean 'tests'? -node_modules/assert/test.js(74,5): error TS2552: Cannot find name 'test'. Did you mean 'tests'? -node_modules/assert/test.js(84,5): error TS2552: Cannot find name 'test'. Did you mean 'tests'? -node_modules/assert/test.js(94,5): error TS2552: Cannot find name 'test'. Did you mean 'tests'? -node_modules/assert/test.js(103,5): error TS2552: Cannot find name 'test'. Did you mean 'tests'? -node_modules/assert/test.js(120,5): error TS2552: Cannot find name 'test'. Did you mean 'tests'? -node_modules/assert/test.js(128,5): error TS2552: Cannot find name 'test'. Did you mean 'tests'? +node_modules/assert/test.js(39,5): error TS2593: Cannot find name 'test'. Do you need to install type definitions for a test runner? Try `npm i @types/jest` or `npm i @types/mocha` and then add `jest` or `mocha` to the types field in your tsconfig. +node_modules/assert/test.js(55,5): error TS2593: Cannot find name 'test'. Do you need to install type definitions for a test runner? Try `npm i @types/jest` or `npm i @types/mocha` and then add `jest` or `mocha` to the types field in your tsconfig. +node_modules/assert/test.js(74,5): error TS2593: Cannot find name 'test'. Do you need to install type definitions for a test runner? Try `npm i @types/jest` or `npm i @types/mocha` and then add `jest` or `mocha` to the types field in your tsconfig. +node_modules/assert/test.js(84,5): error TS2593: Cannot find name 'test'. Do you need to install type definitions for a test runner? Try `npm i @types/jest` or `npm i @types/mocha` and then add `jest` or `mocha` to the types field in your tsconfig. +node_modules/assert/test.js(94,5): error TS2593: Cannot find name 'test'. Do you need to install type definitions for a test runner? Try `npm i @types/jest` or `npm i @types/mocha` and then add `jest` or `mocha` to the types field in your tsconfig. +node_modules/assert/test.js(103,5): error TS2593: Cannot find name 'test'. Do you need to install type definitions for a test runner? Try `npm i @types/jest` or `npm i @types/mocha` and then add `jest` or `mocha` to the types field in your tsconfig. +node_modules/assert/test.js(120,5): error TS2593: Cannot find name 'test'. Do you need to install type definitions for a test runner? Try `npm i @types/jest` or `npm i @types/mocha` and then add `jest` or `mocha` to the types field in your tsconfig. +node_modules/assert/test.js(128,5): error TS2593: Cannot find name 'test'. Do you need to install type definitions for a test runner? Try `npm i @types/jest` or `npm i @types/mocha` and then add `jest` or `mocha` to the types field in your tsconfig. node_modules/assert/test.js(140,10): error TS2339: Property 'a' does not exist on type 'number[]'. node_modules/assert/test.js(141,10): error TS2339: Property 'b' does not exist on type 'number[]'. node_modules/assert/test.js(142,10): error TS2339: Property 'b' does not exist on type 'number[]'. node_modules/assert/test.js(143,10): error TS2339: Property 'a' does not exist on type 'number[]'. -node_modules/assert/test.js(149,5): error TS2552: Cannot find name 'test'. Did you mean 'tests'? +node_modules/assert/test.js(149,5): error TS2593: Cannot find name 'test'. Do you need to install type definitions for a test runner? Try `npm i @types/jest` or `npm i @types/mocha` and then add `jest` or `mocha` to the types field in your tsconfig. node_modules/assert/test.js(157,51): error TS2349: This expression is not callable. Type 'never' has no call signatures. -node_modules/assert/test.js(161,5): error TS2552: Cannot find name 'test'. Did you mean 'tests'? +node_modules/assert/test.js(161,5): error TS2593: Cannot find name 'test'. Do you need to install type definitions for a test runner? Try `npm i @types/jest` or `npm i @types/mocha` and then add `jest` or `mocha` to the types field in your tsconfig. node_modules/assert/test.js(168,5): error TS2593: Cannot find name 'test'. Do you need to install type definitions for a test runner? Try `npm i @types/jest` or `npm i @types/mocha` and then add `jest` or `mocha` to the types field in your tsconfig. -node_modules/assert/test.js(182,5): error TS2593: Cannot find name 'test'. Do you need to install type definitions for a test runner? Try `npm i @types/jest` or `npm i @types/mocha` and then add `jest` or `mocha` to the types field in your tsconfig. -node_modules/assert/test.js(229,5): error TS2593: Cannot find name 'test'. Do you need to install type definitions for a test runner? Try `npm i @types/jest` or `npm i @types/mocha` and then add `jest` or `mocha` to the types field in your tsconfig. -node_modules/assert/test.js(235,5): error TS2593: Cannot find name 'test'. Do you need to install type definitions for a test runner? Try `npm i @types/jest` or `npm i @types/mocha` and then add `jest` or `mocha` to the types field in your tsconfig. -node_modules/assert/test.js(250,5): error TS2593: Cannot find name 'test'. Do you need to install type definitions for a test runner? Try `npm i @types/jest` or `npm i @types/mocha` and then add `jest` or `mocha` to the types field in your tsconfig. -node_modules/assert/test.js(254,5): error TS2593: Cannot find name 'test'. Do you need to install type definitions for a test runner? Try `npm i @types/jest` or `npm i @types/mocha` and then add `jest` or `mocha` to the types field in your tsconfig. +node_modules/assert/test.js(182,5): error TS2552: Cannot find name 'test'. Did you mean 'tests'? +node_modules/assert/test.js(229,5): error TS2552: Cannot find name 'test'. Did you mean 'tests'? +node_modules/assert/test.js(235,5): error TS2552: Cannot find name 'test'. Did you mean 'tests'? +node_modules/assert/test.js(250,5): error TS2552: Cannot find name 'test'. Did you mean 'tests'? +node_modules/assert/test.js(254,5): error TS2552: Cannot find name 'test'. Did you mean 'tests'? node_modules/assert/test.js(256,55): error TS2345: Argument of type 'TypeError' is not assignable to parameter of type 'string'. -node_modules/assert/test.js(262,5): error TS2593: Cannot find name 'test'. Do you need to install type definitions for a test runner? Try `npm i @types/jest` or `npm i @types/mocha` and then add `jest` or `mocha` to the types field in your tsconfig. -node_modules/assert/test.js(279,5): error TS2593: Cannot find name 'test'. Do you need to install type definitions for a test runner? Try `npm i @types/jest` or `npm i @types/mocha` and then add `jest` or `mocha` to the types field in your tsconfig. -node_modules/assert/test.js(285,5): error TS2593: Cannot find name 'test'. Do you need to install type definitions for a test runner? Try `npm i @types/jest` or `npm i @types/mocha` and then add `jest` or `mocha` to the types field in your tsconfig. -node_modules/assert/test.js(320,5): error TS2593: Cannot find name 'test'. Do you need to install type definitions for a test runner? Try `npm i @types/jest` or `npm i @types/mocha` and then add `jest` or `mocha` to the types field in your tsconfig. -node_modules/assert/test.js(346,5): error TS2593: Cannot find name 'test'. Do you need to install type definitions for a test runner? Try `npm i @types/jest` or `npm i @types/mocha` and then add `jest` or `mocha` to the types field in your tsconfig. +node_modules/assert/test.js(262,5): error TS2552: Cannot find name 'test'. Did you mean 'tests'? +node_modules/assert/test.js(279,5): error TS2552: Cannot find name 'test'. Did you mean 'tests'? +node_modules/assert/test.js(285,5): error TS2552: Cannot find name 'test'. Did you mean 'tests'? +node_modules/assert/test.js(320,5): error TS2552: Cannot find name 'test'. Did you mean 'tests'? +node_modules/assert/test.js(346,5): error TS2552: Cannot find name 'test'. Did you mean 'tests'? diff --git a/tests/baselines/reference/user/axios-src.log b/tests/baselines/reference/user/axios-src.log index adc8d7e0a485c..d24af763712cc 100644 --- a/tests/baselines/reference/user/axios-src.log +++ b/tests/baselines/reference/user/axios-src.log @@ -1,18 +1,18 @@ Exit Code: 1 Standard output: lib/adapters/http.js(13,19): error TS2732: Cannot find module './../../package.json'. Consider using '--resolveJsonModule' to import module with '.json' extension -lib/adapters/http.js(87,22): error TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'. +lib/adapters/http.js(84,22): error TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'. Type 'undefined' is not assignable to type 'string'. -lib/adapters/http.js(123,17): error TS2532: Object is possibly 'undefined'. -lib/adapters/http.js(123,40): error TS2532: Object is possibly 'undefined'. -lib/adapters/http.js(124,17): error TS2531: Object is possibly 'null'. -lib/adapters/http.js(124,54): error TS2531: Object is possibly 'null'. -lib/adapters/http.js(124,54): error TS2532: Object is possibly 'undefined'. -lib/adapters/http.js(223,23): error TS2345: Argument of type 'null' is not assignable to parameter of type 'string | undefined'. -lib/adapters/http.js(229,44): error TS2345: Argument of type 'null' is not assignable to parameter of type 'string | undefined'. -lib/adapters/http.js(235,13): error TS2322: Type 'string' is not assignable to type 'Buffer'. -lib/adapters/http.js(247,40): error TS2345: Argument of type 'null' is not assignable to parameter of type 'string | undefined'. -lib/adapters/http.js(271,42): error TS2345: Argument of type 'null' is not assignable to parameter of type 'string | undefined'. +lib/adapters/http.js(120,17): error TS2532: Object is possibly 'undefined'. +lib/adapters/http.js(120,40): error TS2532: Object is possibly 'undefined'. +lib/adapters/http.js(121,17): error TS2531: Object is possibly 'null'. +lib/adapters/http.js(121,54): error TS2531: Object is possibly 'null'. +lib/adapters/http.js(121,54): error TS2532: Object is possibly 'undefined'. +lib/adapters/http.js(220,23): error TS2345: Argument of type 'null' is not assignable to parameter of type 'string | undefined'. +lib/adapters/http.js(226,44): error TS2345: Argument of type 'null' is not assignable to parameter of type 'string | undefined'. +lib/adapters/http.js(232,13): error TS2322: Type 'string' is not assignable to type 'Buffer'. +lib/adapters/http.js(244,40): error TS2345: Argument of type 'null' is not assignable to parameter of type 'string | undefined'. +lib/adapters/http.js(273,42): error TS2345: Argument of type 'null' is not assignable to parameter of type 'string | undefined'. lib/adapters/xhr.js(64,7): error TS2322: Type 'null' is not assignable to type 'XMLHttpRequest'. lib/adapters/xhr.js(76,7): error TS2322: Type 'null' is not assignable to type 'XMLHttpRequest'. lib/adapters/xhr.js(83,51): error TS2345: Argument of type 'null' is not assignable to parameter of type 'string | undefined'. diff --git a/tests/baselines/reference/user/chrome-devtools-frontend.log b/tests/baselines/reference/user/chrome-devtools-frontend.log index bad901d3d5745..c9ce3bc730bb2 100644 --- a/tests/baselines/reference/user/chrome-devtools-frontend.log +++ b/tests/baselines/reference/user/chrome-devtools-frontend.log @@ -3990,10 +3990,9 @@ node_modules/chrome-devtools-frontend/front_end/console/ConsoleView.js(1277,60): node_modules/chrome-devtools-frontend/front_end/console/ConsoleView.js(1278,42): error TS2769: No overload matches this call. Overload 1 of 2, '(...items: ConcatArray<{ key: string; text: string; regex: RegExp; negative: boolean; }>[]): { key: string; text: string; regex: RegExp; negative: boolean; }[]', gave the following error. Argument of type '{ key: any; text: string; negative: boolean; }[]' is not assignable to parameter of type 'ConcatArray<{ key: string; text: string; regex: RegExp; negative: boolean; }>'. - Types of property 'slice' are incompatible. - Type '(start?: number, end?: number) => { key: any; text: string; negative: boolean; }[]' is not assignable to type '(start?: number, end?: number) => { key: string; text: string; regex: RegExp; negative: boolean; }[]'. - Type '{ key: any; text: string; negative: boolean; }[]' is not assignable to type '{ key: string; text: string; regex: RegExp; negative: boolean; }[]'. - Property 'regex' is missing in type '{ key: any; text: string; negative: boolean; }' but required in type '{ key: string; text: string; regex: RegExp; negative: boolean; }'. + The types returned by 'slice(...)' are incompatible between these types. + Type '{ key: any; text: string; negative: boolean; }[]' is not assignable to type '{ key: string; text: string; regex: RegExp; negative: boolean; }[]'. + Property 'regex' is missing in type '{ key: any; text: string; negative: boolean; }' but required in type '{ key: string; text: string; regex: RegExp; negative: boolean; }'. Overload 2 of 2, '(...items: ({ key: string; text: string; regex: RegExp; negative: boolean; } | ConcatArray<{ key: string; text: string; regex: RegExp; negative: boolean; }>)[]): { key: string; text: string; regex: RegExp; negative: boolean; }[]', gave the following error. Argument of type '{ key: any; text: string; negative: boolean; }[]' is not assignable to parameter of type '{ key: string; text: string; regex: RegExp; negative: boolean; } | ConcatArray<{ key: string; text: string; regex: RegExp; negative: boolean; }>'. Type '{ key: any; text: string; negative: boolean; }[]' is not assignable to type 'ConcatArray<{ key: string; text: string; regex: RegExp; negative: boolean; }>'. @@ -5038,22 +5037,18 @@ node_modules/chrome-devtools-frontend/front_end/elements/ComputedStyleWidget.js( node_modules/chrome-devtools-frontend/front_end/elements/ComputedStyleWidget.js(91,24): error TS2769: No overload matches this call. The last overload gave the following error. Argument of type '(Promise | Promise)[]' is not assignable to parameter of type 'Iterable>'. - Types of property '[Symbol.iterator]' are incompatible. - Type '() => IterableIterator | Promise>' is not assignable to type '() => Iterator, any, undefined>'. - Type 'IterableIterator | Promise>' is not assignable to type 'Iterator, any, undefined>'. - Types of property 'next' are incompatible. - Type '(...args: [] | [undefined]) => IteratorResult | Promise, any>' is not assignable to type '(...args: [] | [undefined]) => IteratorResult, any>'. - Type 'IteratorResult | Promise, any>' is not assignable to type 'IteratorResult, any>'. - Type 'IteratorYieldResult | Promise>' is not assignable to type 'IteratorResult, any>'. - Type 'IteratorYieldResult | Promise>' is not assignable to type 'IteratorYieldResult>'. - Type 'Promise | Promise' is not assignable to type 'CSSMatchedStyles | PromiseLike'. - Type 'Promise' is not assignable to type 'CSSMatchedStyles | PromiseLike'. - Type 'Promise' is not assignable to type 'PromiseLike'. - Types of property 'then' are incompatible. - Type '(onfulfilled?: (value: ComputedStyle) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise' is not assignable to type '(onfulfilled?: (value: CSSMatchedStyles) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => PromiseLike<...>'. - Types of parameters 'onfulfilled' and 'onfulfilled' are incompatible. - Types of parameters 'value' and 'value' are incompatible. - Type 'ComputedStyle' is missing the following properties from type 'CSSMatchedStyles': _cssModel, _node, _nodeStyles, _nodeForStyle, and 22 more. + The types returned by '[Symbol.iterator]().next(...)' are incompatible between these types. + Type 'IteratorResult | Promise, any>' is not assignable to type 'IteratorResult, any>'. + Type 'IteratorYieldResult | Promise>' is not assignable to type 'IteratorResult, any>'. + Type 'IteratorYieldResult | Promise>' is not assignable to type 'IteratorYieldResult>'. + Type 'Promise | Promise' is not assignable to type 'CSSMatchedStyles | PromiseLike'. + Type 'Promise' is not assignable to type 'CSSMatchedStyles | PromiseLike'. + Type 'Promise' is not assignable to type 'PromiseLike'. + Types of property 'then' are incompatible. + Type '(onfulfilled?: (value: ComputedStyle) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise' is not assignable to type '(onfulfilled?: (value: CSSMatchedStyles) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => PromiseLike<...>'. + Types of parameters 'onfulfilled' and 'onfulfilled' are incompatible. + Types of parameters 'value' and 'value' are incompatible. + Type 'ComputedStyle' is missing the following properties from type 'CSSMatchedStyles': _cssModel, _node, _nodeStyles, _nodeForStyle, and 22 more. node_modules/chrome-devtools-frontend/front_end/elements/ComputedStyleWidget.js(147,52): error TS2339: Property 'keysArray' does not exist on type 'Map'. node_modules/chrome-devtools-frontend/front_end/elements/ComputedStyleWidget.js(179,50): error TS2339: Property 'createChild' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/elements/ComputedStyleWidget.js(200,74): error TS2339: Property 'consume' does not exist on type 'Event'. @@ -5339,22 +5334,18 @@ node_modules/chrome-devtools-frontend/front_end/elements/MetricsSidebarPane.js(5 node_modules/chrome-devtools-frontend/front_end/elements/MetricsSidebarPane.js(82,24): error TS2769: No overload matches this call. The last overload gave the following error. Argument of type '(Promise> | Promise)[]' is not assignable to parameter of type 'Iterable | PromiseLike>>'. - Types of property '[Symbol.iterator]' are incompatible. - Type '() => IterableIterator> | Promise>' is not assignable to type '() => Iterator | PromiseLike>, any, undefined>'. - Type 'IterableIterator> | Promise>' is not assignable to type 'Iterator | PromiseLike>, any, undefined>'. - Types of property 'next' are incompatible. - Type '(...args: [] | [undefined]) => IteratorResult> | Promise, any>' is not assignable to type '(...args: [] | [undefined]) => IteratorResult | PromiseLike>, any>'. - Type 'IteratorResult> | Promise, any>' is not assignable to type 'IteratorResult | PromiseLike>, any>'. - Type 'IteratorYieldResult> | Promise>' is not assignable to type 'IteratorResult | PromiseLike>, any>'. - Type 'IteratorYieldResult> | Promise>' is not assignable to type 'IteratorYieldResult | PromiseLike>>'. - Type 'Promise> | Promise' is not assignable to type 'Map | PromiseLike>'. - Type 'Promise' is not assignable to type 'Map | PromiseLike>'. - Type 'Promise' is not assignable to type 'PromiseLike>'. - Types of property 'then' are incompatible. - Type '(onfulfilled?: (value: InlineStyleResult) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise<...>' is not assignable to type ', TResult2 = never>(onfulfilled?: (value: Map) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => PromiseLike<...>'. - Types of parameters 'onfulfilled' and 'onfulfilled' are incompatible. - Types of parameters 'value' and 'value' are incompatible. - Type 'InlineStyleResult' is missing the following properties from type 'Map': clear, delete, forEach, get, and 8 more. + The types returned by '[Symbol.iterator]().next(...)' are incompatible between these types. + Type 'IteratorResult> | Promise, any>' is not assignable to type 'IteratorResult | PromiseLike>, any>'. + Type 'IteratorYieldResult> | Promise>' is not assignable to type 'IteratorResult | PromiseLike>, any>'. + Type 'IteratorYieldResult> | Promise>' is not assignable to type 'IteratorYieldResult | PromiseLike>>'. + Type 'Promise> | Promise' is not assignable to type 'Map | PromiseLike>'. + Type 'Promise' is not assignable to type 'Map | PromiseLike>'. + Type 'Promise' is not assignable to type 'PromiseLike>'. + Types of property 'then' are incompatible. + Type '(onfulfilled?: (value: InlineStyleResult) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise<...>' is not assignable to type ', TResult2 = never>(onfulfilled?: (value: Map) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => PromiseLike<...>'. + Types of parameters 'onfulfilled' and 'onfulfilled' are incompatible. + Types of parameters 'value' and 'value' are incompatible. + Type 'InlineStyleResult' is missing the following properties from type 'Map': clear, delete, forEach, get, and 8 more. node_modules/chrome-devtools-frontend/front_end/elements/MetricsSidebarPane.js(120,11): error TS2339: Property 'consume' does not exist on type 'Event'. node_modules/chrome-devtools-frontend/front_end/elements/MetricsSidebarPane.js(164,22): error TS2339: Property 'toFixedIfFloating' does not exist on type 'NumberConstructor'. node_modules/chrome-devtools-frontend/front_end/elements/MetricsSidebarPane.js(179,18): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. @@ -12648,22 +12639,18 @@ node_modules/chrome-devtools-frontend/front_end/ui/View.js(454,38): error TS2339 node_modules/chrome-devtools-frontend/front_end/ui/View.js(461,44): error TS2769: No overload matches this call. The last overload gave the following error. Argument of type '(Promise | Promise)[]' is not assignable to parameter of type 'Iterable>'. - Types of property '[Symbol.iterator]' are incompatible. - Type '() => IterableIterator | Promise>' is not assignable to type '() => Iterator, any, undefined>'. - Type 'IterableIterator | Promise>' is not assignable to type 'Iterator, any, undefined>'. - Types of property 'next' are incompatible. - Type '(...args: [] | [undefined]) => IteratorResult | Promise, any>' is not assignable to type '(...args: [] | [undefined]) => IteratorResult, any>'. - Type 'IteratorResult | Promise, any>' is not assignable to type 'IteratorResult, any>'. - Type 'IteratorYieldResult | Promise>' is not assignable to type 'IteratorResult, any>'. - Type 'IteratorYieldResult | Promise>' is not assignable to type 'IteratorYieldResult>'. - Type 'Promise | Promise' is not assignable to type 'void | PromiseLike'. - Type 'Promise' is not assignable to type 'void | PromiseLike'. - Type 'Promise' is not assignable to type 'PromiseLike'. - Types of property 'then' are incompatible. - Type '(onfulfilled?: (value: ToolbarItem[]) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise' is not assignable to type '(onfulfilled?: (value: void) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => PromiseLike'. - Types of parameters 'onfulfilled' and 'onfulfilled' are incompatible. - Types of parameters 'value' and 'value' are incompatible. - Type 'ToolbarItem[]' is not assignable to type 'void'. + The types returned by '[Symbol.iterator]().next(...)' are incompatible between these types. + Type 'IteratorResult | Promise, any>' is not assignable to type 'IteratorResult, any>'. + Type 'IteratorYieldResult | Promise>' is not assignable to type 'IteratorResult, any>'. + Type 'IteratorYieldResult | Promise>' is not assignable to type 'IteratorYieldResult>'. + Type 'Promise | Promise' is not assignable to type 'void | PromiseLike'. + Type 'Promise' is not assignable to type 'void | PromiseLike'. + Type 'Promise' is not assignable to type 'PromiseLike'. + Types of property 'then' are incompatible. + Type '(onfulfilled?: (value: ToolbarItem[]) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise' is not assignable to type '(onfulfilled?: (value: void) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => PromiseLike'. + Types of parameters 'onfulfilled' and 'onfulfilled' are incompatible. + Types of parameters 'value' and 'value' are incompatible. + Type 'ToolbarItem[]' is not assignable to type 'void'. node_modules/chrome-devtools-frontend/front_end/ui/View.js(495,24): error TS2339: Property 'createTextChild' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/ui/View.js(496,24): error TS2339: Property 'tabIndex' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/ui/View.js(501,25): error TS2339: Property 'createChild' does not exist on type 'Element'. diff --git a/tests/baselines/reference/user/jimp.log b/tests/baselines/reference/user/jimp.log deleted file mode 100644 index 94ca297844bf6..0000000000000 --- a/tests/baselines/reference/user/jimp.log +++ /dev/null @@ -1,11 +0,0 @@ -Exit Code: 1 -Standard output: -node_modules/@jimp/core/index.d.ts(200,3): error TS2411: Property 'class' of type 'undefined' is not assignable to string index type 'Function'. -node_modules/@jimp/core/index.d.ts(201,3): error TS2411: Property 'constants' of type 'undefined' is not assignable to string index type 'Function'. -node_modules/@jimp/core/index.d.ts(255,42): error TS2344: Type 'T' does not satisfy the constraint 'WellFormedPlugin'. - Type 'JimpType | undefined' is not assignable to type 'WellFormedPlugin'. - Type 'undefined' is not assignable to type 'WellFormedPlugin'. - - - -Standard error: diff --git a/tests/baselines/reference/user/npm.log b/tests/baselines/reference/user/npm.log index 915f6640ff982..6af4d36f857e2 100644 --- a/tests/baselines/reference/user/npm.log +++ b/tests/baselines/reference/user/npm.log @@ -1153,6 +1153,8 @@ node_modules/npm/test/tap/check-engine-reqs.js(4,20): error TS2307: Cannot find node_modules/npm/test/tap/check-install-self.js(4,20): error TS2307: Cannot find module 'tap'. node_modules/npm/test/tap/check-os-reqs.js(4,20): error TS2307: Cannot find module 'tap'. node_modules/npm/test/tap/check-permissions.js(4,20): error TS2307: Cannot find module 'tap'. +node_modules/npm/test/tap/check-permissions.js(26,7): error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead? +node_modules/npm/test/tap/check-permissions.js(42,7): error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead? node_modules/npm/test/tap/ci-header.js(3,20): error TS2307: Cannot find module 'tap'. node_modules/npm/test/tap/ci-header.js(4,18): error TS2307: Cannot find module 'npm-registry-mock'. node_modules/npm/test/tap/ci-header.js(5,21): error TS2307: Cannot find module 'tacks'. diff --git a/tests/baselines/reference/user/prettier.log b/tests/baselines/reference/user/prettier.log index 6e7cf80047343..6d7d08f01e439 100644 --- a/tests/baselines/reference/user/prettier.log +++ b/tests/baselines/reference/user/prettier.log @@ -55,16 +55,18 @@ src/doc/doc-printer.js(501,37): error TS2345: Argument of type 'any[][]' is not src/index.js(3,25): error TS2732: Cannot find module '../package.json'. Consider using '--resolveJsonModule' to import module with '.json' extension src/index.js(30,17): error TS2339: Property 'sync' does not exist on type '(...args: any[]) => any'. src/language-css/clean.js(3,30): error TS2307: Cannot find module 'html-tag-names'. -src/language-css/index.js(8,26): error TS2307: Cannot find module 'linguist-languages/data/css'. -src/language-css/index.js(8,58): error TS2345: Argument of type '{ override: { since: string; parsers: string[]; vscodeLanguageIds: string[]; }; }' is not assignable to parameter of type '{ extend: any; override: any; }'. - Property 'extend' is missing in type '{ override: { since: string; parsers: string[]; vscodeLanguageIds: string[]; }; }' but required in type '{ extend: any; override: any; }'. -src/language-css/index.js(15,26): error TS2307: Cannot find module 'linguist-languages/data/postcss'. -src/language-css/index.js(25,26): error TS2307: Cannot find module 'linguist-languages/data/less'. -src/language-css/index.js(25,59): error TS2345: Argument of type '{ override: { since: string; parsers: string[]; vscodeLanguageIds: string[]; }; }' is not assignable to parameter of type '{ extend: any; override: any; }'. - Property 'extend' is missing in type '{ override: { since: string; parsers: string[]; vscodeLanguageIds: string[]; }; }' but required in type '{ extend: any; override: any; }'. -src/language-css/index.js(32,26): error TS2307: Cannot find module 'linguist-languages/data/scss'. -src/language-css/index.js(32,59): error TS2345: Argument of type '{ override: { since: string; parsers: string[]; vscodeLanguageIds: string[]; }; }' is not assignable to parameter of type '{ extend: any; override: any; }'. - Property 'extend' is missing in type '{ override: { since: string; parsers: string[]; vscodeLanguageIds: string[]; }; }' but required in type '{ extend: any; override: any; }'. +src/language-css/index.js(8,26): error TS2307: Cannot find module 'linguist-languages/data/CSS'. +src/language-css/index.js(8,58): error TS2345: Argument of type '{ override: { since: string; parsers: string[]; vscodeLanguageIds: string[]; }; }' is not assignable to parameter of type '{ extend: any; override: any; exclude: any; }'. + Type '{ override: { since: string; parsers: string[]; vscodeLanguageIds: string[]; }; }' is missing the following properties from type '{ extend: any; override: any; exclude: any; }': extend, exclude +src/language-css/index.js(15,26): error TS2307: Cannot find module 'linguist-languages/data/PostCSS'. +src/language-css/index.js(15,62): error TS2345: Argument of type '{ override: { since: string; parsers: string[]; vscodeLanguageIds: string[]; }; extend: { extensions: string[]; }; }' is not assignable to parameter of type '{ extend: any; override: any; exclude: any; }'. + Property 'exclude' is missing in type '{ override: { since: string; parsers: string[]; vscodeLanguageIds: string[]; }; extend: { extensions: string[]; }; }' but required in type '{ extend: any; override: any; exclude: any; }'. +src/language-css/index.js(25,26): error TS2307: Cannot find module 'linguist-languages/data/Less'. +src/language-css/index.js(25,59): error TS2345: Argument of type '{ override: { since: string; parsers: string[]; vscodeLanguageIds: string[]; }; }' is not assignable to parameter of type '{ extend: any; override: any; exclude: any; }'. + Type '{ override: { since: string; parsers: string[]; vscodeLanguageIds: string[]; }; }' is missing the following properties from type '{ extend: any; override: any; exclude: any; }': extend, exclude +src/language-css/index.js(32,26): error TS2307: Cannot find module 'linguist-languages/data/SCSS'. +src/language-css/index.js(32,59): error TS2345: Argument of type '{ override: { since: string; parsers: string[]; vscodeLanguageIds: string[]; }; }' is not assignable to parameter of type '{ extend: any; override: any; exclude: any; }'. + Type '{ override: { since: string; parsers: string[]; vscodeLanguageIds: string[]; }; }' is missing the following properties from type '{ extend: any; override: any; exclude: any; }': extend, exclude src/language-css/parser-postcss.js(64,32): error TS2345: Argument of type '{ groups: never[]; type: string; }' is not assignable to parameter of type 'never'. src/language-css/parser-postcss.js(74,30): error TS2345: Argument of type '{ open: null; close: null; groups: never[]; type: string; }' is not assignable to parameter of type 'never'. src/language-css/parser-postcss.js(79,30): error TS2345: Argument of type '{ groups: never[]; type: string; }' is not assignable to parameter of type 'never'. @@ -72,12 +74,12 @@ src/language-css/parser-postcss.js(86,30): error TS2345: Argument of type 'any' src/language-css/parser-postcss.js(90,28): error TS2345: Argument of type '{ groups: never[]; type: string; }' is not assignable to parameter of type 'never'. src/language-css/parser-postcss.js(449,32): error TS2531: Object is possibly 'null'. src/language-css/utils.js(3,30): error TS2307: Cannot find module 'html-tag-names'. -src/language-graphql/index.js(8,26): error TS2307: Cannot find module 'linguist-languages/data/graphql'. -src/language-graphql/index.js(8,62): error TS2345: Argument of type '{ override: { since: string; parsers: string[]; vscodeLanguageIds: string[]; }; }' is not assignable to parameter of type '{ extend: any; override: any; }'. - Property 'extend' is missing in type '{ override: { since: string; parsers: string[]; vscodeLanguageIds: string[]; }; }' but required in type '{ extend: any; override: any; }'. -src/language-handlebars/index.js(7,26): error TS2307: Cannot find module 'linguist-languages/data/handlebars'. -src/language-handlebars/index.js(7,65): error TS2345: Argument of type '{ override: { since: null; parsers: string[]; vscodeLanguageIds: string[]; }; }' is not assignable to parameter of type '{ extend: any; override: any; }'. - Property 'extend' is missing in type '{ override: { since: null; parsers: string[]; vscodeLanguageIds: string[]; }; }' but required in type '{ extend: any; override: any; }'. +src/language-graphql/index.js(8,26): error TS2307: Cannot find module 'linguist-languages/data/GraphQL'. +src/language-graphql/index.js(8,62): error TS2345: Argument of type '{ override: { since: string; parsers: string[]; vscodeLanguageIds: string[]; }; }' is not assignable to parameter of type '{ extend: any; override: any; exclude: any; }'. + Type '{ override: { since: string; parsers: string[]; vscodeLanguageIds: string[]; }; }' is missing the following properties from type '{ extend: any; override: any; exclude: any; }': extend, exclude +src/language-handlebars/index.js(7,26): error TS2307: Cannot find module 'linguist-languages/data/Handlebars'. +src/language-handlebars/index.js(7,65): error TS2345: Argument of type '{ override: { since: null; parsers: string[]; vscodeLanguageIds: string[]; }; }' is not assignable to parameter of type '{ extend: any; override: any; exclude: any; }'. + Type '{ override: { since: null; parsers: string[]; vscodeLanguageIds: string[]; }; }' is missing the following properties from type '{ extend: any; override: any; exclude: any; }': extend, exclude src/language-html/ast.js(53,11): error TS2536: Type 'Extract' cannot be used to index type 'Node'. src/language-html/ast.js(56,15): error TS2339: Property 'index' does not exist on type 'Node'. src/language-html/ast.js(56,22): error TS2339: Property 'siblings' does not exist on type 'Node'. @@ -100,16 +102,18 @@ src/language-html/ast.js(90,69): error TS2339: Property 'name' does not exist on src/language-html/conditional-comment.js(23,16): error TS2349: This expression is not callable. Not all constituents of type 'RegExp | ((node: any) => { type: string; sourceSpan: any; })' are callable. Type 'RegExp' has no call signatures. -src/language-html/index.js(8,26): error TS2307: Cannot find module 'linguist-languages/data/html'. -src/language-html/index.js(8,59): error TS2345: Argument of type '{ override: { name: string; since: string; parsers: string[]; vscodeLanguageIds: string[]; extensions: string[]; filenames: never[]; }; }' is not assignable to parameter of type '{ extend: any; override: any; }'. - Property 'extend' is missing in type '{ override: { name: string; since: string; parsers: string[]; vscodeLanguageIds: string[]; extensions: string[]; filenames: never[]; }; }' but required in type '{ extend: any; override: any; }'. -src/language-html/index.js(19,26): error TS2307: Cannot find module 'linguist-languages/data/html'. -src/language-html/index.js(31,26): error TS2307: Cannot find module 'linguist-languages/data/html'. -src/language-html/index.js(31,59): error TS2345: Argument of type '{ override: { name: string; since: string; parsers: string[]; vscodeLanguageIds: string[]; extensions: never[]; filenames: never[]; }; }' is not assignable to parameter of type '{ extend: any; override: any; }'. - Property 'extend' is missing in type '{ override: { name: string; since: string; parsers: string[]; vscodeLanguageIds: string[]; extensions: never[]; filenames: never[]; }; }' but required in type '{ extend: any; override: any; }'. -src/language-html/index.js(42,26): error TS2307: Cannot find module 'linguist-languages/data/vue'. -src/language-html/index.js(42,58): error TS2345: Argument of type '{ override: { since: string; parsers: string[]; vscodeLanguageIds: string[]; }; }' is not assignable to parameter of type '{ extend: any; override: any; }'. - Property 'extend' is missing in type '{ override: { since: string; parsers: string[]; vscodeLanguageIds: string[]; }; }' but required in type '{ extend: any; override: any; }'. +src/language-html/index.js(8,26): error TS2307: Cannot find module 'linguist-languages/data/HTML'. +src/language-html/index.js(8,59): error TS2345: Argument of type '{ override: { name: string; since: string; parsers: string[]; vscodeLanguageIds: string[]; extensions: string[]; filenames: never[]; }; }' is not assignable to parameter of type '{ extend: any; override: any; exclude: any; }'. + Type '{ override: { name: string; since: string; parsers: string[]; vscodeLanguageIds: string[]; extensions: string[]; filenames: never[]; }; }' is missing the following properties from type '{ extend: any; override: any; exclude: any; }': extend, exclude +src/language-html/index.js(19,26): error TS2307: Cannot find module 'linguist-languages/data/HTML'. +src/language-html/index.js(19,59): error TS2345: Argument of type '{ override: { since: string; parsers: string[]; vscodeLanguageIds: string[]; }; extend: { extensions: string[]; }; }' is not assignable to parameter of type '{ extend: any; override: any; exclude: any; }'. + Property 'exclude' is missing in type '{ override: { since: string; parsers: string[]; vscodeLanguageIds: string[]; }; extend: { extensions: string[]; }; }' but required in type '{ extend: any; override: any; exclude: any; }'. +src/language-html/index.js(31,26): error TS2307: Cannot find module 'linguist-languages/data/HTML'. +src/language-html/index.js(31,59): error TS2345: Argument of type '{ override: { name: string; since: string; parsers: string[]; vscodeLanguageIds: string[]; extensions: never[]; filenames: never[]; }; }' is not assignable to parameter of type '{ extend: any; override: any; exclude: any; }'. + Type '{ override: { name: string; since: string; parsers: string[]; vscodeLanguageIds: string[]; extensions: never[]; filenames: never[]; }; }' is missing the following properties from type '{ extend: any; override: any; exclude: any; }': extend, exclude +src/language-html/index.js(42,26): error TS2307: Cannot find module 'linguist-languages/data/Vue'. +src/language-html/index.js(42,58): error TS2345: Argument of type '{ override: { since: string; parsers: string[]; vscodeLanguageIds: string[]; }; }' is not assignable to parameter of type '{ extend: any; override: any; exclude: any; }'. + Type '{ override: { since: string; parsers: string[]; vscodeLanguageIds: string[]; }; }' is missing the following properties from type '{ extend: any; override: any; exclude: any; }': extend, exclude src/language-html/parser-html.js(52,12): error TS2339: Property 'type' does not exist on type 'Attribute'. src/language-html/parser-html.js(54,12): error TS2339: Property 'type' does not exist on type 'CDATA'. src/language-html/parser-html.js(56,12): error TS2339: Property 'type' does not exist on type 'Comment'. @@ -138,10 +142,9 @@ src/language-html/printer-html.js(314,13): error TS2769: No overload matches thi src/language-html/printer-html.js(471,11): error TS2769: No overload matches this call. Overload 1 of 2, '(...items: ConcatArray[]): never[]', gave the following error. Argument of type '{ type: string; parts: any; }[]' is not assignable to parameter of type 'ConcatArray'. - Types of property 'slice' are incompatible. - Type '(start?: number | undefined, end?: number | undefined) => { type: string; parts: any; }[]' is not assignable to type '(start?: number | undefined, end?: number | undefined) => never[]'. - Type '{ type: string; parts: any; }[]' is not assignable to type 'never[]'. - Type '{ type: string; parts: any; }' is not assignable to type 'never'. + The types returned by 'slice(...)' are incompatible between these types. + Type '{ type: string; parts: any; }[]' is not assignable to type 'never[]'. + Type '{ type: string; parts: any; }' is not assignable to type 'never'. Overload 2 of 2, '(...items: ConcatArray[]): never[]', gave the following error. Argument of type '{ type: string; parts: any; }[]' is not assignable to parameter of type 'ConcatArray'. src/language-html/printer-html.js(492,11): error TS2769: No overload matches this call. @@ -165,33 +168,41 @@ src/language-html/syntax-vue.js(14,27): error TS2339: Property 'right' does not src/language-html/utils.js(10,30): error TS2307: Cannot find module 'html-tag-names'. src/language-html/utils.js(11,39): error TS2307: Cannot find module 'html-element-attributes'. src/language-html/utils.js(444,17): error TS2554: Expected 0 arguments, but got 1. -src/language-js/comments.js(864,64): error TS2554: Expected 0 arguments, but got 1. -src/language-js/index.js(9,26): error TS2307: Cannot find module 'linguist-languages/data/javascript'. -src/language-js/index.js(19,26): error TS2307: Cannot find module 'linguist-languages/data/javascript'. -src/language-js/index.js(19,65): error TS2345: Argument of type '{ override: { name: string; since: string; parsers: string[]; vscodeLanguageIds: string[]; aliases: never[]; filenames: never[]; extensions: string[]; }; }' is not assignable to parameter of type '{ extend: any; override: any; }'. - Property 'extend' is missing in type '{ override: { name: string; since: string; parsers: string[]; vscodeLanguageIds: string[]; aliases: never[]; filenames: never[]; extensions: string[]; }; }' but required in type '{ extend: any; override: any; }'. -src/language-js/index.js(31,26): error TS2307: Cannot find module 'linguist-languages/data/jsx'. -src/language-js/index.js(31,58): error TS2345: Argument of type '{ override: { since: string; parsers: string[]; vscodeLanguageIds: string[]; }; }' is not assignable to parameter of type '{ extend: any; override: any; }'. - Property 'extend' is missing in type '{ override: { since: string; parsers: string[]; vscodeLanguageIds: string[]; }; }' but required in type '{ extend: any; override: any; }'. -src/language-js/index.js(38,26): error TS2307: Cannot find module 'linguist-languages/data/typescript'. -src/language-js/index.js(38,65): error TS2345: Argument of type '{ override: { since: string; parsers: string[]; vscodeLanguageIds: string[]; }; }' is not assignable to parameter of type '{ extend: any; override: any; }'. - Property 'extend' is missing in type '{ override: { since: string; parsers: string[]; vscodeLanguageIds: string[]; }; }' but required in type '{ extend: any; override: any; }'. -src/language-js/index.js(45,26): error TS2307: Cannot find module 'linguist-languages/data/json'. -src/language-js/index.js(45,59): error TS2345: Argument of type '{ override: { name: string; since: string; parsers: string[]; vscodeLanguageIds: string[]; extensions: never[]; filenames: string[]; }; }' is not assignable to parameter of type '{ extend: any; override: any; }'. - Property 'extend' is missing in type '{ override: { name: string; since: string; parsers: string[]; vscodeLanguageIds: string[]; extensions: never[]; filenames: string[]; }; }' but required in type '{ extend: any; override: any; }'. -src/language-js/index.js(56,26): error TS2307: Cannot find module 'linguist-languages/data/json'. -src/language-js/index.js(66,26): error TS2307: Cannot find module 'linguist-languages/data/json-with-comments'. -src/language-js/index.js(76,26): error TS2307: Cannot find module 'linguist-languages/data/json5'. -src/language-js/index.js(76,60): error TS2345: Argument of type '{ override: { since: string; parsers: string[]; vscodeLanguageIds: string[]; }; }' is not assignable to parameter of type '{ extend: any; override: any; }'. - Property 'extend' is missing in type '{ override: { since: string; parsers: string[]; vscodeLanguageIds: string[]; }; }' but required in type '{ extend: any; override: any; }'. +src/language-js/comments.js(865,64): error TS2554: Expected 0 arguments, but got 1. +src/language-js/index.js(9,26): error TS2307: Cannot find module 'linguist-languages/data/JavaScript'. +src/language-js/index.js(9,65): error TS2345: Argument of type '{ override: { since: string; parsers: string[]; vscodeLanguageIds: string[]; }; extend: { interpreters: string[]; }; }' is not assignable to parameter of type '{ extend: any; override: any; exclude: any; }'. + Property 'exclude' is missing in type '{ override: { since: string; parsers: string[]; vscodeLanguageIds: string[]; }; extend: { interpreters: string[]; }; }' but required in type '{ extend: any; override: any; exclude: any; }'. +src/language-js/index.js(19,26): error TS2307: Cannot find module 'linguist-languages/data/JavaScript'. +src/language-js/index.js(19,65): error TS2345: Argument of type '{ override: { name: string; since: string; parsers: string[]; vscodeLanguageIds: string[]; aliases: never[]; filenames: never[]; extensions: string[]; }; }' is not assignable to parameter of type '{ extend: any; override: any; exclude: any; }'. + Type '{ override: { name: string; since: string; parsers: string[]; vscodeLanguageIds: string[]; aliases: never[]; filenames: never[]; extensions: string[]; }; }' is missing the following properties from type '{ extend: any; override: any; exclude: any; }': extend, exclude +src/language-js/index.js(30,26): error TS2307: Cannot find module 'linguist-languages/data/JSX'. +src/language-js/index.js(30,58): error TS2345: Argument of type '{ override: { since: string; parsers: string[]; vscodeLanguageIds: string[]; }; }' is not assignable to parameter of type '{ extend: any; override: any; exclude: any; }'. + Type '{ override: { since: string; parsers: string[]; vscodeLanguageIds: string[]; }; }' is missing the following properties from type '{ extend: any; override: any; exclude: any; }': extend, exclude +src/language-js/index.js(37,26): error TS2307: Cannot find module 'linguist-languages/data/TypeScript'. +src/language-js/index.js(37,65): error TS2345: Argument of type '{ override: { since: string; parsers: string[]; vscodeLanguageIds: string[]; }; }' is not assignable to parameter of type '{ extend: any; override: any; exclude: any; }'. + Type '{ override: { since: string; parsers: string[]; vscodeLanguageIds: string[]; }; }' is missing the following properties from type '{ extend: any; override: any; exclude: any; }': extend, exclude +src/language-js/index.js(44,26): error TS2307: Cannot find module 'linguist-languages/data/TSX'. +src/language-js/index.js(44,58): error TS2345: Argument of type '{ override: { since: string; parsers: string[]; vscodeLanguageIds: string[]; }; }' is not assignable to parameter of type '{ extend: any; override: any; exclude: any; }'. + Type '{ override: { since: string; parsers: string[]; vscodeLanguageIds: string[]; }; }' is missing the following properties from type '{ extend: any; override: any; exclude: any; }': extend, exclude +src/language-js/index.js(51,26): error TS2307: Cannot find module 'linguist-languages/data/JSON'. +src/language-js/index.js(51,59): error TS2345: Argument of type '{ override: { name: string; since: string; parsers: string[]; vscodeLanguageIds: string[]; extensions: never[]; filenames: string[]; }; }' is not assignable to parameter of type '{ extend: any; override: any; exclude: any; }'. + Type '{ override: { name: string; since: string; parsers: string[]; vscodeLanguageIds: string[]; extensions: never[]; filenames: string[]; }; }' is missing the following properties from type '{ extend: any; override: any; exclude: any; }': extend, exclude +src/language-js/index.js(61,26): error TS2307: Cannot find module 'linguist-languages/data/JSON'. +src/language-js/index.js(61,59): error TS2345: Argument of type '{ override: { since: string; parsers: string[]; vscodeLanguageIds: string[]; }; extend: { filenames: string[]; }; }' is not assignable to parameter of type '{ extend: any; override: any; exclude: any; }'. + Property 'exclude' is missing in type '{ override: { since: string; parsers: string[]; vscodeLanguageIds: string[]; }; extend: { filenames: string[]; }; }' but required in type '{ extend: any; override: any; exclude: any; }'. +src/language-js/index.js(71,26): error TS2307: Cannot find module 'linguist-languages/data/JSON with Comments'. +src/language-js/index.js(71,73): error TS2345: Argument of type '{ override: { since: string; parsers: string[]; vscodeLanguageIds: string[]; }; extend: { filenames: string[]; }; }' is not assignable to parameter of type '{ extend: any; override: any; exclude: any; }'. + Property 'exclude' is missing in type '{ override: { since: string; parsers: string[]; vscodeLanguageIds: string[]; }; extend: { filenames: string[]; }; }' but required in type '{ extend: any; override: any; exclude: any; }'. +src/language-js/index.js(81,26): error TS2307: Cannot find module 'linguist-languages/data/JSON5'. +src/language-js/index.js(81,60): error TS2345: Argument of type '{ override: { since: string; parsers: string[]; vscodeLanguageIds: string[]; }; }' is not assignable to parameter of type '{ extend: any; override: any; exclude: any; }'. + Type '{ override: { since: string; parsers: string[]; vscodeLanguageIds: string[]; }; }' is missing the following properties from type '{ extend: any; override: any; exclude: any; }': extend, exclude src/language-js/needs-parens.js(871,14): error TS2769: No overload matches this call. Overload 1 of 2, '(...items: ConcatArray<(childPath: any) => any>[]): ((childPath: any) => any)[]', gave the following error. Argument of type '(string | number)[]' is not assignable to parameter of type 'ConcatArray<(childPath: any) => any>'. - Types of property 'slice' are incompatible. - Type '(start?: number | undefined, end?: number | undefined) => (string | number)[]' is not assignable to type '(start?: number | undefined, end?: number | undefined) => ((childPath: any) => any)[]'. - Type '(string | number)[]' is not assignable to type '((childPath: any) => any)[]'. - Type 'string | number' is not assignable to type '(childPath: any) => any'. - Type 'string' is not assignable to type '(childPath: any) => any'. + The types returned by 'slice(...)' are incompatible between these types. + Type '(string | number)[]' is not assignable to type '((childPath: any) => any)[]'. + Type 'string | number' is not assignable to type '(childPath: any) => any'. + Type 'string' is not assignable to type '(childPath: any) => any'. Overload 2 of 2, '(...items: (((childPath: any) => any) | ConcatArray<(childPath: any) => any>)[]): ((childPath: any) => any)[]', gave the following error. Argument of type '(string | number)[]' is not assignable to parameter of type '((childPath: any) => any) | ConcatArray<(childPath: any) => any>'. Type '(string | number)[]' is not assignable to type 'ConcatArray<(childPath: any) => any>'. @@ -206,69 +217,71 @@ src/language-js/printer-estree.js(400,9): error TS2769: No overload matches this Overload 2 of 2, '(...items: ConcatArray[]): never[]', gave the following error. Argument of type '{ type: string; parts: any; } | { type: string; contents: any; n: any; }' is not assignable to parameter of type 'ConcatArray'. Type '{ type: string; parts: any; }' is not assignable to type 'ConcatArray'. -src/language-js/printer-estree.js(1480,28): error TS2769: No overload matches this call. +src/language-js/printer-estree.js(1481,28): error TS2769: No overload matches this call. Overload 1 of 2, '(...items: ConcatArray[]): (string | { type: string; id: any; contents: any; break: boolean; expandedStates: any; })[]', gave the following error. Argument of type '{ type: string; parts: any; }' is not assignable to parameter of type 'ConcatArray'. Type '{ type: string; parts: any; }' is missing the following properties from type 'ConcatArray': length, join, slice Overload 2 of 2, '(...items: (string | { type: string; id: any; contents: any; break: boolean; expandedStates: any; } | ConcatArray)[]): (string | { ...; })[]', gave the following error. Argument of type '{ type: string; parts: any; }' is not assignable to parameter of type 'string | { type: string; id: any; contents: any; break: boolean; expandedStates: any; } | ConcatArray'. Type '{ type: string; parts: any; }' is missing the following properties from type '{ type: string; id: any; contents: any; break: boolean; expandedStates: any; }': id, contents, break, expandedStates -src/language-js/printer-estree.js(1913,20): error TS2345: Argument of type '" "' is not assignable to parameter of type '{ type: string; id: any; contents: any; break: boolean; expandedStates: any; }'. -src/language-js/printer-estree.js(1915,20): error TS2345: Argument of type '{ type: string; parts: any; }' is not assignable to parameter of type '{ type: string; id: any; contents: any; break: boolean; expandedStates: any; }'. -src/language-js/printer-estree.js(1917,18): error TS2345: Argument of type '"while ("' is not assignable to parameter of type '{ type: string; id: any; contents: any; break: boolean; expandedStates: any; }'. -src/language-js/printer-estree.js(1926,9): error TS2345: Argument of type '")"' is not assignable to parameter of type '{ type: string; id: any; contents: any; break: boolean; expandedStates: any; }'. -src/language-js/printer-estree.js(3472,11): error TS2769: No overload matches this call. +src/language-js/printer-estree.js(1914,20): error TS2345: Argument of type '" "' is not assignable to parameter of type '{ type: string; id: any; contents: any; break: boolean; expandedStates: any; }'. +src/language-js/printer-estree.js(1916,20): error TS2345: Argument of type '{ type: string; parts: any; }' is not assignable to parameter of type '{ type: string; id: any; contents: any; break: boolean; expandedStates: any; }'. +src/language-js/printer-estree.js(1918,18): error TS2345: Argument of type '"while ("' is not assignable to parameter of type '{ type: string; id: any; contents: any; break: boolean; expandedStates: any; }'. +src/language-js/printer-estree.js(1927,9): error TS2345: Argument of type '")"' is not assignable to parameter of type '{ type: string; id: any; contents: any; break: boolean; expandedStates: any; }'. +src/language-js/printer-estree.js(3473,11): error TS2769: No overload matches this call. Overload 1 of 2, '(...items: ConcatArray[]): never[]', gave the following error. Argument of type 'never[] | { type: string; parts: any; }' is not assignable to parameter of type 'ConcatArray'. Type '{ type: string; parts: any; }' is not assignable to type 'ConcatArray'. Overload 2 of 2, '(...items: ConcatArray[]): never[]', gave the following error. Argument of type 'never[] | { type: string; parts: any; }' is not assignable to parameter of type 'ConcatArray'. Type '{ type: string; parts: any; }' is not assignable to type 'ConcatArray'. -src/language-js/printer-estree.js(3901,22): error TS2345: Argument of type 'any' is not assignable to parameter of type 'never'. -src/language-js/printer-estree.js(3968,14): error TS2339: Property 'comments' does not exist on type 'Expression'. +src/language-js/printer-estree.js(3902,22): error TS2345: Argument of type 'any' is not assignable to parameter of type 'never'. +src/language-js/printer-estree.js(3969,14): error TS2339: Property 'comments' does not exist on type 'Expression'. Property 'comments' does not exist on type 'Identifier'. -src/language-js/printer-estree.js(3980,9): error TS2367: This condition will always return 'false' since the types '"FunctionExpression" | "ClassExpression" | "ObjectExpression" | "TaggedTemplateExpression" | "CallExpression" | "ConditionalExpression" | "UpdateExpression" | "SequenceExpression" | ... 11 more ... | "MetaProperty"' and '"OptionalMemberExpression"' have no overlap. -src/language-js/printer-estree.js(3981,13): error TS2339: Property 'property' does not exist on type 'SimpleLiteral | RegExpLiteral | FunctionExpression | ArrowFunctionExpression | ArrayExpression | ObjectExpression | YieldExpression | UnaryExpression | UpdateExpression | ... 12 more ... | AwaitExpression'. +src/language-js/printer-estree.js(3981,9): error TS2367: This condition will always return 'false' since the types '"FunctionExpression" | "ClassExpression" | "ObjectExpression" | "TaggedTemplateExpression" | "CallExpression" | "ConditionalExpression" | "UpdateExpression" | "SequenceExpression" | ... 11 more ... | "MetaProperty"' and '"OptionalMemberExpression"' have no overlap. +src/language-js/printer-estree.js(3982,13): error TS2339: Property 'property' does not exist on type 'SimpleLiteral | RegExpLiteral | FunctionExpression | ArrowFunctionExpression | ArrayExpression | ObjectExpression | YieldExpression | UnaryExpression | UpdateExpression | ... 12 more ... | AwaitExpression'. Property 'property' does not exist on type 'SimpleLiteral'. -src/language-js/printer-estree.js(3981,52): error TS2339: Property 'property' does not exist on type 'SimpleLiteral | RegExpLiteral | FunctionExpression | ArrowFunctionExpression | ArrayExpression | ObjectExpression | YieldExpression | UnaryExpression | UpdateExpression | ... 12 more ... | AwaitExpression'. +src/language-js/printer-estree.js(3982,52): error TS2339: Property 'property' does not exist on type 'SimpleLiteral | RegExpLiteral | FunctionExpression | ArrowFunctionExpression | ArrayExpression | ObjectExpression | YieldExpression | UnaryExpression | UpdateExpression | ... 12 more ... | AwaitExpression'. Property 'property' does not exist on type 'SimpleLiteral'. -src/language-js/printer-estree.js(3986,9): error TS2367: This condition will always return 'false' since the types '"FunctionExpression" | "ClassExpression" | "ObjectExpression" | "TaggedTemplateExpression" | "CallExpression" | "ConditionalExpression" | "UpdateExpression" | "SequenceExpression" | ... 11 more ... | "MetaProperty"' and '"OptionalMemberExpression"' have no overlap. -src/language-js/printer-estree.js(3988,29): error TS2339: Property 'object' does not exist on type 'SimpleLiteral | RegExpLiteral | FunctionExpression | ArrowFunctionExpression | ArrayExpression | ObjectExpression | YieldExpression | UnaryExpression | UpdateExpression | ... 12 more ... | AwaitExpression'. +src/language-js/printer-estree.js(3987,9): error TS2367: This condition will always return 'false' since the types '"FunctionExpression" | "ClassExpression" | "ObjectExpression" | "TaggedTemplateExpression" | "CallExpression" | "ConditionalExpression" | "UpdateExpression" | "SequenceExpression" | ... 11 more ... | "MetaProperty"' and '"OptionalMemberExpression"' have no overlap. +src/language-js/printer-estree.js(3989,29): error TS2339: Property 'object' does not exist on type 'SimpleLiteral | RegExpLiteral | FunctionExpression | ArrowFunctionExpression | ArrayExpression | ObjectExpression | YieldExpression | UnaryExpression | UpdateExpression | ... 12 more ... | AwaitExpression'. Property 'object' does not exist on type 'SimpleLiteral'. -src/language-js/printer-estree.js(3989,22): error TS2339: Property 'comments' does not exist on type 'SimpleLiteral | RegExpLiteral | FunctionExpression | ArrowFunctionExpression | ArrayExpression | ObjectExpression | YieldExpression | UnaryExpression | UpdateExpression | ... 12 more ... | AwaitExpression'. +src/language-js/printer-estree.js(3990,22): error TS2339: Property 'comments' does not exist on type 'SimpleLiteral | RegExpLiteral | FunctionExpression | ArrowFunctionExpression | ArrayExpression | ObjectExpression | YieldExpression | UnaryExpression | UpdateExpression | ... 12 more ... | AwaitExpression'. Property 'comments' does not exist on type 'SimpleLiteral'. -src/language-js/printer-estree.js(3995,9): error TS2367: This condition will always return 'false' since the types '"FunctionExpression" | "ClassExpression" | "ObjectExpression" | "TaggedTemplateExpression" | "CallExpression" | "ConditionalExpression" | "UpdateExpression" | "SequenceExpression" | ... 11 more ... | "MetaProperty"' and '"Identifier"' have no overlap. -src/language-js/printer-estree.js(3996,9): error TS2367: This condition will always return 'false' since the types '"FunctionExpression" | "ClassExpression" | "ObjectExpression" | "TaggedTemplateExpression" | "CallExpression" | "ConditionalExpression" | "UpdateExpression" | "SequenceExpression" | ... 11 more ... | "MetaProperty"' and '"ThisExpression"' have no overlap. -src/language-js/printer-estree.js(4200,23): error TS2532: Object is possibly 'undefined'. -src/language-js/printer-estree.js(4201,24): error TS2532: Object is possibly 'undefined'. -src/language-js/printer-estree.js(4557,5): error TS2345: Argument of type '"" | { type: string; parts: any; } | { type: string; contents: any; }' is not assignable to parameter of type 'string'. +src/language-js/printer-estree.js(3996,9): error TS2367: This condition will always return 'false' since the types '"FunctionExpression" | "ClassExpression" | "ObjectExpression" | "TaggedTemplateExpression" | "CallExpression" | "ConditionalExpression" | "UpdateExpression" | "SequenceExpression" | ... 11 more ... | "MetaProperty"' and '"Identifier"' have no overlap. +src/language-js/printer-estree.js(3997,9): error TS2367: This condition will always return 'false' since the types '"FunctionExpression" | "ClassExpression" | "ObjectExpression" | "TaggedTemplateExpression" | "CallExpression" | "ConditionalExpression" | "UpdateExpression" | "SequenceExpression" | ... 11 more ... | "MetaProperty"' and '"ThisExpression"' have no overlap. +src/language-js/printer-estree.js(4201,23): error TS2532: Object is possibly 'undefined'. +src/language-js/printer-estree.js(4202,24): error TS2532: Object is possibly 'undefined'. +src/language-js/printer-estree.js(4558,5): error TS2345: Argument of type '"" | { type: string; parts: any; } | { type: string; contents: any; }' is not assignable to parameter of type 'string'. Type '{ type: string; parts: any; }' is not assignable to type 'string'. -src/language-js/printer-estree.js(4561,16): error TS2345: Argument of type '{ type: string; parts: any; }' is not assignable to parameter of type 'string'. -src/language-js/printer-estree.js(4603,9): error TS2345: Argument of type '{ type: string; parts: any; }' is not assignable to parameter of type 'string'. -src/language-js/printer-estree.js(4905,9): error TS2554: Expected 0-2 arguments, but got 3. -src/language-js/printer-estree.js(6112,7): error TS2769: No overload matches this call. +src/language-js/printer-estree.js(4562,16): error TS2345: Argument of type '{ type: string; parts: any; }' is not assignable to parameter of type 'string'. +src/language-js/printer-estree.js(4610,11): error TS2322: Type '{ type: string; id: any; contents: any; break: boolean; expandedStates: any; }' is not assignable to type 'string'. +src/language-js/printer-estree.js(4625,11): error TS2322: Type '{ type: string; parts: any; }' is not assignable to type 'string'. +src/language-js/printer-estree.js(4637,9): error TS2345: Argument of type '{ type: string; parts: any; }' is not assignable to parameter of type 'string'. +src/language-js/printer-estree.js(4931,9): error TS2554: Expected 0-2 arguments, but got 3. +src/language-js/printer-estree.js(6138,7): error TS2769: No overload matches this call. Overload 1 of 2, '(...items: ConcatArray<(childPath: any) => any>[]): ((childPath: any) => any)[]', gave the following error. Argument of type '(string | number)[]' is not assignable to parameter of type 'ConcatArray<(childPath: any) => any>'. - Types of property 'slice' are incompatible. - Type '(start?: number | undefined, end?: number | undefined) => (string | number)[]' is not assignable to type '(start?: number | undefined, end?: number | undefined) => ((childPath: any) => any)[]'. - Type '(string | number)[]' is not assignable to type '((childPath: any) => any)[]'. - Type 'string | number' is not assignable to type '(childPath: any) => any'. - Type 'string' is not assignable to type '(childPath: any) => any'. + The types returned by 'slice(...)' are incompatible between these types. + Type '(string | number)[]' is not assignable to type '((childPath: any) => any)[]'. + Type 'string | number' is not assignable to type '(childPath: any) => any'. + Type 'string' is not assignable to type '(childPath: any) => any'. Overload 2 of 2, '(...items: (((childPath: any) => any) | ConcatArray<(childPath: any) => any>)[]): ((childPath: any) => any)[]', gave the following error. Argument of type '(string | number)[]' is not assignable to parameter of type '((childPath: any) => any) | ConcatArray<(childPath: any) => any>'. Type '(string | number)[]' is not assignable to type 'ConcatArray<(childPath: any) => any>'. src/language-js/utils.js(107,55): error TS2554: Expected 0-1 arguments, but got 2. -src/language-markdown/index.js(8,26): error TS2307: Cannot find module 'linguist-languages/data/markdown'. -src/language-markdown/index.js(20,5): error TS2345: Argument of type '{ override: { since: string; parsers: string[]; vscodeLanguageIds: string[]; }; }' is not assignable to parameter of type '{ extend: any; override: any; }'. - Property 'extend' is missing in type '{ override: { since: string; parsers: string[]; vscodeLanguageIds: string[]; }; }' but required in type '{ extend: any; override: any; }'. +src/language-markdown/index.js(8,26): error TS2307: Cannot find module 'linguist-languages/data/Markdown'. +src/language-markdown/index.js(21,26): error TS2307: Cannot find module 'linguist-languages/data/Markdown'. +src/language-markdown/index.js(21,63): error TS2345: Argument of type '{ override: { name: string; since: string; parsers: string[]; vscodeLanguageIds: string[]; filenames: never[]; extensions: string[]; }; }' is not assignable to parameter of type '{ extend: any; override: any; exclude: any; }'. + Type '{ override: { name: string; since: string; parsers: string[]; vscodeLanguageIds: string[]; filenames: never[]; extensions: string[]; }; }' is missing the following properties from type '{ extend: any; override: any; exclude: any; }': extend, exclude src/language-markdown/printer-markdown.js(278,18): error TS2532: Object is possibly 'undefined'. src/language-markdown/printer-markdown.js(279,17): error TS2532: Object is possibly 'undefined'. src/language-markdown/printer-markdown.js(300,14): error TS2532: Object is possibly 'undefined'. src/language-markdown/utils.js(203,5): error TS2322: Type 'never[]' is not assignable to type 'null'. src/language-markdown/utils.js(213,47): error TS2345: Argument of type 'any[]' is not assignable to parameter of type 'null'. -src/language-yaml/index.js(8,26): error TS2307: Cannot find module 'linguist-languages/data/yaml'. -src/language-yaml/index.js(8,59): error TS2345: Argument of type '{ override: { since: string; parsers: string[]; vscodeLanguageIds: string[]; }; }' is not assignable to parameter of type '{ extend: any; override: any; }'. - Property 'extend' is missing in type '{ override: { since: string; parsers: string[]; vscodeLanguageIds: string[]; }; }' but required in type '{ extend: any; override: any; }'. +src/language-yaml/index.js(8,26): error TS2307: Cannot find module 'linguist-languages/data/YAML'. +src/language-yaml/index.js(8,59): error TS2345: Argument of type '{ override: { since: string; parsers: string[]; vscodeLanguageIds: string[]; }; }' is not assignable to parameter of type '{ extend: any; override: any; exclude: any; }'. + Type '{ override: { since: string; parsers: string[]; vscodeLanguageIds: string[]; }; }' is missing the following properties from type '{ extend: any; override: any; exclude: any; }': extend, exclude src/language-yaml/printer-yaml.js(226,41): error TS2769: No overload matches this call. Overload 1 of 2, '(...items: ConcatArray[]): never[]', gave the following error. Argument of type '"" | { type: string; parts: any; }' is not assignable to parameter of type 'ConcatArray'. @@ -319,8 +332,6 @@ src/main/options-normalizer.js(36,35): error TS2339: Property 'blue' does not ex src/main/options-normalizer.js(54,5): error TS2525: Initializer provides no value for this binding element and the binding element has no default value. src/main/options-normalizer.js(74,16): error TS2341: Property '_hasDeprecationWarned' is private and only accessible within class 'Normalizer'. src/main/options-normalizer.js(80,39): error TS2341: Property '_hasDeprecationWarned' is private and only accessible within class 'Normalizer'. -src/main/options-normalizer.js(90,44): error TS2345: Argument of type '{ name: string; }' is not assignable to parameter of type 'SchemaHandlers'. - Object literal may only specify known properties, and 'name' does not exist in type 'SchemaHandlers'. src/main/options-normalizer.js(99,11): error TS2345: Argument of type '{ name: any; sourceName: any; }' is not assignable to parameter of type 'SchemaHandlers'. Object literal may only specify known properties, and 'name' does not exist in type 'SchemaHandlers'. src/main/options-normalizer.js(143,13): error TS2769: No overload matches this call. diff --git a/tests/baselines/reference/varianceRepeatedlyPropegatesWithUnreliableFlag.js b/tests/baselines/reference/varianceRepeatedlyPropegatesWithUnreliableFlag.js new file mode 100644 index 0000000000000..73062e82014f6 --- /dev/null +++ b/tests/baselines/reference/varianceRepeatedlyPropegatesWithUnreliableFlag.js @@ -0,0 +1,25 @@ +//// [varianceRepeatedlyPropegatesWithUnreliableFlag.ts] +type A = { a: number }; +type B = { b: number }; +type X = ({ [K in keyof T]: T[K] } & Record)[keyof T]; +type P1 = { data: X }; +type P2 = { data: X }; + +interface I { + fn(p1: P1>, p2: P2>): void; +} + +const i: I
= null as any; +const p2: P2 = null as any; + +// Commenting out the below line will remove the error on the `const _i: I = i;` +i.fn(null as any, p2); + +const _i: I = i; + +//// [varianceRepeatedlyPropegatesWithUnreliableFlag.js] +var i = null; +var p2 = null; +// Commenting out the below line will remove the error on the `const _i: I = i;` +i.fn(null, p2); +var _i = i; diff --git a/tests/baselines/reference/varianceRepeatedlyPropegatesWithUnreliableFlag.symbols b/tests/baselines/reference/varianceRepeatedlyPropegatesWithUnreliableFlag.symbols new file mode 100644 index 0000000000000..b2e1f46f1e87b --- /dev/null +++ b/tests/baselines/reference/varianceRepeatedlyPropegatesWithUnreliableFlag.symbols @@ -0,0 +1,77 @@ +=== tests/cases/compiler/varianceRepeatedlyPropegatesWithUnreliableFlag.ts === +type A = { a: number }; +>A : Symbol(A, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 0, 0)) +>a : Symbol(a, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 0, 10)) + +type B = { b: number }; +>B : Symbol(B, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 0, 23)) +>b : Symbol(b, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 1, 10)) + +type X = ({ [K in keyof T]: T[K] } & Record)[keyof T]; +>X : Symbol(X, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 1, 23)) +>T : Symbol(T, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 2, 7)) +>K : Symbol(K, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 2, 16)) +>T : Symbol(T, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 2, 7)) +>T : Symbol(T, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 2, 7)) +>K : Symbol(K, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 2, 16)) +>Record : Symbol(Record, Decl(lib.es5.d.ts, --, --)) +>T : Symbol(T, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 2, 7)) + +type P1 = { data: X }; +>P1 : Symbol(P1, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 2, 71)) +>T : Symbol(T, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 3, 8)) +>data : Symbol(data, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 3, 14)) +>X : Symbol(X, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 1, 23)) +>T : Symbol(T, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 3, 8)) + +type P2 = { data: X }; +>P2 : Symbol(P2, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 3, 28)) +>T : Symbol(T, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 4, 8)) +>data : Symbol(data, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 4, 14)) +>X : Symbol(X, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 1, 23)) +>T : Symbol(T, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 4, 8)) + +interface I { +>I : Symbol(I, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 4, 28)) +>T : Symbol(T, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 6, 12)) + + fn(p1: P1>, p2: P2>): void; +>fn : Symbol(I.fn, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 6, 16)) +>K : Symbol(K, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 7, 7)) +>T : Symbol(T, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 6, 12)) +>p1 : Symbol(p1, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 7, 26)) +>P1 : Symbol(P1, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 2, 71)) +>Pick : Symbol(Pick, Decl(lib.es5.d.ts, --, --)) +>T : Symbol(T, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 6, 12)) +>K : Symbol(K, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 7, 7)) +>p2 : Symbol(p2, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 7, 45)) +>P2 : Symbol(P2, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 3, 28)) +>Pick : Symbol(Pick, Decl(lib.es5.d.ts, --, --)) +>T : Symbol(T, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 6, 12)) +>K : Symbol(K, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 7, 7)) +} + +const i: I = null as any; +>i : Symbol(i, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 10, 5)) +>I : Symbol(I, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 4, 28)) +>A : Symbol(A, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 0, 0)) +>B : Symbol(B, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 0, 23)) + +const p2: P2 = null as any; +>p2 : Symbol(p2, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 11, 5)) +>P2 : Symbol(P2, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 3, 28)) +>A : Symbol(A, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 0, 0)) + +// Commenting out the below line will remove the error on the `const _i: I = i;` +i.fn(null as any, p2); +>i.fn : Symbol(I.fn, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 6, 16)) +>i : Symbol(i, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 10, 5)) +>fn : Symbol(I.fn, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 6, 16)) +>p2 : Symbol(p2, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 11, 5)) + +const _i: I = i; +>_i : Symbol(_i, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 16, 5)) +>I : Symbol(I, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 4, 28)) +>A : Symbol(A, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 0, 0)) +>i : Symbol(i, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 10, 5)) + diff --git a/tests/baselines/reference/varianceRepeatedlyPropegatesWithUnreliableFlag.types b/tests/baselines/reference/varianceRepeatedlyPropegatesWithUnreliableFlag.types new file mode 100644 index 0000000000000..82bf01d05d922 --- /dev/null +++ b/tests/baselines/reference/varianceRepeatedlyPropegatesWithUnreliableFlag.types @@ -0,0 +1,51 @@ +=== tests/cases/compiler/varianceRepeatedlyPropegatesWithUnreliableFlag.ts === +type A = { a: number }; +>A : A +>a : number + +type B = { b: number }; +>B : B +>b : number + +type X = ({ [K in keyof T]: T[K] } & Record)[keyof T]; +>X : ({ [K in keyof T]: T[K]; } & Record)[keyof T] + +type P1 = { data: X }; +>P1 : P1 +>data : ({ [K in keyof T]: T[K]; } & Record)[keyof T] + +type P2 = { data: X }; +>P2 : P2 +>data : ({ [K in keyof T]: T[K]; } & Record)[keyof T] + +interface I { + fn(p1: P1>, p2: P2>): void; +>fn : (p1: P1>, p2: P2>) => void +>p1 : P1> +>p2 : P2> +} + +const i: I = null as any; +>i : I +>null as any : any +>null : null + +const p2: P2 = null as any; +>p2 : P2 +>null as any : any +>null : null + +// Commenting out the below line will remove the error on the `const _i: I = i;` +i.fn(null as any, p2); +>i.fn(null as any, p2) : void +>i.fn : (p1: P1>, p2: P2>) => void +>i : I +>fn : (p1: P1>, p2: P2>) => void +>null as any : any +>null : null +>p2 : P2 + +const _i: I = i; +>_i : I +>i : I + diff --git a/tests/baselines/reference/voidIsInitialized.js b/tests/baselines/reference/voidIsInitialized.js new file mode 100644 index 0000000000000..4aaa550d44fb5 --- /dev/null +++ b/tests/baselines/reference/voidIsInitialized.js @@ -0,0 +1,23 @@ +//// [voidIsInitialized.ts] +const x: void = undefined; +const y: void = undefined; + +if(typeof x === "undefined") { + x // no error: assume x2 is initialised +} + +if(typeof y !== "undefined") { + y // no error: do not narrow void +} + + +//// [voidIsInitialized.js] +"use strict"; +var x = undefined; +var y = undefined; +if (typeof x === "undefined") { + x; // no error: assume x2 is initialised +} +if (typeof y !== "undefined") { + y; // no error: do not narrow void +} diff --git a/tests/baselines/reference/voidIsInitialized.symbols b/tests/baselines/reference/voidIsInitialized.symbols new file mode 100644 index 0000000000000..23ce56b309f85 --- /dev/null +++ b/tests/baselines/reference/voidIsInitialized.symbols @@ -0,0 +1,23 @@ +=== tests/cases/compiler/voidIsInitialized.ts === +const x: void = undefined; +>x : Symbol(x, Decl(voidIsInitialized.ts, 0, 5)) +>undefined : Symbol(undefined) + +const y: void = undefined; +>y : Symbol(y, Decl(voidIsInitialized.ts, 1, 5)) +>undefined : Symbol(undefined) + +if(typeof x === "undefined") { +>x : Symbol(x, Decl(voidIsInitialized.ts, 0, 5)) + + x // no error: assume x2 is initialised +>x : Symbol(x, Decl(voidIsInitialized.ts, 0, 5)) +} + +if(typeof y !== "undefined") { +>y : Symbol(y, Decl(voidIsInitialized.ts, 1, 5)) + + y // no error: do not narrow void +>y : Symbol(y, Decl(voidIsInitialized.ts, 1, 5)) +} + diff --git a/tests/baselines/reference/voidIsInitialized.types b/tests/baselines/reference/voidIsInitialized.types new file mode 100644 index 0000000000000..a8b5767d2c47b --- /dev/null +++ b/tests/baselines/reference/voidIsInitialized.types @@ -0,0 +1,29 @@ +=== tests/cases/compiler/voidIsInitialized.ts === +const x: void = undefined; +>x : void +>undefined : undefined + +const y: void = undefined; +>y : void +>undefined : undefined + +if(typeof x === "undefined") { +>typeof x === "undefined" : boolean +>typeof x : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" +>x : void +>"undefined" : "undefined" + + x // no error: assume x2 is initialised +>x : void +} + +if(typeof y !== "undefined") { +>typeof y !== "undefined" : boolean +>typeof y : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" +>y : void +>"undefined" : "undefined" + + y // no error: do not narrow void +>y : void +} + diff --git a/tests/cases/compiler/contextualSignatureInstantiation4.ts b/tests/cases/compiler/contextualSignatureInstantiation4.ts new file mode 100644 index 0000000000000..6c29ca3d40af1 --- /dev/null +++ b/tests/cases/compiler/contextualSignatureInstantiation4.ts @@ -0,0 +1,20 @@ +// @strict: true + +// Repros from #32976 + +declare class Banana { constructor(a: string, property: T) } + +declare function fruitFactory1(Fruit: new (...args: any[]) => TFruit): TFruit +const banana1 = fruitFactory1(Banana) // Banana + +declare function fruitFactory2(Fruit: new (a: string, ...args: any[]) => TFruit): TFruit +const banana2 = fruitFactory2(Banana) // Banana + +declare function fruitFactory3(Fruit: new (a: string, s: "foo", ...args: any[]) => TFruit): TFruit +const banana3 = fruitFactory3(Banana) // Banana<"foo"> + +declare function fruitFactory4(Fruit: new (a: string, ...args: "foo"[]) => TFruit): TFruit +const banana4 = fruitFactory4(Banana) // Banana<"foo"> + +declare function fruitFactory5(Fruit: new (...args: "foo"[]) => TFruit): TFruit +const banana5 = fruitFactory5(Banana) // Banana<"foo"> diff --git a/tests/cases/compiler/correctOrderOfPromiseMethod.ts b/tests/cases/compiler/correctOrderOfPromiseMethod.ts index 85f4be9843ce5..70c730c6b20b1 100644 --- a/tests/cases/compiler/correctOrderOfPromiseMethod.ts +++ b/tests/cases/compiler/correctOrderOfPromiseMethod.ts @@ -17,7 +17,7 @@ async function countEverything(): Promise { const [resultA, resultB] = await Promise.all([ providerA(), providerB(), - ]); + ] as const); const dataA: A[] = resultA; const dataB: B[] = resultB; @@ -25,4 +25,4 @@ async function countEverything(): Promise { return dataA.length + dataB.length; } return 0; -} \ No newline at end of file +} diff --git a/tests/cases/compiler/customAsyncIterator.ts b/tests/cases/compiler/customAsyncIterator.ts new file mode 100644 index 0000000000000..dcd1140f6b5cd --- /dev/null +++ b/tests/cases/compiler/customAsyncIterator.ts @@ -0,0 +1,13 @@ +// @target: esnext + +// GH: https://github.com/microsoft/TypeScript/issues/33239 +class ConstantIterator implements AsyncIterator { + constructor(private constant: T) { + } + async next(value?: T): Promise> { + if (value != null) { + throw new Error("ConstantIterator.prototype.next may not take any values"); + } + return { value: this.constant, done: false }; + } +} \ No newline at end of file diff --git a/tests/cases/compiler/deeplyNestedAssignabilityErrorsCombined.ts b/tests/cases/compiler/deeplyNestedAssignabilityErrorsCombined.ts new file mode 100644 index 0000000000000..d802c707830e5 --- /dev/null +++ b/tests/cases/compiler/deeplyNestedAssignabilityErrorsCombined.ts @@ -0,0 +1,15 @@ +let x = { a: { b: { c: { d: { e: { f() { return { g: "hello" }; } } } } } } }; +let y = { a: { b: { c: { d: { e: { f() { return { g: 12345 }; } } } } } } }; +x = y; + +class Ctor1 { + g = "ok" +} + +class Ctor2 { + g = 12; +} + +let x2 = { a: { b: { c: { d: { e: { f: Ctor1 } } } } } }; +let y2 = { a: { b: { c: { d: { e: { f: Ctor2 } } } } } }; +x2 = y2; \ No newline at end of file diff --git a/tests/cases/compiler/exhaustiveSwitchImplicitReturn.ts b/tests/cases/compiler/exhaustiveSwitchImplicitReturn.ts index b87baffdaf95a..7355a5dba30fb 100644 --- a/tests/cases/compiler/exhaustiveSwitchImplicitReturn.ts +++ b/tests/cases/compiler/exhaustiveSwitchImplicitReturn.ts @@ -40,3 +40,17 @@ function foo5(bar: "a" | "b"): number { return 1; } } + +function foo6(bar: "a", a: boolean, b: boolean): number { + if (a) { + switch (bar) { + case "a": return 1; + } + } + else { + switch (b) { + case true: return -1; + case false: return 0; + } + } +} diff --git a/tests/cases/compiler/interfaceMergedUnconstrainedNoErrorIrrespectiveOfOrder.ts b/tests/cases/compiler/interfaceMergedUnconstrainedNoErrorIrrespectiveOfOrder.ts new file mode 100644 index 0000000000000..7bbce8e8b0383 --- /dev/null +++ b/tests/cases/compiler/interfaceMergedUnconstrainedNoErrorIrrespectiveOfOrder.ts @@ -0,0 +1,19 @@ +// @filename: working.ts +// minmal samples from #33395 +export namespace ns { + interface Function any> { + throttle(): Function; + } + interface Function { + unary(): Function<() => ReturnType>; + } +} +// @filename: regression.ts +export namespace ns { + interface Function { + unary(): Function<() => ReturnType>; + } + interface Function any> { + throttle(): Function; + } +} \ No newline at end of file diff --git a/tests/cases/compiler/jsFileCompilationOptionalClassElementSyntaxOfClass.ts b/tests/cases/compiler/jsFileCompilationOptionalClassElementSyntaxOfClass.ts new file mode 100644 index 0000000000000..27739f58d6cf0 --- /dev/null +++ b/tests/cases/compiler/jsFileCompilationOptionalClassElementSyntaxOfClass.ts @@ -0,0 +1,8 @@ +// @allowJs: true +// @noTypesAndSymbols: true +// @filename: a.js +class C { + foo?() { + } + bar? = 1; +} \ No newline at end of file diff --git a/tests/cases/compiler/jsFileCompilationTypeArgumentSyntaxOfCall.ts b/tests/cases/compiler/jsFileCompilationTypeArgumentSyntaxOfCall.ts index a5bcdae904b61..008714f0df7e7 100644 --- a/tests/cases/compiler/jsFileCompilationTypeArgumentSyntaxOfCall.ts +++ b/tests/cases/compiler/jsFileCompilationTypeArgumentSyntaxOfCall.ts @@ -1,3 +1,7 @@ // @allowJs: true -// @filename: a.js -Foo(); \ No newline at end of file +// @noTypesAndSymbols: true +// @filename: a.jsx +Foo(); +Foo``; +>; +/>; \ No newline at end of file diff --git a/tests/cases/compiler/mixinIntersectionIsValidbaseType.ts b/tests/cases/compiler/mixinIntersectionIsValidbaseType.ts new file mode 100644 index 0000000000000..4f446a9db8d08 --- /dev/null +++ b/tests/cases/compiler/mixinIntersectionIsValidbaseType.ts @@ -0,0 +1,27 @@ +export type Constructor = new (...args: any[]) => T; + +export interface Initable { + init(...args: any[]): void; +} + +/** + * Plain mixin where the superclass must be Initable + */ +export const Serializable = & Initable>( + SuperClass: K +) => { + const LocalMixin = (InnerSuperClass: K) => { + return class SerializableLocal extends InnerSuperClass { + } + }; + let ResultClass = LocalMixin(SuperClass); + return ResultClass; +}; + +const AMixin = & Initable>(SuperClass: K) => { + let SomeHowOkay = class A extends SuperClass { + }; + + let SomeHowNotOkay = class A extends Serializable(SuperClass) { + }; +}; \ No newline at end of file diff --git a/tests/cases/compiler/nestedCallbackErrorNotFlattened.ts b/tests/cases/compiler/nestedCallbackErrorNotFlattened.ts new file mode 100644 index 0000000000000..76a1fabdf6ed3 --- /dev/null +++ b/tests/cases/compiler/nestedCallbackErrorNotFlattened.ts @@ -0,0 +1,7 @@ +// @strict: true +type Cb = {noAlias: () => T}["noAlias"]; // `"noAlias"` here prevents an alias symbol from being made +// which means the comparison will definitely be structural, rather than by variance + +declare const x: Cb>>>; // one more layer of `Cb` adn we'd get a `true` from the deeply-nested symbol check +declare let y: Cb>>>; +y = x; \ No newline at end of file diff --git a/tests/cases/compiler/reverseMappedTypeAssignableToIndex.ts b/tests/cases/compiler/reverseMappedTypeAssignableToIndex.ts new file mode 100644 index 0000000000000..a1244fe8eb277 --- /dev/null +++ b/tests/cases/compiler/reverseMappedTypeAssignableToIndex.ts @@ -0,0 +1,19 @@ +// Simple mapped type and inferrence +type Mapped = { [K in keyof T]: { name: T[K] } }; +type InferFromMapped = T extends Mapped ? R : never; + +// Object literal type and associated mapped type +// Note that in the real code we don't have a direct reference to LiteralType +type LiteralType = { + first: "first"; + second: "second"; +} +type MappedLiteralType = { + first: { name: "first" }, + second: { name: "second" }, +}; + +type Inferred = InferFromMapped; + +// UNEXPECTED resolves to false +type Test1 = Inferred extends Record ? true : false; \ No newline at end of file diff --git a/tests/cases/compiler/truthinessCallExpressionCoercion.ts b/tests/cases/compiler/truthinessCallExpressionCoercion.ts new file mode 100644 index 0000000000000..431a0b0463c17 --- /dev/null +++ b/tests/cases/compiler/truthinessCallExpressionCoercion.ts @@ -0,0 +1,74 @@ +// @strictNullChecks:true + +function onlyErrorsWhenTestingNonNullableFunctionType(required: () => boolean, optional?: () => boolean) { + if (required) { // error + } + + if (optional) { // ok + } + + if (!!required) { // ok + } + + if (required()) { // ok + } +} + +function onlyErrorsWhenUnusedInBody() { + function test() { return Math.random() > 0.5; } + + if (test) { // error + console.log('test'); + } + + if (test) { // ok + console.log(test); + } + + if (test) { // ok + test(); + } + + if (test) { // ok + [() => null].forEach(() => { + test(); + }); + } + + if (test) { // error + [() => null].forEach(test => { + test(); + }); + } +} + +function checksPropertyAccess() { + const x = { + foo: { + bar() { return true; } + } + } + + if (x.foo.bar) { // error + } + + if (x.foo.bar) { // ok + x.foo.bar; + } +} + +class Foo { + maybeIsUser?: () => boolean; + + isUser() { + return true; + } + + test() { + if (this.isUser) { // error + } + + if (this.maybeIsUser) { // ok + } + } +} diff --git a/tests/cases/compiler/twiceNestedKeyofIndexInference.ts b/tests/cases/compiler/twiceNestedKeyofIndexInference.ts new file mode 100644 index 0000000000000..35fb39b009e55 --- /dev/null +++ b/tests/cases/compiler/twiceNestedKeyofIndexInference.ts @@ -0,0 +1,32 @@ +type Set1 = T extends any[] ? T : Pick> & { + [SK1 in K1]-?: Required>; +}[K1]; + +type Set2 = T extends any[] ? T : Pick> & { + [SK1 in K1]-?: Required<{ + [key in K1]: Set1; + }>; +}[K1]; + +declare function set(source: T, path: [K1], value: T[K1]): Set1; + +declare function set(source: T, path: [K1, K2], value: T[K1][K2]): Set2; + + +interface State { + a: { + b: string; + c: number; + }; + d: boolean; +} + +const state: State = { + a: { + b: "", + c: 0, + }, + d: false, +}; + +const newState: State = set(state, ["a", 'b'], 'why'); // shouldn't be an error \ No newline at end of file diff --git a/tests/cases/compiler/varianceRepeatedlyPropegatesWithUnreliableFlag.ts b/tests/cases/compiler/varianceRepeatedlyPropegatesWithUnreliableFlag.ts new file mode 100644 index 0000000000000..03cdaee0e9d83 --- /dev/null +++ b/tests/cases/compiler/varianceRepeatedlyPropegatesWithUnreliableFlag.ts @@ -0,0 +1,17 @@ +type A = { a: number }; +type B = { b: number }; +type X = ({ [K in keyof T]: T[K] } & Record)[keyof T]; +type P1 = { data: X }; +type P2 = { data: X }; + +interface I { + fn(p1: P1>, p2: P2>): void; +} + +const i: I = null as any; +const p2: P2 = null as any; + +// Commenting out the below line will remove the error on the `const _i: I = i;` +i.fn(null as any, p2); + +const _i: I = i; \ No newline at end of file diff --git a/tests/cases/compiler/voidIsInitialized.ts b/tests/cases/compiler/voidIsInitialized.ts new file mode 100644 index 0000000000000..b2027c21df3b5 --- /dev/null +++ b/tests/cases/compiler/voidIsInitialized.ts @@ -0,0 +1,12 @@ +// @strict: true + +const x: void = undefined; +const y: void = undefined; + +if(typeof x === "undefined") { + x // no error: assume x2 is initialised +} + +if(typeof y !== "undefined") { + y // no error: do not narrow void +} diff --git a/tests/cases/conformance/controlFlow/assertionTypePredicates1.ts b/tests/cases/conformance/controlFlow/assertionTypePredicates1.ts new file mode 100644 index 0000000000000..b20cd42414b53 --- /dev/null +++ b/tests/cases/conformance/controlFlow/assertionTypePredicates1.ts @@ -0,0 +1,128 @@ +// @strict: true +// @declaration: true + +declare function isString(value: unknown): value is string; +declare function isArrayOfStrings(value: unknown): value is string[]; + +const assert: (value: unknown) => asserts value = value => {} + +declare function assertIsString(value: unknown): asserts value is string; +declare function assertIsArrayOfStrings(value: unknown): asserts value is string[]; +declare function assertDefined(value: T): asserts value is NonNullable; + +function f01(x: unknown) { + if (!!true) { + assert(typeof x === "string"); + x.length; + } + if (!!true) { + assert(x instanceof Error); + x.message; + } + if (!!true) { + assert(typeof x === "boolean" || typeof x === "number"); + x.toLocaleString; + } + if (!!true) { + assert(isArrayOfStrings(x)); + x[0].length; + } + if (!!true) { + assertIsArrayOfStrings(x); + x[0].length; + } + if (!!true) { + assert(x === undefined || typeof x === "string"); + x; // string | undefined + assertDefined(x); + x; // string + } +} + +function f02(x: string | undefined) { + if (!!true) { + assert(x); + x.length; + } + if (!!true) { + assert(x !== undefined); + x.length; + } + if (!!true) { + assertDefined(x); + x.length; + } +} + +function f03(x: string | undefined, assert: (value: unknown) => asserts value) { + assert(x); + x.length; +} + +namespace Debug { + export declare function assert(value: unknown, message?: string): asserts value; + export declare function assertDefined(value: T): asserts value is NonNullable; +} + +function f10(x: string | undefined) { + if (!!true) { + Debug.assert(x); + x.length; + } + if (!!true) { + Debug.assert(x !== undefined); + x.length; + } + if (!!true) { + Debug.assertDefined(x); + x.length; + } +} + +class Test { + assert(value: unknown): asserts value { + if (value) return; + throw new Error(); + } + isTest2(): this is Test2 { + return this instanceof Test2; + } + assertIsTest2(): asserts this is Test2 { + if (this instanceof Test2) return; + throw new Error(); + } + assertThis(): asserts this { + if (!this) return; + throw new Error(); + } + bar() { + this.assertThis(); + this; + } + foo(x: unknown) { + this.assert(typeof x === "string"); + x.length; + if (this.isTest2()) { + this.z; + } + this.assertIsTest2(); + this.z; + } +} + +class Test2 extends Test { + z = 0; +} + +// Invalid constructs + +declare let Q1: new (x: unknown) => x is string; +declare let Q2: new (x: boolean) => asserts x; +declare let Q3: new (x: unknown) => asserts x is string; + +declare class Wat { + get p1(): this is string; + set p1(x: this is string); + get p2(): asserts this is string; + set p2(x: asserts this is string); +} diff --git a/tests/cases/conformance/controlFlow/exhaustiveSwitchStatements1.ts b/tests/cases/conformance/controlFlow/exhaustiveSwitchStatements1.ts new file mode 100644 index 0000000000000..9fd0f608ddb3f --- /dev/null +++ b/tests/cases/conformance/controlFlow/exhaustiveSwitchStatements1.ts @@ -0,0 +1,199 @@ +// @strict: true +// @allowUnreachableCode: false +// @declaration: true + +function f1(x: 1 | 2): string { + if (!!true) { + switch (x) { + case 1: return 'a'; + case 2: return 'b'; + } + x; // Unreachable + } + else { + throw 0; + } +} + +function f2(x: 1 | 2) { + let z: number; + switch (x) { + case 1: z = 10; break; + case 2: z = 20; break; + } + z; // Definitely assigned +} + +function f3(x: 1 | 2) { + switch (x) { + case 1: return 10; + case 2: return 20; + // Default considered reachable to allow defensive coding + default: throw new Error("Bad input"); + } +} + +// Repro from #11572 + +enum E { A, B } + +function f(e: E): number { + switch (e) { + case E.A: return 0 + case E.B: return 1 + } +} + +function g(e: E): number { + if (!true) + return -1 + else + switch (e) { + case E.A: return 0 + case E.B: return 1 + } +} + +// Repro from #12668 + +interface Square { kind: "square"; size: number; } + +interface Rectangle { kind: "rectangle"; width: number; height: number; } + +interface Circle { kind: "circle"; radius: number; } + +interface Triangle { kind: "triangle"; side: number; } + +type Shape = Square | Rectangle | Circle | Triangle; + +function area(s: Shape): number { + let area; + switch (s.kind) { + case "square": area = s.size * s.size; break; + case "rectangle": area = s.width * s.height; break; + case "circle": area = Math.PI * s.radius * s.radius; break; + case "triangle": area = Math.sqrt(3) / 4 * s.side * s.side; break; + } + return area; +} + +function areaWrapped(s: Shape): number { + let area; + area = (() => { + switch (s.kind) { + case "square": return s.size * s.size; + case "rectangle": return s.width * s.height; + case "circle": return Math.PI * s.radius * s.radius; + case "triangle": return Math.sqrt(3) / 4 * s.side * s.side; + } + })(); + return area; +} + +// Repro from #13241 + +enum MyEnum { + A, + B +} + +function thisGivesError(e: MyEnum): string { + let s: string; + switch (e) { + case MyEnum.A: s = "it was A"; break; + case MyEnum.B: s = "it was B"; break; + } + return s; +} + +function good1(e: MyEnum): string { + let s: string; + switch (e) { + case MyEnum.A: s = "it was A"; break; + case MyEnum.B: s = "it was B"; break; + default: s = "it was something else"; break; + } + return s; +} + +function good2(e: MyEnum): string { + switch (e) { + case MyEnum.A: return "it was A"; + case MyEnum.B: return "it was B"; + } +} + +// Repro from #18362 + +enum Level { + One, + Two, +} + +const doSomethingWithLevel = (level: Level) => { + let next: Level; + switch (level) { + case Level.One: + next = Level.Two; + break; + case Level.Two: + next = Level.One; + break; + } + return next; +}; + +// Repro from #20409 + +interface Square2 { + kind: "square"; + size: number; +} + +interface Circle2 { + kind: "circle"; + radius: number; +} + +type Shape2 = Square2 | Circle2; + +function withDefault(s1: Shape2, s2: Shape2): string { + switch (s1.kind) { + case "square": + return "1"; + case "circle": + switch (s2.kind) { + case "square": + return "2"; + case "circle": + return "3"; + default: + return "never"; + } + } +} + +function withoutDefault(s1: Shape2, s2: Shape2): string { + switch (s1.kind) { + case "square": + return "1"; + case "circle": + switch (s2.kind) { + case "square": + return "2"; + case "circle": + return "3"; + } + } +} + +// Repro from #20823 + +function test4(value: 1 | 2) { + let x: string; + switch (value) { + case 1: x = "one"; break; + case 2: x = "two"; break; + } + return x; +} diff --git a/tests/cases/conformance/controlFlow/neverReturningFunctions1.ts b/tests/cases/conformance/controlFlow/neverReturningFunctions1.ts new file mode 100644 index 0000000000000..72dd0a13b5ae0 --- /dev/null +++ b/tests/cases/conformance/controlFlow/neverReturningFunctions1.ts @@ -0,0 +1,227 @@ +// @strict: true +// @allowUnreachableCode: false +// @declaration: true + +function fail(message?: string): never { + throw new Error(message); +} + +function f01(x: string | undefined) { + if (x === undefined) fail("undefined argument"); + x.length; // string +} + +function f02(x: number): number { + if (x >= 0) return x; + fail("negative number"); + x; // Unreachable +} + +function f03(x: string) { + x; // string + fail(); + x; // Unreachable +} + +function f11(x: string | undefined, fail: (message?: string) => never) { + if (x === undefined) fail("undefined argument"); + x.length; // string +} + +function f12(x: number, fail: (message?: string) => never): number { + if (x >= 0) return x; + fail("negative number"); + x; // Unreachable +} + +function f13(x: string, fail: (message?: string) => never) { + x; // string + fail(); + x; // Unreachable +} + +namespace Debug { + export declare function fail(message?: string): never; +} + +function f21(x: string | undefined) { + if (x === undefined) Debug.fail("undefined argument"); + x.length; // string +} + +function f22(x: number): number { + if (x >= 0) return x; + Debug.fail("negative number"); + x; // Unreachable +} + +function f23(x: string) { + x; // string + Debug.fail(); + x; // Unreachable +} + +function f24(x: string) { + x; // string + ((Debug).fail)(); + x; // Unreachable +} + +class Test { + fail(message?: string): never { + throw new Error(message); + } + f1(x: string | undefined) { + if (x === undefined) this.fail("undefined argument"); + x.length; // string + } + f2(x: number): number { + if (x >= 0) return x; + this.fail("negative number"); + x; // Unreachable + } + f3(x: string) { + x; // string + this.fail(); + x; // Unreachable + } +} + +function f30(x: string | number | undefined) { + if (typeof x === "string") { + fail(); + x; // Unreachable + } + else { + x; // number | undefined + if (x !== undefined) { + x; // number + fail(); + x; // Unreachable + } + else { + x; // undefined + fail(); + x; // Unreachable + } + x; // Unreachable + } + x; // Unreachable +} + +function f31(x: { a: string | number }) { + if (typeof x.a === "string") { + fail(); + x; // Unreachable + x.a; // Unreachable + } + x; // { a: string | number } + x.a; // number +} + +function f40(x: number) { + try { + x; + fail(); + x; // Unreachable + } + finally { + x; + fail(); + x; // Unreachable + } + x; // Unreachable +} + +function f41(x: number) { + try { + x; + } + finally { + x; + fail(); + x; // Unreachable + } + x; // Unreachable +} + +function f42(x: number) { + try { + x; + fail(); + x; // Unreachable + } + finally { + x; + } + x; // Unreachable +} + +// Repro from #33582 + +export interface Component { + attrName?: string; + data: T; + dependencies?: string[]; + el: any; + id: string; + multiple?: boolean; + name: string; + schema: unknown; + system: any; + + init(data?: T): void; + pause(): void; + play(): void; + remove(): void; + tick?(time: number, timeDelta: number): void; + update(oldData: T): void; + updateSchema?(): void; + + extendSchema(update: unknown): void; + flushToDOM(): void; +} + +export interface ComponentConstructor { + new (el: unknown, attrValue: string, id: string): T & Component; + prototype: T & { + name: string; + system: unknown; + play(): void; + pause(): void; + }; +} + +declare function registerComponent( + name: string, + component: ComponentDefinition +): ComponentConstructor; + +export type ComponentDefinition = T & Partial & ThisType; + +const Component = registerComponent('test-component', { + schema: { + myProperty: { + default: [], + parse() { + return [true]; + } + }, + string: { type: 'string' }, + num: 0 + }, + init() { + this.data.num = 0; + this.el.setAttribute('custom-attribute', 'custom-value'); + }, + update() {}, + tick() {}, + remove() {}, + pause() {}, + play() {}, + + multiply(f: number) { + // Reference to system because both were registered with the same name. + return f * this.data.num * this.system!.data.counter; + } +}); diff --git a/tests/cases/conformance/enums/enumErrors.ts b/tests/cases/conformance/enums/enumErrors.ts index 99de3d4bc0d2e..16360574167a3 100644 --- a/tests/cases/conformance/enums/enumErrors.ts +++ b/tests/cases/conformance/enums/enumErrors.ts @@ -37,3 +37,15 @@ enum E12 { D = {}, E = 1 + 1, } + +// Enum with incorrect syntax +enum E13 { + postComma, + postValueComma = 1, + + postSemicolon; + postColonValueComma: 2, + postColonValueSemicolon: 3; +}; + +enum E14 { a, b: any "hello" += 1, c, d} diff --git a/tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithDifferentConstraints.ts b/tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithDifferentConstraints.ts index 4c698626eb003..6963277915af1 100644 --- a/tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithDifferentConstraints.ts +++ b/tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithDifferentConstraints.ts @@ -54,7 +54,7 @@ interface C { x: T; } -interface C { // error +interface C { // ok y: T; } diff --git a/tests/cases/conformance/jsdoc/assertionsAndNonReturningFunctions.ts b/tests/cases/conformance/jsdoc/assertionsAndNonReturningFunctions.ts new file mode 100644 index 0000000000000..9a15a5b5245a3 --- /dev/null +++ b/tests/cases/conformance/jsdoc/assertionsAndNonReturningFunctions.ts @@ -0,0 +1,65 @@ +// @allowJs: true +// @checkJs: true +// @noEmit: true +// @allowUnreachableCode: false +// @filename: assertionsAndNonReturningFunctions.js + +/** @typedef {(check: boolean) => asserts check} AssertFunc */ + +/** @type {AssertFunc} */ +const assert = check => { + if (!check) throw new Error(); +} + +/** @type {(x: unknown) => asserts x is string } */ +function assertIsString(x) { + if (!(typeof x === "string")) throw new Error(); +} + +/** + * @param {boolean} check + * @returns {asserts check} +*/ +function assert2(check) { + if (!check) throw new Error(); +} + +/** + * @returns {never} + */ +function fail() { + throw new Error(); +} + +/** + * @param {*} x + */ +function f1(x) { + if (!!true) { + assert(typeof x === "string"); + x.length; + } + if (!!true) { + assert2(typeof x === "string"); + x.length; + } + if (!!true) { + assertIsString(x); + x.length; + } + if (!!true) { + fail(); + x; // Unreachable + } +} + +/** + * @param {boolean} b + */ +function f2(b) { + switch (b) { + case true: return 1; + case false: return 0; + } + b; // Unreachable +} diff --git a/tests/cases/conformance/jsdoc/typeParameterExtendsUnionConstraintDistributed.ts b/tests/cases/conformance/jsdoc/typeParameterExtendsUnionConstraintDistributed.ts new file mode 100644 index 0000000000000..2a87bb3ccaa4e --- /dev/null +++ b/tests/cases/conformance/jsdoc/typeParameterExtendsUnionConstraintDistributed.ts @@ -0,0 +1,5 @@ +type A = 1 | 2; +function f(a: T): A & T { return a; } // Shouldn't error + +type B = 2 | 3; +function f2(ab: T & U): (A | B) & T & U { return ab; } // Also shouldn't error diff --git a/tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.1.ts b/tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.1.ts index f31f453ba5f15..6d39be9cef75e 100644 --- a/tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.1.ts +++ b/tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.1.ts @@ -124,3 +124,6 @@ async function * awaitedType1() { async function * awaitedType2() { const x = await Promise.resolve(1); } +async function * nextType1(): { next(...args: [] | [number | PromiseLike]): any } { + const x = yield; // `number | PromiseLike` (should not await TNext) +} diff --git a/tests/cases/conformance/types/unknown/unknownType2.ts b/tests/cases/conformance/types/unknown/unknownType2.ts index b3d16654b80d5..7da3093634ee8 100644 --- a/tests/cases/conformance/types/unknown/unknownType2.ts +++ b/tests/cases/conformance/types/unknown/unknownType2.ts @@ -222,3 +222,40 @@ function switchResponseWrong(x: unknown): SomeResponse { // Arguably this should be never. type End = isTrue> } + +// Repro from #33483 + +function f2(x: unknown): string | undefined { + if (x !== undefined && typeof x !== 'string') { + throw new Error(); + } + return x; +} + +function notNotEquals(u: unknown) { + if (u !== NumberEnum) { } + else { + const o: object = u; + } + + if (u !== NumberEnum.A) { } + else { + const a: NumberEnum.A = u; + } + + + if (u !== NumberEnum.A && u !== NumberEnum.B && u !== StringEnum.A) { } + else { + const aOrB: NumberEnum.A | NumberEnum.B | StringEnum.A = u; + } + + // equivalent to + if (!(u === NumberEnum.A || u === NumberEnum.B || u === StringEnum.A)) { } + else { + const aOrB: NumberEnum.A | NumberEnum.B | StringEnum.A = u; + } +} + + + + diff --git a/tests/cases/fourslash/codeFixAwaitInSyncFunction_all.ts b/tests/cases/fourslash/codeFixAwaitInSyncFunction_all.ts index 4b5f7aea0a327..fadb5f30ca843 100644 --- a/tests/cases/fourslash/codeFixAwaitInSyncFunction_all.ts +++ b/tests/cases/fourslash/codeFixAwaitInSyncFunction_all.ts @@ -2,10 +2,12 @@ ////function f() { //// await Promise.resolve(); +//// await Promise.resolve(); ////} //// ////const g = () => { //// await f(); +//// await f(); ////} verify.codeFixAll({ @@ -14,9 +16,11 @@ verify.codeFixAll({ newFileContent: `async function f() { await Promise.resolve(); + await Promise.resolve(); } const g = async () => { await f(); + await f(); }`, }); diff --git a/tests/cases/fourslash/codeFixConstToLet.ts b/tests/cases/fourslash/codeFixConstToLet.ts new file mode 100644 index 0000000000000..949c45104a286 --- /dev/null +++ b/tests/cases/fourslash/codeFixConstToLet.ts @@ -0,0 +1,12 @@ +/// + +//// const x = 42; +//// x = 75; + +verify.codeFix({ + description: "Convert 'const' to 'let'", + index: 0, + newFileContent: +`let x = 42; +x = 75;` +}); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixInferFromCallInAssignment.ts b/tests/cases/fourslash/codeFixInferFromCallInAssignment.ts new file mode 100644 index 0000000000000..85e1d3bc50952 --- /dev/null +++ b/tests/cases/fourslash/codeFixInferFromCallInAssignment.ts @@ -0,0 +1,9 @@ +/// + +// @noImplicitAny: true +//// function inferAny( [| app |] ) { +//// const result = app.use('hi') +//// return result +//// } + +verify.rangeAfterCodeFix("app: { use: (arg0: string) => any; }"); diff --git a/tests/cases/fourslash/codeFixInferFromExpressionStatement.ts b/tests/cases/fourslash/codeFixInferFromExpressionStatement.ts new file mode 100644 index 0000000000000..b5969c79378d8 --- /dev/null +++ b/tests/cases/fourslash/codeFixInferFromExpressionStatement.ts @@ -0,0 +1,8 @@ +/// + +// @noImplicitAny: true +//// function inferVoid( [| app |] ) { +//// app.use('hi') +//// } + +verify.rangeAfterCodeFix("app: { use: (arg0: string) => void; }"); diff --git a/tests/cases/fourslash/codeFixInferFromFunctionUsage.ts b/tests/cases/fourslash/codeFixInferFromFunctionUsage.ts index 27a039878ba36..f2dbad67b4b7d 100644 --- a/tests/cases/fourslash/codeFixInferFromFunctionUsage.ts +++ b/tests/cases/fourslash/codeFixInferFromFunctionUsage.ts @@ -2,8 +2,8 @@ // @noImplicitAny: true ////function wrap( [| arr |] ) { -//// arr.sort(function (a: number, b: number) { return a < b ? -1 : 1 }) +//// arr.other(function (a: number, b: number) { return a < b ? -1 : 1 }) //// } // https://github.com/Microsoft/TypeScript/issues/29330 -verify.rangeAfterCodeFix("arr: { sort: (arg0: (a: number, b: number) => 1 | -1) => void; }"); +verify.rangeAfterCodeFix("arr: { other: (arg0: (a: number, b: number) => 1 | -1) => void; }"); diff --git a/tests/cases/fourslash/codeFixInferFromPrimitiveUsage.ts b/tests/cases/fourslash/codeFixInferFromPrimitiveUsage.ts new file mode 100644 index 0000000000000..b74e49b4d391a --- /dev/null +++ b/tests/cases/fourslash/codeFixInferFromPrimitiveUsage.ts @@ -0,0 +1,10 @@ +/// + +// @noImplicitAny: true +//// function wrap( [| s |] ) { +//// return s.length + s.indexOf('hi') +//// } + +// https://github.com/Microsoft/TypeScript/issues/29330 +verify.rangeAfterCodeFix("s: string | string[]"); + diff --git a/tests/cases/fourslash/codeFixInferFromUsageAddition.ts b/tests/cases/fourslash/codeFixInferFromUsageAddition.ts new file mode 100644 index 0000000000000..4b57d0603f19b --- /dev/null +++ b/tests/cases/fourslash/codeFixInferFromUsageAddition.ts @@ -0,0 +1,9 @@ +/// + +// @noImplicitAny: true +//// function foo([|a, m |]) { +//// return a + m +//// } + +verify.rangeAfterCodeFix("a: any, m: any", /*includeWhiteSpace*/ undefined, /*errorCode*/ undefined, /*index*/0); + diff --git a/tests/cases/fourslash/codeFixInferFromUsageArray.ts b/tests/cases/fourslash/codeFixInferFromUsageArray.ts new file mode 100644 index 0000000000000..75f923d5aeefa --- /dev/null +++ b/tests/cases/fourslash/codeFixInferFromUsageArray.ts @@ -0,0 +1,14 @@ +/// + +// @noImplicitAny: true +//// function foo([|p, a, b, c, d, e |]) { +//// var x: string = a.pop() +//// b.reverse() +//// var rr: boolean[] = c.reverse() +//// d.some(t => t > 1); // can't infer from callbacks right now +//// var y = e.concat(12); // can't infer from overloaded functions right now +//// return p.push(12) +//// } + +verify.rangeAfterCodeFix("p: number[], a: string[], b: any[], c: boolean[], d: any[], e: any[]", /*includeWhiteSpace*/ undefined, /*errorCode*/ undefined, /*index*/0); + diff --git a/tests/cases/fourslash/codeFixInferFromUsageCallBodyBoth.ts b/tests/cases/fourslash/codeFixInferFromUsageCallBodyBoth.ts index 859d5ea2ce7a3..f59d1bc190758 100644 --- a/tests/cases/fourslash/codeFixInferFromUsageCallBodyBoth.ts +++ b/tests/cases/fourslash/codeFixInferFromUsageCallBodyBoth.ts @@ -1,7 +1,7 @@ /// ////class C { -//// +//// p = 2 ////} ////var c = new C() ////function f([|x, y |]) { diff --git a/tests/cases/fourslash/codeFixInferFromUsageCommentAfterParameter.ts b/tests/cases/fourslash/codeFixInferFromUsageCommentAfterParameter.ts index bdefd2b5dea9e..866bfe04c137a 100644 --- a/tests/cases/fourslash/codeFixInferFromUsageCommentAfterParameter.ts +++ b/tests/cases/fourslash/codeFixInferFromUsageCommentAfterParameter.ts @@ -16,7 +16,7 @@ verify.codeFix({ index: 0, newFileContent: `/** - * @param {(arg0: any) => void} callback + * @param {(arg0: any) => any} callback */ function coll(callback /*, name1, name2, ... */) { return callback(this); diff --git a/tests/cases/fourslash/codeFixInferFromUsageJSXElement.ts b/tests/cases/fourslash/codeFixInferFromUsageJSXElement.ts index 3200fffafb8bb..abe35fe46c8df 100644 --- a/tests/cases/fourslash/codeFixInferFromUsageJSXElement.ts +++ b/tests/cases/fourslash/codeFixInferFromUsageJSXElement.ts @@ -30,4 +30,4 @@ //// } -verify.rangeAfterCodeFix("props: { isLoading: any; update: (arg0: any) => void; }",/*includeWhiteSpace*/ undefined, /*errorCode*/ undefined, 0); +verify.rangeAfterCodeFix("props: { isLoading: any; update: (arg0: any) => any; }",/*includeWhiteSpace*/ undefined, /*errorCode*/ undefined, 0); diff --git a/tests/cases/fourslash/codeFixInferFromUsageLiteralTypes.ts b/tests/cases/fourslash/codeFixInferFromUsageLiteralTypes.ts new file mode 100644 index 0000000000000..3b8c9441159b9 --- /dev/null +++ b/tests/cases/fourslash/codeFixInferFromUsageLiteralTypes.ts @@ -0,0 +1,10 @@ +/// + +// @noImplicitAny: true +//// function foo([|a, m |]) { +//// a = 'hi' +//// m = 1 +//// } + +verify.rangeAfterCodeFix("a: string, m: number", /*includeWhiteSpace*/ undefined, /*errorCode*/ undefined, /*index*/0); + diff --git a/tests/cases/fourslash/codeFixInferFromUsagePromise.ts b/tests/cases/fourslash/codeFixInferFromUsagePromise.ts new file mode 100644 index 0000000000000..d06bb3b6a0f03 --- /dev/null +++ b/tests/cases/fourslash/codeFixInferFromUsagePromise.ts @@ -0,0 +1,9 @@ +/// + +// @noImplicitAny: true +//// function foo([|p |]) { +//// return p.then((x: string[]) => x[0]) +//// } + +verify.rangeAfterCodeFix("p: Promise", /*includeWhiteSpace*/ undefined, /*errorCode*/ undefined, /*index*/0); + diff --git a/tests/cases/fourslash/codeFixInferFromUsagePropertyAccess.ts b/tests/cases/fourslash/codeFixInferFromUsagePropertyAccess.ts index c8b85ee11e88d..44d2e2d7b1c25 100644 --- a/tests/cases/fourslash/codeFixInferFromUsagePropertyAccess.ts +++ b/tests/cases/fourslash/codeFixInferFromUsagePropertyAccess.ts @@ -12,4 +12,4 @@ //// return x.y.z ////} -verify.rangeAfterCodeFix("a: { b: { c: any; }; }, m: { n: () => number; }, x: { y: { z: number[]; }; }", /*includeWhiteSpace*/ undefined, /*errorCode*/ undefined, /*index*/0); \ No newline at end of file +verify.rangeAfterCodeFix("a: { b: { c: void; }; }, m: { n: () => number; }, x: { y: { z: number[]; }; }", /*includeWhiteSpace*/ undefined, /*errorCode*/ undefined, /*index*/0); diff --git a/tests/cases/fourslash/codeFixInferFromUsagePropertyAccessJS.ts b/tests/cases/fourslash/codeFixInferFromUsagePropertyAccessJS.ts index ed9d4b33b377c..357b1a991ba83 100644 --- a/tests/cases/fourslash/codeFixInferFromUsagePropertyAccessJS.ts +++ b/tests/cases/fourslash/codeFixInferFromUsagePropertyAccessJS.ts @@ -21,7 +21,7 @@ verify.codeFix({ index: 0, newFileContent: `/** - * @param {{ b: { c: any; }; }} a + * @param {{ b: { c: void; }; }} a * @param {{ n: () => number; }} m * @param {{ y: { z: number[]; }; }} x */ diff --git a/tests/cases/fourslash/codeFixInferFromUsageString.ts b/tests/cases/fourslash/codeFixInferFromUsageString.ts new file mode 100644 index 0000000000000..d58998cf4a31a --- /dev/null +++ b/tests/cases/fourslash/codeFixInferFromUsageString.ts @@ -0,0 +1,12 @@ +/// + +// @noImplicitAny: true +//// function foo([|p, a, b |]) { +//// var x +//// p.charAt(x) +//// a.charAt(0) +//// b.concat('hi') +//// } + +verify.rangeAfterCodeFix("p: string, a: string, b: string | any[]", /*includeWhiteSpace*/ undefined, /*errorCode*/ undefined, /*index*/0); + diff --git a/tests/cases/fourslash/codeFixUseBigIntLiteral.ts b/tests/cases/fourslash/codeFixUseBigIntLiteral.ts new file mode 100644 index 0000000000000..dcdff381af332 --- /dev/null +++ b/tests/cases/fourslash/codeFixUseBigIntLiteral.ts @@ -0,0 +1,73 @@ +/// +////9007199254740991; +////-9007199254740991; +////9007199254740992; +////-9007199254740992; +////9007199254740993; +////-9007199254740993; +////9007199254740994; +////-9007199254740994; +////0x19999999999998; +////-0x19999999999998; +////0x19999999999999; +////-0x19999999999999; +////0x20000000000000; +////-0x20000000000000; +////0x20000000000001; +////-0x20000000000001; +////2e52; +////2e53; +////2e54; +////1e00000000010; + +verify.codeFix({ + description: ts.Diagnostics.Convert_to_a_bigint_numeric_literal.message, + index: 0, + newFileContent: +`9007199254740991; +-9007199254740991; +9007199254740992n; +-9007199254740992; +9007199254740993; +-9007199254740993; +9007199254740994; +-9007199254740994; +0x19999999999998; +-0x19999999999998; +0x19999999999999; +-0x19999999999999; +0x20000000000000; +-0x20000000000000; +0x20000000000001; +-0x20000000000001; +2e52; +2e53; +2e54; +1e00000000010;` +}); + +verify.codeFixAll({ + fixAllDescription: ts.Diagnostics.Convert_all_to_bigint_numeric_literals.message, + fixId: "useBigintLiteral", + newFileContent: +`9007199254740991; +-9007199254740991; +9007199254740992n; +-9007199254740992n; +9007199254740993n; +-9007199254740993n; +9007199254740994n; +-9007199254740994n; +0x19999999999998; +-0x19999999999998; +0x19999999999999; +-0x19999999999999; +0x20000000000000n; +-0x20000000000000n; +0x20000000000001n; +-0x20000000000001n; +2e52; +2e53; +2e54; +1e00000000010;` +}); diff --git a/tests/cases/fourslash/extract-const-callback-function-generic.ts b/tests/cases/fourslash/extract-const-callback-function-generic.ts new file mode 100644 index 0000000000000..cafba8f824537 --- /dev/null +++ b/tests/cases/fourslash/extract-const-callback-function-generic.ts @@ -0,0 +1,15 @@ +/// + +////declare function fnUnion(fn: (a: T) => T): void +////fnUnion(/*a*/a => a/*b*/); + +goTo.select("a", "b"); +edit.applyRefactor({ + refactorName: "Extract Symbol", + actionName: "constant_scope_0", + actionDescription: "Extract to constant in enclosing scope", + newContent: +`declare function fnUnion(fn: (a: T) => T): void +const newLocal: (a: T) => T = a => a; +fnUnion(/*RENAME*/newLocal);` +}); \ No newline at end of file diff --git a/tests/cases/fourslash/extract-const-callback-function-no-context1.ts b/tests/cases/fourslash/extract-const-callback-function-no-context1.ts new file mode 100644 index 0000000000000..4bd090768683a --- /dev/null +++ b/tests/cases/fourslash/extract-const-callback-function-no-context1.ts @@ -0,0 +1,15 @@ +/// + +////declare function fnUnion(fn: ((a: number) => number) | ((a: string) => string)): void +////fnUnion(/*a*/(a: any) => a/*b*/); + +goTo.select("a", "b"); +edit.applyRefactor({ + refactorName: "Extract Symbol", + actionName: "constant_scope_0", + actionDescription: "Extract to constant in enclosing scope", + newContent: +`declare function fnUnion(fn: ((a: number) => number) | ((a: string) => string)): void +const newLocal = (a: any) => a; +fnUnion(/*RENAME*/newLocal);` +}); diff --git a/tests/cases/fourslash/extract-const-callback-function-no-context2.ts b/tests/cases/fourslash/extract-const-callback-function-no-context2.ts new file mode 100644 index 0000000000000..eb392bcb445ef --- /dev/null +++ b/tests/cases/fourslash/extract-const-callback-function-no-context2.ts @@ -0,0 +1,15 @@ +/// + +////declare function fnUnion(fn: ((a: number) => number) | ((a: string) => string)): void +////fnUnion(/*a*/(a) => a/*b*/); + +goTo.select("a", "b"); +edit.applyRefactor({ + refactorName: "Extract Symbol", + actionName: "constant_scope_0", + actionDescription: "Extract to constant in enclosing scope", + newContent: +`declare function fnUnion(fn: ((a: number) => number) | ((a: string) => string)): void +const newLocal: ((a: number) => number) | ((a: string) => string) = (a) => a; +fnUnion(/*RENAME*/newLocal);` +}); diff --git a/tests/cases/fourslash/extract-const-callback-function-no-context3.ts b/tests/cases/fourslash/extract-const-callback-function-no-context3.ts new file mode 100644 index 0000000000000..92835d0d38c8d --- /dev/null +++ b/tests/cases/fourslash/extract-const-callback-function-no-context3.ts @@ -0,0 +1,15 @@ +/// + +////declare function fnUnion(fn: ((a: number) => number) | ((a: string) => string)): void +////fnUnion(/*a*/(a: string) => a/*b*/); + +goTo.select("a", "b"); +edit.applyRefactor({ + refactorName: "Extract Symbol", + actionName: "constant_scope_0", + actionDescription: "Extract to constant in enclosing scope", + newContent: +`declare function fnUnion(fn: ((a: number) => number) | ((a: string) => string)): void +const newLocal = (a: string) => a; +fnUnion(/*RENAME*/newLocal);` +}); diff --git a/tests/cases/fourslash/extract-const-callback-function-rest.ts b/tests/cases/fourslash/extract-const-callback-function-rest.ts new file mode 100644 index 0000000000000..50feb63dd2056 --- /dev/null +++ b/tests/cases/fourslash/extract-const-callback-function-rest.ts @@ -0,0 +1,18 @@ +/// + + +////function fWithRest(fn: (...a: number[]) => number) { } +////fWithRest(/*a*/(a, b, c) => a + b + c/*b*/); + + +goTo.select("a", "b"); +edit.applyRefactor({ + refactorName: "Extract Symbol", + actionName: "constant_scope_0", + actionDescription: "Extract to constant in enclosing scope", + newContent: +`function fWithRest(fn: (...a: number[]) => number) { } +const newLocal = (a: number, b: number, c: number): number => a + b + c; +fWithRest(/*RENAME*/newLocal);` +}); + diff --git a/tests/cases/fourslash/extract-const-callback-function-this1.ts b/tests/cases/fourslash/extract-const-callback-function-this1.ts new file mode 100644 index 0000000000000..b0d269400bbd1 --- /dev/null +++ b/tests/cases/fourslash/extract-const-callback-function-this1.ts @@ -0,0 +1,15 @@ +/// + +////declare function fWithThis(fn: (this: { a: string }, a: string) => string): void; +////fWithThis(/*a*/function (a: string): string { return this.a; }/*b*/); + +goTo.select("a", "b"); +edit.applyRefactor({ + refactorName: "Extract Symbol", + actionName: "constant_scope_0", + actionDescription: "Extract to constant in enclosing scope", + newContent: +`declare function fWithThis(fn: (this: { a: string }, a: string) => string): void; +const newLocal = function(this: { a: string; }, a: string): string { return this.a; }; +fWithThis(/*RENAME*/newLocal);` +}); diff --git a/tests/cases/fourslash/extract-const-callback-function-this2.ts b/tests/cases/fourslash/extract-const-callback-function-this2.ts new file mode 100644 index 0000000000000..518c39e26e546 --- /dev/null +++ b/tests/cases/fourslash/extract-const-callback-function-this2.ts @@ -0,0 +1,15 @@ +/// + +////declare function fWithThis(fn: (this: { a: string }, a: string) => string): void; +////fWithThis(/*a*/function (a) { return this.a; }/*b*/); + +goTo.select("a", "b"); +edit.applyRefactor({ + refactorName: "Extract Symbol", + actionName: "constant_scope_0", + actionDescription: "Extract to constant in enclosing scope", + newContent: +`declare function fWithThis(fn: (this: { a: string }, a: string) => string): void; +const newLocal = function(this: { a: string; }, a: string): string { return this.a; }; +fWithThis(/*RENAME*/newLocal);` +}); diff --git a/tests/cases/fourslash/extract-const-callback-function-this3.ts b/tests/cases/fourslash/extract-const-callback-function-this3.ts new file mode 100644 index 0000000000000..1d9d8ba59e767 --- /dev/null +++ b/tests/cases/fourslash/extract-const-callback-function-this3.ts @@ -0,0 +1,17 @@ +/// + +////declare function fWithThis(fn: (this: { a: string }, a: string) => string): void; +////fWithThis(/*a*/function (this: { a: string }, a) { return this.a; }/*b*/); + +goTo.select("a", "b"); +edit.applyRefactor({ + refactorName: "Extract Symbol", + actionName: "constant_scope_0", + actionDescription: "Extract to constant in enclosing scope", + newContent: +`declare function fWithThis(fn: (this: { a: string }, a: string) => string): void; +const newLocal = function(this: { + a: string; +}, a: string): string { return this.a; }; +fWithThis(/*RENAME*/newLocal);` +}); diff --git a/tests/cases/fourslash/extract-const-callback-function.ts b/tests/cases/fourslash/extract-const-callback-function.ts new file mode 100644 index 0000000000000..ccf05c6c1ad78 --- /dev/null +++ b/tests/cases/fourslash/extract-const-callback-function.ts @@ -0,0 +1,13 @@ +/// + +////const x = [1,2,3].map(/*a*/function (x) { return x + 1 }/*b*/); + +goTo.select("a", "b"); +edit.applyRefactor({ + refactorName: "Extract Symbol", + actionName: "constant_scope_0", + actionDescription: "Extract to constant in enclosing scope", + newContent: +`const newLocal = function(x: number): number { return x + 1; }; +const x = [1,2,3].map(/*RENAME*/newLocal);` +}); diff --git a/tests/cases/fourslash/extract-const-callback.ts b/tests/cases/fourslash/extract-const-callback.ts new file mode 100644 index 0000000000000..4bd71ba16b1cb --- /dev/null +++ b/tests/cases/fourslash/extract-const-callback.ts @@ -0,0 +1,13 @@ +/// + +////const x = [1,2,3].map(/*a*/x => x + 1/*b*/); + +goTo.select("a", "b"); +edit.applyRefactor({ + refactorName: "Extract Symbol", + actionName: "constant_scope_0", + actionDescription: "Extract to constant in enclosing scope", + newContent: +`const newLocal = (x: number): number => x + 1; +const x = [1,2,3].map(/*RENAME*/newLocal);` +}); diff --git a/tests/cases/fourslash/navbarNestedCommonJsExports.ts b/tests/cases/fourslash/navbarNestedCommonJsExports.ts index 3c2d449917233..14c289a3bc235 100644 --- a/tests/cases/fourslash/navbarNestedCommonJsExports.ts +++ b/tests/cases/fourslash/navbarNestedCommonJsExports.ts @@ -29,7 +29,23 @@ verify.navigationBar([ kind: "script", childItems: [ { text: "a", kind: "const" }, + ] + }, + { + text: "a", + kind: "const", + childItems: [ + { text: "b", kind: "const"}, ], + indent: 1, }, + { + text: "b", + kind: "const", + childItems: [ + { text: "c", kind: "const" }, + ], + indent: 2, + } ]); diff --git a/tests/cases/fourslash/navigationBarAnonymousClassAndFunctionExpressions.ts b/tests/cases/fourslash/navigationBarAnonymousClassAndFunctionExpressions.ts index ad1ba1e72f962..d35d051eda66c 100644 --- a/tests/cases/fourslash/navigationBarAnonymousClassAndFunctionExpressions.ts +++ b/tests/cases/fourslash/navigationBarAnonymousClassAndFunctionExpressions.ts @@ -62,7 +62,7 @@ verify.navigationTree({ "childItems": [ { "text": "foo", - "kind": "function" + "kind": "method" } ] } @@ -185,7 +185,7 @@ verify.navigationBar([ "childItems": [ { "text": "foo", - "kind": "function" + "kind": "method" } ], "indent": 2 diff --git a/tests/cases/fourslash/navigationBarAssignmentTypes.ts b/tests/cases/fourslash/navigationBarAssignmentTypes.ts new file mode 100644 index 0000000000000..d3ee66f9b0886 --- /dev/null +++ b/tests/cases/fourslash/navigationBarAssignmentTypes.ts @@ -0,0 +1,64 @@ +/// +////'use strict' +////const a = { +//// ...b, +//// c, +//// d: 0 +////}; + +verify.navigationTree({ + text: "", + kind: "script", + childItems: [ + { + text: "a", + kind: "const", + childItems: [ + { + text: "b", + kind: "property", + }, + { + text: "c", + kind: "property" + }, + { + text: "d", + kind: "property" + } + ] + } + ] +}); + +verify.navigationBar([ + { + text: "", + kind: "script", + childItems: [ + { + text: "a", + kind: "const" + } + ] + }, + { + text: "a", + kind: "const", + childItems: [ + { + text: "b", + kind: "property", + }, + { + text: "c", + kind: "property" + }, + { + text: "d", + kind: "property" + } + ], + indent: 1 + } +]); diff --git a/tests/cases/fourslash/navigationBarFunctionIndirectlyInVariableDeclaration.ts b/tests/cases/fourslash/navigationBarFunctionIndirectlyInVariableDeclaration.ts index a0ed5174f5686..a9b588041ddcd 100644 --- a/tests/cases/fourslash/navigationBarFunctionIndirectlyInVariableDeclaration.ts +++ b/tests/cases/fourslash/navigationBarFunctionIndirectlyInVariableDeclaration.ts @@ -1,11 +1,16 @@ /// ////var a = { -//// propA: function() {} +//// propA: function() { +//// var c; +//// } ////}; ////var b; ////b = { -//// propB: function() {} +//// propB: function() { +//// // function must not have an empty body to appear top level +//// var d; +//// } ////}; verify.navigationTree({ @@ -18,7 +23,13 @@ verify.navigationTree({ "childItems": [ { "text": "propA", - "kind": "function" + "kind": "method", + "childItems": [ + { + "text": "c", + "kind": "var" + } + ] } ] }, @@ -28,7 +39,13 @@ verify.navigationTree({ }, { "text": "propB", - "kind": "function" + "kind": "method", + "childItems": [ + { + "text": "d", + "kind": "var" + } + ] } ] }); @@ -48,7 +65,7 @@ verify.navigationBar([ }, { "text": "propB", - "kind": "function" + "kind": "method" } ] }, @@ -58,14 +75,31 @@ verify.navigationBar([ "childItems": [ { "text": "propA", - "kind": "function" + "kind": "method" } ], "indent": 1 }, + { + "text": "propA", + "kind": "method", + "childItems": [ + { + "text": "c", + "kind": "var" + } + ], + "indent": 2 + }, { "text": "propB", - "kind": "function", + "kind": "method", + "childItems": [ + { + "text": "d", + "kind": "var" + } + ], "indent": 1 } ]); diff --git a/tests/cases/fourslash/navigationBarFunctionLikePropertyAssignments.ts b/tests/cases/fourslash/navigationBarFunctionLikePropertyAssignments.ts new file mode 100644 index 0000000000000..39bc0e1893e2b --- /dev/null +++ b/tests/cases/fourslash/navigationBarFunctionLikePropertyAssignments.ts @@ -0,0 +1,91 @@ +/// + +////var functions = { +//// a: 0, +//// b: function () { }, +//// c: function x() { }, +//// d: () => { }, +//// e: y(), +//// f() { } +////}; + +verify.navigationTree({ + text: "", + kind: "script", + childItems: [ + { + text: "functions", + kind: "var", + childItems: [ + { + text: "a", + kind: "property" + }, + { + text: "b", + kind: "method" + }, + { + text: "c", + kind: "method" + }, + { + text: "d", + kind: "method" + }, + { + text: "e", + kind: "property" + }, + { + text: "f", + kind: "method" + } + ] + } + ] +}); + +verify.navigationBar([ + { + "text": "", + "kind": "script", + "childItems": [ + { + "text": "functions", + "kind": "var" + } + ] + }, + { + "text": "functions", + "kind": "var", + "childItems": [ + { + "text": "a", + "kind": "property" + }, + { + "text": "b", + "kind": "method" + }, + { + "text": "c", + "kind": "method" + }, + { + "text": "d", + "kind": "method" + }, + { + "text": "e", + "kind": "property" + }, + { + "text": "f", + "kind": "method" + } + ], + "indent": 1 + } +]); \ No newline at end of file diff --git a/tests/cases/fourslash/navigationBarFunctionPrototype.ts b/tests/cases/fourslash/navigationBarFunctionPrototype.ts index fbd3ba2c16f6d..2806f36dae9cf 100644 --- a/tests/cases/fourslash/navigationBarFunctionPrototype.ts +++ b/tests/cases/fourslash/navigationBarFunctionPrototype.ts @@ -44,11 +44,11 @@ verify.navigationTree({ "childItems": [ { "text": "get", - "kind": "function" + "kind": "method" }, { "text": "set", - "kind": "function" + "kind": "method" } ] }, @@ -57,11 +57,11 @@ verify.navigationTree({ "childItems": [ { "text": "get", - "kind": "function" + "kind": "method" }, { "text": "set", - "kind": "function" + "kind": "method" } ] } @@ -108,5 +108,33 @@ verify.navigationBar([ } ], "indent": 1 - } + }, + { + "text": "staticProp", + "childItems": [ + { + "text": "get", + "kind": "method" + }, + { + "text": "set", + "kind": "method" + } + ], + "indent": 2 + }, + { + "text": "name", + "childItems": [ + { + "text": "get", + "kind": "method" + }, + { + "text": "set", + "kind": "method" + } + ], + "indent": 2 + } ]); diff --git a/tests/cases/fourslash/navigationBarFunctionPrototypeBroken.ts b/tests/cases/fourslash/navigationBarFunctionPrototypeBroken.ts index 48270dc3aa167..01d70c6117064 100644 --- a/tests/cases/fourslash/navigationBarFunctionPrototypeBroken.ts +++ b/tests/cases/fourslash/navigationBarFunctionPrototypeBroken.ts @@ -138,6 +138,28 @@ verify.navigationBar([ } ] }, + { + "text": "G", + "kind": "method", + "childItems": [ + { + "text": "A", + "kind": "method" + } + ], + "indent": 1 + }, + { + "text": "A", + "kind": "method", + "childItems": [ + { + "text": "a", + "kind": "function" + } + ], + "indent": 2 + }, { "text": "A", "kind": "class", @@ -152,5 +174,16 @@ verify.navigationBar([ } ], "indent": 1 - } + }, + { + "text": "A", + "kind": "method", + "childItems": [ + { + "text": "a", + "kind": "function" + } + ], + "indent": 2 + }, ]); diff --git a/tests/cases/fourslash/navigationBarFunctionPrototypeNested.ts b/tests/cases/fourslash/navigationBarFunctionPrototypeNested.ts index dea8b872061eb..97f9a5a580507 100644 --- a/tests/cases/fourslash/navigationBarFunctionPrototypeNested.ts +++ b/tests/cases/fourslash/navigationBarFunctionPrototypeNested.ts @@ -208,6 +208,16 @@ verify.navigationBar([ ], "indent": 2 }, + { + "text": "x", + "childItems": [ + { + "text": "get", + "kind": "method" + } + ], + "indent": 3 + }, { "text": "D", "kind": "class", diff --git a/tests/cases/fourslash/navigationBarInitializerSpans.ts b/tests/cases/fourslash/navigationBarInitializerSpans.ts index 7b044db9c4c39..036b83cf31806 100644 --- a/tests/cases/fourslash/navigationBarInitializerSpans.ts +++ b/tests/cases/fourslash/navigationBarInitializerSpans.ts @@ -1,10 +1,25 @@ /// -////const [|[|x|] = () => 0|]; -////const f = [|function [|f|]() {}|]; +////// get the name for the navbar from the variable name rather than the function name +////const [|[|x|] = () => { var [|a|]; }|]; +////const [|[|f|] = function f() { var [|b|]; }|]; +////const [|[|y|] = { [|[|z|]: function z() { var [|c|]; }|] }|]; -const [s0, s0Name, s1, s1Name] = test.spans(); -const sGlobal = { start: 0, length: 45 }; +const [ + s0, + s0Name, + s0Child, + s1, + s1Name, + s1Child, + s2, + s2Name, + s2Child, + s2ChildName, + s2GrandChildName +] = test.spans(); + +const sGlobal = { start: 0, length: 188 }; verify.navigationTree({ text: "", @@ -13,16 +28,54 @@ verify.navigationTree({ childItems: [ { text: "f", - kind: "function", + kind: "const", spans: [s1], nameSpan: s1Name, + childItems: [ + { + text: "b", + kind: "var", + spans: [s1Child], + nameSpan: s1Child, + }, + ], }, { text: "x", kind: "const", spans: [s0], nameSpan: s0Name, + childItems: [ + { + text: "a", + kind: "var", + spans: [s0Child], + nameSpan: s0Child, + }, + ], }, + { + text: "y", + kind: "const", + spans: [s2], + nameSpan: s2Name, + childItems:[ + { + text: "z", + kind: "method", + spans: [s2Child], + nameSpan: s2ChildName, + childItems: [ + { + text: "c", + kind: "var", + spans: [s2GrandChildName], + nameSpan: s2GrandChildName, + }, + ], + }, + ], + } ] }, { checkSpans: true }); @@ -34,7 +87,7 @@ verify.navigationBar([ childItems: [ { text: "f", - kind: "function", + kind: "const", spans: [s1], }, { @@ -42,12 +95,63 @@ verify.navigationBar([ kind: "const", spans: [s0], }, + { + text: "y", + kind: "const", + spans: [s2], + } ], }, { text: "f", - kind: "function", + kind: "const", spans: [s1], + childItems: [ + { + text: "b", + kind: "var", + spans: [s1Child], + }, + ], indent: 1, }, + { + text: "x", + kind: "const", + spans: [s0], + childItems: [ + { + text: "a", + kind: "var", + spans: [s0Child], + }, + ], + indent: 1, + }, + { + text: "y", + kind: "const", + spans: [s2], + childItems: [ + { + text: "z", + kind: "method", + spans: [s2Child], + }, + ], + indent: 1, + }, + { + text: "z", + kind: "method", + spans: [s2Child], + childItems: [ + { + text: "c", + kind: "var", + spans: [s2GrandChildName], + }, + ], + indent: 2, + }, ], { checkSpans: true }); diff --git a/tests/cases/fourslash/navigationBarItemsBindingPatterns.ts b/tests/cases/fourslash/navigationBarItemsBindingPatterns.ts index d2b8b24bcbf9a..7e64257604cf1 100644 --- a/tests/cases/fourslash/navigationBarItemsBindingPatterns.ts +++ b/tests/cases/fourslash/navigationBarItemsBindingPatterns.ts @@ -5,6 +5,7 @@ ////let foo1, {a, b} ////const bar1, [c, d] ////var {e, x: [f, g]} = {a:1, x:[]}; +////var { h: i = function j() {} } = obj; verify.navigationTree({ "text": "", @@ -53,6 +54,10 @@ verify.navigationTree({ { "text": "g", "kind": "var" + }, + { + "text": "i", + "kind": "var" } ] }); @@ -105,6 +110,10 @@ verify.navigationBar([ { "text": "g", "kind": "var" + }, + { + "text": "i", + "kind": "var" } ] } diff --git a/tests/cases/fourslash/navigationBarItemsFunctions.ts b/tests/cases/fourslash/navigationBarItemsFunctions.ts index f43cd3effaf8c..5978a1b940dad 100644 --- a/tests/cases/fourslash/navigationBarItemsFunctions.ts +++ b/tests/cases/fourslash/navigationBarItemsFunctions.ts @@ -7,6 +7,9 @@ //// function biz() { //// var z = 10; //// } +//// function qux() { +//// // A function with an empty body should not be top level +//// } //// } ////} //// @@ -46,6 +49,10 @@ verify.navigationTree({ } ] }, + { + "text": "qux", + "kind": "function" + }, { "text": "y", "kind": "var" @@ -110,11 +117,27 @@ verify.navigationBar([ "text": "biz", "kind": "function" }, + { + "text": "qux", + "kind": "function" + }, { "text": "y", "kind": "var" } ], "indent": 2 - } + }, + { + "text": "biz", + "kind": "function", + "childItems": [ + { + "text": "z", + "kind": "var" + } + ], + "indent": 3 + }, + ]); diff --git a/tests/cases/fourslash/navigationBarItemsPropertiesDefinedInConstructors.ts b/tests/cases/fourslash/navigationBarItemsPropertiesDefinedInConstructors.ts index 6e8e0ea350c89..d880c6e3844a0 100644 --- a/tests/cases/fourslash/navigationBarItemsPropertiesDefinedInConstructors.ts +++ b/tests/cases/fourslash/navigationBarItemsPropertiesDefinedInConstructors.ts @@ -78,5 +78,17 @@ verify.navigationBar([ } ], "indent": 1 + }, + { + "text": "constructor", + "kind": "constructor", + "childItems": [ + { + "text": "local", + "kind": "var" + } + ], + "indent": 2 } + ]); diff --git a/tests/cases/fourslash/navigationBarMerging_grandchildren.ts b/tests/cases/fourslash/navigationBarMerging_grandchildren.ts index 732b1794b6818..87b705585481d 100644 --- a/tests/cases/fourslash/navigationBarMerging_grandchildren.ts +++ b/tests/cases/fourslash/navigationBarMerging_grandchildren.ts @@ -1,5 +1,6 @@ /// +////// Should not merge grandchildren with property assignments ////const o = { //// a: { //// m() {}, @@ -17,8 +18,20 @@ verify.navigationTree({ text: "o", kind: "const", childItems: [ - { text: "m", kind: "method" }, - { text: "m", kind: "method" }, + { + text: "a", + kind: "property", + childItems: [ + { text: "m", kind: "method" } + ] + }, + { + text: "b", + kind: "property", + childItems: [ + { text: "m", kind: "method" } + ] + }, ], }, ] @@ -35,10 +48,27 @@ verify.navigationBar([ { text: "o", kind: "const", + childItems: [ + { text: "a", kind: "property" }, + { text: "b", kind: "property" }, + ], + indent: 1, + }, + { + text: "a", + kind: "property", childItems: [ { text: "m", kind: "method" }, + ], + indent: 2, + }, + { + text: "b", + kind: "property", + childItems: [ { text: "m", kind: "method" }, ], - indent: 1, + indent: 2, }, + ]); diff --git a/tests/cases/fourslash/navigationBarNestedObjectLiterals.ts b/tests/cases/fourslash/navigationBarNestedObjectLiterals.ts new file mode 100644 index 0000000000000..5c62a7e26fbcf --- /dev/null +++ b/tests/cases/fourslash/navigationBarNestedObjectLiterals.ts @@ -0,0 +1,139 @@ +/// + +////var a = { +//// b: 0, +//// c: {}, +//// d: { +//// e: 1, +//// }, +//// f: { +//// g: 2, +//// h: { +//// i: 3, +//// }, +//// }, +////} + +verify.navigationTree({ + "text": "", + "kind": "script", + "childItems": [ + { + "text": "a", + "kind": "var", + "childItems": [ + { + "text": "b", + "kind": "property" + }, + { + "text": "c", + "kind": "property" + }, + { + "text": "d", + "kind": "property", + "childItems": [ + { + "text": "e", + "kind": "property" + } + ] + }, + { + "text": "f", + "kind": "property", + "childItems": [ + { + "text": "g", + "kind": "property" + }, + { + "text": "h", + "kind": "property", + "childItems": [ + { + "text": "i", + "kind": "property" + } + ] + } + ] + } + ] + } + ] + }); + +verify.navigationBar([ + { + "text": "", + "kind": "script", + "childItems": [ + { + "text": "a", + "kind": "var" + } + ] + }, + { + "text": "a", + "kind": "var", + "childItems": [ + { + "text": "b", + "kind": "property" + }, + { + "text": "c", + "kind": "property" + }, + { + "text": "d", + "kind": "property" + }, + { + "text": "f", + "kind": "property" + } + ], + "indent": 1 + }, + { + "text": "d", + "kind": "property", + "childItems": [ + { + "text": "e", + "kind": "property" + } + ], + "indent": 2 + }, + { + "text": "f", + "kind": "property", + "childItems": [ + { + "text": "g", + "kind": "property" + }, + { + "text": "h", + "kind": "property" + } + ], + "indent": 2 + }, + { + "text": "h", + "kind": "property", + "childItems": [ + { + "text": "i", + "kind": "property" + } + ], + "indent": 3 + } + ]); \ No newline at end of file diff --git a/tests/cases/user/TypeScript-Node-Starter/TypeScript-Node-Starter b/tests/cases/user/TypeScript-Node-Starter/TypeScript-Node-Starter deleted file mode 160000 index ca14e7ccbca8a..0000000000000 --- a/tests/cases/user/TypeScript-Node-Starter/TypeScript-Node-Starter +++ /dev/null @@ -1 +0,0 @@ -Subproject commit ca14e7ccbca8a821d3b860ebb6f3c81c68ccbd06 diff --git a/tests/cases/user/TypeScript-Node-Starter/test.json b/tests/cases/user/TypeScript-Node-Starter/test.json index 11d2aa87c5975..c37bf34ad152f 100644 --- a/tests/cases/user/TypeScript-Node-Starter/test.json +++ b/tests/cases/user/TypeScript-Node-Starter/test.json @@ -1,3 +1,4 @@ { + "cloneUrl": "https://github.com/Microsoft/TypeScript-Node-Starter.git", "types": ["jquery"] } diff --git a/tests/cases/user/TypeScript-React-Native-Starter/TypeScript-React-Native-Starter b/tests/cases/user/TypeScript-React-Native-Starter/TypeScript-React-Native-Starter deleted file mode 160000 index 30acce5e136e8..0000000000000 --- a/tests/cases/user/TypeScript-React-Native-Starter/TypeScript-React-Native-Starter +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 30acce5e136e86bcf4eff1df151742f78142aa1a diff --git a/tests/cases/user/TypeScript-React-Native-Starter/test.json b/tests/cases/user/TypeScript-React-Native-Starter/test.json index cbe38c569ee58..a87cd1ed89e73 100644 --- a/tests/cases/user/TypeScript-React-Native-Starter/test.json +++ b/tests/cases/user/TypeScript-React-Native-Starter/test.json @@ -1,4 +1,5 @@ { + "cloneUrl": "https://github.com/Microsoft/TypeScript-React-Native-Starter.git", "types": ["jest"], "path": "TypeScript-React-Native-Starter/ExampleProject" } diff --git a/tests/cases/user/TypeScript-React-Starter/TypeScript-React-Starter b/tests/cases/user/TypeScript-React-Starter/TypeScript-React-Starter deleted file mode 160000 index 19c71f2c6a2b8..0000000000000 --- a/tests/cases/user/TypeScript-React-Starter/TypeScript-React-Starter +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 19c71f2c6a2b874b1b2bb28a8526b19185b8eece diff --git a/tests/cases/user/TypeScript-React-Starter/test.json b/tests/cases/user/TypeScript-React-Starter/test.json index f3613bf3b01d7..caa97357cb741 100644 --- a/tests/cases/user/TypeScript-React-Starter/test.json +++ b/tests/cases/user/TypeScript-React-Starter/test.json @@ -1,3 +1,4 @@ { + "cloneUrl": "https://github.com/Microsoft/TypeScript-React-Starter", "types": ["jest", "node"] } diff --git a/tests/cases/user/TypeScript-Vue-Starter/TypeScript-Vue-Starter b/tests/cases/user/TypeScript-Vue-Starter/TypeScript-Vue-Starter deleted file mode 160000 index 56024cfe41449..0000000000000 --- a/tests/cases/user/TypeScript-Vue-Starter/TypeScript-Vue-Starter +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 56024cfe414491a9097e9dd33661a5ad5d51d975 diff --git a/tests/cases/user/TypeScript-Vue-Starter/test.json b/tests/cases/user/TypeScript-Vue-Starter/test.json index e0d4d26bdca44..4504c4c1cd515 100644 --- a/tests/cases/user/TypeScript-Vue-Starter/test.json +++ b/tests/cases/user/TypeScript-Vue-Starter/test.json @@ -1,3 +1,4 @@ { + "cloneUrl": "https://github.com/Microsoft/TypeScript-Vue-Starter.git", "types": [] } diff --git a/tests/cases/user/TypeScript-WeChat-Starter/TypeScript-WeChat-Starter b/tests/cases/user/TypeScript-WeChat-Starter/TypeScript-WeChat-Starter deleted file mode 160000 index 3fb8b4601022f..0000000000000 --- a/tests/cases/user/TypeScript-WeChat-Starter/TypeScript-WeChat-Starter +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 3fb8b4601022f7e2df899eb0ac0178f531e6f027 diff --git a/tests/cases/user/TypeScript-WeChat-Starter/test.json b/tests/cases/user/TypeScript-WeChat-Starter/test.json index e0d4d26bdca44..92c47595d1a3b 100644 --- a/tests/cases/user/TypeScript-WeChat-Starter/test.json +++ b/tests/cases/user/TypeScript-WeChat-Starter/test.json @@ -1,3 +1,4 @@ { + "cloneUrl": "https://github.com/Microsoft/TypeScript-React-Starter", "types": [] } diff --git a/tests/cases/user/axios-src/axios-src b/tests/cases/user/axios-src/axios-src deleted file mode 160000 index 6a4a85c57fcab..0000000000000 --- a/tests/cases/user/axios-src/axios-src +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 6a4a85c57fcaba912eee61b87ba34d07323bc60c diff --git a/tests/cases/user/axios-src/test.json b/tests/cases/user/axios-src/test.json index b6495a1b80ba2..36c01c495bd4b 100644 --- a/tests/cases/user/axios-src/test.json +++ b/tests/cases/user/axios-src/test.json @@ -1,3 +1,4 @@ { + "cloneUrl": "https://github.com/axios/axios.git", "types": ["node"] } diff --git a/tests/cases/user/create-react-app/create-react-app b/tests/cases/user/create-react-app/create-react-app deleted file mode 160000 index c9b95047b979b..0000000000000 --- a/tests/cases/user/create-react-app/create-react-app +++ /dev/null @@ -1 +0,0 @@ -Subproject commit c9b95047b979bebe89ee70590b2a32ab67ef68af diff --git a/tests/cases/user/create-react-app/test.json b/tests/cases/user/create-react-app/test.json index e0d4d26bdca44..98888de7fdbbb 100644 --- a/tests/cases/user/create-react-app/test.json +++ b/tests/cases/user/create-react-app/test.json @@ -1,3 +1,4 @@ { + "cloneUrl": "https://github.com/facebook/create-react-app.git", "types": [] } diff --git a/tests/cases/user/prettier/prettier b/tests/cases/user/prettier/prettier deleted file mode 160000 index 9f5bd298db26f..0000000000000 --- a/tests/cases/user/prettier/prettier +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 9f5bd298db26f76e95ad17f8406edd7ebefacc5a diff --git a/tests/cases/user/prettier/test.json b/tests/cases/user/prettier/test.json index b6495a1b80ba2..7b04123842498 100644 --- a/tests/cases/user/prettier/test.json +++ b/tests/cases/user/prettier/test.json @@ -1,3 +1,4 @@ { + "cloneUrl": "https://github.com/prettier/prettier.git", "types": ["node"] } diff --git a/tests/cases/user/puppeteer/puppeteer b/tests/cases/user/puppeteer/puppeteer deleted file mode 160000 index c2651c2b5cc88..0000000000000 --- a/tests/cases/user/puppeteer/puppeteer +++ /dev/null @@ -1 +0,0 @@ -Subproject commit c2651c2b5cc888ebd0ca6be87063d9f98b9eb59c diff --git a/tests/cases/user/puppeteer/test.json b/tests/cases/user/puppeteer/test.json index e0d4d26bdca44..f2e61aca5f943 100644 --- a/tests/cases/user/puppeteer/test.json +++ b/tests/cases/user/puppeteer/test.json @@ -1,3 +1,4 @@ { + "cloneUrl": "https://github.com/GoogleChrome/puppeteer.git", "types": [] } diff --git a/tests/cases/user/webpack/test.json b/tests/cases/user/webpack/test.json index e0d4d26bdca44..a3fcf317a7480 100644 --- a/tests/cases/user/webpack/test.json +++ b/tests/cases/user/webpack/test.json @@ -1,3 +1,4 @@ { + "cloneUrl": "https://github.com/webpack/webpack.git", "types": [] } diff --git a/tests/cases/user/webpack/webpack b/tests/cases/user/webpack/webpack deleted file mode 160000 index 77cd3d0cff39d..0000000000000 --- a/tests/cases/user/webpack/webpack +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 77cd3d0cff39def2f8bd6355dcd270dd80bc5da2