diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index bf3fd23ffd2ff..c8fc54ff13dc6 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -16013,7 +16013,7 @@ namespace ts { const declarations = concatenate(leftProp.declarations, rightProp.declarations); const flags = SymbolFlags.Property | (leftProp.flags & SymbolFlags.Optional); const result = createSymbol(flags, leftProp.escapedName); - result.type = getUnionType([getTypeOfSymbol(leftProp), removeMissingOrUndefinedType(rightType)]); + result.type = getUnionType([getTypeOfSymbol(leftProp), removeMissingOrUndefinedType(rightType)], UnionReduction.Subtype); result.leftSpread = leftProp; result.rightSpread = rightProp; result.declarations = declarations; @@ -21221,9 +21221,10 @@ namespace ts { (isCallSignatureDeclaration(param.parent) || isMethodSignature(param.parent) || isFunctionTypeNode(param.parent)) && param.parent.parameters.indexOf(param) > -1 && (resolveName(param, param.name.escapedText, SymbolFlags.Type, undefined, param.name.escapedText, /*isUse*/ true) || - param.name.originalKeywordKind && isTypeNodeKind(param.name.originalKeywordKind))) { + param.name.originalKeywordKind && isTypeNodeKind(param.name.originalKeywordKind))) { const newName = "arg" + param.parent.parameters.indexOf(param); - errorOrSuggestion(noImplicitAny, declaration, Diagnostics.Parameter_has_a_name_but_no_type_Did_you_mean_0_Colon_1, newName, declarationNameToString(param.name)); + const typeName = declarationNameToString(param.name) + (param.dotDotDotToken ? "[]" : ""); + errorOrSuggestion(noImplicitAny, declaration, Diagnostics.Parameter_has_a_name_but_no_type_Did_you_mean_0_Colon_1, newName, typeName); return; } diagnostic = (declaration as ParameterDeclaration).dotDotDotToken ? diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index fe0031d1f2afd..b9d39151148a1 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -29,6 +29,7 @@ namespace ts { ["es2019", "lib.es2019.d.ts"], ["es2020", "lib.es2020.d.ts"], ["es2021", "lib.es2021.d.ts"], + ["es2022", "lib.es2022.d.ts"], ["esnext", "lib.esnext.d.ts"], // Host only ["dom", "lib.dom.d.ts"], @@ -72,12 +73,16 @@ namespace ts { ["es2021.string", "lib.es2021.string.d.ts"], ["es2021.weakref", "lib.es2021.weakref.d.ts"], ["es2021.intl", "lib.es2021.intl.d.ts"], - ["esnext.array", "lib.es2019.array.d.ts"], + ["es2022.array", "lib.es2022.array.d.ts"], + ["es2022.error", "lib.es2022.error.d.ts"], + ["es2022.object", "lib.es2022.object.d.ts"], + ["es2022.string", "lib.es2022.string.d.ts"], + ["esnext.array", "lib.es2022.array.d.ts"], ["esnext.symbol", "lib.es2019.symbol.d.ts"], ["esnext.asynciterable", "lib.es2018.asynciterable.d.ts"], ["esnext.intl", "lib.esnext.intl.d.ts"], ["esnext.bigint", "lib.es2020.bigint.d.ts"], - ["esnext.string", "lib.es2021.string.d.ts"], + ["esnext.string", "lib.es2022.string.d.ts"], ["esnext.promise", "lib.es2021.promise.d.ts"], ["esnext.weakref", "lib.es2021.weakref.d.ts"] ]; @@ -314,6 +319,7 @@ namespace ts { es2019: ScriptTarget.ES2019, es2020: ScriptTarget.ES2020, es2021: ScriptTarget.ES2021, + es2022: ScriptTarget.ES2022, esnext: ScriptTarget.ESNext, })), affectsSourceFile: true, diff --git a/src/compiler/moduleSpecifiers.ts b/src/compiler/moduleSpecifiers.ts index 7c48d891a744c..cb2bad2e27166 100644 --- a/src/compiler/moduleSpecifiers.ts +++ b/src/compiler/moduleSpecifiers.ts @@ -707,13 +707,15 @@ namespace ts.moduleSpecifiers { if (host.fileExists(packageJsonPath)) { const packageJsonContent = JSON.parse(host.readFile!(packageJsonPath)!); // TODO: Inject `require` or `import` condition based on the intended import mode - const fromExports = packageJsonContent.exports && typeof packageJsonContent.name === "string" ? tryGetModuleNameFromExports(options, path, packageRootPath, packageJsonContent.name, packageJsonContent.exports, ["node", "types"]) : undefined; - if (fromExports) { - const withJsExtension = !hasTSFileExtension(fromExports.moduleFileToTry) ? fromExports : { moduleFileToTry: removeFileExtension(fromExports.moduleFileToTry) + tryGetJSExtensionForFile(fromExports.moduleFileToTry, options) }; - return { ...withJsExtension, verbatimFromExports: true }; - } - if (packageJsonContent.exports) { - return { moduleFileToTry: path, blockedByExports: true }; + if (getEmitModuleResolutionKind(options) === ModuleResolutionKind.Node12 || getEmitModuleResolutionKind(options) === ModuleResolutionKind.NodeNext) { + const fromExports = packageJsonContent.exports && typeof packageJsonContent.name === "string" ? tryGetModuleNameFromExports(options, path, packageRootPath, packageJsonContent.name, packageJsonContent.exports, ["node", "types"]) : undefined; + if (fromExports) { + const withJsExtension = !hasTSFileExtension(fromExports.moduleFileToTry) ? fromExports : { moduleFileToTry: removeFileExtension(fromExports.moduleFileToTry) + tryGetJSExtensionForFile(fromExports.moduleFileToTry, options) }; + return { ...withJsExtension, verbatimFromExports: true }; + } + if (packageJsonContent.exports) { + return { moduleFileToTry: path, blockedByExports: true }; + } } const versionPaths = packageJsonContent.typesVersions ? getPackageJsonTypesVersionsPaths(packageJsonContent.typesVersions) diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 03122cc56b80a..b75a5ac9439aa 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -6268,6 +6268,7 @@ namespace ts { ES2019 = 6, ES2020 = 7, ES2021 = 8, + ES2022 = 9, ESNext = 99, JSON = 100, Latest = ESNext, @@ -6725,15 +6726,16 @@ namespace ts { ContainsTypeScript = 1 << 0, ContainsJsx = 1 << 1, ContainsESNext = 1 << 2, - ContainsES2021 = 1 << 3, - ContainsES2020 = 1 << 4, - ContainsES2019 = 1 << 5, - ContainsES2018 = 1 << 6, - ContainsES2017 = 1 << 7, - ContainsES2016 = 1 << 8, - ContainsES2015 = 1 << 9, - ContainsGenerator = 1 << 10, - ContainsDestructuringAssignment = 1 << 11, + ContainsES2022 = 1 << 3, + ContainsES2021 = 1 << 4, + ContainsES2020 = 1 << 5, + ContainsES2019 = 1 << 6, + ContainsES2018 = 1 << 7, + ContainsES2017 = 1 << 8, + ContainsES2016 = 1 << 9, + ContainsES2015 = 1 << 10, + ContainsGenerator = 1 << 11, + ContainsDestructuringAssignment = 1 << 12, // Markers // - Flags used to indicate that a subtree contains a specific transformation. @@ -6762,6 +6764,7 @@ namespace ts { AssertTypeScript = ContainsTypeScript, AssertJsx = ContainsJsx, AssertESNext = ContainsESNext, + AssertES2022 = ContainsES2022, AssertES2021 = ContainsES2021, AssertES2020 = ContainsES2020, AssertES2019 = ContainsES2019, diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 8caba5b205af8..aa3e8e0ee92b7 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -606,6 +606,7 @@ namespace ts { AsyncIterableIterator: emptyArray, AsyncGenerator: emptyArray, AsyncGeneratorFunction: emptyArray, + NumberFormat: ["formatToParts"] }, es2019: { Array: ["flat", "flatMap"], @@ -627,8 +628,21 @@ namespace ts { PromiseConstructor: ["any"], String: ["replaceAll"] }, - esnext: { - NumberFormat: ["formatToParts"] + es2022: { + Array: ["at"], + String: ["at"], + Int8Array: ["at"], + Uint8Array: ["at"], + Uint8ClampedArray: ["at"], + Int16Array: ["at"], + Uint16Array: ["at"], + Int32Array: ["at"], + Uint32Array: ["at"], + Float32Array: ["at"], + Float64Array: ["at"], + BigInt64Array: ["at"], + BigUint64Array: ["at"], + ObjectConstructor: ["hasOwn"] } }; } diff --git a/src/compiler/utilitiesPublic.ts b/src/compiler/utilitiesPublic.ts index d638ec32a8270..8f834e5e45971 100644 --- a/src/compiler/utilitiesPublic.ts +++ b/src/compiler/utilitiesPublic.ts @@ -14,6 +14,8 @@ namespace ts { switch (getEmitScriptTarget(options)) { case ScriptTarget.ESNext: return "lib.esnext.full.d.ts"; + case ScriptTarget.ES2022: + return "lib.es2022.full.d.ts"; case ScriptTarget.ES2021: return "lib.es2021.full.d.ts"; case ScriptTarget.ES2020: diff --git a/src/lib/es2022.array.d.ts b/src/lib/es2022.array.d.ts new file mode 100644 index 0000000000000..68a797f8275d3 --- /dev/null +++ b/src/lib/es2022.array.d.ts @@ -0,0 +1,103 @@ +interface Array { + /** + * Returns the item located at the specified index. + * @param index The zero-based index of the desired code unit. A negative index will count back from the last item. + */ + at(index: number): T | undefined; +} + +interface ReadonlyArray { + /** + * Returns the item located at the specified index. + * @param index The zero-based index of the desired code unit. A negative index will count back from the last item. + */ + at(index: number): T | undefined; +} + +interface Int8Array { + /** + * Returns the item located at the specified index. + * @param index The zero-based index of the desired code unit. A negative index will count back from the last item. + */ + at(index: number): number | undefined; +} + +interface Uint8Array { + /** + * Returns the item located at the specified index. + * @param index The zero-based index of the desired code unit. A negative index will count back from the last item. + */ + at(index: number): number | undefined; +} + +interface Uint8ClampedArray { + /** + * Returns the item located at the specified index. + * @param index The zero-based index of the desired code unit. A negative index will count back from the last item. + */ + at(index: number): number | undefined; +} + +interface Int16Array { + /** + * Returns the item located at the specified index. + * @param index The zero-based index of the desired code unit. A negative index will count back from the last item. + */ + at(index: number): number | undefined; +} + +interface Uint16Array { + /** + * Returns the item located at the specified index. + * @param index The zero-based index of the desired code unit. A negative index will count back from the last item. + */ + at(index: number): number | undefined; +} + +interface Int32Array { + /** + * Returns the item located at the specified index. + * @param index The zero-based index of the desired code unit. A negative index will count back from the last item. + */ + at(index: number): number | undefined; +} + +interface Uint32Array { + /** + * Returns the item located at the specified index. + * @param index The zero-based index of the desired code unit. A negative index will count back from the last item. + */ + at(index: number): number | undefined; +} + +interface Float32Array { + /** + * Returns the item located at the specified index. + * @param index The zero-based index of the desired code unit. A negative index will count back from the last item. + */ + at(index: number): number | undefined; +} + +interface Float64Array { + /** + * Returns the item located at the specified index. + * @param index The zero-based index of the desired code unit. A negative index will count back from the last item. + */ + at(index: number): number | undefined; +} + +interface BigInt64Array { + /** + * Returns the item located at the specified index. + * @param index The zero-based index of the desired code unit. A negative index will count back from the last item. + */ + at(index: number): bigint | undefined; +} + +interface BigUint64Array { + /** + * Returns the item located at the specified index. + * @param index The zero-based index of the desired code unit. A negative index will count back from the last item. + */ + at(index: number): bigint | undefined; +} diff --git a/src/lib/es2022.d.ts b/src/lib/es2022.d.ts new file mode 100644 index 0000000000000..67a9199b5d6f4 --- /dev/null +++ b/src/lib/es2022.d.ts @@ -0,0 +1,5 @@ +/// +/// +/// +/// +/// diff --git a/src/lib/es2022.error.d.ts b/src/lib/es2022.error.d.ts new file mode 100644 index 0000000000000..20927134e3536 --- /dev/null +++ b/src/lib/es2022.error.d.ts @@ -0,0 +1,8 @@ +interface ErrorOptions { + cause?: Error; +} + +interface ErrorConstructor { + new(message?: string, options?: ErrorOptions): Error; + (message?: string, options?: ErrorOptions): Error; +} diff --git a/src/lib/es2022.full.d.ts b/src/lib/es2022.full.d.ts new file mode 100644 index 0000000000000..f7a8fdc84c167 --- /dev/null +++ b/src/lib/es2022.full.d.ts @@ -0,0 +1,5 @@ +/// +/// +/// +/// +/// diff --git a/src/lib/es2022.object.d.ts b/src/lib/es2022.object.d.ts new file mode 100644 index 0000000000000..764610213b6ac --- /dev/null +++ b/src/lib/es2022.object.d.ts @@ -0,0 +1,8 @@ +interface Object { + /** + * Determines whether an object has a property with the specified name. + * @param o An object. + * @param v A property name. + */ + hasOwn(o: object, v: PropertyKey): boolean; +} diff --git a/src/lib/es2022.string.d.ts b/src/lib/es2022.string.d.ts new file mode 100644 index 0000000000000..23f4a0123f269 --- /dev/null +++ b/src/lib/es2022.string.d.ts @@ -0,0 +1,7 @@ +interface String { + /** + * Returns a new String consisting of the single UTF-16 code unit located at the specified index. + * @param index The zero-based index of the desired code unit. A negative index will count back from the last item. + */ + at(index: number): string | undefined; +} diff --git a/src/lib/esnext.d.ts b/src/lib/esnext.d.ts index 4a3ac819c1900..6735ced8f7367 100644 --- a/src/lib/esnext.d.ts +++ b/src/lib/esnext.d.ts @@ -1,2 +1,2 @@ -/// +/// /// diff --git a/src/lib/libs.json b/src/lib/libs.json index 4131d45171b23..e4434e89ea64a 100644 --- a/src/lib/libs.json +++ b/src/lib/libs.json @@ -9,6 +9,7 @@ "es2019", "es2020", "es2021", + "es2022", "esnext", // Host only "dom.generated", @@ -52,6 +53,10 @@ "es2021.promise", "es2021.weakref", "es2021.intl", + "es2022.array", + "es2022.error", + "es2022.object", + "es2022.string", "esnext.intl", // Default libraries "es5.full", @@ -62,6 +67,7 @@ "es2019.full", "es2020.full", "es2021.full", + "es2022.full", "esnext.full" ], "paths": { diff --git a/src/server/protocol.ts b/src/server/protocol.ts index da6606796727d..9a8fbfa4bed74 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -3199,6 +3199,25 @@ namespace ts.server.protocol { payload: TypingsInstalledTelemetryEventPayload; } + // A __GDPR__FRAGMENT__ has no meaning until it is ${include}d by a __GDPR__ comment, at which point + // the included properties are effectively inlined into the __GDPR__ declaration. In this case, for + // example, any __GDPR__ comment including the TypeScriptCommonProperties will be updated with an + // additional version property with the classification below. Obviously, the purpose of such a construct + // is to reduce duplication and keep multiple use sites consistent (e.g. by making sure that all reflect + // any newly added TypeScriptCommonProperties). Unfortunately, the system has limits - in particular, + // these reusable __GDPR__FRAGMENT__s are not accessible across repo boundaries. Therefore, even though + // the code for adding the common properties (i.e. version), along with the corresponding __GDPR__FRAGMENT__, + // lives in the VS Code repo (see https://github.com/microsoft/vscode/blob/main/extensions/typescript-language-features/src/utils/telemetry.ts) + // we have to duplicate it here. It would be nice to keep them in sync, but the only likely failure mode + // is adding a property to the VS Code repro but not here and the only consequence would be having that + // property suppressed on the events (i.e. __GDPT__ comments) in this repo that reference the out-of-date + // local __GDPR__FRAGMENT__. + /* __GDPR__FRAGMENT__ + "TypeScriptCommonProperties" : { + "version" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" } + } + */ + /* __GDPR__ "typingsinstalled" : { "${include}": ["${TypeScriptCommonProperties}"], @@ -3515,6 +3534,7 @@ namespace ts.server.protocol { ES2019 = "ES2019", ES2020 = "ES2020", ES2021 = "ES2021", + ES2022 = "ES2022", ESNext = "ESNext" } diff --git a/src/services/codefixes/addNameToNamelessParameter.ts b/src/services/codefixes/addNameToNamelessParameter.ts index 07bc1bea7e3c6..bd53c23743239 100644 --- a/src/services/codefixes/addNameToNamelessParameter.ts +++ b/src/services/codefixes/addNameToNamelessParameter.ts @@ -14,24 +14,24 @@ namespace ts.codefix { function makeChange(changeTracker: textChanges.ChangeTracker, sourceFile: SourceFile, pos: number) { const token = getTokenAtPosition(sourceFile, pos); - if (!isIdentifier(token)) { - return Debug.fail("add-name-to-nameless-parameter operates on identifiers, but got a " + Debug.formatSyntaxKind(token.kind)); - } const param = token.parent; if (!isParameter(param)) { return Debug.fail("Tried to add a parameter name to a non-parameter: " + Debug.formatSyntaxKind(token.kind)); } + const i = param.parent.parameters.indexOf(param); Debug.assert(!param.type, "Tried to add a parameter name to a parameter that already had one."); Debug.assert(i > -1, "Parameter not found in parent parameter list."); + + const typeNode = factory.createTypeReferenceNode(param.name as Identifier, /*typeArguments*/ undefined); const replacement = factory.createParameterDeclaration( /*decorators*/ undefined, param.modifiers, param.dotDotDotToken, "arg" + i, param.questionToken, - factory.createTypeReferenceNode(token, /*typeArguments*/ undefined), + param.dotDotDotToken ? factory.createArrayTypeNode(typeNode) : typeNode, param.initializer); - changeTracker.replaceNode(sourceFile, token, replacement); + changeTracker.replaceNode(sourceFile, param, replacement); } } diff --git a/src/services/codefixes/helpers.ts b/src/services/codefixes/helpers.ts index 4564a571b1f43..21981c8df5f40 100644 --- a/src/services/codefixes/helpers.ts +++ b/src/services/codefixes/helpers.ts @@ -37,6 +37,12 @@ namespace ts.codefix { type AddNode = PropertyDeclaration | GetAccessorDeclaration | SetAccessorDeclaration | MethodDeclaration | FunctionExpression | ArrowFunction; + export const enum PreserveOptionalFlags { + Method = 1 << 0, + Property = 1 << 1, + All = Method | Property + } + /** * `addClassElement` will not be called if we can't figure out a representation for `symbol` in `enclosingDeclaration`. * @param body If defined, this will be the body of the member node passed to `addClassElement`. Otherwise, the body will default to a stub. @@ -50,6 +56,7 @@ namespace ts.codefix { importAdder: ImportAdder | undefined, addClassElement: (node: AddNode) => void, body: Block | undefined, + preserveOptional = PreserveOptionalFlags.All, isAmbient = false, ): void { const declarations = symbol.getDeclarations(); @@ -83,7 +90,7 @@ namespace ts.codefix { /*decorators*/ undefined, modifiers, name, - optional ? factory.createToken(SyntaxKind.QuestionToken) : undefined, + optional && (preserveOptional & PreserveOptionalFlags.Property) ? factory.createToken(SyntaxKind.QuestionToken) : undefined, typeNode, /*initializer*/ undefined)); break; @@ -158,14 +165,14 @@ namespace ts.codefix { } else { Debug.assert(declarations.length === signatures.length, "Declarations and signatures should match count"); - addClassElement(createMethodImplementingSignatures(checker, context, enclosingDeclaration, signatures, name, optional, modifiers, quotePreference, body)); + addClassElement(createMethodImplementingSignatures(checker, context, enclosingDeclaration, signatures, name, optional && !!(preserveOptional & PreserveOptionalFlags.Method), modifiers, quotePreference, body)); } } break; } function outputMethod(quotePreference: QuotePreference, signature: Signature, modifiers: NodeArray | undefined, name: PropertyName, body?: Block): void { - const method = createSignatureDeclarationFromSignature(SyntaxKind.MethodDeclaration, context, quotePreference, signature, body, name, modifiers, optional, enclosingDeclaration, importAdder); + const method = createSignatureDeclarationFromSignature(SyntaxKind.MethodDeclaration, context, quotePreference, signature, body, name, modifiers, optional && !!(preserveOptional & PreserveOptionalFlags.Method), enclosingDeclaration, importAdder); if (method) addClassElement(method); } } diff --git a/src/services/codefixes/inferFromUsage.ts b/src/services/codefixes/inferFromUsage.ts index b6b3aea3f02fd..e680d4307ec22 100644 --- a/src/services/codefixes/inferFromUsage.ts +++ b/src/services/codefixes/inferFromUsage.ts @@ -1000,13 +1000,25 @@ namespace ts.codefix { if (usage.numberIndex) { types.push(checker.createArrayType(combineFromUsage(usage.numberIndex))); } - if (usage.properties?.size || usage.calls?.length || usage.constructs?.length || usage.stringIndex) { + if (usage.properties?.size || usage.constructs?.length || usage.stringIndex) { types.push(inferStructuralType(usage)); } - types.push(...(usage.candidateTypes || []).map(t => checker.getBaseTypeOfLiteralType(t))); - types.push(...inferNamedTypesFromProperties(usage)); + const candidateTypes = (usage.candidateTypes || []).map(t => checker.getBaseTypeOfLiteralType(t)); + const callsType = usage.calls?.length ? inferStructuralType(usage) : undefined; + if (callsType && candidateTypes) { + types.push(checker.getUnionType([callsType, ...candidateTypes], UnionReduction.Subtype)); + } + else { + if (callsType) { + types.push(callsType); + } + if (length(candidateTypes)) { + types.push(...candidateTypes); + } + } + types.push(...inferNamedTypesFromProperties(usage)); return types; } diff --git a/src/services/completions.ts b/src/services/completions.ts index 85b13866ecf7b..9b2747db14d2f 100644 --- a/src/services/completions.ts +++ b/src/services/completions.ts @@ -895,7 +895,7 @@ namespace ts.Completions { node => { let requiredModifiers = ModifierFlags.None; if (isAbstract) { - requiredModifiers |= ModifierFlags.Abstract; + requiredModifiers |= ModifierFlags.Abstract; } if (isClassElement(node) && checker.getMemberOverrideModifierStatus(classLikeDeclaration, node) === MemberOverrideStatus.NeedsOverride) { @@ -919,6 +919,7 @@ namespace ts.Completions { completionNodes.push(node); }, body, + codefix.PreserveOptionalFlags.Property, isAbstract); if (completionNodes.length) { @@ -3891,5 +3892,6 @@ namespace ts.Completions { } return charCode; } + } diff --git a/src/services/outliningElementsCollector.ts b/src/services/outliningElementsCollector.ts index be6755e880c5e..c071fb145cc18 100644 --- a/src/services/outliningElementsCollector.ts +++ b/src/services/outliningElementsCollector.ts @@ -34,7 +34,7 @@ namespace ts.OutliningElementsCollector { if (depthRemaining === 0) return; cancellationToken.throwIfCancellationRequested(); - if (isDeclaration(n) || isVariableStatement(n) || isReturnStatement(n) || n.kind === SyntaxKind.EndOfFileToken) { + if (isDeclaration(n) || isVariableStatement(n) || isReturnStatement(n) || isCallOrNewExpression(n) || n.kind === SyntaxKind.EndOfFileToken) { addOutliningForLeadingCommentsForNode(n, sourceFile, cancellationToken, out); } diff --git a/src/services/refactors/extractSymbol.ts b/src/services/refactors/extractSymbol.ts index 6490fde538708..a14ee526ae783 100644 --- a/src/services/refactors/extractSymbol.ts +++ b/src/services/refactors/extractSymbol.ts @@ -364,10 +364,11 @@ namespace ts.refactor.extractSymbol { return node.expression; } } - else if (isVariableStatement(node)) { + else if (isVariableStatement(node) || isVariableDeclarationList(node)) { + const declarations = isVariableStatement(node) ? node.declarationList.declarations : node.declarations; let numInitializers = 0; let lastInitializer: Expression | undefined; - for (const declaration of node.declarationList.declarations) { + for (const declaration of declarations) { if (declaration.initializer) { numInitializers++; lastInitializer = declaration.initializer; @@ -383,7 +384,6 @@ namespace ts.refactor.extractSymbol { return node.initializer; } } - return node; } diff --git a/src/services/services.ts b/src/services/services.ts index b04052a29c0b6..c9c54c0234ec6 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -599,10 +599,11 @@ namespace ts { } function findBaseOfDeclaration(checker: TypeChecker, declaration: Declaration, cb: (symbol: Symbol) => T[] | undefined): T[] | undefined { + if (hasStaticModifier(declaration)) return; + const classOrInterfaceDeclaration = declaration.parent?.kind === SyntaxKind.Constructor ? declaration.parent.parent : declaration.parent; - if (!classOrInterfaceDeclaration) { - return; - } + if (!classOrInterfaceDeclaration) return; + return firstDefined(getAllSuperTypeNodes(classOrInterfaceDeclaration), superTypeNode => { const symbol = checker.getPropertyOfType(checker.getTypeAtLocation(superTypeNode), declaration.symbol.name); return symbol ? cb(symbol) : undefined; diff --git a/src/testRunner/unittests/config/commandLineParsing.ts b/src/testRunner/unittests/config/commandLineParsing.ts index 9739b3245831f..34644a0976640 100644 --- a/src/testRunner/unittests/config/commandLineParsing.ts +++ b/src/testRunner/unittests/config/commandLineParsing.ts @@ -211,7 +211,7 @@ namespace ts { start: undefined, length: undefined, }, { - messageText: "Argument for '--target' option must be: 'es3', 'es5', 'es6', 'es2015', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'esnext'.", + messageText: "Argument for '--target' option must be: 'es3', 'es5', 'es6', 'es2015', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'esnext'.", category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category, code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code, diff --git a/src/testRunner/unittests/services/extract/ranges.ts b/src/testRunner/unittests/services/extract/ranges.ts index 2264f3982ff79..34f379df26d3c 100644 --- a/src/testRunner/unittests/services/extract/ranges.ts +++ b/src/testRunner/unittests/services/extract/ranges.ts @@ -191,7 +191,7 @@ namespace ts { testExtractRange("extractRange28", `[#|return [$|1|];|]`); // For statements - testExtractRange("extractRange29", `for ([#|var i = 1|]; i < 2; i++) {}`); + testExtractRange("extractRange29", `for ([#|var i = [$|1|]|]; i < 2; i++) {}`); testExtractRange("extractRange30", `for (var i = [#|[$|1|]|]; i < 2; i++) {}`); }); diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 24af70f15d3e6..2ea26a94f1bc6 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -3078,6 +3078,7 @@ declare namespace ts { ES2019 = 6, ES2020 = 7, ES2021 = 8, + ES2022 = 9, ESNext = 99, JSON = 100, Latest = 99 @@ -9666,6 +9667,7 @@ declare namespace ts.server.protocol { ES2019 = "ES2019", ES2020 = "ES2020", ES2021 = "ES2021", + ES2022 = "ES2022", ESNext = "ESNext" } enum ClassificationType { diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index b23eb3cd3f018..022504652a940 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -3078,6 +3078,7 @@ declare namespace ts { ES2019 = 6, ES2020 = 7, ES2021 = 8, + ES2022 = 9, ESNext = 99, JSON = 100, Latest = 99 diff --git a/tests/baselines/reference/callChainWithSuper(target=es2022).js b/tests/baselines/reference/callChainWithSuper(target=es2022).js new file mode 100644 index 0000000000000..30e1ad3886dc5 --- /dev/null +++ b/tests/baselines/reference/callChainWithSuper(target=es2022).js @@ -0,0 +1,18 @@ +//// [callChainWithSuper.ts] +// GH#34952 +class Base { method?() {} } +class Derived extends Base { + method1() { return super.method?.(); } + method2() { return super["method"]?.(); } +} + +//// [callChainWithSuper.js] +"use strict"; +// GH#34952 +class Base { + method() { } +} +class Derived extends Base { + method1() { return super.method?.(); } + method2() { return super["method"]?.(); } +} diff --git a/tests/baselines/reference/callWithSpread4.symbols b/tests/baselines/reference/callWithSpread4.symbols index dbb7576582895..428f41b17c340 100644 --- a/tests/baselines/reference/callWithSpread4.symbols +++ b/tests/baselines/reference/callWithSpread4.symbols @@ -30,7 +30,7 @@ declare const pli: { (streams: ReadonlyArray): Promise; >streams : Symbol(streams, Decl(callWithSpread4.ts, 5, 5)) ->ReadonlyArray : Symbol(ReadonlyArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --), Decl(lib.es2019.array.d.ts, --, --)) +>ReadonlyArray : Symbol(ReadonlyArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --), Decl(lib.es2019.array.d.ts, --, --) ... and 1 more) >R : Symbol(R, Decl(callWithSpread4.ts, 0, 0)) >W : Symbol(W, Decl(callWithSpread4.ts, 0, 22)) >RW : Symbol(RW, Decl(callWithSpread4.ts, 1, 22)) @@ -43,7 +43,7 @@ declare const pli: { >RW : Symbol(RW, Decl(callWithSpread4.ts, 1, 22)) >W : Symbol(W, Decl(callWithSpread4.ts, 0, 22)) >streams : Symbol(streams, Decl(callWithSpread4.ts, 6, 23)) ->Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 2 more) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 3 more) >RW : Symbol(RW, Decl(callWithSpread4.ts, 1, 22)) >W : Symbol(W, Decl(callWithSpread4.ts, 0, 22)) >Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --)) diff --git a/tests/baselines/reference/doYouNeedToChangeYourTargetLibraryES2016Plus.errors.txt b/tests/baselines/reference/doYouNeedToChangeYourTargetLibraryES2016Plus.errors.txt index ee42a781a6366..3e7a58d4b942f 100644 --- a/tests/baselines/reference/doYouNeedToChangeYourTargetLibraryES2016Plus.errors.txt +++ b/tests/baselines/reference/doYouNeedToChangeYourTargetLibraryES2016Plus.errors.txt @@ -16,7 +16,7 @@ tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(20,27): err tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(21,35): error TS2583: Cannot find name 'AsyncGeneratorFunction'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2018' or later. tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(22,26): error TS2583: Cannot find name 'AsyncIterable'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2018' or later. tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(23,34): error TS2583: Cannot find name 'AsyncIterableIterator'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2018' or later. -tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(24,70): error TS2550: Property 'formatToParts' does not exist on type 'NumberFormat'. Do you need to change your target library? Try changing the 'lib' compiler option to 'esnext' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(24,70): error TS2550: Property 'formatToParts' does not exist on type 'NumberFormat'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2018' or later. tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(27,26): error TS2550: Property 'flat' does not exist on type 'undefined[]'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2019' or later. tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(28,29): error TS2550: Property 'flatMap' does not exist on type 'undefined[]'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2019' or later. tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(29,49): error TS2550: Property 'fromEntries' does not exist on type 'ObjectConstructor'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2019' or later. @@ -95,7 +95,7 @@ tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(44,33): err !!! error TS2583: Cannot find name 'AsyncIterableIterator'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2018' or later. const testNumberFormatFormatToParts = new Intl.NumberFormat("en-US").formatToParts(); ~~~~~~~~~~~~~ -!!! error TS2550: Property 'formatToParts' does not exist on type 'NumberFormat'. Do you need to change your target library? Try changing the 'lib' compiler option to 'esnext' or later. +!!! error TS2550: Property 'formatToParts' does not exist on type 'NumberFormat'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2018' or later. // es2019 const testArrayFlat = [].flat(); diff --git a/tests/baselines/reference/errorCause(target=es2021).errors.txt b/tests/baselines/reference/errorCause(target=es2021).errors.txt new file mode 100644 index 0000000000000..4cac6368fccb4 --- /dev/null +++ b/tests/baselines/reference/errorCause(target=es2021).errors.txt @@ -0,0 +1,8 @@ +tests/cases/compiler/errorCause.ts(1,18): error TS2554: Expected 0-1 arguments, but got 2. + + +==== tests/cases/compiler/errorCause.ts (1 errors) ==== + new Error("foo", { cause: new Error("bar") }); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2554: Expected 0-1 arguments, but got 2. + \ No newline at end of file diff --git a/tests/baselines/reference/errorCause(target=es2021).js b/tests/baselines/reference/errorCause(target=es2021).js new file mode 100644 index 0000000000000..24432cbe9625b --- /dev/null +++ b/tests/baselines/reference/errorCause(target=es2021).js @@ -0,0 +1,6 @@ +//// [errorCause.ts] +new Error("foo", { cause: new Error("bar") }); + + +//// [errorCause.js] +new Error("foo", { cause: new Error("bar") }); diff --git a/tests/baselines/reference/errorCause(target=es2021).symbols b/tests/baselines/reference/errorCause(target=es2021).symbols new file mode 100644 index 0000000000000..0fe6616b0a8b7 --- /dev/null +++ b/tests/baselines/reference/errorCause(target=es2021).symbols @@ -0,0 +1,6 @@ +=== tests/cases/compiler/errorCause.ts === +new Error("foo", { cause: new Error("bar") }); +>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>cause : Symbol(cause, Decl(errorCause.ts, 0, 18)) +>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + diff --git a/tests/baselines/reference/errorCause(target=es2021).types b/tests/baselines/reference/errorCause(target=es2021).types new file mode 100644 index 0000000000000..e92889262730c --- /dev/null +++ b/tests/baselines/reference/errorCause(target=es2021).types @@ -0,0 +1,11 @@ +=== tests/cases/compiler/errorCause.ts === +new Error("foo", { cause: new Error("bar") }); +>new Error("foo", { cause: new Error("bar") }) : Error +>Error : ErrorConstructor +>"foo" : "foo" +>{ cause: new Error("bar") } : { cause: Error; } +>cause : Error +>new Error("bar") : Error +>Error : ErrorConstructor +>"bar" : "bar" + diff --git a/tests/baselines/reference/errorCause(target=es2022).js b/tests/baselines/reference/errorCause(target=es2022).js new file mode 100644 index 0000000000000..24432cbe9625b --- /dev/null +++ b/tests/baselines/reference/errorCause(target=es2022).js @@ -0,0 +1,6 @@ +//// [errorCause.ts] +new Error("foo", { cause: new Error("bar") }); + + +//// [errorCause.js] +new Error("foo", { cause: new Error("bar") }); diff --git a/tests/baselines/reference/errorCause(target=es2022).symbols b/tests/baselines/reference/errorCause(target=es2022).symbols new file mode 100644 index 0000000000000..0fe6616b0a8b7 --- /dev/null +++ b/tests/baselines/reference/errorCause(target=es2022).symbols @@ -0,0 +1,6 @@ +=== tests/cases/compiler/errorCause.ts === +new Error("foo", { cause: new Error("bar") }); +>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>cause : Symbol(cause, Decl(errorCause.ts, 0, 18)) +>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + diff --git a/tests/baselines/reference/errorCause(target=es2022).types b/tests/baselines/reference/errorCause(target=es2022).types new file mode 100644 index 0000000000000..e92889262730c --- /dev/null +++ b/tests/baselines/reference/errorCause(target=es2022).types @@ -0,0 +1,11 @@ +=== tests/cases/compiler/errorCause.ts === +new Error("foo", { cause: new Error("bar") }); +>new Error("foo", { cause: new Error("bar") }) : Error +>Error : ErrorConstructor +>"foo" : "foo" +>{ cause: new Error("bar") } : { cause: Error; } +>cause : Error +>new Error("bar") : Error +>Error : ErrorConstructor +>"bar" : "bar" + diff --git a/tests/baselines/reference/errorCause(target=esnext).js b/tests/baselines/reference/errorCause(target=esnext).js new file mode 100644 index 0000000000000..24432cbe9625b --- /dev/null +++ b/tests/baselines/reference/errorCause(target=esnext).js @@ -0,0 +1,6 @@ +//// [errorCause.ts] +new Error("foo", { cause: new Error("bar") }); + + +//// [errorCause.js] +new Error("foo", { cause: new Error("bar") }); diff --git a/tests/baselines/reference/errorCause(target=esnext).symbols b/tests/baselines/reference/errorCause(target=esnext).symbols new file mode 100644 index 0000000000000..0fe6616b0a8b7 --- /dev/null +++ b/tests/baselines/reference/errorCause(target=esnext).symbols @@ -0,0 +1,6 @@ +=== tests/cases/compiler/errorCause.ts === +new Error("foo", { cause: new Error("bar") }); +>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>cause : Symbol(cause, Decl(errorCause.ts, 0, 18)) +>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + diff --git a/tests/baselines/reference/errorCause(target=esnext).types b/tests/baselines/reference/errorCause(target=esnext).types new file mode 100644 index 0000000000000..e92889262730c --- /dev/null +++ b/tests/baselines/reference/errorCause(target=esnext).types @@ -0,0 +1,11 @@ +=== tests/cases/compiler/errorCause.ts === +new Error("foo", { cause: new Error("bar") }); +>new Error("foo", { cause: new Error("bar") }) : Error +>Error : ErrorConstructor +>"foo" : "foo" +>{ cause: new Error("bar") } : { cause: Error; } +>cause : Error +>new Error("bar") : Error +>Error : ErrorConstructor +>"bar" : "bar" + diff --git a/tests/baselines/reference/esNextWeakRefs_IterableWeakMap.symbols b/tests/baselines/reference/esNextWeakRefs_IterableWeakMap.symbols index be0559bfe5251..cf1ed59e66d6e 100644 --- a/tests/baselines/reference/esNextWeakRefs_IterableWeakMap.symbols +++ b/tests/baselines/reference/esNextWeakRefs_IterableWeakMap.symbols @@ -297,7 +297,7 @@ export class IterableWeakMap implements WeakMap { Object.defineProperties(IterableWeakMap.prototype, { >Object.defineProperties : Symbol(ObjectConstructor.defineProperties, Decl(lib.es5.d.ts, --, --)) ->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2022.object.d.ts, --, --)) >defineProperties : Symbol(ObjectConstructor.defineProperties, Decl(lib.es5.d.ts, --, --)) >IterableWeakMap.prototype : Symbol(IterableWeakMap.prototype) >IterableWeakMap : Symbol(IterableWeakMap, Decl(esNextWeakRefs_IterableWeakMap.ts, 6, 2)) @@ -322,7 +322,7 @@ Object.defineProperties(IterableWeakMap.prototype, { >value : Symbol(value, Decl(esNextWeakRefs_IterableWeakMap.ts, 89, 23)) >Object.getOwnPropertyDescriptor( IterableWeakMap.prototype, "entries", )!.value : Symbol(PropertyDescriptor.value, Decl(lib.es5.d.ts, --, --)) >Object.getOwnPropertyDescriptor : Symbol(ObjectConstructor.getOwnPropertyDescriptor, Decl(lib.es5.d.ts, --, --)) ->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2022.object.d.ts, --, --)) >getOwnPropertyDescriptor : Symbol(ObjectConstructor.getOwnPropertyDescriptor, Decl(lib.es5.d.ts, --, --)) IterableWeakMap.prototype, diff --git a/tests/baselines/reference/flatArrayNoExcessiveStackDepth.symbols b/tests/baselines/reference/flatArrayNoExcessiveStackDepth.symbols index 4b27f6006cbd7..bbd3083d04c40 100644 --- a/tests/baselines/reference/flatArrayNoExcessiveStackDepth.symbols +++ b/tests/baselines/reference/flatArrayNoExcessiveStackDepth.symbols @@ -15,7 +15,7 @@ const bar = foo.flatMap(bar => bar as Foo); interface Foo extends Array {} >Foo : Symbol(Foo, Decl(flatArrayNoExcessiveStackDepth.ts, 3, 43)) ->Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 2 more) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 3 more) // Repros from comments in #43249 diff --git a/tests/baselines/reference/importExportInternalComments.symbols b/tests/baselines/reference/importExportInternalComments.symbols index 87eeb2d31e9c9..e4c5f85d9bd77 100644 --- a/tests/baselines/reference/importExportInternalComments.symbols +++ b/tests/baselines/reference/importExportInternalComments.symbols @@ -4,7 +4,7 @@ declare module "foo"; === tests/cases/compiler/default.ts === /*1*/ export /*2*/ default /*3*/ Array /*4*/; ->Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 2 more) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 3 more) === tests/cases/compiler/index.ts === /*1*/ import /*2*/ D /*3*/, /*4*/ { /*5*/ A /*6*/, /*7*/ B /*8*/ as /*9*/ C /*10*/ } /*11*/ from /*12*/ "foo"; diff --git a/tests/baselines/reference/indexAt(target=es2021).errors.txt b/tests/baselines/reference/indexAt(target=es2021).errors.txt new file mode 100644 index 0000000000000..9307c2f7d5623 --- /dev/null +++ b/tests/baselines/reference/indexAt(target=es2021).errors.txt @@ -0,0 +1,56 @@ +tests/cases/compiler/indexAt.ts(1,5): error TS2550: Property 'at' does not exist on type 'number[]'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2022' or later. +tests/cases/compiler/indexAt.ts(2,7): error TS2550: Property 'at' does not exist on type '"foo"'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2022' or later. +tests/cases/compiler/indexAt.ts(3,17): error TS2550: Property 'at' does not exist on type 'Int8Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2022' or later. +tests/cases/compiler/indexAt.ts(4,18): error TS2550: Property 'at' does not exist on type 'Uint8Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2022' or later. +tests/cases/compiler/indexAt.ts(5,25): error TS2550: Property 'at' does not exist on type 'Uint8ClampedArray'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2022' or later. +tests/cases/compiler/indexAt.ts(6,18): error TS2550: Property 'at' does not exist on type 'Int16Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2022' or later. +tests/cases/compiler/indexAt.ts(7,19): error TS2550: Property 'at' does not exist on type 'Uint16Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2022' or later. +tests/cases/compiler/indexAt.ts(8,18): error TS2550: Property 'at' does not exist on type 'Int32Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2022' or later. +tests/cases/compiler/indexAt.ts(9,19): error TS2550: Property 'at' does not exist on type 'Uint32Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2022' or later. +tests/cases/compiler/indexAt.ts(10,20): error TS2550: Property 'at' does not exist on type 'Float32Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2022' or later. +tests/cases/compiler/indexAt.ts(11,20): error TS2550: Property 'at' does not exist on type 'Float64Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2022' or later. +tests/cases/compiler/indexAt.ts(12,21): error TS2550: Property 'at' does not exist on type 'BigInt64Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2022' or later. +tests/cases/compiler/indexAt.ts(13,22): error TS2550: Property 'at' does not exist on type 'BigUint64Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2022' or later. + + +==== tests/cases/compiler/indexAt.ts (13 errors) ==== + [0].at(0); + ~~ +!!! error TS2550: Property 'at' does not exist on type 'number[]'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2022' or later. + "foo".at(0); + ~~ +!!! error TS2550: Property 'at' does not exist on type '"foo"'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2022' or later. + new Int8Array().at(0); + ~~ +!!! error TS2550: Property 'at' does not exist on type 'Int8Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2022' or later. + new Uint8Array().at(0); + ~~ +!!! error TS2550: Property 'at' does not exist on type 'Uint8Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2022' or later. + new Uint8ClampedArray().at(0); + ~~ +!!! error TS2550: Property 'at' does not exist on type 'Uint8ClampedArray'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2022' or later. + new Int16Array().at(0); + ~~ +!!! error TS2550: Property 'at' does not exist on type 'Int16Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2022' or later. + new Uint16Array().at(0); + ~~ +!!! error TS2550: Property 'at' does not exist on type 'Uint16Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2022' or later. + new Int32Array().at(0); + ~~ +!!! error TS2550: Property 'at' does not exist on type 'Int32Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2022' or later. + new Uint32Array().at(0); + ~~ +!!! error TS2550: Property 'at' does not exist on type 'Uint32Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2022' or later. + new Float32Array().at(0); + ~~ +!!! error TS2550: Property 'at' does not exist on type 'Float32Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2022' or later. + new Float64Array().at(0); + ~~ +!!! error TS2550: Property 'at' does not exist on type 'Float64Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2022' or later. + new BigInt64Array().at(0); + ~~ +!!! error TS2550: Property 'at' does not exist on type 'BigInt64Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2022' or later. + new BigUint64Array().at(0); + ~~ +!!! error TS2550: Property 'at' does not exist on type 'BigUint64Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2022' or later. + \ No newline at end of file diff --git a/tests/baselines/reference/indexAt(target=es2021).js b/tests/baselines/reference/indexAt(target=es2021).js new file mode 100644 index 0000000000000..01ffbff491904 --- /dev/null +++ b/tests/baselines/reference/indexAt(target=es2021).js @@ -0,0 +1,30 @@ +//// [indexAt.ts] +[0].at(0); +"foo".at(0); +new Int8Array().at(0); +new Uint8Array().at(0); +new Uint8ClampedArray().at(0); +new Int16Array().at(0); +new Uint16Array().at(0); +new Int32Array().at(0); +new Uint32Array().at(0); +new Float32Array().at(0); +new Float64Array().at(0); +new BigInt64Array().at(0); +new BigUint64Array().at(0); + + +//// [indexAt.js] +[0].at(0); +"foo".at(0); +new Int8Array().at(0); +new Uint8Array().at(0); +new Uint8ClampedArray().at(0); +new Int16Array().at(0); +new Uint16Array().at(0); +new Int32Array().at(0); +new Uint32Array().at(0); +new Float32Array().at(0); +new Float64Array().at(0); +new BigInt64Array().at(0); +new BigUint64Array().at(0); diff --git a/tests/baselines/reference/indexAt(target=es2021).symbols b/tests/baselines/reference/indexAt(target=es2021).symbols new file mode 100644 index 0000000000000..383f372fadd3e --- /dev/null +++ b/tests/baselines/reference/indexAt(target=es2021).symbols @@ -0,0 +1,36 @@ +=== tests/cases/compiler/indexAt.ts === +[0].at(0); +"foo".at(0); +new Int8Array().at(0); +>Int8Array : Symbol(Int8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --)) + +new Uint8Array().at(0); +>Uint8Array : Symbol(Uint8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --)) + +new Uint8ClampedArray().at(0); +>Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --)) + +new Int16Array().at(0); +>Int16Array : Symbol(Int16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --)) + +new Uint16Array().at(0); +>Uint16Array : Symbol(Uint16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --)) + +new Int32Array().at(0); +>Int32Array : Symbol(Int32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --)) + +new Uint32Array().at(0); +>Uint32Array : Symbol(Uint32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --)) + +new Float32Array().at(0); +>Float32Array : Symbol(Float32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --)) + +new Float64Array().at(0); +>Float64Array : Symbol(Float64Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --)) + +new BigInt64Array().at(0); +>BigInt64Array : Symbol(BigInt64Array, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --)) + +new BigUint64Array().at(0); +>BigUint64Array : Symbol(BigUint64Array, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --)) + diff --git a/tests/baselines/reference/indexAt(target=es2021).types b/tests/baselines/reference/indexAt(target=es2021).types new file mode 100644 index 0000000000000..8229bcacb9328 --- /dev/null +++ b/tests/baselines/reference/indexAt(target=es2021).types @@ -0,0 +1,104 @@ +=== tests/cases/compiler/indexAt.ts === +[0].at(0); +>[0].at(0) : any +>[0].at : any +>[0] : number[] +>0 : 0 +>at : any +>0 : 0 + +"foo".at(0); +>"foo".at(0) : any +>"foo".at : any +>"foo" : "foo" +>at : any +>0 : 0 + +new Int8Array().at(0); +>new Int8Array().at(0) : any +>new Int8Array().at : any +>new Int8Array() : Int8Array +>Int8Array : Int8ArrayConstructor +>at : any +>0 : 0 + +new Uint8Array().at(0); +>new Uint8Array().at(0) : any +>new Uint8Array().at : any +>new Uint8Array() : Uint8Array +>Uint8Array : Uint8ArrayConstructor +>at : any +>0 : 0 + +new Uint8ClampedArray().at(0); +>new Uint8ClampedArray().at(0) : any +>new Uint8ClampedArray().at : any +>new Uint8ClampedArray() : Uint8ClampedArray +>Uint8ClampedArray : Uint8ClampedArrayConstructor +>at : any +>0 : 0 + +new Int16Array().at(0); +>new Int16Array().at(0) : any +>new Int16Array().at : any +>new Int16Array() : Int16Array +>Int16Array : Int16ArrayConstructor +>at : any +>0 : 0 + +new Uint16Array().at(0); +>new Uint16Array().at(0) : any +>new Uint16Array().at : any +>new Uint16Array() : Uint16Array +>Uint16Array : Uint16ArrayConstructor +>at : any +>0 : 0 + +new Int32Array().at(0); +>new Int32Array().at(0) : any +>new Int32Array().at : any +>new Int32Array() : Int32Array +>Int32Array : Int32ArrayConstructor +>at : any +>0 : 0 + +new Uint32Array().at(0); +>new Uint32Array().at(0) : any +>new Uint32Array().at : any +>new Uint32Array() : Uint32Array +>Uint32Array : Uint32ArrayConstructor +>at : any +>0 : 0 + +new Float32Array().at(0); +>new Float32Array().at(0) : any +>new Float32Array().at : any +>new Float32Array() : Float32Array +>Float32Array : Float32ArrayConstructor +>at : any +>0 : 0 + +new Float64Array().at(0); +>new Float64Array().at(0) : any +>new Float64Array().at : any +>new Float64Array() : Float64Array +>Float64Array : Float64ArrayConstructor +>at : any +>0 : 0 + +new BigInt64Array().at(0); +>new BigInt64Array().at(0) : any +>new BigInt64Array().at : any +>new BigInt64Array() : BigInt64Array +>BigInt64Array : BigInt64ArrayConstructor +>at : any +>0 : 0 + +new BigUint64Array().at(0); +>new BigUint64Array().at(0) : any +>new BigUint64Array().at : any +>new BigUint64Array() : BigUint64Array +>BigUint64Array : BigUint64ArrayConstructor +>at : any +>0 : 0 + diff --git a/tests/baselines/reference/indexAt(target=es2022).js b/tests/baselines/reference/indexAt(target=es2022).js new file mode 100644 index 0000000000000..01ffbff491904 --- /dev/null +++ b/tests/baselines/reference/indexAt(target=es2022).js @@ -0,0 +1,30 @@ +//// [indexAt.ts] +[0].at(0); +"foo".at(0); +new Int8Array().at(0); +new Uint8Array().at(0); +new Uint8ClampedArray().at(0); +new Int16Array().at(0); +new Uint16Array().at(0); +new Int32Array().at(0); +new Uint32Array().at(0); +new Float32Array().at(0); +new Float64Array().at(0); +new BigInt64Array().at(0); +new BigUint64Array().at(0); + + +//// [indexAt.js] +[0].at(0); +"foo".at(0); +new Int8Array().at(0); +new Uint8Array().at(0); +new Uint8ClampedArray().at(0); +new Int16Array().at(0); +new Uint16Array().at(0); +new Int32Array().at(0); +new Uint32Array().at(0); +new Float32Array().at(0); +new Float64Array().at(0); +new BigInt64Array().at(0); +new BigUint64Array().at(0); diff --git a/tests/baselines/reference/indexAt(target=es2022).symbols b/tests/baselines/reference/indexAt(target=es2022).symbols new file mode 100644 index 0000000000000..09b7425331f42 --- /dev/null +++ b/tests/baselines/reference/indexAt(target=es2022).symbols @@ -0,0 +1,64 @@ +=== tests/cases/compiler/indexAt.ts === +[0].at(0); +>[0].at : Symbol(Array.at, Decl(lib.es2022.array.d.ts, --, --)) +>at : Symbol(Array.at, Decl(lib.es2022.array.d.ts, --, --)) + +"foo".at(0); +>"foo".at : Symbol(String.at, Decl(lib.es2022.string.d.ts, --, --)) +>at : Symbol(String.at, Decl(lib.es2022.string.d.ts, --, --)) + +new Int8Array().at(0); +>new Int8Array().at : Symbol(Int8Array.at, Decl(lib.es2022.array.d.ts, --, --)) +>Int8Array : Symbol(Int8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 1 more) +>at : Symbol(Int8Array.at, Decl(lib.es2022.array.d.ts, --, --)) + +new Uint8Array().at(0); +>new Uint8Array().at : Symbol(Uint8Array.at, Decl(lib.es2022.array.d.ts, --, --)) +>Uint8Array : Symbol(Uint8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 1 more) +>at : Symbol(Uint8Array.at, Decl(lib.es2022.array.d.ts, --, --)) + +new Uint8ClampedArray().at(0); +>new Uint8ClampedArray().at : Symbol(Uint8ClampedArray.at, Decl(lib.es2022.array.d.ts, --, --)) +>Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 1 more) +>at : Symbol(Uint8ClampedArray.at, Decl(lib.es2022.array.d.ts, --, --)) + +new Int16Array().at(0); +>new Int16Array().at : Symbol(Int16Array.at, Decl(lib.es2022.array.d.ts, --, --)) +>Int16Array : Symbol(Int16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 1 more) +>at : Symbol(Int16Array.at, Decl(lib.es2022.array.d.ts, --, --)) + +new Uint16Array().at(0); +>new Uint16Array().at : Symbol(Uint16Array.at, Decl(lib.es2022.array.d.ts, --, --)) +>Uint16Array : Symbol(Uint16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 1 more) +>at : Symbol(Uint16Array.at, Decl(lib.es2022.array.d.ts, --, --)) + +new Int32Array().at(0); +>new Int32Array().at : Symbol(Int32Array.at, Decl(lib.es2022.array.d.ts, --, --)) +>Int32Array : Symbol(Int32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 1 more) +>at : Symbol(Int32Array.at, Decl(lib.es2022.array.d.ts, --, --)) + +new Uint32Array().at(0); +>new Uint32Array().at : Symbol(Uint32Array.at, Decl(lib.es2022.array.d.ts, --, --)) +>Uint32Array : Symbol(Uint32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 1 more) +>at : Symbol(Uint32Array.at, Decl(lib.es2022.array.d.ts, --, --)) + +new Float32Array().at(0); +>new Float32Array().at : Symbol(Float32Array.at, Decl(lib.es2022.array.d.ts, --, --)) +>Float32Array : Symbol(Float32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 1 more) +>at : Symbol(Float32Array.at, Decl(lib.es2022.array.d.ts, --, --)) + +new Float64Array().at(0); +>new Float64Array().at : Symbol(Float64Array.at, Decl(lib.es2022.array.d.ts, --, --)) +>Float64Array : Symbol(Float64Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 1 more) +>at : Symbol(Float64Array.at, Decl(lib.es2022.array.d.ts, --, --)) + +new BigInt64Array().at(0); +>new BigInt64Array().at : Symbol(BigInt64Array.at, Decl(lib.es2022.array.d.ts, --, --)) +>BigInt64Array : Symbol(BigInt64Array, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2022.array.d.ts, --, --)) +>at : Symbol(BigInt64Array.at, Decl(lib.es2022.array.d.ts, --, --)) + +new BigUint64Array().at(0); +>new BigUint64Array().at : Symbol(BigUint64Array.at, Decl(lib.es2022.array.d.ts, --, --)) +>BigUint64Array : Symbol(BigUint64Array, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2022.array.d.ts, --, --)) +>at : Symbol(BigUint64Array.at, Decl(lib.es2022.array.d.ts, --, --)) + diff --git a/tests/baselines/reference/indexAt(target=es2022).types b/tests/baselines/reference/indexAt(target=es2022).types new file mode 100644 index 0000000000000..acd40c3f67572 --- /dev/null +++ b/tests/baselines/reference/indexAt(target=es2022).types @@ -0,0 +1,104 @@ +=== tests/cases/compiler/indexAt.ts === +[0].at(0); +>[0].at(0) : number +>[0].at : (index: number) => number +>[0] : number[] +>0 : 0 +>at : (index: number) => number +>0 : 0 + +"foo".at(0); +>"foo".at(0) : string +>"foo".at : (index: number) => string +>"foo" : "foo" +>at : (index: number) => string +>0 : 0 + +new Int8Array().at(0); +>new Int8Array().at(0) : number +>new Int8Array().at : (index: number) => number +>new Int8Array() : Int8Array +>Int8Array : Int8ArrayConstructor +>at : (index: number) => number +>0 : 0 + +new Uint8Array().at(0); +>new Uint8Array().at(0) : number +>new Uint8Array().at : (index: number) => number +>new Uint8Array() : Uint8Array +>Uint8Array : Uint8ArrayConstructor +>at : (index: number) => number +>0 : 0 + +new Uint8ClampedArray().at(0); +>new Uint8ClampedArray().at(0) : number +>new Uint8ClampedArray().at : (index: number) => number +>new Uint8ClampedArray() : Uint8ClampedArray +>Uint8ClampedArray : Uint8ClampedArrayConstructor +>at : (index: number) => number +>0 : 0 + +new Int16Array().at(0); +>new Int16Array().at(0) : number +>new Int16Array().at : (index: number) => number +>new Int16Array() : Int16Array +>Int16Array : Int16ArrayConstructor +>at : (index: number) => number +>0 : 0 + +new Uint16Array().at(0); +>new Uint16Array().at(0) : number +>new Uint16Array().at : (index: number) => number +>new Uint16Array() : Uint16Array +>Uint16Array : Uint16ArrayConstructor +>at : (index: number) => number +>0 : 0 + +new Int32Array().at(0); +>new Int32Array().at(0) : number +>new Int32Array().at : (index: number) => number +>new Int32Array() : Int32Array +>Int32Array : Int32ArrayConstructor +>at : (index: number) => number +>0 : 0 + +new Uint32Array().at(0); +>new Uint32Array().at(0) : number +>new Uint32Array().at : (index: number) => number +>new Uint32Array() : Uint32Array +>Uint32Array : Uint32ArrayConstructor +>at : (index: number) => number +>0 : 0 + +new Float32Array().at(0); +>new Float32Array().at(0) : number +>new Float32Array().at : (index: number) => number +>new Float32Array() : Float32Array +>Float32Array : Float32ArrayConstructor +>at : (index: number) => number +>0 : 0 + +new Float64Array().at(0); +>new Float64Array().at(0) : number +>new Float64Array().at : (index: number) => number +>new Float64Array() : Float64Array +>Float64Array : Float64ArrayConstructor +>at : (index: number) => number +>0 : 0 + +new BigInt64Array().at(0); +>new BigInt64Array().at(0) : bigint +>new BigInt64Array().at : (index: number) => bigint +>new BigInt64Array() : BigInt64Array +>BigInt64Array : BigInt64ArrayConstructor +>at : (index: number) => bigint +>0 : 0 + +new BigUint64Array().at(0); +>new BigUint64Array().at(0) : bigint +>new BigUint64Array().at : (index: number) => bigint +>new BigUint64Array() : BigUint64Array +>BigUint64Array : BigUint64ArrayConstructor +>at : (index: number) => bigint +>0 : 0 + diff --git a/tests/baselines/reference/indexAt(target=esnext).js b/tests/baselines/reference/indexAt(target=esnext).js new file mode 100644 index 0000000000000..01ffbff491904 --- /dev/null +++ b/tests/baselines/reference/indexAt(target=esnext).js @@ -0,0 +1,30 @@ +//// [indexAt.ts] +[0].at(0); +"foo".at(0); +new Int8Array().at(0); +new Uint8Array().at(0); +new Uint8ClampedArray().at(0); +new Int16Array().at(0); +new Uint16Array().at(0); +new Int32Array().at(0); +new Uint32Array().at(0); +new Float32Array().at(0); +new Float64Array().at(0); +new BigInt64Array().at(0); +new BigUint64Array().at(0); + + +//// [indexAt.js] +[0].at(0); +"foo".at(0); +new Int8Array().at(0); +new Uint8Array().at(0); +new Uint8ClampedArray().at(0); +new Int16Array().at(0); +new Uint16Array().at(0); +new Int32Array().at(0); +new Uint32Array().at(0); +new Float32Array().at(0); +new Float64Array().at(0); +new BigInt64Array().at(0); +new BigUint64Array().at(0); diff --git a/tests/baselines/reference/indexAt(target=esnext).symbols b/tests/baselines/reference/indexAt(target=esnext).symbols new file mode 100644 index 0000000000000..09b7425331f42 --- /dev/null +++ b/tests/baselines/reference/indexAt(target=esnext).symbols @@ -0,0 +1,64 @@ +=== tests/cases/compiler/indexAt.ts === +[0].at(0); +>[0].at : Symbol(Array.at, Decl(lib.es2022.array.d.ts, --, --)) +>at : Symbol(Array.at, Decl(lib.es2022.array.d.ts, --, --)) + +"foo".at(0); +>"foo".at : Symbol(String.at, Decl(lib.es2022.string.d.ts, --, --)) +>at : Symbol(String.at, Decl(lib.es2022.string.d.ts, --, --)) + +new Int8Array().at(0); +>new Int8Array().at : Symbol(Int8Array.at, Decl(lib.es2022.array.d.ts, --, --)) +>Int8Array : Symbol(Int8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 1 more) +>at : Symbol(Int8Array.at, Decl(lib.es2022.array.d.ts, --, --)) + +new Uint8Array().at(0); +>new Uint8Array().at : Symbol(Uint8Array.at, Decl(lib.es2022.array.d.ts, --, --)) +>Uint8Array : Symbol(Uint8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 1 more) +>at : Symbol(Uint8Array.at, Decl(lib.es2022.array.d.ts, --, --)) + +new Uint8ClampedArray().at(0); +>new Uint8ClampedArray().at : Symbol(Uint8ClampedArray.at, Decl(lib.es2022.array.d.ts, --, --)) +>Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 1 more) +>at : Symbol(Uint8ClampedArray.at, Decl(lib.es2022.array.d.ts, --, --)) + +new Int16Array().at(0); +>new Int16Array().at : Symbol(Int16Array.at, Decl(lib.es2022.array.d.ts, --, --)) +>Int16Array : Symbol(Int16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 1 more) +>at : Symbol(Int16Array.at, Decl(lib.es2022.array.d.ts, --, --)) + +new Uint16Array().at(0); +>new Uint16Array().at : Symbol(Uint16Array.at, Decl(lib.es2022.array.d.ts, --, --)) +>Uint16Array : Symbol(Uint16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 1 more) +>at : Symbol(Uint16Array.at, Decl(lib.es2022.array.d.ts, --, --)) + +new Int32Array().at(0); +>new Int32Array().at : Symbol(Int32Array.at, Decl(lib.es2022.array.d.ts, --, --)) +>Int32Array : Symbol(Int32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 1 more) +>at : Symbol(Int32Array.at, Decl(lib.es2022.array.d.ts, --, --)) + +new Uint32Array().at(0); +>new Uint32Array().at : Symbol(Uint32Array.at, Decl(lib.es2022.array.d.ts, --, --)) +>Uint32Array : Symbol(Uint32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 1 more) +>at : Symbol(Uint32Array.at, Decl(lib.es2022.array.d.ts, --, --)) + +new Float32Array().at(0); +>new Float32Array().at : Symbol(Float32Array.at, Decl(lib.es2022.array.d.ts, --, --)) +>Float32Array : Symbol(Float32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 1 more) +>at : Symbol(Float32Array.at, Decl(lib.es2022.array.d.ts, --, --)) + +new Float64Array().at(0); +>new Float64Array().at : Symbol(Float64Array.at, Decl(lib.es2022.array.d.ts, --, --)) +>Float64Array : Symbol(Float64Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 1 more) +>at : Symbol(Float64Array.at, Decl(lib.es2022.array.d.ts, --, --)) + +new BigInt64Array().at(0); +>new BigInt64Array().at : Symbol(BigInt64Array.at, Decl(lib.es2022.array.d.ts, --, --)) +>BigInt64Array : Symbol(BigInt64Array, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2022.array.d.ts, --, --)) +>at : Symbol(BigInt64Array.at, Decl(lib.es2022.array.d.ts, --, --)) + +new BigUint64Array().at(0); +>new BigUint64Array().at : Symbol(BigUint64Array.at, Decl(lib.es2022.array.d.ts, --, --)) +>BigUint64Array : Symbol(BigUint64Array, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2022.array.d.ts, --, --)) +>at : Symbol(BigUint64Array.at, Decl(lib.es2022.array.d.ts, --, --)) + diff --git a/tests/baselines/reference/indexAt(target=esnext).types b/tests/baselines/reference/indexAt(target=esnext).types new file mode 100644 index 0000000000000..acd40c3f67572 --- /dev/null +++ b/tests/baselines/reference/indexAt(target=esnext).types @@ -0,0 +1,104 @@ +=== tests/cases/compiler/indexAt.ts === +[0].at(0); +>[0].at(0) : number +>[0].at : (index: number) => number +>[0] : number[] +>0 : 0 +>at : (index: number) => number +>0 : 0 + +"foo".at(0); +>"foo".at(0) : string +>"foo".at : (index: number) => string +>"foo" : "foo" +>at : (index: number) => string +>0 : 0 + +new Int8Array().at(0); +>new Int8Array().at(0) : number +>new Int8Array().at : (index: number) => number +>new Int8Array() : Int8Array +>Int8Array : Int8ArrayConstructor +>at : (index: number) => number +>0 : 0 + +new Uint8Array().at(0); +>new Uint8Array().at(0) : number +>new Uint8Array().at : (index: number) => number +>new Uint8Array() : Uint8Array +>Uint8Array : Uint8ArrayConstructor +>at : (index: number) => number +>0 : 0 + +new Uint8ClampedArray().at(0); +>new Uint8ClampedArray().at(0) : number +>new Uint8ClampedArray().at : (index: number) => number +>new Uint8ClampedArray() : Uint8ClampedArray +>Uint8ClampedArray : Uint8ClampedArrayConstructor +>at : (index: number) => number +>0 : 0 + +new Int16Array().at(0); +>new Int16Array().at(0) : number +>new Int16Array().at : (index: number) => number +>new Int16Array() : Int16Array +>Int16Array : Int16ArrayConstructor +>at : (index: number) => number +>0 : 0 + +new Uint16Array().at(0); +>new Uint16Array().at(0) : number +>new Uint16Array().at : (index: number) => number +>new Uint16Array() : Uint16Array +>Uint16Array : Uint16ArrayConstructor +>at : (index: number) => number +>0 : 0 + +new Int32Array().at(0); +>new Int32Array().at(0) : number +>new Int32Array().at : (index: number) => number +>new Int32Array() : Int32Array +>Int32Array : Int32ArrayConstructor +>at : (index: number) => number +>0 : 0 + +new Uint32Array().at(0); +>new Uint32Array().at(0) : number +>new Uint32Array().at : (index: number) => number +>new Uint32Array() : Uint32Array +>Uint32Array : Uint32ArrayConstructor +>at : (index: number) => number +>0 : 0 + +new Float32Array().at(0); +>new Float32Array().at(0) : number +>new Float32Array().at : (index: number) => number +>new Float32Array() : Float32Array +>Float32Array : Float32ArrayConstructor +>at : (index: number) => number +>0 : 0 + +new Float64Array().at(0); +>new Float64Array().at(0) : number +>new Float64Array().at : (index: number) => number +>new Float64Array() : Float64Array +>Float64Array : Float64ArrayConstructor +>at : (index: number) => number +>0 : 0 + +new BigInt64Array().at(0); +>new BigInt64Array().at(0) : bigint +>new BigInt64Array().at : (index: number) => bigint +>new BigInt64Array() : BigInt64Array +>BigInt64Array : BigInt64ArrayConstructor +>at : (index: number) => bigint +>0 : 0 + +new BigUint64Array().at(0); +>new BigUint64Array().at(0) : bigint +>new BigUint64Array().at : (index: number) => bigint +>new BigUint64Array() : BigUint64Array +>BigUint64Array : BigUint64ArrayConstructor +>at : (index: number) => bigint +>0 : 0 + diff --git a/tests/baselines/reference/inferenceOptionalPropertiesToIndexSignatures.symbols b/tests/baselines/reference/inferenceOptionalPropertiesToIndexSignatures.symbols index 9874e516a2b75..72d4478539d77 100644 --- a/tests/baselines/reference/inferenceOptionalPropertiesToIndexSignatures.symbols +++ b/tests/baselines/reference/inferenceOptionalPropertiesToIndexSignatures.symbols @@ -72,7 +72,7 @@ const query = Object.entries(obj).map( >Object.entries(obj).map( ([k, v]) => `${k}=${encodeURIComponent(v)}`).join : Symbol(Array.join, Decl(lib.es5.d.ts, --, --)) >Object.entries(obj).map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --)) >Object.entries : Symbol(ObjectConstructor.entries, Decl(lib.es2017.object.d.ts, --, --), Decl(lib.es2017.object.d.ts, --, --)) ->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2022.object.d.ts, --, --)) >entries : Symbol(ObjectConstructor.entries, Decl(lib.es2017.object.d.ts, --, --), Decl(lib.es2017.object.d.ts, --, --)) >obj : Symbol(obj, Decl(inferenceOptionalPropertiesToIndexSignatures.ts, 16, 5)) >map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --)) diff --git a/tests/baselines/reference/keyofAndIndexedAccess2.symbols b/tests/baselines/reference/keyofAndIndexedAccess2.symbols index 1c3758c137d3e..a17aafe571aa5 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess2.symbols +++ b/tests/baselines/reference/keyofAndIndexedAccess2.symbols @@ -440,9 +440,9 @@ function fn} | {elements: Array}>(par >fn : Symbol(fn, Decl(keyofAndIndexedAccess2.ts, 115, 69)) >T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 119, 12)) >elements : Symbol(elements, Decl(keyofAndIndexedAccess2.ts, 119, 23)) ->Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 2 more) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 3 more) >elements : Symbol(elements, Decl(keyofAndIndexedAccess2.ts, 119, 51)) ->Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 2 more) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 3 more) >param : Symbol(param, Decl(keyofAndIndexedAccess2.ts, 119, 77)) >T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 119, 12)) >cb : Symbol(cb, Decl(keyofAndIndexedAccess2.ts, 119, 86)) @@ -459,7 +459,7 @@ function fn} | {elements: Array}>(par function fn2>(param: T, cb: (element: T[number]) => void) { >fn2 : Symbol(fn2, Decl(keyofAndIndexedAccess2.ts, 121, 1)) >T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 123, 13)) ->Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 2 more) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 3 more) >param : Symbol(param, Decl(keyofAndIndexedAccess2.ts, 123, 38)) >T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 123, 13)) >cb : Symbol(cb, Decl(keyofAndIndexedAccess2.ts, 123, 47)) @@ -476,7 +476,7 @@ function fn2>(param: T, cb: (element: T[number]) => void function fn3>(param: T, cb: (element: T[number]) => void) { >fn3 : Symbol(fn3, Decl(keyofAndIndexedAccess2.ts, 125, 1)) >T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 129, 13)) ->ReadonlyArray : Symbol(ReadonlyArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --), Decl(lib.es2019.array.d.ts, --, --)) +>ReadonlyArray : Symbol(ReadonlyArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --), Decl(lib.es2019.array.d.ts, --, --) ... and 1 more) >param : Symbol(param, Decl(keyofAndIndexedAccess2.ts, 129, 46)) >T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 129, 13)) >cb : Symbol(cb, Decl(keyofAndIndexedAccess2.ts, 129, 55)) @@ -494,12 +494,12 @@ function fn4() { let x: Array[K] = 'abc'; >x : Symbol(x, Decl(keyofAndIndexedAccess2.ts, 134, 7)) ->Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 2 more) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 3 more) >K : Symbol(K, Decl(keyofAndIndexedAccess2.ts, 133, 13)) let y: ReadonlyArray[K] = 'abc'; >y : Symbol(y, Decl(keyofAndIndexedAccess2.ts, 135, 7)) ->ReadonlyArray : Symbol(ReadonlyArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --), Decl(lib.es2019.array.d.ts, --, --)) +>ReadonlyArray : Symbol(ReadonlyArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --), Decl(lib.es2019.array.d.ts, --, --) ... and 1 more) >K : Symbol(K, Decl(keyofAndIndexedAccess2.ts, 133, 13)) } diff --git a/tests/baselines/reference/legacyNodeModulesExportsSpecifierGenerationConditions.js b/tests/baselines/reference/legacyNodeModulesExportsSpecifierGenerationConditions.js new file mode 100644 index 0000000000000..a4d9ac6d90b02 --- /dev/null +++ b/tests/baselines/reference/legacyNodeModulesExportsSpecifierGenerationConditions.js @@ -0,0 +1,84 @@ +//// [tests/cases/conformance/node/legacyNodeModulesExportsSpecifierGenerationConditions.ts] //// + +//// [index.ts] +export const a = async () => (await import("inner")).x(); +//// [index.d.ts] +export { x } from "./other.js"; +//// [other.d.ts] +import { Thing } from "./private.js" +export const x: () => Thing; +//// [private.d.ts] +export interface Thing {} // not exported in export map, inaccessible under new module modes +//// [package.json] +{ + "name": "package", + "private": true, + "type": "module", + "exports": "./index.js" +} +//// [package.json] +{ + "name": "inner", + "private": true, + "type": "module", + "exports": { + ".": { + "default": "./index.js" + }, + "./other": { + "default": "./other.js" + } + } +} + +//// [index.js] +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __generator = (this && this.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; +exports.__esModule = true; +exports.a = void 0; +var a = function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, Promise.resolve().then(function () { return require("inner"); })]; + case 1: return [2 /*return*/, (_a.sent()).x()]; + } +}); }); }; +exports.a = a; + + +//// [index.d.ts] +export declare const a: () => Promise; diff --git a/tests/baselines/reference/legacyNodeModulesExportsSpecifierGenerationConditions.symbols b/tests/baselines/reference/legacyNodeModulesExportsSpecifierGenerationConditions.symbols new file mode 100644 index 0000000000000..ee12f2e974ae8 --- /dev/null +++ b/tests/baselines/reference/legacyNodeModulesExportsSpecifierGenerationConditions.symbols @@ -0,0 +1,23 @@ +=== tests/cases/conformance/node/index.ts === +export const a = async () => (await import("inner")).x(); +>a : Symbol(a, Decl(index.ts, 0, 12)) +>(await import("inner")).x : Symbol(x, Decl(index.d.ts, 0, 8)) +>"inner" : Symbol("tests/cases/conformance/node/node_modules/inner/index", Decl(index.d.ts, 0, 0)) +>x : Symbol(x, Decl(index.d.ts, 0, 8)) + +=== tests/cases/conformance/node/node_modules/inner/index.d.ts === +export { x } from "./other.js"; +>x : Symbol(x, Decl(index.d.ts, 0, 8)) + +=== tests/cases/conformance/node/node_modules/inner/other.d.ts === +import { Thing } from "./private.js" +>Thing : Symbol(Thing, Decl(other.d.ts, 0, 8)) + +export const x: () => Thing; +>x : Symbol(x, Decl(other.d.ts, 1, 12)) +>Thing : Symbol(Thing, Decl(other.d.ts, 0, 8)) + +=== tests/cases/conformance/node/node_modules/inner/private.d.ts === +export interface Thing {} // not exported in export map, inaccessible under new module modes +>Thing : Symbol(Thing, Decl(private.d.ts, 0, 0)) + diff --git a/tests/baselines/reference/legacyNodeModulesExportsSpecifierGenerationConditions.types b/tests/baselines/reference/legacyNodeModulesExportsSpecifierGenerationConditions.types new file mode 100644 index 0000000000000..b0aa85034178d --- /dev/null +++ b/tests/baselines/reference/legacyNodeModulesExportsSpecifierGenerationConditions.types @@ -0,0 +1,26 @@ +=== tests/cases/conformance/node/index.ts === +export const a = async () => (await import("inner")).x(); +>a : () => Promise +>async () => (await import("inner")).x() : () => Promise +>(await import("inner")).x() : import("tests/cases/conformance/node/node_modules/inner/private").Thing +>(await import("inner")).x : () => import("tests/cases/conformance/node/node_modules/inner/private").Thing +>(await import("inner")) : typeof import("tests/cases/conformance/node/node_modules/inner/index") +>await import("inner") : typeof import("tests/cases/conformance/node/node_modules/inner/index") +>import("inner") : Promise +>"inner" : "inner" +>x : () => import("tests/cases/conformance/node/node_modules/inner/private").Thing + +=== tests/cases/conformance/node/node_modules/inner/index.d.ts === +export { x } from "./other.js"; +>x : () => import("tests/cases/conformance/node/node_modules/inner/private").Thing + +=== tests/cases/conformance/node/node_modules/inner/other.d.ts === +import { Thing } from "./private.js" +>Thing : any + +export const x: () => Thing; +>x : () => Thing + +=== tests/cases/conformance/node/node_modules/inner/private.d.ts === +export interface Thing {} // not exported in export map, inaccessible under new module modes +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/noImplicitAnyNamelessParameter.errors.txt b/tests/baselines/reference/noImplicitAnyNamelessParameter.errors.txt index 9dc95461d63c1..c93dd533a1ef5 100644 --- a/tests/baselines/reference/noImplicitAnyNamelessParameter.errors.txt +++ b/tests/baselines/reference/noImplicitAnyNamelessParameter.errors.txt @@ -1,26 +1,30 @@ -tests/cases/compiler/noImplicitAnyNamelessParameter.ts(2,17): error TS7051: Parameter has a name but no type. Did you mean 'arg0: string'? -tests/cases/compiler/noImplicitAnyNamelessParameter.ts(2,25): error TS7051: Parameter has a name but no type. Did you mean 'arg1: C'? -tests/cases/compiler/noImplicitAnyNamelessParameter.ts(3,19): error TS7051: Parameter has a name but no type. Did you mean 'arg0: C'? -tests/cases/compiler/noImplicitAnyNamelessParameter.ts(3,22): error TS7051: Parameter has a name but no type. Did you mean 'arg1: number'? -tests/cases/compiler/noImplicitAnyNamelessParameter.ts(4,20): error TS7051: Parameter has a name but no type. Did you mean 'arg0: boolean'? -tests/cases/compiler/noImplicitAnyNamelessParameter.ts(4,29): error TS7051: Parameter has a name but no type. Did you mean 'arg1: C'? -tests/cases/compiler/noImplicitAnyNamelessParameter.ts(4,32): error TS7051: Parameter has a name but no type. Did you mean 'arg2: object'? -tests/cases/compiler/noImplicitAnyNamelessParameter.ts(4,40): error TS7051: Parameter has a name but no type. Did you mean 'arg3: undefined'? +tests/cases/compiler/noImplicitAnyNamelessParameter.ts(2,20): error TS7051: Parameter has a name but no type. Did you mean 'arg0: string[]'? +tests/cases/compiler/noImplicitAnyNamelessParameter.ts(3,17): error TS7051: Parameter has a name but no type. Did you mean 'arg0: string'? +tests/cases/compiler/noImplicitAnyNamelessParameter.ts(3,25): error TS7051: Parameter has a name but no type. Did you mean 'arg1: C'? +tests/cases/compiler/noImplicitAnyNamelessParameter.ts(4,19): error TS7051: Parameter has a name but no type. Did you mean 'arg0: C'? +tests/cases/compiler/noImplicitAnyNamelessParameter.ts(4,22): error TS7051: Parameter has a name but no type. Did you mean 'arg1: number'? +tests/cases/compiler/noImplicitAnyNamelessParameter.ts(5,20): error TS7051: Parameter has a name but no type. Did you mean 'arg0: boolean'? +tests/cases/compiler/noImplicitAnyNamelessParameter.ts(5,29): error TS7051: Parameter has a name but no type. Did you mean 'arg1: C'? +tests/cases/compiler/noImplicitAnyNamelessParameter.ts(5,32): error TS7051: Parameter has a name but no type. Did you mean 'arg2: object'? +tests/cases/compiler/noImplicitAnyNamelessParameter.ts(5,40): error TS7051: Parameter has a name but no type. Did you mean 'arg3: undefined'? -==== tests/cases/compiler/noImplicitAnyNamelessParameter.ts (8 errors) ==== +==== tests/cases/compiler/noImplicitAnyNamelessParameter.ts (9 errors) ==== class C { } - declare var x: (string, C) => void; + declare var a: { m(...string): void } + ~~~~~~~~~ +!!! error TS7051: Parameter has a name but no type. Did you mean 'arg0: string[]'? + declare var b: (string, C) => void; ~~~~~~ !!! error TS7051: Parameter has a name but no type. Did you mean 'arg0: string'? ~ !!! error TS7051: Parameter has a name but no type. Did you mean 'arg1: C'? - declare var y: { (C, number): void }; + declare var c: { (C, number): void }; ~ !!! error TS7051: Parameter has a name but no type. Did you mean 'arg0: C'? ~~~~~~ !!! error TS7051: Parameter has a name but no type. Did you mean 'arg1: number'? - declare var z: { m(boolean, C, object, undefined): void } + declare var d: { m(boolean, C, object, undefined): void } ~~~~~~~ !!! error TS7051: Parameter has a name but no type. Did you mean 'arg0: boolean'? ~ diff --git a/tests/baselines/reference/noImplicitAnyNamelessParameter.js b/tests/baselines/reference/noImplicitAnyNamelessParameter.js index 39d7e644578b3..5fabc25b94043 100644 --- a/tests/baselines/reference/noImplicitAnyNamelessParameter.js +++ b/tests/baselines/reference/noImplicitAnyNamelessParameter.js @@ -1,8 +1,9 @@ //// [noImplicitAnyNamelessParameter.ts] class C { } -declare var x: (string, C) => void; -declare var y: { (C, number): void }; -declare var z: { m(boolean, C, object, undefined): void } +declare var a: { m(...string): void } +declare var b: (string, C) => void; +declare var c: { (C, number): void }; +declare var d: { m(boolean, C, object, undefined): void } // note: null and void do not parse correctly without a preceding parameter name diff --git a/tests/baselines/reference/noImplicitAnyNamelessParameter.symbols b/tests/baselines/reference/noImplicitAnyNamelessParameter.symbols index 2a22f5389d6bb..1662ce08e4693 100644 --- a/tests/baselines/reference/noImplicitAnyNamelessParameter.symbols +++ b/tests/baselines/reference/noImplicitAnyNamelessParameter.symbols @@ -2,23 +2,28 @@ class C { } >C : Symbol(C, Decl(noImplicitAnyNamelessParameter.ts, 0, 0)) -declare var x: (string, C) => void; ->x : Symbol(x, Decl(noImplicitAnyNamelessParameter.ts, 1, 11)) ->string : Symbol(string, Decl(noImplicitAnyNamelessParameter.ts, 1, 16)) ->C : Symbol(C, Decl(noImplicitAnyNamelessParameter.ts, 1, 23)) +declare var a: { m(...string): void } +>a : Symbol(a, Decl(noImplicitAnyNamelessParameter.ts, 1, 11)) +>m : Symbol(m, Decl(noImplicitAnyNamelessParameter.ts, 1, 16)) +>string : Symbol(string, Decl(noImplicitAnyNamelessParameter.ts, 1, 19)) -declare var y: { (C, number): void }; ->y : Symbol(y, Decl(noImplicitAnyNamelessParameter.ts, 2, 11)) ->C : Symbol(C, Decl(noImplicitAnyNamelessParameter.ts, 2, 18)) ->number : Symbol(number, Decl(noImplicitAnyNamelessParameter.ts, 2, 20)) +declare var b: (string, C) => void; +>b : Symbol(b, Decl(noImplicitAnyNamelessParameter.ts, 2, 11)) +>string : Symbol(string, Decl(noImplicitAnyNamelessParameter.ts, 2, 16)) +>C : Symbol(C, Decl(noImplicitAnyNamelessParameter.ts, 2, 23)) -declare var z: { m(boolean, C, object, undefined): void } ->z : Symbol(z, Decl(noImplicitAnyNamelessParameter.ts, 3, 11)) ->m : Symbol(m, Decl(noImplicitAnyNamelessParameter.ts, 3, 16)) ->boolean : Symbol(boolean, Decl(noImplicitAnyNamelessParameter.ts, 3, 19)) ->C : Symbol(C, Decl(noImplicitAnyNamelessParameter.ts, 3, 27)) ->object : Symbol(object, Decl(noImplicitAnyNamelessParameter.ts, 3, 30)) ->undefined : Symbol(undefined, Decl(noImplicitAnyNamelessParameter.ts, 3, 38)) +declare var c: { (C, number): void }; +>c : Symbol(c, Decl(noImplicitAnyNamelessParameter.ts, 3, 11)) +>C : Symbol(C, Decl(noImplicitAnyNamelessParameter.ts, 3, 18)) +>number : Symbol(number, Decl(noImplicitAnyNamelessParameter.ts, 3, 20)) + +declare var d: { m(boolean, C, object, undefined): void } +>d : Symbol(d, Decl(noImplicitAnyNamelessParameter.ts, 4, 11)) +>m : Symbol(m, Decl(noImplicitAnyNamelessParameter.ts, 4, 16)) +>boolean : Symbol(boolean, Decl(noImplicitAnyNamelessParameter.ts, 4, 19)) +>C : Symbol(C, Decl(noImplicitAnyNamelessParameter.ts, 4, 27)) +>object : Symbol(object, Decl(noImplicitAnyNamelessParameter.ts, 4, 30)) +>undefined : Symbol(undefined, Decl(noImplicitAnyNamelessParameter.ts, 4, 38)) // note: null and void do not parse correctly without a preceding parameter name diff --git a/tests/baselines/reference/noImplicitAnyNamelessParameter.types b/tests/baselines/reference/noImplicitAnyNamelessParameter.types index 7ab5cdcc4bdb7..bd274700b7e60 100644 --- a/tests/baselines/reference/noImplicitAnyNamelessParameter.types +++ b/tests/baselines/reference/noImplicitAnyNamelessParameter.types @@ -2,18 +2,23 @@ class C { } >C : C -declare var x: (string, C) => void; ->x : (string: any, C: any) => void +declare var a: { m(...string): void } +>a : { m(...string: any[]): void; } +>m : (...string: any[]) => void +>string : any[] + +declare var b: (string, C) => void; +>b : (string: any, C: any) => void >string : any >C : any -declare var y: { (C, number): void }; ->y : (C: any, number: any) => void +declare var c: { (C, number): void }; +>c : (C: any, number: any) => void >C : any >number : any -declare var z: { m(boolean, C, object, undefined): void } ->z : { m(boolean: any, C: any, object: any, undefined: any): void; } +declare var d: { m(boolean, C, object, undefined): void } +>d : { m(boolean: any, C: any, object: any, undefined: any): void; } >m : (boolean: any, C: any, object: any, undefined: any) => void >boolean : any >C : any diff --git a/tests/baselines/reference/noIterationTypeErrorsInCFA.symbols b/tests/baselines/reference/noIterationTypeErrorsInCFA.symbols index 3498f52d456f3..60040c3ed17c4 100644 --- a/tests/baselines/reference/noIterationTypeErrorsInCFA.symbols +++ b/tests/baselines/reference/noIterationTypeErrorsInCFA.symbols @@ -13,7 +13,7 @@ export function doRemove(dds: F | F[]) { if (!Array.isArray(dds)) { >Array.isArray : Symbol(ArrayConstructor.isArray, Decl(lib.es5.d.ts, --, --)) ->Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 2 more) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 3 more) >isArray : Symbol(ArrayConstructor.isArray, Decl(lib.es5.d.ts, --, --)) >dds : Symbol(dds, Decl(noIterationTypeErrorsInCFA.ts, 3, 25)) diff --git a/tests/baselines/reference/reactJsxReactResolvedNodeNext.trace.json b/tests/baselines/reference/reactJsxReactResolvedNodeNext.trace.json index 00597f669b34b..ed76bdb1760bc 100644 --- a/tests/baselines/reference/reactJsxReactResolvedNodeNext.trace.json +++ b/tests/baselines/reference/reactJsxReactResolvedNodeNext.trace.json @@ -131,5 +131,15 @@ "File 'package.json' does not exist according to earlier cached lookups.", "File '/package.json' does not exist according to earlier cached lookups.", "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", "File '/package.json' does not exist according to earlier cached lookups." ] \ No newline at end of file diff --git a/tests/baselines/reference/reactJsxReactResolvedNodeNextEsm.trace.json b/tests/baselines/reference/reactJsxReactResolvedNodeNextEsm.trace.json index 02a5d6a429932..7d2a5308b9e8b 100644 --- a/tests/baselines/reference/reactJsxReactResolvedNodeNextEsm.trace.json +++ b/tests/baselines/reference/reactJsxReactResolvedNodeNextEsm.trace.json @@ -125,5 +125,15 @@ "File 'package.json' does not exist according to earlier cached lookups.", "File '/package.json' does not exist according to earlier cached lookups.", "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", "File '/package.json' does not exist according to earlier cached lookups." ] \ No newline at end of file diff --git a/tests/baselines/reference/recursiveConditionalTypes.symbols b/tests/baselines/reference/recursiveConditionalTypes.symbols index 3c77d93e71f13..e9b58df3c28a3 100644 --- a/tests/baselines/reference/recursiveConditionalTypes.symbols +++ b/tests/baselines/reference/recursiveConditionalTypes.symbols @@ -566,7 +566,7 @@ let five: Add<2, 3>; type _PrependNextNum> = A['length'] extends infer T >_PrependNextNum : Symbol(_PrependNextNum, Decl(recursiveConditionalTypes.ts, 147, 20)) >A : Symbol(A, Decl(recursiveConditionalTypes.ts, 151, 21)) ->Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 2 more) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 3 more) >A : Symbol(A, Decl(recursiveConditionalTypes.ts, 151, 21)) >T : Symbol(T, Decl(recursiveConditionalTypes.ts, 151, 74)) @@ -584,7 +584,7 @@ type _PrependNextNum> = A['length'] extends infer T type _Enumerate, N extends number> = N extends A['length'] >_Enumerate : Symbol(_Enumerate, Decl(recursiveConditionalTypes.ts, 155, 12)) >A : Symbol(A, Decl(recursiveConditionalTypes.ts, 157, 16)) ->Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 2 more) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 3 more) >N : Symbol(N, Decl(recursiveConditionalTypes.ts, 157, 41)) >N : Symbol(N, Decl(recursiveConditionalTypes.ts, 157, 41)) >A : Symbol(A, Decl(recursiveConditionalTypes.ts, 157, 16)) diff --git a/tests/baselines/reference/spreadUnion4.js b/tests/baselines/reference/spreadUnion4.js new file mode 100644 index 0000000000000..9887c8e6f1794 --- /dev/null +++ b/tests/baselines/reference/spreadUnion4.js @@ -0,0 +1,20 @@ +//// [spreadUnion4.ts] +declare const a: { x: () => void } +declare const b: { x?: () => void } + +const c = { ...a, ...b }; + + +//// [spreadUnion4.js] +var __assign = (this && this.__assign) || function () { + __assign = Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); +}; +var c = __assign(__assign({}, a), b); diff --git a/tests/baselines/reference/spreadUnion4.symbols b/tests/baselines/reference/spreadUnion4.symbols new file mode 100644 index 0000000000000..85f9071e31d9b --- /dev/null +++ b/tests/baselines/reference/spreadUnion4.symbols @@ -0,0 +1,14 @@ +=== tests/cases/conformance/types/spread/spreadUnion4.ts === +declare const a: { x: () => void } +>a : Symbol(a, Decl(spreadUnion4.ts, 0, 13)) +>x : Symbol(x, Decl(spreadUnion4.ts, 0, 18)) + +declare const b: { x?: () => void } +>b : Symbol(b, Decl(spreadUnion4.ts, 1, 13)) +>x : Symbol(x, Decl(spreadUnion4.ts, 1, 18)) + +const c = { ...a, ...b }; +>c : Symbol(c, Decl(spreadUnion4.ts, 3, 5)) +>a : Symbol(a, Decl(spreadUnion4.ts, 0, 13)) +>b : Symbol(b, Decl(spreadUnion4.ts, 1, 13)) + diff --git a/tests/baselines/reference/spreadUnion4.types b/tests/baselines/reference/spreadUnion4.types new file mode 100644 index 0000000000000..d3be34c89c70f --- /dev/null +++ b/tests/baselines/reference/spreadUnion4.types @@ -0,0 +1,15 @@ +=== tests/cases/conformance/types/spread/spreadUnion4.ts === +declare const a: { x: () => void } +>a : { x: () => void; } +>x : () => void + +declare const b: { x?: () => void } +>b : { x?: () => void; } +>x : () => void + +const c = { ...a, ...b }; +>c : { x: () => void; } +>{ ...a, ...b } : { x: () => void; } +>a : { x: () => void; } +>b : { x?: () => void; } + diff --git a/tests/baselines/reference/taggedTemplatesWithTypeArguments1.symbols b/tests/baselines/reference/taggedTemplatesWithTypeArguments1.symbols index 4cd6dce23e368..f37166423f17c 100644 --- a/tests/baselines/reference/taggedTemplatesWithTypeArguments1.symbols +++ b/tests/baselines/reference/taggedTemplatesWithTypeArguments1.symbols @@ -5,7 +5,7 @@ declare function f(strs: TemplateStringsArray, ...callbacks: Array<(x: T) => >strs : Symbol(strs, Decl(taggedTemplatesWithTypeArguments1.ts, 0, 22)) >TemplateStringsArray : Symbol(TemplateStringsArray, Decl(lib.es5.d.ts, --, --)) >callbacks : Symbol(callbacks, Decl(taggedTemplatesWithTypeArguments1.ts, 0, 49)) ->Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 2 more) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 3 more) >x : Symbol(x, Decl(taggedTemplatesWithTypeArguments1.ts, 0, 71)) >T : Symbol(T, Decl(taggedTemplatesWithTypeArguments1.ts, 0, 19)) diff --git a/tests/baselines/reference/tsc/runWithoutArgs/initial-build/does-not-add-color-when-NO_COLOR-is-set.js b/tests/baselines/reference/tsc/runWithoutArgs/initial-build/does-not-add-color-when-NO_COLOR-is-set.js index 100d910dfbaba..01d07f61429b4 100644 --- a/tests/baselines/reference/tsc/runWithoutArgs/initial-build/does-not-add-color-when-NO_COLOR-is-set.js +++ b/tests/baselines/reference/tsc/runWithoutArgs/initial-build/does-not-add-color-when-NO_COLOR-is-set.js @@ -68,7 +68,7 @@ default: true --target, -t Set the JavaScript language version for emitted JavaScript and include compatible library declarations. -one of: es3, es5, es6, es2015, es2016, es2017, es2018, es2019, es2020, es2021, esnext +one of: es3, es5, es6, es2015, es2016, es2017, es2018, es2019, es2020, es2021, es2022, esnext default: ES3 --module, -m @@ -77,7 +77,7 @@ one of: none, commonjs, amd, system, umd, es6, es2015, es2020, es2022, esnext, n --lib Specify a set of bundled library declaration files that describe the target runtime environment. -one or more: es5, es6, es2015, es7, es2016, es2017, es2018, es2019, es2020, es2021, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol, es2020.bigint, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2021.promise, es2021.string, es2021.weakref, es2021.intl, esnext.array, esnext.symbol, esnext.asynciterable, esnext.intl, esnext.bigint, esnext.string, esnext.promise, esnext.weakref +one or more: es5, es6, es2015, es7, es2016, es2017, es2018, es2019, es2020, es2021, es2022, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol, es2020.bigint, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2021.promise, es2021.string, es2021.weakref, es2021.intl, es2022.array, es2022.error, es2022.object, es2022.string, esnext.array, esnext.symbol, esnext.asynciterable, esnext.intl, esnext.bigint, esnext.string, esnext.promise, esnext.weakref --allowJs Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. diff --git a/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js b/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js index 3b4922b2fe603..4db9e7df4d352 100644 --- a/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js +++ b/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js @@ -68,7 +68,7 @@ default: true --target, -t Set the JavaScript language version for emitted JavaScript and include compatible library declarations. -one of: es3, es5, es6, es2015, es2016, es2017, es2018, es2019, es2020, es2021, esnext +one of: es3, es5, es6, es2015, es2016, es2017, es2018, es2019, es2020, es2021, es2022, esnext default: ES3 --module, -m @@ -77,7 +77,7 @@ one of: none, commonjs, amd, system, umd, es6, es2015, es2020, es2022, esnext, n --lib Specify a set of bundled library declaration files that describe the target runtime environment. -one or more: es5, es6, es2015, es7, es2016, es2017, es2018, es2019, es2020, es2021, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol, es2020.bigint, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2021.promise, es2021.string, es2021.weakref, es2021.intl, esnext.array, esnext.symbol, esnext.asynciterable, esnext.intl, esnext.bigint, esnext.string, esnext.promise, esnext.weakref +one or more: es5, es6, es2015, es7, es2016, es2017, es2018, es2019, es2020, es2021, es2022, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol, es2020.bigint, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2021.promise, es2021.string, es2021.weakref, es2021.intl, es2022.array, es2022.error, es2022.object, es2022.string, esnext.array, esnext.symbol, esnext.asynciterable, esnext.intl, esnext.bigint, esnext.string, esnext.promise, esnext.weakref --allowJs Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. diff --git a/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js b/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js index 3b4922b2fe603..4db9e7df4d352 100644 --- a/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js +++ b/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js @@ -68,7 +68,7 @@ default: true --target, -t Set the JavaScript language version for emitted JavaScript and include compatible library declarations. -one of: es3, es5, es6, es2015, es2016, es2017, es2018, es2019, es2020, es2021, esnext +one of: es3, es5, es6, es2015, es2016, es2017, es2018, es2019, es2020, es2021, es2022, esnext default: ES3 --module, -m @@ -77,7 +77,7 @@ one of: none, commonjs, amd, system, umd, es6, es2015, es2020, es2022, esnext, n --lib Specify a set of bundled library declaration files that describe the target runtime environment. -one or more: es5, es6, es2015, es7, es2016, es2017, es2018, es2019, es2020, es2021, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol, es2020.bigint, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2021.promise, es2021.string, es2021.weakref, es2021.intl, esnext.array, esnext.symbol, esnext.asynciterable, esnext.intl, esnext.bigint, esnext.string, esnext.promise, esnext.weakref +one or more: es5, es6, es2015, es7, es2016, es2017, es2018, es2019, es2020, es2021, es2022, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol, es2020.bigint, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2021.promise, es2021.string, es2021.weakref, es2021.intl, es2022.array, es2022.error, es2022.object, es2022.string, esnext.array, esnext.symbol, esnext.asynciterable, esnext.intl, esnext.bigint, esnext.string, esnext.promise, esnext.weakref --allowJs Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. diff --git a/tests/baselines/reference/typeGuardConstructorNarrowAny.symbols b/tests/baselines/reference/typeGuardConstructorNarrowAny.symbols index acbc179aa270d..980e68c3f1cf9 100644 --- a/tests/baselines/reference/typeGuardConstructorNarrowAny.symbols +++ b/tests/baselines/reference/typeGuardConstructorNarrowAny.symbols @@ -5,7 +5,7 @@ let var1: any; if (var1.constructor === String) { >var1 : Symbol(var1, Decl(typeGuardConstructorNarrowAny.ts, 1, 3)) ->String : Symbol(String, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --) ... and 5 more) +>String : Symbol(String, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --) ... and 6 more) var1; // String >var1 : Symbol(var1, Decl(typeGuardConstructorNarrowAny.ts, 1, 3)) @@ -26,7 +26,7 @@ if (var1.constructor === Boolean) { } if (var1.constructor === Array) { >var1 : Symbol(var1, Decl(typeGuardConstructorNarrowAny.ts, 1, 3)) ->Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 2 more) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 3 more) var1; // any[] >var1 : Symbol(var1, Decl(typeGuardConstructorNarrowAny.ts, 1, 3)) diff --git a/tests/baselines/reference/typeGuardConstructorPrimitiveTypes.symbols b/tests/baselines/reference/typeGuardConstructorPrimitiveTypes.symbols index 1bcc2f586eb5e..7258c198d18f7 100644 --- a/tests/baselines/reference/typeGuardConstructorPrimitiveTypes.symbols +++ b/tests/baselines/reference/typeGuardConstructorPrimitiveTypes.symbols @@ -7,7 +7,7 @@ if (var1.constructor === String) { >var1.constructor : Symbol(Object.constructor, Decl(lib.es5.d.ts, --, --)) >var1 : Symbol(var1, Decl(typeGuardConstructorPrimitiveTypes.ts, 1, 3)) >constructor : Symbol(Object.constructor, Decl(lib.es5.d.ts, --, --)) ->String : Symbol(String, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --) ... and 5 more) +>String : Symbol(String, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --) ... and 6 more) var1; // string >var1 : Symbol(var1, Decl(typeGuardConstructorPrimitiveTypes.ts, 1, 3)) @@ -34,7 +34,7 @@ if (var1.constructor === Array) { >var1.constructor : Symbol(Object.constructor, Decl(lib.es5.d.ts, --, --)) >var1 : Symbol(var1, Decl(typeGuardConstructorPrimitiveTypes.ts, 1, 3)) >constructor : Symbol(Object.constructor, Decl(lib.es5.d.ts, --, --)) ->Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 2 more) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 3 more) var1; // any[] >var1 : Symbol(var1, Decl(typeGuardConstructorPrimitiveTypes.ts, 1, 3)) @@ -61,7 +61,7 @@ if (var1.constructor === BigInt) { // Narrow a union of primitive object types let var2: String | Number | Boolean | Symbol | BigInt; >var2 : Symbol(var2, Decl(typeGuardConstructorPrimitiveTypes.ts, 22, 3)) ->String : Symbol(String, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --) ... and 5 more) +>String : Symbol(String, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --) ... and 6 more) >Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >Boolean : Symbol(Boolean, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2019.symbol.d.ts, --, --)) @@ -71,7 +71,7 @@ if (var2.constructor === String) { >var2.constructor : Symbol(Object.constructor, Decl(lib.es5.d.ts, --, --)) >var2 : Symbol(var2, Decl(typeGuardConstructorPrimitiveTypes.ts, 22, 3)) >constructor : Symbol(Object.constructor, Decl(lib.es5.d.ts, --, --)) ->String : Symbol(String, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --) ... and 5 more) +>String : Symbol(String, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --) ... and 6 more) var2; // String >var2 : Symbol(var2, Decl(typeGuardConstructorPrimitiveTypes.ts, 22, 3)) diff --git a/tests/baselines/reference/unionTypeInference.symbols b/tests/baselines/reference/unionTypeInference.symbols index 11fdc52396485..a4a24b15ebfcc 100644 --- a/tests/baselines/reference/unionTypeInference.symbols +++ b/tests/baselines/reference/unionTypeInference.symbols @@ -230,7 +230,7 @@ async function fun(deepPromised: DeepPromised) { for (const value of Object.values(deepPromisedWithIndexer)) { >value : Symbol(value, Decl(unionTypeInference.ts, 62, 14)) >Object.values : Symbol(ObjectConstructor.values, Decl(lib.es2017.object.d.ts, --, --), Decl(lib.es2017.object.d.ts, --, --)) ->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2022.object.d.ts, --, --)) >values : Symbol(ObjectConstructor.values, Decl(lib.es2017.object.d.ts, --, --), Decl(lib.es2017.object.d.ts, --, --)) >deepPromisedWithIndexer : Symbol(deepPromisedWithIndexer, Decl(unionTypeInference.ts, 61, 9)) diff --git a/tests/cases/compiler/errorCause.ts b/tests/cases/compiler/errorCause.ts new file mode 100644 index 0000000000000..c04ce180bff35 --- /dev/null +++ b/tests/cases/compiler/errorCause.ts @@ -0,0 +1,3 @@ +// @target: es2021, es2022, esnext + +new Error("foo", { cause: new Error("bar") }); diff --git a/tests/cases/compiler/indexAt.ts b/tests/cases/compiler/indexAt.ts new file mode 100644 index 0000000000000..d41117903a5b1 --- /dev/null +++ b/tests/cases/compiler/indexAt.ts @@ -0,0 +1,15 @@ +// @target: es2021, es2022, esnext + +[0].at(0); +"foo".at(0); +new Int8Array().at(0); +new Uint8Array().at(0); +new Uint8ClampedArray().at(0); +new Int16Array().at(0); +new Uint16Array().at(0); +new Int32Array().at(0); +new Uint32Array().at(0); +new Float32Array().at(0); +new Float64Array().at(0); +new BigInt64Array().at(0); +new BigUint64Array().at(0); diff --git a/tests/cases/compiler/noImplicitAnyNamelessParameter.ts b/tests/cases/compiler/noImplicitAnyNamelessParameter.ts index 6206a5e68ad24..aa98a725bd687 100644 --- a/tests/cases/compiler/noImplicitAnyNamelessParameter.ts +++ b/tests/cases/compiler/noImplicitAnyNamelessParameter.ts @@ -1,6 +1,7 @@ // @noImplicitAny: true class C { } -declare var x: (string, C) => void; -declare var y: { (C, number): void }; -declare var z: { m(boolean, C, object, undefined): void } +declare var a: { m(...string): void } +declare var b: (string, C) => void; +declare var c: { (C, number): void }; +declare var d: { m(boolean, C, object, undefined): void } // note: null and void do not parse correctly without a preceding parameter name diff --git a/tests/cases/conformance/node/legacyNodeModulesExportsSpecifierGenerationConditions.ts b/tests/cases/conformance/node/legacyNodeModulesExportsSpecifierGenerationConditions.ts new file mode 100644 index 0000000000000..656465829e6d9 --- /dev/null +++ b/tests/cases/conformance/node/legacyNodeModulesExportsSpecifierGenerationConditions.ts @@ -0,0 +1,33 @@ +// @module: commonjs +// @lib: es2020 +// @declaration: true +// @filename: index.ts +export const a = async () => (await import("inner")).x(); +// @filename: node_modules/inner/index.d.ts +export { x } from "./other.js"; +// @filename: node_modules/inner/other.d.ts +import { Thing } from "./private.js" +export const x: () => Thing; +// @filename: node_modules/inner/private.d.ts +export interface Thing {} // not exported in export map, inaccessible under new module modes +// @filename: package.json +{ + "name": "package", + "private": true, + "type": "module", + "exports": "./index.js" +} +// @filename: node_modules/inner/package.json +{ + "name": "inner", + "private": true, + "type": "module", + "exports": { + ".": { + "default": "./index.js" + }, + "./other": { + "default": "./other.js" + } + } +} \ No newline at end of file diff --git a/tests/cases/conformance/types/spread/spreadUnion4.ts b/tests/cases/conformance/types/spread/spreadUnion4.ts new file mode 100644 index 0000000000000..6a39ac3a3cc40 --- /dev/null +++ b/tests/cases/conformance/types/spread/spreadUnion4.ts @@ -0,0 +1,4 @@ +declare const a: { x: () => void } +declare const b: { x?: () => void } + +const c = { ...a, ...b }; diff --git a/tests/cases/fourslash/codeFixAddParameterNames.ts b/tests/cases/fourslash/codeFixAddParameterNames1.ts similarity index 100% rename from tests/cases/fourslash/codeFixAddParameterNames.ts rename to tests/cases/fourslash/codeFixAddParameterNames1.ts diff --git a/tests/cases/fourslash/codeFixAddParameterNames2.ts b/tests/cases/fourslash/codeFixAddParameterNames2.ts new file mode 100644 index 0000000000000..31e26358aebc4 --- /dev/null +++ b/tests/cases/fourslash/codeFixAddParameterNames2.ts @@ -0,0 +1,6 @@ +/// + +// @noImplicitAny: true +////type Rest = ([|...number|]) => void; + +verify.rangeAfterCodeFix("...arg0: number[]"); diff --git a/tests/cases/fourslash/codeFixAddParameterNames3.ts b/tests/cases/fourslash/codeFixAddParameterNames3.ts new file mode 100644 index 0000000000000..465471e11287f --- /dev/null +++ b/tests/cases/fourslash/codeFixAddParameterNames3.ts @@ -0,0 +1,6 @@ +/// + +// @noImplicitAny: true +////type Rest = ([|public string|]) => void; + +verify.rangeAfterCodeFix("public arg0: string"); diff --git a/tests/cases/fourslash/codeFixInferFromUsageVariable4.ts b/tests/cases/fourslash/codeFixInferFromUsageVariable4.ts new file mode 100644 index 0000000000000..12db84cfef00f --- /dev/null +++ b/tests/cases/fourslash/codeFixInferFromUsageVariable4.ts @@ -0,0 +1,13 @@ +/// + +// @noImplicitAny: false +////[|let foo;|] +//// +////foo?.(); +////foo = () => {} + +verify.codeFix({ + description: "Infer type of 'foo' from usage", + index: 0, + newRangeContent: "let foo: () => void;" +}); diff --git a/tests/cases/fourslash/completionsOverridingMethod9.ts b/tests/cases/fourslash/completionsOverridingMethod9.ts new file mode 100644 index 0000000000000..8f9cac56feb8a --- /dev/null +++ b/tests/cases/fourslash/completionsOverridingMethod9.ts @@ -0,0 +1,44 @@ +/// + +// @Filename: a.ts +// @newline: LF + +////interface IFoo { +//// a?: number; +//// b?(x: number): void; +////} +////class Foo implements IFoo { +//// /**/ +////} + +verify.completions({ + marker: "", + isNewIdentifierLocation: true, + preferences: { + includeCompletionsWithInsertText: true, + includeCompletionsWithSnippetText: false, + includeCompletionsWithClassMemberSnippets: true, + }, + includes: [ + { + name: "a", + sortText: completion.SortText.LocationPriority, + replacementSpan: { + fileName: "", + pos: 0, + end: 0, + }, + insertText: "a?: number;\n" + }, + { + name: "b", + sortText: completion.SortText.LocationPriority, + replacementSpan: { + fileName: "", + pos: 0, + end: 0, + }, + insertText: "b(x: number): void {\n}\n" + }, + ], +}); diff --git a/tests/cases/fourslash/extract-const10.ts b/tests/cases/fourslash/extract-const10.ts new file mode 100644 index 0000000000000..2eaea4991578a --- /dev/null +++ b/tests/cases/fourslash/extract-const10.ts @@ -0,0 +1,20 @@ +/// + +// @filename: foo.ts +////function foo() { +//// /*a*/const a = [1]/*b*/; +//// return a; +////} + +goTo.select("a", "b"); +edit.applyRefactor({ + refactorName: "Extract Symbol", + actionName: "constant_scope_1", + actionDescription: "Extract to constant in global scope", + newContent: +`const newLocal = [1]; +function foo() { + const a = /*RENAME*/newLocal; + return a; +}` +}); diff --git a/tests/cases/fourslash/getOutliningForBlockComments.ts b/tests/cases/fourslash/getOutliningForBlockComments.ts index 59e11451b3b07..93d7ed8818d45 100644 --- a/tests/cases/fourslash/getOutliningForBlockComments.ts +++ b/tests/cases/fourslash/getOutliningForBlockComments.ts @@ -192,6 +192,13 @@ //// */|] //// const x = 1; ////}|] +//// +////[|/* +////comment +////*/|] +//// +////f6(); +//// ////class C1[| { //// [|/** //// * comment @@ -231,6 +238,12 @@ //// */|] //// private prop = 1; ////}|] +//// +////[|/* +////comment +////*/|] +////new C4(); +//// ////module M1[| { //// [|/** //// * comment diff --git a/tests/cases/fourslash/jsDocInheritDoc.ts b/tests/cases/fourslash/jsDocInheritDoc.ts index 8a19bd0c14e26..7ef822ce65331 100644 --- a/tests/cases/fourslash/jsDocInheritDoc.ts +++ b/tests/cases/fourslash/jsDocInheritDoc.ts @@ -17,6 +17,10 @@ //// * Foo#property1 documentation //// */ //// property1: string; +//// /** +//// * Foo#property3 documentation +//// */ +//// property3 = "instance prop"; ////} ////interface Baz { //// /** Baz#property1 documentation */ @@ -43,6 +47,8 @@ //// * @inheritDoc //// */ //// property2: object; +//// +//// static /*6*/property3 = "class prop"; ////} ////const b = new Bar/*1*/(5); ////b.method2/*2*/(); @@ -55,3 +61,4 @@ verify.quickInfoAt("2", "(method) Bar.method2(): void", "Foo#method2 documentati verify.quickInfoAt("3", "(method) Bar.method1(): void", undefined); // statics aren't actually inherited verify.quickInfoAt("4", "(property) Bar.property1: string", "Foo#property1 documentation"); // use inherited docs only verify.quickInfoAt("5", "(property) Bar.property2: object", "Baz#property2 documentation\nBar#property2"); // include local and inherited docs +verify.quickInfoAt("6", "(property) Bar.property3: string", undefined);