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/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/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/builder.ts b/src/compiler/builder.ts index 653832c8dbde7..36521a14eae69 100644 --- a/src/compiler/builder.ts +++ b/src/compiler/builder.ts @@ -173,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(); @@ -257,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; @@ -483,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 @@ -656,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); diff --git a/src/compiler/builderState.ts b/src/compiler/builderState.ts index 189d801777dc3..b34a0bf837030 100644 --- a/src/compiler/builderState.ts +++ b/src/compiler/builderState.ts @@ -466,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 fbda30b4d1796..5fc61a0f68d7d 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 { @@ -819,6 +820,7 @@ namespace ts { let flowLoopCount = 0; let sharedFlowCount = 0; let flowAnalysisDisabled = false; + let flowInvocationCount = 0; const emptyStringType = getLiteralType(""); const zeroType = getLiteralType(0); @@ -834,8 +836,7 @@ 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[][] = []; @@ -16852,12 +16853,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!) || @@ -17144,6 +17139,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; @@ -17176,15 +17172,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 @@ -17215,15 +17202,6 @@ 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.Condition) { type = getTypeAtFlowCondition(flow); @@ -17276,6 +17254,27 @@ 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 @@ -17289,11 +17288,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; } @@ -17463,24 +17462,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 @@ -19385,7 +19391,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)) { @@ -25291,8 +25297,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) { diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 91df5402be3f2..7bad8359b26ee 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -45,14 +45,13 @@ namespace ts { } } 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 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 outputs || emptyArray; + return getOutputs(); } /*@internal*/ @@ -220,7 +252,7 @@ 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`); } diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 68eccdff30726..23a3e660c82bf 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -2807,10 +2807,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"); } @@ -3108,7 +3104,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; @@ -3135,7 +3131,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/tsbuild.ts b/src/compiler/tsbuild.ts index d572fc9dad8d9..69b90135fd056 100644 --- a/src/compiler/tsbuild.ts +++ b/src/compiler/tsbuild.ts @@ -1621,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); diff --git a/src/compiler/watch.ts b/src/compiler/watch.ts index b3b4739a2c62f..652b85d000d50 100644 --- a/src/compiler/watch.ts +++ b/src/compiler/watch.ts @@ -447,7 +447,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/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/testRunner/unittests/tsbuild/helpers.ts b/src/testRunner/unittests/tsbuild/helpers.ts index e33edf289d381..126b8d2f7d5b2 100644 --- a/src/testRunner/unittests/tsbuild/helpers.ts +++ b/src/testRunner/unittests/tsbuild/helpers.ts @@ -230,7 +230,7 @@ interface Symbol { } } - interface BuildInput { + export interface BuildInput { fs: vfs.FileSystem; tick: () => void; rootNames: readonly string[]; @@ -239,7 +239,7 @@ interface Symbol { baselineBuildInfo?: true; } - function build({ fs, tick, rootNames, modifyFs, baselineSourceMap, baselineBuildInfo }: BuildInput) { + export function tscBuild({ fs, tick, rootNames, modifyFs, baselineSourceMap, baselineBuildInfo }: BuildInput) { const actualReadFileMap = createMap(); modifyFs(fs); tick(); @@ -344,7 +344,7 @@ Mismatch Actual(path, actual, expected): ${JSON.stringify(arrayFrom(mapDefinedIt let host: fakes.SolutionBuilderHost; let initialWrittenFiles: Map; before(() => { - const result = build({ + const result = tscBuild({ fs: projFs().shadow(), tick, rootNames, @@ -390,7 +390,7 @@ Mismatch Actual(path, actual, expected): ${JSON.stringify(arrayFrom(mapDefinedIt tick(); newFs = fs.shadow(); tick(); - ({ actualReadFileMap, host } = build({ + ({ actualReadFileMap, host } = tscBuild({ fs: newFs, tick, rootNames, @@ -429,7 +429,7 @@ Mismatch Actual(path, actual, expected): ${JSON.stringify(arrayFrom(mapDefinedIt }); } it(`Verify emit output file text is same when built clean`, () => { - const { fs, writtenFiles } = build({ + const { fs, writtenFiles } = tscBuild({ fs: newFs.shadow(), tick, rootNames, diff --git a/src/testRunner/unittests/tsbuild/inferredTypeFromTransitiveModule.ts b/src/testRunner/unittests/tsbuild/inferredTypeFromTransitiveModule.ts index 92762dfd49d55..5383b7d32be1a 100644 --- a/src/testRunner/unittests/tsbuild/inferredTypeFromTransitiveModule.ts +++ b/src/testRunner/unittests/tsbuild/inferredTypeFromTransitiveModule.ts @@ -25,7 +25,7 @@ namespace ts { ] }, incrementalDtsChangedBuild: { - modifyFs: fs => replaceText(fs, "/src/bar.ts", "param: string", ""), + modifyFs: changeBarParam, 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"], @@ -36,5 +36,55 @@ namespace ts { baselineOnly: true, verifyDiagnostics: true }); + + verifyTsbuildOutput({ + scenario: "inferred type from transitive module with isolatedModules", + projFs: () => projFs, + time, + tick, + proj: "inferredTypeFromTransitiveModule", + rootNames: ["/src"], + initialBuild: { modifyFs: changeToIsolatedModules }, + incrementalDtsChangedBuild: { modifyFs: changeBarParam }, + baselineOnly: true, + }); + + it("reports errors in files affected by change in signature", () => { + const { fs, host } = tscBuild({ + fs: projFs.shadow(), + tick, + rootNames: ["/src"], + modifyFs: fs => { + changeToIsolatedModules(fs); + appendText(fs, "/src/lazyIndex.ts", ` +import { default as bar } from './bar'; +bar("hello");`); + } + }); + host.assertErrors(/*empty*/); + + tick(); + const { fs: newFs, host: newHost, writtenFiles } = tscBuild({ + fs: fs.shadow(), + tick, + rootNames: ["/src"], + modifyFs: changeBarParam + }); + // Has errors + newHost.assertErrors({ + message: [Diagnostics.Expected_0_arguments_but_got_1, 0, 1], + location: expectedLocationIndexOf(newFs, "/src/lazyIndex.ts", `"hello"`) + }); + // No written files + assert.equal(writtenFiles.size, 0); + }); }); + + 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/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/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 58d513b2e0a4b..79450ca83c9d3 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -4289,6 +4289,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/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index bc71eaffa373f..f0ae718d57001 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -4289,6 +4289,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/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/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/docker/azure-sdk.log b/tests/baselines/reference/docker/azure-sdk.log index fb911c5a36728..ba878ab443a93 100644 --- a/tests/baselines/reference/docker/azure-sdk.log +++ b/tests/baselines/reference/docker/azure-sdk.log @@ -9,15 +9,16 @@ XX of XX: [@azure/abort-controller] completed successfully in ? seconds XX of XX: [@azure/core-auth] completed successfully in ? seconds XX of XX: [@azure/core-tracing] completed successfully in ? seconds XX of XX: [@azure/core-http] completed successfully in ? seconds +XX of XX: [@azure/identity] completed successfully in ? seconds +XX of XX: [@azure/core-amqp] completed successfully in ? seconds XX of XX: [@azure/core-arm] completed successfully in ? seconds XX of XX: [@azure/core-paging] completed successfully in ? seconds -XX of XX: [@azure/identity] completed successfully in ? seconds XX of XX: [@azure/test-utils-recorder] completed successfully in ? seconds -XX of XX: [@azure/core-amqp] completed successfully in ? seconds +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... @@ -38,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') @@ -55,7 +56,6 @@ atob (guessing 'atob') (!) Circular dependency: dist-esm/index.js -> dist-esm/CosmosClient.js -> dist-esm/client/Database/index.js -> dist-esm/client/Database/Database.js -> dist-esm/client/Container/index.js -> dist-esm/client/Container/Container.js -> dist-esm/client/Script/Scripts.js -> dist-esm/index.js (!) 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/event-hubs] completed successfully in ? seconds XX of XX: [@azure/eventhubs-checkpointstore-blob] 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 @@ -64,23 +64,22 @@ 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) @azure/core-tracing (? seconds) @azure/core-http (? seconds) +@azure/identity (? seconds) +@azure/core-amqp (? seconds) @azure/core-arm (? seconds) @azure/core-paging (? seconds) -@azure/identity (? seconds) @azure/test-utils-recorder (? seconds) -@azure/core-amqp (? seconds) +@azure/event-hubs (? seconds) @azure/event-processor-host (? seconds) @azure/keyvault-keys (? seconds) @azure/keyvault-secrets (? seconds) -@azure/app-configuration (? seconds) @azure/core-asynciterator-polyfill (? seconds) -@azure/event-hubs (? seconds) @azure/eventhubs-checkpointstore-blob (? seconds) @azure/keyvault-certificates (? seconds) @azure/storage-blob (? seconds) @@ -89,8 +88,10 @@ SUCCESS (22) @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 56cc33c98c65f..9cda725e39e60 100644 --- a/tests/baselines/reference/docker/office-ui-fabric.log +++ b/tests/baselines/reference/docker/office-ui-fabric.log @@ -36,7 +36,9 @@ Standard output: @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 [lib] +@uifabric/monaco-editor: [XX:XX:XX XM] ■ Removing [esm, lib] +@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: Done in ?s. @uifabric/set-version: yarn run vX.X.X @uifabric/set-version: $ just-scripts build --production --lint @@ -88,6 +90,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: [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. @uifabric/jest-serializer-merge-styles: yarn run vX.X.X @@ -131,9 +134,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 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/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/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/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..f8dfdc7e146ca --- /dev/null +++ b/tests/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/incremental-declaration-changes/inferred-type-from-transitive-module-with-isolatedModules.js @@ -0,0 +1,96 @@ +//// [/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/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..568116485a416 --- /dev/null +++ b/tests/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/initial-Build/inferred-type-from-transitive-module-with-isolatedModules.js @@ -0,0 +1,143 @@ +//// [/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/user/jimp.log b/tests/baselines/reference/user/jimp.log deleted file mode 100644 index 8aa96e8bb8270..0000000000000 --- a/tests/baselines/reference/user/jimp.log +++ /dev/null @@ -1,52 +0,0 @@ -Exit Code: 1 -Standard output: -node_modules/@jimp/bmp/index.d.ts(1,38): error TS7016: Could not find a declaration file for module '@jimp/core'. '../../../tests/cases/user/jimp/node_modules/@jimp/core/dist/index.js' implicitly has an 'any' type. - Try `npm install @types/jimp__core` if it exists or add a new declaration (.d.ts) file containing `declare module '@jimp/core';` -node_modules/@jimp/gif/index.d.ts(1,27): error TS7016: Could not find a declaration file for module '@jimp/core'. '../../../tests/cases/user/jimp/node_modules/@jimp/core/dist/index.js' implicitly has an 'any' type. - Try `npm install @types/jimp__core` if it exists or add a new declaration (.d.ts) file containing `declare module '@jimp/core';` -node_modules/@jimp/jpeg/index.d.ts(1,59): error TS7016: Could not find a declaration file for module '@jimp/core'. '../../../tests/cases/user/jimp/node_modules/@jimp/core/dist/index.js' implicitly has an 'any' type. - Try `npm install @types/jimp__core` if it exists or add a new declaration (.d.ts) file containing `declare module '@jimp/core';` -node_modules/@jimp/plugin-blit/index.d.ts(1,54): error TS7016: Could not find a declaration file for module '@jimp/core'. '../../../tests/cases/user/jimp/node_modules/@jimp/core/dist/index.js' implicitly has an 'any' type. - Try `npm install @types/jimp__core` if it exists or add a new declaration (.d.ts) file containing `declare module '@jimp/core';` -node_modules/@jimp/plugin-blur/index.d.ts(1,31): error TS7016: Could not find a declaration file for module '@jimp/core'. '../../../tests/cases/user/jimp/node_modules/@jimp/core/dist/index.js' implicitly has an 'any' type. - Try `npm install @types/jimp__core` if it exists or add a new declaration (.d.ts) file containing `declare module '@jimp/core';` -node_modules/@jimp/plugin-color/index.d.ts(1,31): error TS7016: Could not find a declaration file for module '@jimp/core'. '../../../tests/cases/user/jimp/node_modules/@jimp/core/dist/index.js' implicitly has an 'any' type. - Try `npm install @types/jimp__core` if it exists or add a new declaration (.d.ts) file containing `declare module '@jimp/core';` -node_modules/@jimp/plugin-contain/index.d.ts(1,31): error TS7016: Could not find a declaration file for module '@jimp/core'. '../../../tests/cases/user/jimp/node_modules/@jimp/core/dist/index.js' implicitly has an 'any' type. - Try `npm install @types/jimp__core` if it exists or add a new declaration (.d.ts) file containing `declare module '@jimp/core';` -node_modules/@jimp/plugin-cover/index.d.ts(1,31): error TS7016: Could not find a declaration file for module '@jimp/core'. '../../../tests/cases/user/jimp/node_modules/@jimp/core/dist/index.js' implicitly has an 'any' type. - Try `npm install @types/jimp__core` if it exists or add a new declaration (.d.ts) file containing `declare module '@jimp/core';` -node_modules/@jimp/plugin-crop/index.d.ts(1,37): error TS7016: Could not find a declaration file for module '@jimp/core'. '../../../tests/cases/user/jimp/node_modules/@jimp/core/dist/index.js' implicitly has an 'any' type. - Try `npm install @types/jimp__core` if it exists or add a new declaration (.d.ts) file containing `declare module '@jimp/core';` -node_modules/@jimp/plugin-displace/index.d.ts(1,54): error TS7016: Could not find a declaration file for module '@jimp/core'. '../../../tests/cases/user/jimp/node_modules/@jimp/core/dist/index.js' implicitly has an 'any' type. - Try `npm install @types/jimp__core` if it exists or add a new declaration (.d.ts) file containing `declare module '@jimp/core';` -node_modules/@jimp/plugin-dither/index.d.ts(1,31): error TS7016: Could not find a declaration file for module '@jimp/core'. '../../../tests/cases/user/jimp/node_modules/@jimp/core/dist/index.js' implicitly has an 'any' type. - Try `npm install @types/jimp__core` if it exists or add a new declaration (.d.ts) file containing `declare module '@jimp/core';` -node_modules/@jimp/plugin-flip/index.d.ts(1,31): error TS7016: Could not find a declaration file for module '@jimp/core'. '../../../tests/cases/user/jimp/node_modules/@jimp/core/dist/index.js' implicitly has an 'any' type. - Try `npm install @types/jimp__core` if it exists or add a new declaration (.d.ts) file containing `declare module '@jimp/core';` -node_modules/@jimp/plugin-gaussian/index.d.ts(1,31): error TS7016: Could not find a declaration file for module '@jimp/core'. '../../../tests/cases/user/jimp/node_modules/@jimp/core/dist/index.js' implicitly has an 'any' type. - Try `npm install @types/jimp__core` if it exists or add a new declaration (.d.ts) file containing `declare module '@jimp/core';` -node_modules/@jimp/plugin-invert/index.d.ts(1,31): error TS7016: Could not find a declaration file for module '@jimp/core'. '../../../tests/cases/user/jimp/node_modules/@jimp/core/dist/index.js' implicitly has an 'any' type. - Try `npm install @types/jimp__core` if it exists or add a new declaration (.d.ts) file containing `declare module '@jimp/core';` -node_modules/@jimp/plugin-mask/index.d.ts(1,54): error TS7016: Could not find a declaration file for module '@jimp/core'. '../../../tests/cases/user/jimp/node_modules/@jimp/core/dist/index.js' implicitly has an 'any' type. - Try `npm install @types/jimp__core` if it exists or add a new declaration (.d.ts) file containing `declare module '@jimp/core';` -node_modules/@jimp/plugin-normalize/index.d.ts(1,31): error TS7016: Could not find a declaration file for module '@jimp/core'. '../../../tests/cases/user/jimp/node_modules/@jimp/core/dist/index.js' implicitly has an 'any' type. - Try `npm install @types/jimp__core` if it exists or add a new declaration (.d.ts) file containing `declare module '@jimp/core';` -node_modules/@jimp/plugin-print/index.d.ts(1,54): error TS7016: Could not find a declaration file for module '@jimp/core'. '../../../tests/cases/user/jimp/node_modules/@jimp/core/dist/index.js' implicitly has an 'any' type. - Try `npm install @types/jimp__core` if it exists or add a new declaration (.d.ts) file containing `declare module '@jimp/core';` -node_modules/@jimp/plugin-resize/index.d.ts(1,37): error TS7016: Could not find a declaration file for module '@jimp/core'. '../../../tests/cases/user/jimp/node_modules/@jimp/core/dist/index.js' implicitly has an 'any' type. - Try `npm install @types/jimp__core` if it exists or add a new declaration (.d.ts) file containing `declare module '@jimp/core';` -node_modules/@jimp/plugin-rotate/index.d.ts(1,31): error TS7016: Could not find a declaration file for module '@jimp/core'. '../../../tests/cases/user/jimp/node_modules/@jimp/core/dist/index.js' implicitly has an 'any' type. - Try `npm install @types/jimp__core` if it exists or add a new declaration (.d.ts) file containing `declare module '@jimp/core';` -node_modules/@jimp/plugin-scale/index.d.ts(1,31): error TS7016: Could not find a declaration file for module '@jimp/core'. '../../../tests/cases/user/jimp/node_modules/@jimp/core/dist/index.js' implicitly has an 'any' type. - Try `npm install @types/jimp__core` if it exists or add a new declaration (.d.ts) file containing `declare module '@jimp/core';` -node_modules/@jimp/png/index.d.ts(1,59): error TS7016: Could not find a declaration file for module '@jimp/core'. '../../../tests/cases/user/jimp/node_modules/@jimp/core/dist/index.js' implicitly has an 'any' type. - Try `npm install @types/jimp__core` if it exists or add a new declaration (.d.ts) file containing `declare module '@jimp/core';` -node_modules/@jimp/tiff/index.d.ts(1,38): error TS7016: Could not find a declaration file for module '@jimp/core'. '../../../tests/cases/user/jimp/node_modules/@jimp/core/dist/index.js' implicitly has an 'any' type. - Try `npm install @types/jimp__core` if it exists or add a new declaration (.d.ts) file containing `declare module '@jimp/core';` -node_modules/jimp/types/ts3.1/index.d.ts(16,8): error TS7016: Could not find a declaration file for module '@jimp/core'. '../../../tests/cases/user/jimp/node_modules/@jimp/core/dist/index.js' implicitly has an 'any' type. - Try `npm install @types/jimp__core` if it exists or add a new declaration (.d.ts) file containing `declare module '@jimp/core';` - - - -Standard error: diff --git a/tests/baselines/reference/user/prettier.log b/tests/baselines/reference/user/prettier.log index 93ccd99a0d62e..635c0bc0b3680 100644 --- a/tests/baselines/reference/user/prettier.log +++ b/tests/baselines/reference/user/prettier.log @@ -169,7 +169,7 @@ 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/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; }'. @@ -335,8 +335,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/user/webpack.log b/tests/baselines/reference/user/webpack.log deleted file mode 100644 index d1fbc9df9031b..0000000000000 --- a/tests/baselines/reference/user/webpack.log +++ /dev/null @@ -1,10 +0,0 @@ -Exit Code: 1 -Standard output: -lib/Compilation.js(575,5): error TS2322: Type 'number | "toString" | "valueOf" | "charAt" | "charCodeAt" | "concat" | "indexOf" | "lastIndexOf" | "localeCompare" | "match" | "replace" | "search" | "slice" | "split" | "substring" | ... 29 more ... | "trimRight"' is not assignable to type 'string'. - Type 'number' is not assignable to type 'string'. -lib/Compiler.js(228,48): error TS2345: Argument of type 'number | "toString" | "valueOf" | "charAt" | "charCodeAt" | "concat" | "indexOf" | "lastIndexOf" | "localeCompare" | "match" | "replace" | "search" | "slice" | "split" | "substring" | ... 29 more ... | "trimRight"' is not assignable to parameter of type 'string'. - Type 'number' is not assignable to type 'string'. - - - -Standard error: 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 +}