mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge branch 'master' of https://github.com/Microsoft/TypeScript into feature/eslint
This commit is contained in:
@@ -778,7 +778,7 @@ namespace ts {
|
||||
function isNarrowableReference(expr: Expression): boolean {
|
||||
return expr.kind === SyntaxKind.Identifier || expr.kind === SyntaxKind.ThisKeyword || expr.kind === SyntaxKind.SuperKeyword ||
|
||||
(isPropertyAccessExpression(expr) || isNonNullExpression(expr) || isParenthesizedExpression(expr)) && isNarrowableReference(expr.expression) ||
|
||||
isElementAccessExpression(expr) && expr.argumentExpression &&
|
||||
isElementAccessExpression(expr) &&
|
||||
(isStringLiteral(expr.argumentExpression) || isNumericLiteral(expr.argumentExpression)) &&
|
||||
isNarrowableReference(expr.expression);
|
||||
}
|
||||
|
||||
+31
-44
@@ -384,11 +384,11 @@ namespace ts {
|
||||
typeToTypeNode: nodeBuilder.typeToTypeNode,
|
||||
indexInfoToIndexSignatureDeclaration: nodeBuilder.indexInfoToIndexSignatureDeclaration,
|
||||
signatureToSignatureDeclaration: nodeBuilder.signatureToSignatureDeclaration,
|
||||
symbolToEntityName: nodeBuilder.symbolToEntityName as (symbol: Symbol, meaning: SymbolFlags, enclosingDeclaration?: Node, flags?: NodeBuilderFlags) => EntityName, // TODO: GH#18217
|
||||
symbolToExpression: nodeBuilder.symbolToExpression as (symbol: Symbol, meaning: SymbolFlags, enclosingDeclaration?: Node, flags?: NodeBuilderFlags) => Expression, // TODO: GH#18217
|
||||
symbolToEntityName: nodeBuilder.symbolToEntityName,
|
||||
symbolToExpression: nodeBuilder.symbolToExpression,
|
||||
symbolToTypeParameterDeclarations: nodeBuilder.symbolToTypeParameterDeclarations,
|
||||
symbolToParameterDeclaration: nodeBuilder.symbolToParameterDeclaration as (symbol: Symbol, enclosingDeclaration?: Node, flags?: NodeBuilderFlags) => ParameterDeclaration, // TODO: GH#18217
|
||||
typeParameterToDeclaration: nodeBuilder.typeParameterToDeclaration as (parameter: TypeParameter, enclosingDeclaration?: Node, flags?: NodeBuilderFlags) => TypeParameterDeclaration, // TODO: GH#18217
|
||||
symbolToParameterDeclaration: nodeBuilder.symbolToParameterDeclaration,
|
||||
typeParameterToDeclaration: nodeBuilder.typeParameterToDeclaration,
|
||||
getSymbolsInScope: (location, meaning) => {
|
||||
location = getParseTreeNode(location);
|
||||
return location ? getSymbolsInScope(location, meaning) : [];
|
||||
@@ -557,7 +557,7 @@ namespace ts {
|
||||
},
|
||||
getJsxNamespace: n => unescapeLeadingUnderscores(getJsxNamespace(n)),
|
||||
getAccessibleSymbolChain,
|
||||
getTypePredicateOfSignature: getTypePredicateOfSignature as (signature: Signature) => TypePredicate, // TODO: GH#18217
|
||||
getTypePredicateOfSignature,
|
||||
resolveExternalModuleSymbol,
|
||||
tryGetThisTypeAt: (node, includeGlobalThis) => {
|
||||
node = getParseTreeNode(node);
|
||||
@@ -884,7 +884,7 @@ namespace ts {
|
||||
}
|
||||
const jsxPragma = file.pragmas.get("jsx");
|
||||
if (jsxPragma) {
|
||||
const chosenpragma: any = isArray(jsxPragma) ? jsxPragma[0] : jsxPragma; // TODO: GH#18217
|
||||
const chosenpragma = isArray(jsxPragma) ? jsxPragma[0] : jsxPragma;
|
||||
file.localJsxFactory = parseIsolatedEntityName(chosenpragma.arguments.factory, languageVersion);
|
||||
if (file.localJsxFactory) {
|
||||
return file.localJsxNamespace = getFirstIdentifier(file.localJsxFactory).escapedText;
|
||||
@@ -2564,10 +2564,6 @@ namespace ts {
|
||||
}
|
||||
|
||||
function resolveExternalModule(location: Node, moduleReference: string, moduleNotFoundError: DiagnosticMessage | undefined, errorNode: Node, isForAugmentation = false): Symbol | undefined {
|
||||
if (moduleReference === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (startsWith(moduleReference, "@types/")) {
|
||||
const diag = Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1;
|
||||
const withoutAtTypePrefix = removePrefix(moduleReference, "@types/");
|
||||
@@ -3265,12 +3261,12 @@ namespace ts {
|
||||
return access.accessibility === SymbolAccessibility.Accessible;
|
||||
}
|
||||
|
||||
function isValueSymbolAccessible(typeSymbol: Symbol, enclosingDeclaration: Node): boolean {
|
||||
function isValueSymbolAccessible(typeSymbol: Symbol, enclosingDeclaration: Node | undefined): boolean {
|
||||
const access = isSymbolAccessible(typeSymbol, enclosingDeclaration, SymbolFlags.Value, /*shouldComputeAliasesToMakeVisible*/ false);
|
||||
return access.accessibility === SymbolAccessibility.Accessible;
|
||||
}
|
||||
|
||||
function isAnySymbolAccessible(symbols: Symbol[] | undefined, enclosingDeclaration: Node, initialSymbol: Symbol, meaning: SymbolFlags, shouldComputeAliasesToMakeVisible: boolean): SymbolAccessibilityResult | undefined {
|
||||
function isAnySymbolAccessible(symbols: Symbol[] | undefined, enclosingDeclaration: Node | undefined, initialSymbol: Symbol, meaning: SymbolFlags, shouldComputeAliasesToMakeVisible: boolean): SymbolAccessibilityResult | undefined {
|
||||
if (!length(symbols)) return;
|
||||
|
||||
let hadAccessibleChain: Symbol | undefined;
|
||||
@@ -3544,7 +3540,7 @@ namespace ts {
|
||||
typeToTypeNode: (type: Type, enclosingDeclaration?: Node, flags?: NodeBuilderFlags, tracker?: SymbolTracker) =>
|
||||
withContext(enclosingDeclaration, flags, tracker, context => typeToTypeNodeHelper(type, context)),
|
||||
indexInfoToIndexSignatureDeclaration: (indexInfo: IndexInfo, kind: IndexKind, enclosingDeclaration?: Node, flags?: NodeBuilderFlags, tracker?: SymbolTracker) =>
|
||||
withContext(enclosingDeclaration, flags, tracker, context => indexInfoToIndexSignatureDeclarationHelper(indexInfo, kind, context))!, // TODO: GH#18217
|
||||
withContext(enclosingDeclaration, flags, tracker, context => indexInfoToIndexSignatureDeclarationHelper(indexInfo, kind, context)),
|
||||
signatureToSignatureDeclaration: (signature: Signature, kind: SyntaxKind, enclosingDeclaration?: Node, flags?: NodeBuilderFlags, tracker?: SymbolTracker) =>
|
||||
withContext(enclosingDeclaration, flags, tracker, context => signatureToSignatureDeclarationHelper(signature, kind, context)),
|
||||
symbolToEntityName: (symbol: Symbol, meaning: SymbolFlags, enclosingDeclaration?: Node, flags?: NodeBuilderFlags, tracker?: SymbolTracker) =>
|
||||
@@ -3653,7 +3649,7 @@ namespace ts {
|
||||
}
|
||||
if (type.flags & TypeFlags.UniqueESSymbol) {
|
||||
if (!(context.flags & NodeBuilderFlags.AllowUniqueESSymbolType)) {
|
||||
if (isValueSymbolAccessible(type.symbol, context.enclosingDeclaration!)) {
|
||||
if (isValueSymbolAccessible(type.symbol, context.enclosingDeclaration)) {
|
||||
context.approximateLength += 6;
|
||||
return symbolToTypeNode(type.symbol, context, SymbolFlags.Value);
|
||||
}
|
||||
@@ -3864,7 +3860,7 @@ namespace ts {
|
||||
if (isStaticMethodSymbol || isNonLocalFunctionSymbol) {
|
||||
// typeof is allowed only for static/non local functions
|
||||
return (!!(context.flags & NodeBuilderFlags.UseTypeOfFunction) || (context.visitedTypes && context.visitedTypes.has(typeId))) && // it is type of the symbol uses itself recursively
|
||||
(!(context.flags & NodeBuilderFlags.UseStructuralFallback) || isValueSymbolAccessible(symbol, context.enclosingDeclaration!)); // TODO: GH#18217 // And the build is going to succeed without visibility error or there is no structural fallback allowed
|
||||
(!(context.flags & NodeBuilderFlags.UseStructuralFallback) || isValueSymbolAccessible(symbol, context.enclosingDeclaration)); // And the build is going to succeed without visibility error or there is no structural fallback allowed
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3941,7 +3937,7 @@ namespace ts {
|
||||
else if (context.flags & NodeBuilderFlags.WriteClassExpressionAsTypeLiteral &&
|
||||
type.symbol.valueDeclaration &&
|
||||
isClassLike(type.symbol.valueDeclaration) &&
|
||||
!isValueSymbolAccessible(type.symbol, context.enclosingDeclaration!)
|
||||
!isValueSymbolAccessible(type.symbol, context.enclosingDeclaration)
|
||||
) {
|
||||
return createAnonymousTypeNode(type);
|
||||
}
|
||||
@@ -7159,7 +7155,7 @@ namespace ts {
|
||||
const baseConstructorType = getBaseConstructorTypeOfClass(classType);
|
||||
const baseSignatures = getSignaturesOfType(baseConstructorType, SignatureKind.Construct);
|
||||
if (baseSignatures.length === 0) {
|
||||
return [createSignature(undefined, classType.localTypeParameters, undefined, emptyArray, classType, /*resolvedTypePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false)]; // TODO: GH#18217
|
||||
return [createSignature(undefined, classType.localTypeParameters, undefined, emptyArray, classType, /*resolvedTypePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false)];
|
||||
}
|
||||
const baseTypeNode = getBaseTypeNodeOfClass(classType)!;
|
||||
const isJavaScript = isInJSFile(baseTypeNode);
|
||||
@@ -10229,9 +10225,11 @@ namespace ts {
|
||||
case SyntaxKind.ReadonlyKeyword:
|
||||
links.resolvedType = getTypeFromTypeNode(node.type);
|
||||
break;
|
||||
default:
|
||||
throw Debug.assertNever(node.operator);
|
||||
}
|
||||
}
|
||||
return links.resolvedType!; // TODO: GH#18217
|
||||
return links.resolvedType;
|
||||
}
|
||||
|
||||
function createIndexedAccessType(objectType: Type, indexType: Type) {
|
||||
@@ -10813,11 +10811,11 @@ namespace ts {
|
||||
getNodeLinks(current.parent).resolvedSymbol = next;
|
||||
currentNamespace = next;
|
||||
}
|
||||
resolveImportSymbolType(node, links, currentNamespace, targetMeaning);
|
||||
links.resolvedType = resolveImportSymbolType(node, links, currentNamespace, targetMeaning);
|
||||
}
|
||||
else {
|
||||
if (moduleSymbol.flags & targetMeaning) {
|
||||
resolveImportSymbolType(node, links, moduleSymbol, targetMeaning);
|
||||
links.resolvedType = resolveImportSymbolType(node, links, moduleSymbol, targetMeaning);
|
||||
}
|
||||
else {
|
||||
const errorMessage = targetMeaning === SymbolFlags.Value
|
||||
@@ -10831,17 +10829,17 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
}
|
||||
return links.resolvedType!; // TODO: GH#18217
|
||||
return links.resolvedType;
|
||||
}
|
||||
|
||||
function resolveImportSymbolType(node: ImportTypeNode, links: NodeLinks, symbol: Symbol, meaning: SymbolFlags) {
|
||||
const resolvedSymbol = resolveSymbol(symbol);
|
||||
links.resolvedSymbol = resolvedSymbol;
|
||||
if (meaning === SymbolFlags.Value) {
|
||||
return links.resolvedType = getTypeOfSymbol(symbol); // intentionally doesn't use resolved symbol so type is cached as expected on the alias
|
||||
return getTypeOfSymbol(symbol); // intentionally doesn't use resolved symbol so type is cached as expected on the alias
|
||||
}
|
||||
else {
|
||||
return links.resolvedType = getTypeReferenceType(node, resolvedSymbol); // getTypeReferenceType doesn't handle aliases - it must get the resolved symbol
|
||||
return getTypeReferenceType(node, resolvedSymbol); // getTypeReferenceType doesn't handle aliases - it must get the resolved symbol
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14204,7 +14202,7 @@ namespace ts {
|
||||
if (isGenericMappedType(source)) {
|
||||
// A generic mapped type { [P in K]: T } is related to an index signature { [x: string]: U }
|
||||
// if T is related to U.
|
||||
return (kind === IndexKind.String && isRelatedTo(getTemplateTypeFromMappedType(source), targetInfo.type, reportErrors)) as any as Ternary; // TODO: GH#18217
|
||||
return kind === IndexKind.String ? isRelatedTo(getTemplateTypeFromMappedType(source), targetInfo.type, reportErrors) : Ternary.False;
|
||||
}
|
||||
if (isObjectTypeWithInferableIndex(source)) {
|
||||
let related = Ternary.True;
|
||||
@@ -17414,7 +17412,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
function narrowTypeByTypeof(type: Type, typeOfExpr: TypeOfExpression, operator: SyntaxKind, literal: LiteralExpression, assumeTrue: boolean): Type {
|
||||
// We have '==', '!=', '====', or !==' operator with 'typeof xxx' and string literal operands
|
||||
// We have '==', '!=', '===', or !==' operator with 'typeof xxx' and string literal operands
|
||||
const target = getReferenceCandidate(typeOfExpr.expression);
|
||||
if (!isMatchingReference(reference, target)) {
|
||||
// For a reference of the form 'x.y', a 'typeof x === ...' type guard resets the
|
||||
@@ -19874,6 +19872,12 @@ namespace ts {
|
||||
}
|
||||
|
||||
function isValidSpreadType(type: Type): boolean {
|
||||
if (type.flags & TypeFlags.Instantiable) {
|
||||
const constraint = getBaseConstraintOfType(type);
|
||||
if (constraint !== undefined) {
|
||||
return isValidSpreadType(constraint);
|
||||
}
|
||||
}
|
||||
return !!(type.flags & (TypeFlags.AnyOrUnknown | TypeFlags.NonPrimitive | TypeFlags.Object | TypeFlags.InstantiableNonPrimitive) ||
|
||||
getFalsyFlags(type) & TypeFlags.DefinitelyFalsy && isValidSpreadType(removeDefinitelyFalsyTypes(type)) ||
|
||||
type.flags & TypeFlags.UnionOrIntersection && every((<UnionOrIntersectionType>type).types, isValidSpreadType));
|
||||
@@ -20822,7 +20826,7 @@ namespace ts {
|
||||
let relatedInfo: Diagnostic | undefined;
|
||||
if (containingType.flags & TypeFlags.Union && !(containingType.flags & TypeFlags.Primitive)) {
|
||||
for (const subtype of (containingType as UnionType).types) {
|
||||
if (!getPropertyOfType(subtype, propNode.escapedText)) {
|
||||
if (!getPropertyOfType(subtype, propNode.escapedText) && !getIndexInfoOfType(subtype, IndexKind.String)) {
|
||||
errorInfo = chainDiagnosticMessages(errorInfo, Diagnostics.Property_0_does_not_exist_on_type_1, declarationNameToString(propNode), typeToString(subtype));
|
||||
break;
|
||||
}
|
||||
@@ -21054,21 +21058,6 @@ namespace ts {
|
||||
const objectType = getAssignmentTargetKind(node) !== AssignmentKind.None || isMethodAccessForCall(node) ? getWidenedType(exprType) : exprType;
|
||||
|
||||
const indexExpression = node.argumentExpression;
|
||||
if (!indexExpression) {
|
||||
const sourceFile = getSourceFileOfNode(node);
|
||||
if (node.parent.kind === SyntaxKind.NewExpression && (<NewExpression>node.parent).expression === node) {
|
||||
const start = skipTrivia(sourceFile.text, node.expression.end);
|
||||
const end = node.end;
|
||||
grammarErrorAtPos(sourceFile, start, end - start, Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead);
|
||||
}
|
||||
else {
|
||||
const start = node.end - "]".length;
|
||||
const end = node.end;
|
||||
grammarErrorAtPos(sourceFile, start, end - start, Diagnostics.Expression_expected);
|
||||
}
|
||||
return errorType;
|
||||
}
|
||||
|
||||
const indexType = checkExpression(indexExpression);
|
||||
|
||||
if (objectType === errorType || objectType === silentNeverType) {
|
||||
@@ -29737,9 +29726,7 @@ namespace ts {
|
||||
name = ex.name.escapedText;
|
||||
}
|
||||
else {
|
||||
const argument = ex.argumentExpression;
|
||||
Debug.assert(isLiteralExpression(argument));
|
||||
name = escapeLeadingUnderscores((argument as LiteralExpression).text);
|
||||
name = escapeLeadingUnderscores(cast(ex.argumentExpression, isLiteralExpression).text);
|
||||
}
|
||||
return evaluateEnumMember(expr, type.symbol, name);
|
||||
}
|
||||
|
||||
@@ -459,10 +459,6 @@
|
||||
"category": "Error",
|
||||
"code": 1149
|
||||
},
|
||||
"'new T[]' cannot be used to create an array. Use 'new Array<T>()' instead.": {
|
||||
"category": "Error",
|
||||
"code": 1150
|
||||
},
|
||||
"'const' declarations must be initialized.": {
|
||||
"category": "Error",
|
||||
"code": 1155
|
||||
|
||||
+22
-1
@@ -5490,10 +5490,22 @@ namespace ts {
|
||||
}
|
||||
|
||||
function parseDeclaration(): Statement {
|
||||
const modifiers = lookAhead(() => (parseDecorators(), parseModifiers()));
|
||||
// `parseListElement` attempted to get the reused node at this position,
|
||||
// but the ambient context flag was not yet set, so the node appeared
|
||||
// not reusable in that context.
|
||||
const isAmbient = some(modifiers, isDeclareModifier);
|
||||
if (isAmbient) {
|
||||
const node = tryReuseAmbientDeclaration();
|
||||
if (node) {
|
||||
return node;
|
||||
}
|
||||
}
|
||||
|
||||
const node = <Statement>createNodeWithJSDoc(SyntaxKind.Unknown);
|
||||
node.decorators = parseDecorators();
|
||||
node.modifiers = parseModifiers();
|
||||
if (some(node.modifiers, isDeclareModifier)) {
|
||||
if (isAmbient) {
|
||||
for (const m of node.modifiers!) {
|
||||
m.flags |= NodeFlags.Ambient;
|
||||
}
|
||||
@@ -5504,6 +5516,15 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
function tryReuseAmbientDeclaration(): Statement | undefined {
|
||||
return doInsideOfContext(NodeFlags.Ambient, () => {
|
||||
const node = currentNode(parsingContext);
|
||||
if (node) {
|
||||
return consumeNode(node) as Statement;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function parseDeclarationWorker(node: Statement): Statement {
|
||||
switch (token()) {
|
||||
case SyntaxKind.VarKeyword:
|
||||
|
||||
@@ -1142,7 +1142,7 @@ namespace ts {
|
||||
// If we change our policy of rechecking failed lookups on each program create,
|
||||
// we should adjust the value returned here.
|
||||
function moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName: string): boolean {
|
||||
const resolutionToFile = getResolvedModule(oldSourceFile!, moduleName);
|
||||
const resolutionToFile = getResolvedModule(oldSourceFile, moduleName);
|
||||
const resolvedFile = resolutionToFile && oldProgram!.getSourceFile(resolutionToFile.resolvedFileName);
|
||||
if (resolutionToFile && resolvedFile) {
|
||||
// In the old program, we resolved to an ambient module that was in the same
|
||||
@@ -1831,6 +1831,7 @@ namespace ts {
|
||||
|
||||
switch (parent.kind) {
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
case SyntaxKind.ClassExpression:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
case SyntaxKind.Constructor:
|
||||
@@ -1840,7 +1841,7 @@ namespace ts {
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.ArrowFunction:
|
||||
// Check type parameters
|
||||
if (nodes === (<ClassDeclaration | FunctionLikeDeclaration>parent).typeParameters) {
|
||||
if (nodes === (<ClassLikeDeclaration | FunctionLikeDeclaration>parent).typeParameters) {
|
||||
diagnostics.push(createDiagnosticForNodeArray(nodes, Diagnostics.type_parameter_declarations_can_only_be_used_in_a_ts_file));
|
||||
return;
|
||||
}
|
||||
|
||||
+12
-1
@@ -879,7 +879,7 @@ namespace ts {
|
||||
|
||||
setText(text, start, length);
|
||||
|
||||
return {
|
||||
const scanner: Scanner = {
|
||||
getStartPos: () => startPos,
|
||||
getTextPos: () => pos,
|
||||
getToken: () => token,
|
||||
@@ -915,6 +915,17 @@ namespace ts {
|
||||
scanRange,
|
||||
};
|
||||
|
||||
if (Debug.isDebugging) {
|
||||
Object.defineProperty(scanner, "__debugShowCurrentPositionInText", {
|
||||
get: () => {
|
||||
const text = scanner.getText();
|
||||
return text.slice(0, scanner.getStartPos()) + "║" + text.slice(scanner.getStartPos());
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
return scanner;
|
||||
|
||||
function error(message: DiagnosticMessage): void;
|
||||
function error(message: DiagnosticMessage, errPos: number, length: number): void;
|
||||
function error(message: DiagnosticMessage, errPos: number = pos, length?: number): void {
|
||||
|
||||
@@ -3346,7 +3346,7 @@ namespace ts {
|
||||
* This should be called in a loop climbing parents of the symbol, so we'll get `N`.
|
||||
*/
|
||||
/* @internal */ getAccessibleSymbolChain(symbol: Symbol, enclosingDeclaration: Node | undefined, meaning: SymbolFlags, useOnlyExternalAliasing: boolean): Symbol[] | undefined;
|
||||
/* @internal */ getTypePredicateOfSignature(signature: Signature): TypePredicate;
|
||||
/* @internal */ getTypePredicateOfSignature(signature: Signature): TypePredicate | undefined;
|
||||
/**
|
||||
* An external module with an 'export =' declaration resolves to the target of the 'export =' declaration,
|
||||
* and an external module with no 'export =' declaration resolves to the module itself.
|
||||
|
||||
@@ -220,7 +220,7 @@ namespace ts {
|
||||
return node.end - node.pos;
|
||||
}
|
||||
|
||||
export function getResolvedModule(sourceFile: SourceFile, moduleNameText: string): ResolvedModuleFull | undefined {
|
||||
export function getResolvedModule(sourceFile: SourceFile | undefined, moduleNameText: string): ResolvedModuleFull | undefined {
|
||||
return sourceFile && sourceFile.resolvedModules && sourceFile.resolvedModules.get(moduleNameText);
|
||||
}
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -110,7 +110,7 @@ interface ReadonlyArray<T> {
|
||||
* @param depth The maximum recursion depth
|
||||
*/
|
||||
flat<U>(depth?: number): any[];
|
||||
}
|
||||
}
|
||||
|
||||
interface Array<T> {
|
||||
|
||||
|
||||
Vendored
+20
-29
@@ -1094,7 +1094,7 @@ interface ReadonlyArray<T> {
|
||||
/**
|
||||
* Returns a section of an array.
|
||||
* @param start The beginning of the specified portion of the array.
|
||||
* @param end The end of the specified portion of the array.
|
||||
* @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'.
|
||||
*/
|
||||
slice(start?: number, end?: number): T[];
|
||||
/**
|
||||
@@ -1230,7 +1230,7 @@ interface Array<T> {
|
||||
/**
|
||||
* Returns a section of an array.
|
||||
* @param start The beginning of the specified portion of the array.
|
||||
* @param end The end of the specified portion of the array.
|
||||
* @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'.
|
||||
*/
|
||||
slice(start?: number, end?: number): T[];
|
||||
/**
|
||||
@@ -1860,7 +1860,7 @@ interface Int8Array {
|
||||
/**
|
||||
* Returns a section of an array.
|
||||
* @param start The beginning of the specified portion of the array.
|
||||
* @param end The end of the specified portion of the array.
|
||||
* @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'.
|
||||
*/
|
||||
slice(start?: number, end?: number): Int8Array;
|
||||
|
||||
@@ -1887,7 +1887,7 @@ interface Int8Array {
|
||||
* @param begin The index of the beginning of the array.
|
||||
* @param end The index of the end of the array.
|
||||
*/
|
||||
subarray(begin: number, end?: number): Int8Array;
|
||||
subarray(begin?: number, end?: number): Int8Array;
|
||||
|
||||
/**
|
||||
* Converts a number to a string by using the current locale.
|
||||
@@ -2135,7 +2135,7 @@ interface Uint8Array {
|
||||
/**
|
||||
* Returns a section of an array.
|
||||
* @param start The beginning of the specified portion of the array.
|
||||
* @param end The end of the specified portion of the array.
|
||||
* @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'.
|
||||
*/
|
||||
slice(start?: number, end?: number): Uint8Array;
|
||||
|
||||
@@ -2162,7 +2162,7 @@ interface Uint8Array {
|
||||
* @param begin The index of the beginning of the array.
|
||||
* @param end The index of the end of the array.
|
||||
*/
|
||||
subarray(begin: number, end?: number): Uint8Array;
|
||||
subarray(begin?: number, end?: number): Uint8Array;
|
||||
|
||||
/**
|
||||
* Converts a number to a string by using the current locale.
|
||||
@@ -2410,7 +2410,7 @@ interface Uint8ClampedArray {
|
||||
/**
|
||||
* Returns a section of an array.
|
||||
* @param start The beginning of the specified portion of the array.
|
||||
* @param end The end of the specified portion of the array.
|
||||
* @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'.
|
||||
*/
|
||||
slice(start?: number, end?: number): Uint8ClampedArray;
|
||||
|
||||
@@ -2437,7 +2437,7 @@ interface Uint8ClampedArray {
|
||||
* @param begin The index of the beginning of the array.
|
||||
* @param end The index of the end of the array.
|
||||
*/
|
||||
subarray(begin: number, end?: number): Uint8ClampedArray;
|
||||
subarray(begin?: number, end?: number): Uint8ClampedArray;
|
||||
|
||||
/**
|
||||
* Converts a number to a string by using the current locale.
|
||||
@@ -2683,7 +2683,7 @@ interface Int16Array {
|
||||
/**
|
||||
* Returns a section of an array.
|
||||
* @param start The beginning of the specified portion of the array.
|
||||
* @param end The end of the specified portion of the array.
|
||||
* @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'.
|
||||
*/
|
||||
slice(start?: number, end?: number): Int16Array;
|
||||
|
||||
@@ -2710,7 +2710,7 @@ interface Int16Array {
|
||||
* @param begin The index of the beginning of the array.
|
||||
* @param end The index of the end of the array.
|
||||
*/
|
||||
subarray(begin: number, end?: number): Int16Array;
|
||||
subarray(begin?: number, end?: number): Int16Array;
|
||||
|
||||
/**
|
||||
* Converts a number to a string by using the current locale.
|
||||
@@ -2959,7 +2959,7 @@ interface Uint16Array {
|
||||
/**
|
||||
* Returns a section of an array.
|
||||
* @param start The beginning of the specified portion of the array.
|
||||
* @param end The end of the specified portion of the array.
|
||||
* @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'.
|
||||
*/
|
||||
slice(start?: number, end?: number): Uint16Array;
|
||||
|
||||
@@ -2986,7 +2986,7 @@ interface Uint16Array {
|
||||
* @param begin The index of the beginning of the array.
|
||||
* @param end The index of the end of the array.
|
||||
*/
|
||||
subarray(begin: number, end?: number): Uint16Array;
|
||||
subarray(begin?: number, end?: number): Uint16Array;
|
||||
|
||||
/**
|
||||
* Converts a number to a string by using the current locale.
|
||||
@@ -3234,7 +3234,7 @@ interface Int32Array {
|
||||
/**
|
||||
* Returns a section of an array.
|
||||
* @param start The beginning of the specified portion of the array.
|
||||
* @param end The end of the specified portion of the array.
|
||||
* @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'.
|
||||
*/
|
||||
slice(start?: number, end?: number): Int32Array;
|
||||
|
||||
@@ -3261,7 +3261,7 @@ interface Int32Array {
|
||||
* @param begin The index of the beginning of the array.
|
||||
* @param end The index of the end of the array.
|
||||
*/
|
||||
subarray(begin: number, end?: number): Int32Array;
|
||||
subarray(begin?: number, end?: number): Int32Array;
|
||||
|
||||
/**
|
||||
* Converts a number to a string by using the current locale.
|
||||
@@ -3508,7 +3508,7 @@ interface Uint32Array {
|
||||
/**
|
||||
* Returns a section of an array.
|
||||
* @param start The beginning of the specified portion of the array.
|
||||
* @param end The end of the specified portion of the array.
|
||||
* @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'.
|
||||
*/
|
||||
slice(start?: number, end?: number): Uint32Array;
|
||||
|
||||
@@ -3535,7 +3535,7 @@ interface Uint32Array {
|
||||
* @param begin The index of the beginning of the array.
|
||||
* @param end The index of the end of the array.
|
||||
*/
|
||||
subarray(begin: number, end?: number): Uint32Array;
|
||||
subarray(begin?: number, end?: number): Uint32Array;
|
||||
|
||||
/**
|
||||
* Converts a number to a string by using the current locale.
|
||||
@@ -3783,7 +3783,7 @@ interface Float32Array {
|
||||
/**
|
||||
* Returns a section of an array.
|
||||
* @param start The beginning of the specified portion of the array.
|
||||
* @param end The end of the specified portion of the array.
|
||||
* @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'.
|
||||
*/
|
||||
slice(start?: number, end?: number): Float32Array;
|
||||
|
||||
@@ -3810,7 +3810,7 @@ interface Float32Array {
|
||||
* @param begin The index of the beginning of the array.
|
||||
* @param end The index of the end of the array.
|
||||
*/
|
||||
subarray(begin: number, end?: number): Float32Array;
|
||||
subarray(begin?: number, end?: number): Float32Array;
|
||||
|
||||
/**
|
||||
* Converts a number to a string by using the current locale.
|
||||
@@ -4059,7 +4059,7 @@ interface Float64Array {
|
||||
/**
|
||||
* Returns a section of an array.
|
||||
* @param start The beginning of the specified portion of the array.
|
||||
* @param end The end of the specified portion of the array.
|
||||
* @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'.
|
||||
*/
|
||||
slice(start?: number, end?: number): Float64Array;
|
||||
|
||||
@@ -4081,21 +4081,12 @@ interface Float64Array {
|
||||
sort(compareFn?: (a: number, b: number) => number): this;
|
||||
|
||||
/**
|
||||
* Gets a new Float64Array view of the ArrayBuffer store for this array, referencing the elements
|
||||
* at begin, inclusive, up to end, exclusive.
|
||||
* @param begin The index of the beginning of the array.
|
||||
* @param end The index of the end of the array.
|
||||
*/
|
||||
subarray(begin: number, end?: number): Float64Array;
|
||||
subarray(begin?: number, end?: number): Float64Array;
|
||||
|
||||
/**
|
||||
* Converts a number to a string by using the current locale.
|
||||
*/
|
||||
toLocaleString(): string;
|
||||
|
||||
/**
|
||||
* Returns a string representation of an array.
|
||||
*/
|
||||
toString(): string;
|
||||
|
||||
[index: number]: number;
|
||||
|
||||
Vendored
+2
-2
@@ -260,7 +260,7 @@ interface BigInt64Array {
|
||||
* @param begin The index of the beginning of the array.
|
||||
* @param end The index of the end of the array.
|
||||
*/
|
||||
subarray(begin: number, end?: number): BigInt64Array;
|
||||
subarray(begin?: number, end?: number): BigInt64Array;
|
||||
|
||||
/** Converts the array to a string by using the current locale. */
|
||||
toLocaleString(): string;
|
||||
@@ -529,7 +529,7 @@ interface BigUint64Array {
|
||||
* @param begin The index of the beginning of the array.
|
||||
* @param end The index of the end of the array.
|
||||
*/
|
||||
subarray(begin: number, end?: number): BigUint64Array;
|
||||
subarray(begin?: number, end?: number): BigUint64Array;
|
||||
|
||||
/** Converts the array to a string by using the current locale. */
|
||||
toLocaleString(): string;
|
||||
|
||||
Vendored
+1
-1
@@ -1,3 +1,3 @@
|
||||
/// <reference lib="es2019" />
|
||||
/// <reference lib="es2020" />
|
||||
/// <reference lib="esnext.bigint" />
|
||||
/// <reference lib="esnext.intl" />
|
||||
|
||||
@@ -673,7 +673,7 @@ module m3 { }\
|
||||
const oldText = ScriptSnapshot.fromString(source);
|
||||
const newTextAndChange = withInsert(oldText, 0, "{");
|
||||
|
||||
compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 4);
|
||||
compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 9);
|
||||
});
|
||||
|
||||
it("Removing block around function declarations", () => {
|
||||
@@ -682,7 +682,7 @@ module m3 { }\
|
||||
const oldText = ScriptSnapshot.fromString(source);
|
||||
const newTextAndChange = withDelete(oldText, 0, "{".length);
|
||||
|
||||
compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 4);
|
||||
compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 9);
|
||||
});
|
||||
|
||||
it("Moving methods from class to object literal", () => {
|
||||
|
||||
Reference in New Issue
Block a user