mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge branch 'main' into gabritto/issue46609
This commit is contained in:
@@ -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 ?
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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)
|
||||
|
||||
+12
-9
@@ -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,
|
||||
|
||||
@@ -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"]
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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:
|
||||
|
||||
Vendored
+103
@@ -0,0 +1,103 @@
|
||||
interface Array<T> {
|
||||
/**
|
||||
* 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<T> {
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
/// <reference lib="es2021" />
|
||||
/// <reference lib="es2022.array" />
|
||||
/// <reference lib="es2022.error" />
|
||||
/// <reference lib="es2022.object" />
|
||||
/// <reference lib="es2022.string" />
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
interface ErrorOptions {
|
||||
cause?: Error;
|
||||
}
|
||||
|
||||
interface ErrorConstructor {
|
||||
new(message?: string, options?: ErrorOptions): Error;
|
||||
(message?: string, options?: ErrorOptions): Error;
|
||||
}
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
/// <reference lib="es2022" />
|
||||
/// <reference lib="dom" />
|
||||
/// <reference lib="webworker.importscripts" />
|
||||
/// <reference lib="scripthost" />
|
||||
/// <reference lib="dom.iterable" />
|
||||
Vendored
+8
@@ -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;
|
||||
}
|
||||
Vendored
+7
@@ -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;
|
||||
}
|
||||
Vendored
+1
-1
@@ -1,2 +1,2 @@
|
||||
/// <reference lib="es2021" />
|
||||
/// <reference lib="es2022" />
|
||||
/// <reference lib="esnext.intl" />
|
||||
|
||||
@@ -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": {
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<Modifier> | 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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -599,10 +599,11 @@ namespace ts {
|
||||
}
|
||||
|
||||
function findBaseOfDeclaration<T>(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;
|
||||
|
||||
@@ -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,
|
||||
|
||||
|
||||
@@ -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++) {}`);
|
||||
});
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -3078,6 +3078,7 @@ declare namespace ts {
|
||||
ES2019 = 6,
|
||||
ES2020 = 7,
|
||||
ES2021 = 8,
|
||||
ES2022 = 9,
|
||||
ESNext = 99,
|
||||
JSON = 100,
|
||||
Latest = 99
|
||||
|
||||
@@ -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"]?.(); }
|
||||
}
|
||||
@@ -30,7 +30,7 @@ declare const pli: {
|
||||
|
||||
(streams: ReadonlyArray<R | W | RW>): Promise<void>;
|
||||
>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, --, --))
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
//// [errorCause.ts]
|
||||
new Error("foo", { cause: new Error("bar") });
|
||||
|
||||
|
||||
//// [errorCause.js]
|
||||
new Error("foo", { cause: new Error("bar") });
|
||||
@@ -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, --, --))
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
//// [errorCause.ts]
|
||||
new Error("foo", { cause: new Error("bar") });
|
||||
|
||||
|
||||
//// [errorCause.js]
|
||||
new Error("foo", { cause: new Error("bar") });
|
||||
@@ -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, --, --))
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
//// [errorCause.ts]
|
||||
new Error("foo", { cause: new Error("bar") });
|
||||
|
||||
|
||||
//// [errorCause.js]
|
||||
new Error("foo", { cause: new Error("bar") });
|
||||
@@ -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, --, --))
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -297,7 +297,7 @@ export class IterableWeakMap<K extends object, V> implements WeakMap<K, V> {
|
||||
|
||||
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,
|
||||
|
||||
@@ -15,7 +15,7 @@ const bar = foo.flatMap(bar => bar as Foo);
|
||||
|
||||
interface Foo extends Array<string> {}
|
||||
>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
|
||||
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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);
|
||||
@@ -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, --, --))
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
@@ -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, --, --))
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
@@ -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, --, --))
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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, --, --))
|
||||
|
||||
@@ -440,9 +440,9 @@ function fn<T extends {elements: Array<string>} | {elements: Array<number>}>(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<T extends {elements: Array<string>} | {elements: Array<number>}>(par
|
||||
function fn2<T extends Array<string>>(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<T extends Array<string>>(param: T, cb: (element: T[number]) => void
|
||||
function fn3<T extends ReadonlyArray<string>>(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<K extends number>() {
|
||||
|
||||
let x: Array<string>[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<string>[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))
|
||||
}
|
||||
|
||||
|
||||
@@ -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<import("inner/private").Thing>;
|
||||
+23
@@ -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))
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
=== tests/cases/conformance/node/index.ts ===
|
||||
export const a = async () => (await import("inner")).x();
|
||||
>a : () => Promise<import("tests/cases/conformance/node/node_modules/inner/private").Thing>
|
||||
>async () => (await import("inner")).x() : () => Promise<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")).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<typeof import("tests/cases/conformance/node/node_modules/inner/index")>
|
||||
>"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.
|
||||
@@ -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'?
|
||||
~
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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))
|
||||
|
||||
|
||||
@@ -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."
|
||||
]
|
||||
@@ -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."
|
||||
]
|
||||
@@ -566,7 +566,7 @@ let five: Add<2, 3>;
|
||||
type _PrependNextNum<A extends Array<unknown>> = 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 extends Array<unknown>> = A['length'] extends infer T
|
||||
type _Enumerate<A extends Array<unknown>, 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))
|
||||
|
||||
@@ -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);
|
||||
@@ -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))
|
||||
|
||||
@@ -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; }
|
||||
|
||||
@@ -5,7 +5,7 @@ declare function f<T>(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))
|
||||
|
||||
|
||||
+2
-2
@@ -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.
|
||||
|
||||
+2
-2
@@ -68,7 +68,7 @@ default: true
|
||||
|
||||
[94m--target, -t[39m
|
||||
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
|
||||
|
||||
[94m--module, -m[39m
|
||||
@@ -77,7 +77,7 @@ one of: none, commonjs, amd, system, umd, es6, es2015, es2020, es2022, esnext, n
|
||||
|
||||
[94m--lib[39m
|
||||
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
|
||||
|
||||
[94m--allowJs[39m
|
||||
Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files.
|
||||
|
||||
+2
-2
@@ -68,7 +68,7 @@ default: true
|
||||
|
||||
[94m--target, -t[39m
|
||||
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
|
||||
|
||||
[94m--module, -m[39m
|
||||
@@ -77,7 +77,7 @@ one of: none, commonjs, amd, system, umd, es6, es2015, es2020, es2022, esnext, n
|
||||
|
||||
[94m--lib[39m
|
||||
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
|
||||
|
||||
[94m--allowJs[39m
|
||||
Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files.
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -230,7 +230,7 @@ async function fun<T>(deepPromised: DeepPromised<T>) {
|
||||
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))
|
||||
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
// @target: es2021, es2022, esnext
|
||||
|
||||
new Error("foo", { cause: new Error("bar") });
|
||||
@@ -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);
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
declare const a: { x: () => void }
|
||||
declare const b: { x?: () => void }
|
||||
|
||||
const c = { ...a, ...b };
|
||||
@@ -0,0 +1,6 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// @noImplicitAny: true
|
||||
////type Rest = ([|...number|]) => void;
|
||||
|
||||
verify.rangeAfterCodeFix("...arg0: number[]");
|
||||
@@ -0,0 +1,6 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// @noImplicitAny: true
|
||||
////type Rest = ([|public string|]) => void;
|
||||
|
||||
verify.rangeAfterCodeFix("public arg0: string");
|
||||
@@ -0,0 +1,13 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// @noImplicitAny: false
|
||||
////[|let foo;|]
|
||||
////
|
||||
////foo?.();
|
||||
////foo = () => {}
|
||||
|
||||
verify.codeFix({
|
||||
description: "Infer type of 'foo' from usage",
|
||||
index: 0,
|
||||
newRangeContent: "let foo: () => void;"
|
||||
});
|
||||
@@ -0,0 +1,44 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
// @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"
|
||||
},
|
||||
],
|
||||
});
|
||||
@@ -0,0 +1,20 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// @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;
|
||||
}`
|
||||
});
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user