diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index cce5824fb1f6c..a68f1e041965c 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -42,10 +42,10 @@ namespace ts { iterableCacheKey: "iterationTypesOfAsyncIterable" | "iterationTypesOfIterable"; iteratorCacheKey: "iterationTypesOfAsyncIterator" | "iterationTypesOfIterator"; iteratorSymbolName: "asyncIterator" | "iterator"; - getGlobalIteratorType: (reportErrors: boolean) => Type; - getGlobalIterableType: (reportErrors: boolean) => Type; - getGlobalIterableIteratorType: (reportErrors: boolean) => Type; - getGlobalGeneratorType: (reportErrors: boolean) => Type; + getGlobalIteratorType: (reportErrors: boolean) => GenericType; + getGlobalIterableType: (reportErrors: boolean) => GenericType; + getGlobalIterableIteratorType: (reportErrors: boolean) => GenericType; + getGlobalGeneratorType: (reportErrors: boolean) => GenericType; resolveIterationType: (type: Type, errorNode: Node | undefined) => Type | undefined; mustHaveANextMethodDiagnostic: DiagnosticMessage; mustBeAMethodDiagnostic: DiagnosticMessage; @@ -10674,24 +10674,10 @@ namespace ts { return createTypeFromGenericGlobalType(getGlobalTypedPropertyDescriptorType(), [propertyType]); } - function createAsyncGeneratorType(yieldType: Type, returnType: Type, nextType: Type) { - const globalAsyncGeneratorType = getGlobalAsyncGeneratorType(/*reportErrors*/ true); - if (globalAsyncGeneratorType !== emptyGenericType) { - yieldType = getAwaitedType(yieldType) || unknownType; - returnType = getAwaitedType(returnType) || unknownType; - nextType = getAwaitedType(nextType) || unknownType; - } - return createTypeFromGenericGlobalType(globalAsyncGeneratorType, [yieldType, returnType, nextType]); - } - function createIterableType(iteratedType: Type): Type { return createTypeFromGenericGlobalType(getGlobalIterableType(/*reportErrors*/ true), [iteratedType]); } - function createGeneratorType(yieldType: Type, returnType: Type, nextType: Type) { - return createTypeFromGenericGlobalType(getGlobalGeneratorType(/*reportErrors*/ true), [yieldType, returnType, nextType]); - } - function createArrayType(elementType: Type, readonly?: boolean): ObjectType { return createTypeFromGenericGlobalType(readonly ? globalReadonlyArrayType : globalArrayType, [elementType]); } @@ -11047,7 +11033,7 @@ namespace ts { return links.resolvedType; } - function addTypeToIntersection(typeSet: Type[], includes: TypeFlags, type: Type) { + function addTypeToIntersection(typeSet: Map, includes: TypeFlags, type: Type) { const flags = type.flags; if (flags & TypeFlags.Intersection) { return addTypesToIntersection(typeSet, includes, (type).types); @@ -11055,20 +11041,20 @@ namespace ts { if (isEmptyAnonymousObjectType(type)) { if (!(includes & TypeFlags.IncludesEmptyObject)) { includes |= TypeFlags.IncludesEmptyObject; - typeSet.push(type); + typeSet.set(type.id.toString(), type); } } else { if (flags & TypeFlags.AnyOrUnknown) { if (type === wildcardType) includes |= TypeFlags.IncludesWildcard; } - else if ((strictNullChecks || !(flags & TypeFlags.Nullable)) && !contains(typeSet, type)) { + else if ((strictNullChecks || !(flags & TypeFlags.Nullable)) && !typeSet.has(type.id.toString())) { if (type.flags & TypeFlags.Unit && includes & TypeFlags.Unit) { // We have seen two distinct unit types which means we should reduce to an // empty intersection. Adding TypeFlags.NonPrimitive causes that to happen. includes |= TypeFlags.NonPrimitive; } - typeSet.push(type); + typeSet.set(type.id.toString(), type); } includes |= flags & TypeFlags.IncludesMask; } @@ -11077,7 +11063,7 @@ namespace ts { // Add the given types to the given type set. Order is preserved, freshness is removed from literal // types, duplicates are removed, and nested types of the given kind are flattened into the set. - function addTypesToIntersection(typeSet: Type[], includes: TypeFlags, types: ReadonlyArray) { + function addTypesToIntersection(typeSet: Map, includes: TypeFlags, types: ReadonlyArray) { for (const type of types) { includes = addTypeToIntersection(typeSet, includes, getRegularTypeOfLiteralType(type)); } @@ -11184,8 +11170,9 @@ namespace ts { // Also, unlike union types, the order of the constituent types is preserved in order that overload resolution // for intersections of types with signatures can be deterministic. function getIntersectionType(types: ReadonlyArray, aliasSymbol?: Symbol, aliasTypeArguments?: ReadonlyArray): Type { - const typeSet: Type[] = []; - const includes = addTypesToIntersection(typeSet, 0, types); + const typeMembershipMap: Map = createMap(); + const includes = addTypesToIntersection(typeMembershipMap, 0, types); + const typeSet: Type[] = arrayFrom(typeMembershipMap.values()); // An intersection type is considered empty if it contains // the type never, or // more than one unit type or, @@ -16409,8 +16396,8 @@ namespace ts { const inference = inferences[i]; if (t === inference.typeParameter) { if (fix && !inference.isFixed) { + clearCachedInferences(inferences); inference.isFixed = true; - inference.inferredType = undefined; } return getInferredType(context, i); } @@ -16418,6 +16405,14 @@ namespace ts { return t; } + function clearCachedInferences(inferences: InferenceInfo[]) { + for (const inference of inferences) { + if (!inference.isFixed) { + inference.inferredType = undefined; + } + } + } + function createInferenceInfo(typeParameter: TypeParameter): InferenceInfo { return { typeParameter, @@ -16697,17 +16692,17 @@ namespace ts { if (contravariant && !bivariant) { if (!contains(inference.contraCandidates, candidate)) { inference.contraCandidates = append(inference.contraCandidates, candidate); - inference.inferredType = undefined; + clearCachedInferences(inferences); } } else if (!contains(inference.candidates, candidate)) { inference.candidates = append(inference.candidates, candidate); - inference.inferredType = undefined; + clearCachedInferences(inferences); } } if (!(priority & InferencePriority.ReturnType) && target.flags & TypeFlags.TypeParameter && inference.topLevel && !isTypeParameterAtTopLevel(originalTarget, target)) { inference.topLevel = false; - inference.inferredType = undefined; + clearCachedInferences(inferences); } } return; @@ -21722,10 +21717,15 @@ namespace ts { } propType = getConstraintForLocation(getTypeOfSymbol(prop), node); } + return getFlowTypeOfAccessExpression(node, prop, propType, right); + } + + function getFlowTypeOfAccessExpression(node: ElementAccessExpression | PropertyAccessExpression | QualifiedName, prop: Symbol | undefined, propType: Type, errorNode: Node) { // Only compute control flow type if this is a property access expression that isn't an // assignment target, and the referenced property was declared as a variable, property, // accessor, or optional method. - if (node.kind !== SyntaxKind.PropertyAccessExpression || + const assignmentKind = getAssignmentTargetKind(node); + if (node.kind !== SyntaxKind.ElementAccessExpression && node.kind !== SyntaxKind.PropertyAccessExpression || assignmentKind === AssignmentKind.Definite || prop && !(prop.flags & (SymbolFlags.Variable | SymbolFlags.Property | SymbolFlags.Accessor)) && !(prop.flags & SymbolFlags.Method && propType.flags & TypeFlags.Union)) { return propType; @@ -21735,7 +21735,7 @@ namespace ts { // and if we are in a constructor of the same class as the property declaration, assume that // the property is uninitialized at the top of the control flow. let assumeUninitialized = false; - if (strictNullChecks && strictPropertyInitialization && left.kind === SyntaxKind.ThisKeyword) { + if (strictNullChecks && strictPropertyInitialization && node.expression.kind === SyntaxKind.ThisKeyword) { const declaration = prop && prop.valueDeclaration; if (declaration && isInstancePropertyWithoutInitializer(declaration)) { const flowContainer = getControlFlowContainer(node); @@ -21752,7 +21752,7 @@ namespace ts { } const flowType = getFlowTypeOfReference(node, propType, assumeUninitialized ? getOptionalType(propType) : propType); if (assumeUninitialized && !(getFalsyFlags(propType) & TypeFlags.Undefined) && getFalsyFlags(flowType) & TypeFlags.Undefined) { - error(right, Diagnostics.Property_0_is_used_before_being_assigned, symbolToString(prop!)); // TODO: GH#18217 + error(errorNode, Diagnostics.Property_0_is_used_before_being_assigned, symbolToString(prop!)); // TODO: GH#18217 // Return the declared type to reduce follow-on errors return propType; } @@ -22109,7 +22109,7 @@ namespace ts { AccessFlags.Writing | (isGenericObjectType(objectType) && !isThisTypeParameter(objectType) ? AccessFlags.NoIndexSignatures : 0) : AccessFlags.None; const indexedAccessType = getIndexedAccessTypeOrUndefined(objectType, effectiveIndexType, node, accessFlags) || errorType; - return checkIndexedAccessIndexType(indexedAccessType, node); + return checkIndexedAccessIndexType(getFlowTypeOfAccessExpression(node, indexedAccessType.symbol, indexedAccessType, indexExpression), node); } function checkThatExpressionIsProperSymbolReference(expression: Expression, expressionType: Type, reportError: boolean): boolean { @@ -24536,9 +24536,36 @@ namespace ts { } function createGeneratorReturnType(yieldType: Type, returnType: Type, nextType: Type, isAsyncGenerator: boolean) { - return isAsyncGenerator - ? createAsyncGeneratorType(yieldType, returnType, nextType) - : createGeneratorType(yieldType, returnType, nextType); + const resolver = isAsyncGenerator ? asyncIterationTypesResolver : syncIterationTypesResolver; + const globalGeneratorType = resolver.getGlobalGeneratorType(/*reportErrors*/ false); + yieldType = resolver.resolveIterationType(yieldType, /*errorNode*/ undefined) || unknownType; + returnType = resolver.resolveIterationType(returnType, /*errorNode*/ undefined) || unknownType; + nextType = resolver.resolveIterationType(nextType, /*errorNode*/ undefined) || unknownType; + if (globalGeneratorType === emptyGenericType) { + // Fall back to the global IterableIterator if returnType is assignable to the expected return iteration + // type of IterableIterator, and the expected next iteration type of IterableIterator is assignable to + // nextType. + const globalType = resolver.getGlobalIterableIteratorType(/*reportErrors*/ false); + const iterationTypes = globalType !== emptyGenericType ? getIterationTypesOfGlobalIterableType(globalType, resolver) : undefined; + const iterableIteratorReturnType = iterationTypes ? iterationTypes.returnType : anyType; + const iterableIteratorNextType = iterationTypes ? iterationTypes.nextType : undefinedType; + if (isTypeAssignableTo(returnType, iterableIteratorReturnType) && + isTypeAssignableTo(iterableIteratorNextType, nextType)) { + if (globalType !== emptyGenericType) { + return createTypeFromGenericGlobalType(globalType, [yieldType]); + } + + // The global IterableIterator type doesn't exist, so report an error + resolver.getGlobalIterableIteratorType(/*reportErrors*/ true); + return emptyObjectType; + } + + // The global Generator type doesn't exist, so report an error + resolver.getGlobalGeneratorType(/*reportErrors*/ true); + return emptyObjectType; + } + + return createTypeFromGenericGlobalType(globalGeneratorType, [yieldType, returnType, nextType]); } function checkAndAggregateYieldOperandTypes(func: FunctionLikeDeclaration, checkMode: CheckMode | undefined) { @@ -25857,6 +25884,12 @@ namespace ts { || anyType; } + const contextualReturnType = getContextualReturnType(func); + if (contextualReturnType) { + return getIterationTypeOfGeneratorFunctionReturnType(IterationTypeKind.Next, contextualReturnType, isAsync) + || anyType; + } + return anyType; } @@ -29375,6 +29408,13 @@ namespace ts { return (type as IterableOrIteratorType)[resolver.iterableCacheKey]; } + function getIterationTypesOfGlobalIterableType(globalType: Type, resolver: IterationTypesResolver) { + const globalIterationTypes = + getIterationTypesOfIterableCached(globalType, resolver) || + getIterationTypesOfIterableSlow(globalType, resolver, /*errorNode*/ undefined); + return globalIterationTypes === noIterationTypes ? defaultIterationTypes : globalIterationTypes; + } + /** * Gets the *yield*, *return*, and *next* types of an `Iterable`-like or `AsyncIterable`-like * type from from common heuristics. @@ -29400,10 +29440,7 @@ namespace ts { // iteration types of their `[Symbol.iterator]()` method. The same is true for their async cousins. // While we define these as `any` and `undefined` in our libs by default, a custom lib *could* use // different definitions. - const globalIterationTypes = - getIterationTypesOfIterableCached(globalType, resolver) || - getIterationTypesOfIterableSlow(globalType, resolver, /*errorNode*/ undefined); - const { returnType, nextType } = globalIterationTypes === noIterationTypes ? defaultIterationTypes : globalIterationTypes; + const { returnType, nextType } = getIterationTypesOfGlobalIterableType(globalType, resolver); return (type as IterableOrIteratorType)[resolver.iterableCacheKey] = createIterationTypes(yieldType, returnType, nextType); } @@ -34169,9 +34206,6 @@ namespace ts { return grammarErrorAtPos(node, node.end - 1, ";".length, Diagnostics._0_expected, "{"); } } - else if (isClassLike(node.parent) && isStringLiteral(node.name) && node.name.text === "constructor" && (!compilerOptions.target || compilerOptions.target < ScriptTarget.ES5)) { - return grammarErrorOnNode(node.name, Diagnostics.Quoted_constructors_have_previously_been_interpreted_as_methods_which_is_incorrect_In_TypeScript_3_6_they_will_be_correctly_parsed_as_constructors_In_the_meantime_consider_using_constructor_to_write_a_constructor_or_constructor_to_write_a_method); - } if (checkGrammarForGenerator(node)) { return true; } diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 43d6689ef9241..207f9f369a673 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -5121,10 +5121,6 @@ "category": "Error", "code": 18004 }, - "Quoted constructors have previously been interpreted as methods, which is incorrect. In TypeScript 3.6, they will be correctly parsed as constructors. In the meantime, consider using 'constructor()' to write a constructor, or '[\"constructor\"]()' to write a method.": { - "category": "Error", - "code": 18005 - }, "Classes may not have a field named 'constructor'.": { "category": "Error", "code": 18006 diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index b57ccc28c3ad8..9b7084ec9319f 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -408,7 +408,11 @@ namespace ts { } ); if (emitOnlyDtsFiles && declarationTransform.transformed[0].kind === SyntaxKind.SourceFile) { - const sourceFile = declarationTransform.transformed[0] as SourceFile; + // Improved narrowing in master/3.6 makes this cast unnecessary, triggering a lint rule. + // But at the same time, the LKG (3.5) necessitates it because it doesn’t narrow. + // Once the LKG is updated to 3.6, this comment, the cast to `SourceFile`, and the + // tslint directive can be all be removed. + const sourceFile = declarationTransform.transformed[0] as SourceFile; // tslint:disable-line exportedModulesFromDeclarationEmit = sourceFile.exportedModulesFromDeclarationEmit; } } diff --git a/src/compiler/factory.ts b/src/compiler/factory.ts index 9ed7b02398cf4..cf89a24865806 100644 --- a/src/compiler/factory.ts +++ b/src/compiler/factory.ts @@ -4706,7 +4706,7 @@ namespace ts { } } - function getLeftmostExpression(node: Expression, stopAtCallExpressions: boolean) { + export function getLeftmostExpression(node: Expression, stopAtCallExpressions: boolean) { while (true) { switch (node.kind) { case SyntaxKind.PostfixUnaryExpression: diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index f115d66951af4..254be93000b03 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -5656,12 +5656,27 @@ namespace ts { return finishNode(node); } - function parseConstructorDeclaration(node: ConstructorDeclaration): ConstructorDeclaration { - node.kind = SyntaxKind.Constructor; - parseExpected(SyntaxKind.ConstructorKeyword); - fillSignature(SyntaxKind.ColonToken, SignatureFlags.None, node); - node.body = parseFunctionBlockOrSemicolon(SignatureFlags.None, Diagnostics.or_expected); - return finishNode(node); + function parseConstructorName() { + if (token() === SyntaxKind.ConstructorKeyword) { + return parseExpected(SyntaxKind.ConstructorKeyword); + } + if (token() === SyntaxKind.StringLiteral && lookAhead(nextToken) === SyntaxKind.OpenParenToken) { + return tryParse(() => { + const literalNode = parseLiteralNode(); + return literalNode.text === "constructor" ? literalNode : undefined; + }); + } + } + + function tryParseConstructorDeclaration(node: ConstructorDeclaration): ConstructorDeclaration | undefined { + return tryParse(() => { + if (parseConstructorName()) { + node.kind = SyntaxKind.Constructor; + fillSignature(SyntaxKind.ColonToken, SignatureFlags.None, node); + node.body = parseFunctionBlockOrSemicolon(SignatureFlags.None, Diagnostics.or_expected); + return finishNode(node); + } + }); } function parseMethodDeclaration(node: MethodDeclaration, asteriskToken: AsteriskToken, diagnosticMessage?: DiagnosticMessage): MethodDeclaration { @@ -5867,8 +5882,11 @@ namespace ts { return parseAccessorDeclaration(node, SyntaxKind.SetAccessor); } - if (token() === SyntaxKind.ConstructorKeyword) { - return parseConstructorDeclaration(node); + if (token() === SyntaxKind.ConstructorKeyword || token() === SyntaxKind.StringLiteral) { + const constructorDeclaration = tryParseConstructorDeclaration(node); + if (constructorDeclaration) { + return constructorDeclaration; + } } if (isIndexSignature()) { diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index 256e41629a1d8..f949893171a79 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -197,6 +197,7 @@ namespace ts { "|=": SyntaxKind.BarEqualsToken, "^=": SyntaxKind.CaretEqualsToken, "@": SyntaxKind.AtToken, + "`": SyntaxKind.BacktickToken }); /* @@ -298,7 +299,6 @@ namespace ts { } const tokenStrings = makeReverseMap(textToToken); - export function tokenToString(t: SyntaxKind): string | undefined { return tokenStrings[t]; } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index c1b74fe1c5fe7..b0e946ff0fbae 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -1882,6 +1882,7 @@ namespace ts { } export interface JsxAttributes extends ObjectLiteralExpressionBase { + kind: SyntaxKind.JsxAttributes; parent: JsxOpeningLikeElement; } @@ -4767,7 +4768,7 @@ namespace ts { UMD = 3, System = 4, ES2015 = 5, - ESNext = 6 + ESNext = 99 } export const enum JsxEmit { @@ -4815,7 +4816,7 @@ namespace ts { ES2018 = 5, ES2019 = 6, ES2020 = 7, - ESNext = 8, + ESNext = 99, JSON = 100, Latest = ESNext, } diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 613446bd628b0..631a3e4b62961 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -3173,6 +3173,23 @@ namespace ts { return s.replace(escapedCharsRegExp, getReplacement); } + /** + * Strip off existed single quotes or double quotes from a given string + * + * @return non-quoted string + */ + export function stripQuotes(name: string) { + const length = name.length; + if (length >= 2 && name.charCodeAt(0) === name.charCodeAt(length - 1) && startsWithQuote(name)) { + return name.substring(1, length - 1); + } + return name; + } + + export function startsWithQuote(name: string): boolean { + return isSingleOrDoubleQuote(name.charCodeAt(0)); + } + function getReplacement(c: string, offset: number, input: string) { if (c.charCodeAt(0) === CharacterCodes.nullCharacter) { const lookAhead = input.charCodeAt(offset + c.length); @@ -7529,7 +7546,7 @@ namespace ts { export function getDirectoryPath(path: Path): Path; /** * Returns the path except for its basename. Semantics align with NodeJS's `path.dirname` - * except that we support URLs as well. + * except that we support URL's as well. * * ```ts * getDirectoryPath("/path/to/file.ext") === "/path/to" diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 56cc2b65508b2..f12506be2fb27 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -797,8 +797,8 @@ namespace FourSlash { for (const include of toArray(options.includes)) { const name = typeof include === "string" ? include : include.name; const found = nameToEntries.get(name); - if (!found) throw this.raiseError(`No completion ${name} found`); - assert(found.length === 1, `Must use 'exact' for multiple completions with same name: '${name}'`); + if (!found) throw this.raiseError(`Includes: completion '${name}' not found.`); + assert(found.length === 1); // Must use 'exact' for multiple completions with same name this.verifyCompletionEntry(ts.first(found), include); } } @@ -806,7 +806,7 @@ namespace FourSlash { for (const exclude of toArray(options.excludes)) { assert(typeof exclude === "string"); if (nameToEntries.has(exclude)) { - this.raiseError(`Did not expect to get a completion named ${exclude}`); + this.raiseError(`Excludes: unexpected completion '${exclude}' found.`); } } } @@ -865,7 +865,7 @@ namespace FourSlash { ts.zipWith(actual, expected, (completion, expectedCompletion, index) => { const name = typeof expectedCompletion === "string" ? expectedCompletion : expectedCompletion.name; if (completion.name !== name) { - this.raiseError(`${marker ? JSON.stringify(marker) : "" } Expected completion at index ${index} to be ${name}, got ${completion.name}`); + this.raiseError(`${marker ? JSON.stringify(marker) : ""} Expected completion at index ${index} to be ${name}, got ${completion.name}`); } this.verifyCompletionEntry(completion, expectedCompletion); }); @@ -948,7 +948,7 @@ namespace FourSlash { const actual = checker.typeToString(type); if (actual !== expected) { - this.raiseError(`Expected: '${expected}', actual: '${actual}'`); + this.raiseError(displayExpectedAndActualString(expected, actual)); } } @@ -1024,9 +1024,7 @@ namespace FourSlash { private assertObjectsEqual(fullActual: T, fullExpected: T, msgPrefix = ""): void { const recur = (actual: U, expected: U, path: string) => { const fail = (msg: string) => { - this.raiseError(`${msgPrefix} At ${path}: ${msg} -Expected: ${stringify(fullExpected)} -Actual: ${stringify(fullActual)}`); + this.raiseError(`${msgPrefix} At ${path}: ${msg} ${displayExpectedAndActualString(stringify(fullExpected), stringify(fullActual))}`); }; if ((actual === undefined) !== (expected === undefined)) { @@ -1058,9 +1056,7 @@ Actual: ${stringify(fullActual)}`); if (fullActual === fullExpected) { return; } - this.raiseError(`${msgPrefix} -Expected: ${stringify(fullExpected)} -Actual: ${stringify(fullActual)}`); + this.raiseError(`${msgPrefix} ${displayExpectedAndActualString(stringify(fullExpected), stringify(fullActual))}`); } recur(fullActual, fullExpected, ""); @@ -2111,9 +2107,7 @@ Actual: ${stringify(fullActual)}`); public verifyCurrentLineContent(text: string) { const actual = this.getCurrentLineContent(); if (actual !== text) { - throw new Error("verifyCurrentLineContent\n" + - "\tExpected: \"" + text + "\"\n" + - "\t Actual: \"" + actual + "\""); + throw new Error("verifyCurrentLineContent\n" + displayExpectedAndActualString(text, actual, /* quoted */ true)); } } @@ -2139,25 +2133,19 @@ Actual: ${stringify(fullActual)}`); public verifyTextAtCaretIs(text: string) { const actual = this.getFileContent(this.activeFile.fileName).substring(this.currentCaretPosition, this.currentCaretPosition + text.length); if (actual !== text) { - throw new Error("verifyTextAtCaretIs\n" + - "\tExpected: \"" + text + "\"\n" + - "\t Actual: \"" + actual + "\""); + throw new Error("verifyTextAtCaretIs\n" + displayExpectedAndActualString(text, actual, /* quoted */ true)); } } public verifyCurrentNameOrDottedNameSpanText(text: string) { const span = this.languageService.getNameOrDottedNameSpan(this.activeFile.fileName, this.currentCaretPosition, this.currentCaretPosition); if (!span) { - return this.raiseError("verifyCurrentNameOrDottedNameSpanText\n" + - "\tExpected: \"" + text + "\"\n" + - "\t Actual: undefined"); + return this.raiseError("verifyCurrentNameOrDottedNameSpanText\n" + displayExpectedAndActualString("\"" + text + "\"", "undefined")); } const actual = this.getFileContent(this.activeFile.fileName).substring(span.start, ts.textSpanEnd(span)); if (actual !== text) { - this.raiseError("verifyCurrentNameOrDottedNameSpanText\n" + - "\tExpected: \"" + text + "\"\n" + - "\t Actual: \"" + actual + "\""); + this.raiseError("verifyCurrentNameOrDottedNameSpanText\n" + displayExpectedAndActualString(text, actual, /* quoted */ true)); } } @@ -3690,7 +3678,7 @@ ${code} expected = makeWhitespaceVisible(expected); actual = makeWhitespaceVisible(actual); } - return `Expected:\n${expected}\nActual:\n${actual}`; + return displayExpectedAndActualString(expected, actual); } function differOnlyByWhitespace(a: string, b: string) { @@ -3710,6 +3698,14 @@ ${code} } } } + + function displayExpectedAndActualString(expected: string, actual: string, quoted = false) { + const expectMsg = "\x1b[1mExpected\x1b[0m\x1b[31m"; + const actualMsg = "\x1b[1mActual\x1b[0m\x1b[31m"; + const expectedString = quoted ? "\"" + expected + "\"" : expected; + const actualString = quoted ? "\"" + actual + "\"" : actual; + return `\n${expectMsg}:\n${expectedString}\n\n${actualMsg}:\n${actualString}`; + } } namespace FourSlashInterface { @@ -3759,7 +3755,7 @@ namespace FourSlashInterface { } export class Plugins { - constructor (private state: FourSlash.TestState) { + constructor(private state: FourSlash.TestState) { } public configurePlugin(pluginName: string, configuration: any): void { @@ -4582,7 +4578,7 @@ namespace FourSlashInterface { export const keywords: ReadonlyArray = keywordsWithUndefined.filter(k => k.name !== "undefined"); export const typeKeywords: ReadonlyArray = - ["false", "null", "true", "void", "any", "boolean", "keyof", "never", "number", "object", "string", "symbol", "undefined", "unique", "unknown", "bigint"].map(keywordEntry); + ["false", "null", "true", "void", "any", "boolean", "keyof", "never", "readonly", "number", "object", "string", "symbol", "undefined", "unique", "unknown", "bigint"].map(keywordEntry); const globalTypeDecls: ReadonlyArray = [ interfaceEntry("Symbol"), @@ -4698,6 +4694,9 @@ namespace FourSlashInterface { ]; } + export const typeAssertionKeywords: ReadonlyArray = + globalTypesPlus([keywordEntry("const")]); + function getInJsKeywords(keywords: ReadonlyArray): ReadonlyArray { return keywords.filter(keyword => { switch (keyword.name) { @@ -4828,40 +4827,23 @@ namespace FourSlashInterface { "interface", "let", "package", - "private", - "protected", - "public", - "static", "yield", - "abstract", - "as", "any", "async", "await", "boolean", - "constructor", "declare", - "get", - "infer", - "is", "keyof", "module", - "namespace", "never", "readonly", - "require", "number", "object", - "set", "string", "symbol", - "type", "unique", "unknown", - "from", - "global", "bigint", - "of", ].map(keywordEntry); export const statementKeywords: ReadonlyArray = statementKeywordsWithTypes.filter(k => { @@ -5042,40 +5024,23 @@ namespace FourSlashInterface { "interface", "let", "package", - "private", - "protected", - "public", - "static", "yield", - "abstract", - "as", "any", "async", "await", "boolean", - "constructor", "declare", - "get", - "infer", - "is", "keyof", "module", - "namespace", "never", "readonly", - "require", "number", "object", - "set", "string", "symbol", - "type", "unique", "unknown", - "from", - "global", "bigint", - "of", ].map(keywordEntry); export const globalInJsKeywords = getInJsKeywords(globalKeywords); @@ -5128,11 +5093,6 @@ namespace FourSlashInterface { export const insideMethodInJsKeywords = getInJsKeywords(insideMethodKeywords); - export const globalKeywordsPlusUndefined: ReadonlyArray = (() => { - const i = ts.findIndex(globalKeywords, x => x.name === "unique"); - return [...globalKeywords.slice(0, i), keywordEntry("undefined"), ...globalKeywords.slice(i)]; - })(); - export const globals: ReadonlyArray = [ globalThisEntry, ...globalsVars, diff --git a/src/harness/virtualFileSystemWithWatch.ts b/src/harness/virtualFileSystemWithWatch.ts index f49f15cadc2ee..b8e3d189781a2 100644 --- a/src/harness/virtualFileSystemWithWatch.ts +++ b/src/harness/virtualFileSystemWithWatch.ts @@ -30,7 +30,7 @@ interface Array {}` return combinePaths(getDirectoryPath(libFile.path), "tsc.js"); } - interface TestServerHostCreationParameters { + export interface TestServerHostCreationParameters { useCaseSensitiveFileNames?: boolean; executingFilePath?: string; currentDirectory?: string; diff --git a/src/jsTyping/jsTyping.ts b/src/jsTyping/jsTyping.ts index c2b2ad3f5b39c..172d041cc0182 100644 --- a/src/jsTyping/jsTyping.ts +++ b/src/jsTyping/jsTyping.ts @@ -289,9 +289,8 @@ namespace ts.JsTyping { } - export const enum PackageNameValidationResult { + export const enum NameValidationResult { Ok, - ScopedPackagesNotSupported, EmptyName, NameTooLong, NameStartsWithDot, @@ -301,49 +300,77 @@ namespace ts.JsTyping { const maxPackageNameLength = 214; + export interface ScopedPackageNameValidationResult { + name: string; + isScopeName: boolean; + result: NameValidationResult; + } + export type PackageNameValidationResult = NameValidationResult | ScopedPackageNameValidationResult; + /** * Validates package name using rules defined at https://docs.npmjs.com/files/package.json */ export function validatePackageName(packageName: string): PackageNameValidationResult { + return validatePackageNameWorker(packageName, /*supportScopedPackage*/ true); + } + + function validatePackageNameWorker(packageName: string, supportScopedPackage: false): NameValidationResult; + function validatePackageNameWorker(packageName: string, supportScopedPackage: true): PackageNameValidationResult; + function validatePackageNameWorker(packageName: string, supportScopedPackage: boolean): PackageNameValidationResult { if (!packageName) { - return PackageNameValidationResult.EmptyName; + return NameValidationResult.EmptyName; } if (packageName.length > maxPackageNameLength) { - return PackageNameValidationResult.NameTooLong; + return NameValidationResult.NameTooLong; } if (packageName.charCodeAt(0) === CharacterCodes.dot) { - return PackageNameValidationResult.NameStartsWithDot; + return NameValidationResult.NameStartsWithDot; } if (packageName.charCodeAt(0) === CharacterCodes._) { - return PackageNameValidationResult.NameStartsWithUnderscore; + return NameValidationResult.NameStartsWithUnderscore; } // check if name is scope package like: starts with @ and has one '/' in the middle // scoped packages are not currently supported - // TODO: when support will be added we'll need to split and check both scope and package name - if (/^@[^/]+\/[^/]+$/.test(packageName)) { - return PackageNameValidationResult.ScopedPackagesNotSupported; + if (supportScopedPackage) { + const matches = /^@([^/]+)\/([^/]+)$/.exec(packageName); + if (matches) { + const scopeResult = validatePackageNameWorker(matches[1], /*supportScopedPackage*/ false); + if (scopeResult !== NameValidationResult.Ok) { + return { name: matches[1], isScopeName: true, result: scopeResult }; + } + const packageResult = validatePackageNameWorker(matches[2], /*supportScopedPackage*/ false); + if (packageResult !== NameValidationResult.Ok) { + return { name: matches[2], isScopeName: false, result: packageResult }; + } + return NameValidationResult.Ok; + } } if (encodeURIComponent(packageName) !== packageName) { - return PackageNameValidationResult.NameContainsNonURISafeCharacters; + return NameValidationResult.NameContainsNonURISafeCharacters; } - return PackageNameValidationResult.Ok; + return NameValidationResult.Ok; } export function renderPackageNameValidationFailure(result: PackageNameValidationResult, typing: string): string { + return typeof result === "object" ? + renderPackageNameValidationFailureWorker(typing, result.result, result.name, result.isScopeName) : + renderPackageNameValidationFailureWorker(typing, result, typing, /*isScopeName*/ false); + } + + function renderPackageNameValidationFailureWorker(typing: string, result: NameValidationResult, name: string, isScopeName: boolean): string { + const kind = isScopeName ? "Scope" : "Package"; switch (result) { - case PackageNameValidationResult.EmptyName: - return `Package name '${typing}' cannot be empty`; - case PackageNameValidationResult.NameTooLong: - return `Package name '${typing}' should be less than ${maxPackageNameLength} characters`; - case PackageNameValidationResult.NameStartsWithDot: - return `Package name '${typing}' cannot start with '.'`; - case PackageNameValidationResult.NameStartsWithUnderscore: - return `Package name '${typing}' cannot start with '_'`; - case PackageNameValidationResult.ScopedPackagesNotSupported: - return `Package '${typing}' is scoped and currently is not supported`; - case PackageNameValidationResult.NameContainsNonURISafeCharacters: - return `Package name '${typing}' contains non URI safe characters`; - case PackageNameValidationResult.Ok: + case NameValidationResult.EmptyName: + return `'${typing}':: ${kind} name '${name}' cannot be empty`; + case NameValidationResult.NameTooLong: + return `'${typing}':: ${kind} name '${name}' should be less than ${maxPackageNameLength} characters`; + case NameValidationResult.NameStartsWithDot: + return `'${typing}':: ${kind} name '${name}' cannot start with '.'`; + case NameValidationResult.NameStartsWithUnderscore: + return `'${typing}':: ${kind} name '${name}' cannot start with '_'`; + case NameValidationResult.NameContainsNonURISafeCharacters: + return `'${typing}':: ${kind} name '${name}' contains non URI safe characters`; + case NameValidationResult.Ok: return Debug.fail(); // Shouldn't have called this. default: throw Debug.assertNever(result); diff --git a/src/lib/es5.d.ts b/src/lib/es5.d.ts index 0d1481dd7d26b..2594344decc25 100644 --- a/src/lib/es5.d.ts +++ b/src/lib/es5.d.ts @@ -12,7 +12,7 @@ declare var Infinity: number; declare function eval(x: string): any; /** - * Converts A string to an integer. + * Converts a string to an integer. * @param s A string to convert into a number. * @param radix A value between 2 and 36 that specifies the base of the number in numString. * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. diff --git a/src/loc/lcl/chs/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/chs/diagnosticMessages/diagnosticMessages.generated.json.lcl index 1a28819584407..56bd64e882e8e 100644 --- a/src/loc/lcl/chs/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/chs/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -1,10139 +1,10139 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - or -. For example '{0}' or '{1}'.]]> - - 或 <语言>-<区域> 形式。例如“{0}”或“{1}”。]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - type.]]> - - 类型。]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ()' instead.]]> - - ()"。]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + or -. For example '{0}' or '{1}'.]]> + + 或 <语言>-<区域> 形式。例如“{0}”或“{1}”。]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + type.]]> + + 类型。]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ()' instead.]]> + + ()"。]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/loc/lcl/ita/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/ita/diagnosticMessages/diagnosticMessages.generated.json.lcl index 2c25256b2242f..07839d2447506 100644 --- a/src/loc/lcl/ita/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/ita/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -1,4 +1,4 @@ - + @@ -3301,7 +3301,7 @@ - + @@ -4123,7 +4123,7 @@ - + diff --git a/src/loc/lcl/rus/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/rus/diagnosticMessages/diagnosticMessages.generated.json.lcl index 8d7a0a4acbd72..5ba07d067e16f 100644 --- a/src/loc/lcl/rus/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/rus/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -1,4 +1,4 @@ - + @@ -3300,7 +3300,7 @@ - + @@ -4122,7 +4122,7 @@ - + diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index 81c56bb179b65..df9f0e3ee0134 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -1087,7 +1087,24 @@ namespace ts.server { project.close(); if (Debug.shouldAssert(AssertionLevel.Normal)) { - this.filenameToScriptInfo.forEach(info => Debug.assert(!info.isAttached(project), "Found script Info still attached to project", () => `${project.projectName}: ScriptInfos still attached: ${JSON.stringify(mapDefined(arrayFrom(this.filenameToScriptInfo.values()), info => info.isAttached(project) ? info : undefined))}`)); + this.filenameToScriptInfo.forEach(info => Debug.assert( + !info.isAttached(project), + "Found script Info still attached to project", + () => `${project.projectName}: ScriptInfos still attached: ${JSON.stringify( + arrayFrom( + mapDefinedIterator( + this.filenameToScriptInfo.values(), + info => info.isAttached(project) ? + { + fileName: info.fileName, + projects: info.containingProjects.map(p => p.projectName), + hasMixedContent: info.hasMixedContent + } : undefined + ) + ), + /*replacer*/ undefined, + " " + )}`)); } // Remove the project from pending project updates this.pendingProjectUpdates.delete(project.getProjectName()); diff --git a/src/services/codefixes/importFixes.ts b/src/services/codefixes/importFixes.ts index 2fcc8cf5ccbe6..8006d1a0cfd04 100644 --- a/src/services/codefixes/importFixes.ts +++ b/src/services/codefixes/importFixes.ts @@ -283,25 +283,13 @@ namespace ts.codefix { preferences: UserPreferences, ): ReadonlyArray { const isJs = isSourceFileJS(sourceFile); - const { allowsImporting } = createLazyPackageJsonDependencyReader(sourceFile, host); const choicesForEachExportingModule = flatMap(moduleSymbols, ({ moduleSymbol, importKind, exportedSymbolIsTypeOnly }) => moduleSpecifiers.getModuleSpecifiers(moduleSymbol, program.getCompilerOptions(), sourceFile, host, program.getSourceFiles(), preferences, program.redirectTargetsMap) .map((moduleSpecifier): FixAddNewImport | FixUseImportType => // `position` should only be undefined at a missing jsx namespace, in which case we shouldn't be looking for pure types. exportedSymbolIsTypeOnly && isJs ? { kind: ImportFixKind.ImportType, moduleSpecifier, position: Debug.assertDefined(position) } : { kind: ImportFixKind.AddNew, moduleSpecifier, importKind })); - - // Sort by presence in package.json, then shortest paths first - return sort(choicesForEachExportingModule, (a, b) => { - const allowsImportingA = allowsImporting(a.moduleSpecifier); - const allowsImportingB = allowsImporting(b.moduleSpecifier); - if (allowsImportingA && !allowsImportingB) { - return -1; - } - if (allowsImportingB && !allowsImportingA) { - return 1; - } - return a.moduleSpecifier.length - b.moduleSpecifier.length; - }); + // Sort to keep the shortest paths first + return sort(choicesForEachExportingModule, (a, b) => a.moduleSpecifier.length - b.moduleSpecifier.length); } function getFixesForAddImport( @@ -392,8 +380,7 @@ namespace ts.codefix { // "default" is a keyword and not a legal identifier for the import, so we don't expect it here Debug.assert(symbolName !== InternalSymbolName.Default); - const exportInfos = getExportInfos(symbolName, getMeaningFromLocation(symbolToken), cancellationToken, sourceFile, checker, program, preferences, host); - const fixes = arrayFrom(flatMapIterator(exportInfos.entries(), ([_, exportInfos]) => + const fixes = arrayFrom(flatMapIterator(getExportInfos(symbolName, getMeaningFromLocation(symbolToken), cancellationToken, sourceFile, checker, program).entries(), ([_, exportInfos]) => getFixForImport(exportInfos, symbolName, symbolToken.getStart(sourceFile), program, sourceFile, host, preferences))); return { fixes, symbolName }; } @@ -406,8 +393,6 @@ namespace ts.codefix { sourceFile: SourceFile, checker: TypeChecker, program: Program, - preferences: UserPreferences, - host: LanguageServiceHost ): ReadonlyMap> { // For each original symbol, keep all re-exports of that symbol together so we can call `getCodeActionsForImport` on the whole group at once. // Maps symbol id to info for modules providing that symbol (original export + re-exports). @@ -415,7 +400,7 @@ namespace ts.codefix { function addSymbol(moduleSymbol: Symbol, exportedSymbol: Symbol, importKind: ImportKind): void { originalSymbolToExportInfos.add(getUniqueSymbolId(exportedSymbol, checker).toString(), { moduleSymbol, importKind, exportedSymbolIsTypeOnly: isTypeOnlySymbol(exportedSymbol, checker) }); } - forEachExternalModuleToImportFrom(checker, host, preferences, program.redirectTargetsMap, sourceFile, program.getSourceFiles(), moduleSymbol => { + forEachExternalModuleToImportFrom(checker, sourceFile, program.getSourceFiles(), moduleSymbol => { cancellationToken.throwIfCancellationRequested(); const defaultInfo = getDefaultLikeExportInfo(moduleSymbol, checker, program.getCompilerOptions()); @@ -576,44 +561,12 @@ namespace ts.codefix { return some(declarations, decl => !!(getMeaningFromDeclaration(decl) & meaning)); } - export function forEachExternalModuleToImportFrom(checker: TypeChecker, host: LanguageServiceHost, preferences: UserPreferences, redirectTargetsMap: RedirectTargetsMap, from: SourceFile, allSourceFiles: ReadonlyArray, cb: (module: Symbol) => void) { - const { allowsImporting } = createLazyPackageJsonDependencyReader(from, host); - const compilerOptions = host.getCompilationSettings(); - const getCanonicalFileName = hostGetCanonicalFileName(host); + export function forEachExternalModuleToImportFrom(checker: TypeChecker, from: SourceFile, allSourceFiles: ReadonlyArray, cb: (module: Symbol) => void) { forEachExternalModule(checker, allSourceFiles, (module, sourceFile) => { - if (sourceFile === undefined && allowsImporting(stripQuotes(module.getName()))) { + if (sourceFile === undefined || sourceFile !== from && isImportablePath(from.fileName, sourceFile.fileName)) { cb(module); } - else if (sourceFile && sourceFile !== from && isImportablePath(from.fileName, sourceFile.fileName)) { - const moduleSpecifier = getNodeModulesPackageNameFromFileName(sourceFile.fileName); - if (!moduleSpecifier || allowsImporting(moduleSpecifier)) { - cb(module); - } - } }); - - function getNodeModulesPackageNameFromFileName(importedFileName: string): string | undefined { - const specifier = moduleSpecifiers.getModuleSpecifier( - compilerOptions, - from, - toPath(from.fileName, /*basePath*/ undefined, getCanonicalFileName), - importedFileName, - host, - allSourceFiles, - preferences, - redirectTargetsMap); - - // Paths here are not node_modules, so we don’t care about them; - // returning anything will trigger a lookup in package.json. - if (!pathIsRelative(specifier) && !isRootedDiskPath(specifier)) { - const components = getPathComponents(getPackageNameFromTypesPackageName(specifier)).slice(1); - // Scoped packages - if (startsWith(components[0], "@")) { - return `${components[0]}/${components[1]}`; - } - return components[0]; - } - } } function forEachExternalModule(checker: TypeChecker, allSourceFiles: ReadonlyArray, cb: (module: Symbol, sourceFile: SourceFile | undefined) => void) { @@ -667,69 +620,4 @@ namespace ts.codefix { // Need `|| "_"` to ensure result isn't empty. return !isStringANonContextualKeyword(res) ? res || "_" : `_${res}`; } - - function createLazyPackageJsonDependencyReader(fromFile: SourceFile, host: LanguageServiceHost) { - const packageJsonPaths = findPackageJsons(getDirectoryPath(fromFile.fileName), host); - const dependencyIterator = readPackageJsonDependencies(host, packageJsonPaths); - let seenDeps: Map | undefined; - let usesNodeCoreModules: boolean | undefined; - return { allowsImporting }; - - function containsDependency(dependency: string) { - if ((seenDeps || (seenDeps = createMap())).has(dependency)) { - return true; - } - let packageName: string | void; - while (packageName = dependencyIterator.next().value) { - seenDeps.set(packageName, true); - if (packageName === dependency) { - return true; - } - } - return false; - } - - function allowsImporting(moduleSpecifier: string): boolean { - if (!packageJsonPaths.length) { - return true; - } - - // If we’re in JavaScript, it can be difficult to tell whether the user wants to import - // from Node core modules or not. We can start by seeing if the user is actually using - // any node core modules, as opposed to simply having @types/node accidentally as a - // dependency of a dependency. - if (isSourceFileJS(fromFile) && JsTyping.nodeCoreModules.has(moduleSpecifier)) { - if (usesNodeCoreModules === undefined) { - usesNodeCoreModules = consumesNodeCoreModules(fromFile); - } - if (usesNodeCoreModules) { - return true; - } - } - - return containsDependency(moduleSpecifier) - || containsDependency(getTypesPackageName(moduleSpecifier)); - } - } - - function *readPackageJsonDependencies(host: LanguageServiceHost, packageJsonPaths: string[]) { - type PackageJson = Record | undefined>; - const dependencyKeys = ["dependencies", "devDependencies", "optionalDependencies"] as const; - for (const fileName of packageJsonPaths) { - const content = readJson(fileName, { readFile: host.readFile ? host.readFile.bind(host) : sys.readFile }) as PackageJson; - for (const key of dependencyKeys) { - const dependencies = content[key]; - if (!dependencies) { - continue; - } - for (const packageName in dependencies) { - yield packageName; - } - } - } - } - - function consumesNodeCoreModules(sourceFile: SourceFile): boolean { - return some(sourceFile.imports, ({ text }) => JsTyping.nodeCoreModules.has(text)); - } } diff --git a/src/services/codefixes/removeUnnecessaryAwait.ts b/src/services/codefixes/removeUnnecessaryAwait.ts index c235d028efbce..07028e2793762 100644 --- a/src/services/codefixes/removeUnnecessaryAwait.ts +++ b/src/services/codefixes/removeUnnecessaryAwait.ts @@ -26,8 +26,18 @@ namespace ts.codefix { return; } - const parenthesizedExpression = tryCast(awaitExpression.parent, isParenthesizedExpression); - const removeParens = parenthesizedExpression && (isIdentifier(awaitExpression.expression) || isCallExpression(awaitExpression.expression)); - changeTracker.replaceNode(sourceFile, removeParens ? parenthesizedExpression || awaitExpression : awaitExpression, awaitExpression.expression); + let expressionToReplace: Node = awaitExpression; + const hasSurroundingParens = isParenthesizedExpression(awaitExpression.parent); + if (hasSurroundingParens) { + const leftMostExpression = getLeftmostExpression(awaitExpression.expression, /*stopAtCallExpressions*/ false); + if (isIdentifier(leftMostExpression)) { + const precedingToken = findPrecedingToken(awaitExpression.parent.pos, sourceFile); + if (precedingToken && precedingToken.kind !== SyntaxKind.NewKeyword) { + expressionToReplace = awaitExpression.parent; + } + } + } + + changeTracker.replaceNode(sourceFile, expressionToReplace, awaitExpression.expression); } } diff --git a/src/services/completions.ts b/src/services/completions.ts index cf707c642ed36..e9a38fb1516db 100644 --- a/src/services/completions.ts +++ b/src/services/completions.ts @@ -38,6 +38,7 @@ namespace ts.Completions { InterfaceElementKeywords, // Keywords inside interface body ConstructorParameterKeywords, // Keywords at constructor parameter FunctionLikeBodyKeywords, // Keywords at function like body + TypeAssertionKeywords, TypeKeywords, Last = TypeKeywords } @@ -63,7 +64,7 @@ namespace ts.Completions { return getLabelCompletionAtPosition(contextToken.parent); } - const completionData = getCompletionData(program, log, sourceFile, isUncheckedFile(sourceFile, compilerOptions), position, preferences, /*detailsEntryId*/ undefined, host); + const completionData = getCompletionData(program, log, sourceFile, isUncheckedFile(sourceFile, compilerOptions), position, preferences, /*detailsEntryId*/ undefined); if (!completionData) { return undefined; } @@ -406,10 +407,10 @@ namespace ts.Completions { previousToken: Node | undefined; readonly isJsxInitializer: IsJsxInitializer; } - function getSymbolCompletionFromEntryId(program: Program, log: Log, sourceFile: SourceFile, position: number, entryId: CompletionEntryIdentifier, host: LanguageServiceHost + function getSymbolCompletionFromEntryId(program: Program, log: Log, sourceFile: SourceFile, position: number, entryId: CompletionEntryIdentifier, ): SymbolCompletion | { type: "request", request: Request } | { type: "literal", literal: string | number | PseudoBigInt } | { type: "none" } { const compilerOptions = program.getCompilerOptions(); - const completionData = getCompletionData(program, log, sourceFile, isUncheckedFile(sourceFile, compilerOptions), position, { includeCompletionsForModuleExports: true, includeCompletionsWithInsertText: true }, entryId, host); + const completionData = getCompletionData(program, log, sourceFile, isUncheckedFile(sourceFile, compilerOptions), position, { includeCompletionsForModuleExports: true, includeCompletionsWithInsertText: true }, entryId); if (!completionData) { return { type: "none" }; } @@ -441,7 +442,7 @@ namespace ts.Completions { (symbol.escapedName === InternalSymbolName.ExportEquals)) // Name of "export default foo;" is "foo". Name of "export default 0" is the filename converted to camelCase. ? firstDefined(symbol.declarations, d => isExportAssignment(d) && isIdentifier(d.expression) ? d.expression.text : undefined) - || codefix.moduleSymbolToValidIdentifier(origin.moduleSymbol, target) + || codefix.moduleSymbolToValidIdentifier(origin.moduleSymbol, target) : symbol.name; } @@ -471,7 +472,7 @@ namespace ts.Completions { } // Compute all the completion symbols again. - const symbolCompletion = getSymbolCompletionFromEntryId(program, log, sourceFile, position, entryId, host); + const symbolCompletion = getSymbolCompletionFromEntryId(program, log, sourceFile, position, entryId); switch (symbolCompletion.type) { case "request": { const { request } = symbolCompletion; @@ -556,8 +557,8 @@ namespace ts.Completions { return { sourceDisplay: [textPart(moduleSpecifier)], codeActions: [codeAction] }; } - export function getCompletionEntrySymbol(program: Program, log: Log, sourceFile: SourceFile, position: number, entryId: CompletionEntryIdentifier, host: LanguageServiceHost): Symbol | undefined { - const completion = getSymbolCompletionFromEntryId(program, log, sourceFile, position, entryId, host); + export function getCompletionEntrySymbol(program: Program, log: Log, sourceFile: SourceFile, position: number, entryId: CompletionEntryIdentifier): Symbol | undefined { + const completion = getSymbolCompletionFromEntryId(program, log, sourceFile, position, entryId); return completion.type === "symbol" ? completion.symbol : undefined; } @@ -632,9 +633,9 @@ namespace ts.Completions { // At `,`, treat this as the next argument after the comma. ? checker.getContextualTypeForArgumentAtIndex(argInfo.invocation, argInfo.argumentIndex + (previousToken.kind === SyntaxKind.CommaToken ? 1 : 0)) : isEqualityOperatorKind(previousToken.kind) && isBinaryExpression(parent) && isEqualityOperatorKind(parent.operatorToken.kind) - // completion at `x ===/**/` should be for the right side - ? checker.getTypeAtLocation(parent.left) - : checker.getContextualType(previousToken as Expression); + // completion at `x ===/**/` should be for the right side + ? checker.getTypeAtLocation(parent.left) + : checker.getContextualType(previousToken as Expression); } } @@ -656,7 +657,6 @@ namespace ts.Completions { position: number, preferences: Pick, detailsEntryId: CompletionEntryIdentifier | undefined, - host: LanguageServiceHost ): CompletionData | Request | undefined { const typeChecker = program.getTypeChecker(); @@ -947,11 +947,13 @@ namespace ts.Completions { // Right of dot member completion list completionKind = CompletionKind.PropertyAccess; - // Since this is qualified name check its a type node location + // Since this is qualified name check it's a type node location const isImportType = isLiteralImportTypeNode(node); - const isTypeLocation = insideJsDocTagTypeExpression || (isImportType && !(node as ImportTypeNode).isTypeOf) || isPartOfTypeNode(node.parent); + const isTypeLocation = insideJsDocTagTypeExpression + || (isImportType && !(node as ImportTypeNode).isTypeOf) + || isPartOfTypeNode(node.parent) + || isPossiblyTypeArgumentPosition(contextToken, sourceFile, typeChecker); const isRhsOfImportDeclaration = isInRightSideOfInternalImportEqualsDeclaration(node); - const allowTypeOrValue = isRhsOfImportDeclaration || (!isTypeLocation && isPossiblyTypeArgumentPosition(contextToken, sourceFile, typeChecker)); if (isEntityName(node) || isImportType) { const isNamespaceName = isModuleDeclaration(node.parent); if (isNamespaceName) isNewIdentifierLocation = true; @@ -968,7 +970,7 @@ namespace ts.Completions { isNamespaceName // At `namespace N.M/**/`, if this is the only declaration of `M`, don't include `M` as a completion. ? symbol => !!(symbol.flags & SymbolFlags.Namespace) && !symbol.declarations.every(d => d.parent === node.parent) - : allowTypeOrValue ? + : isRhsOfImportDeclaration ? // Any kind is allowed when dotting off namespace in internal import equals declaration symbol => isValidTypeAccess(symbol) || isValidValueAccess(symbol) : isTypeLocation ? isValidTypeAccess : isValidValueAccess; @@ -1149,7 +1151,7 @@ namespace ts.Completions { } if (shouldOfferImportCompletions()) { - getSymbolsFromOtherSourceFileExports(symbols, previousToken && isIdentifier(previousToken) ? previousToken.text : "", program.getCompilerOptions().target!, host); + getSymbolsFromOtherSourceFileExports(symbols, previousToken && isIdentifier(previousToken) ? previousToken.text : "", program.getCompilerOptions().target!); } filterGlobalCompletion(symbols); } @@ -1181,8 +1183,11 @@ namespace ts.Completions { function filterGlobalCompletion(symbols: Symbol[]): void { const isTypeOnly = isTypeOnlyCompletion(); - const allowTypes = isTypeOnly || !isContextTokenValueLocation(contextToken) && isPossiblyTypeArgumentPosition(contextToken, sourceFile, typeChecker); - if (isTypeOnly) keywordFilters = KeywordCompletionFilters.TypeKeywords; + if (isTypeOnly) { + keywordFilters = isTypeAssertion() + ? KeywordCompletionFilters.TypeAssertionKeywords + : KeywordCompletionFilters.TypeKeywords; + } filterMutate(symbols, symbol => { if (!isSourceFile(location)) { @@ -1198,12 +1203,9 @@ namespace ts.Completions { return !!(symbol.flags & SymbolFlags.Namespace); } - if (allowTypes) { - // Its a type, but you can reach it by namespace.type as well - const symbolAllowedAsType = symbolCanBeReferencedAtTypeLocation(symbol); - if (symbolAllowedAsType || isTypeOnly) { - return symbolAllowedAsType; - } + if (isTypeOnly) { + // It's a type, but you can reach it by namespace.type as well + return symbolCanBeReferencedAtTypeLocation(symbol); } } @@ -1212,8 +1214,16 @@ namespace ts.Completions { }); } + function isTypeAssertion(): boolean { + return isAssertionExpression(contextToken.parent); + } + function isTypeOnlyCompletion(): boolean { - return insideJsDocTagTypeExpression || !isContextTokenValueLocation(contextToken) && (isPartOfTypeNode(location) || isContextTokenTypeLocation(contextToken)); + return insideJsDocTagTypeExpression + || !isContextTokenValueLocation(contextToken) && + (isPossiblyTypeArgumentPosition(contextToken, sourceFile, typeChecker) + || isPartOfTypeNode(location) + || isContextTokenTypeLocation(contextToken)); } function isContextTokenValueLocation(contextToken: Node) { @@ -1239,6 +1249,10 @@ namespace ts.Completions { case SyntaxKind.AsKeyword: return parentKind === SyntaxKind.AsExpression; + case SyntaxKind.LessThanToken: + return parentKind === SyntaxKind.TypeReference || + parentKind === SyntaxKind.TypeAssertionExpression; + case SyntaxKind.ExtendsKeyword: return parentKind === SyntaxKind.TypeParameter; } @@ -1255,64 +1269,12 @@ namespace ts.Completions { typeChecker.getExportsOfModule(sym).some(e => symbolCanBeReferencedAtTypeLocation(e, seenModules)); } - /** - * Gathers symbols that can be imported from other files, deduplicating along the way. Symbols can be “duplicates” - * if re-exported from another module, e.g. `export { foo } from "./a"`. That syntax creates a fresh symbol, but - * it’s just an alias to the first, and both have the same name, so we generally want to filter those aliases out, - * if and only if the the first can be imported (it may be excluded due to package.json filtering in - * `codefix.forEachExternalModuleToImportFrom`). - * - * Example. Imagine a chain of node_modules re-exporting one original symbol: - * - * ```js - * node_modules/x/index.js node_modules/y/index.js node_modules/z/index.js - * +-----------------------+ +--------------------------+ +--------------------------+ - * | | | | | | - * | export const foo = 0; | <--- | export { foo } from 'x'; | <--- | export { foo } from 'y'; | - * | | | | | | - * +-----------------------+ +--------------------------+ +--------------------------+ - * ``` - * - * Also imagine three buckets, which we’ll reference soon: - * - * ```md - * | | | | | | - * | **Bucket A** | | **Bucket B** | | **Bucket C** | - * | Symbols to | | Aliases to symbols | | Symbols to return | - * | definitely | | in Buckets A or C | | if nothing better | - * | return | | (don’t return these) | | comes along | - * |__________________| |______________________| |___________________| - * ``` - * - * We _probably_ want to show `foo` from 'x', but not from 'y' or 'z'. However, if 'x' is not in a package.json, it - * will not appear in a `forEachExternalModuleToImportFrom` iteration. Furthermore, the order of iterations is not - * guaranteed, as it is host-dependent. Therefore, when presented with the symbol `foo` from module 'y' alone, we - * may not be sure whether or not it should go in the list. So, we’ll take the following steps: - * - * 1. Resolve alias `foo` from 'y' to the export declaration in 'x', get the symbol there, and see if that symbol is - * already in Bucket A (symbols we already know will be returned). If it is, put `foo` from 'y' in Bucket B - * (symbols that are aliases to symbols in Bucket A). If it’s not, put it in Bucket C. - * 2. Next, imagine we see `foo` from module 'z'. Again, we resolve the alias to the nearest export, which is in 'y'. - * At this point, if that nearest export from 'y' is in _any_ of the three buckets, we know the symbol in 'z' - * should never be returned in the final list, so put it in Bucket B. - * 3. Next, imagine we see `foo` from module 'x', the original. Syntactically, it doesn’t look like a re-export, so - * we can just check Bucket C to see if we put any aliases to the original in there. If they exist, throw them out. - * Put this symbol in Bucket A. - * 4. After we’ve iterated through every symbol of every module, any symbol left in Bucket C means that step 3 didn’t - * occur for that symbol---that is, the original symbol is not in Bucket A, so we should include the alias. Move - * everything from Bucket C to Bucket A. - * - * Note: Bucket A is passed in as the parameter `symbols` and mutated. - */ - function getSymbolsFromOtherSourceFileExports(/** Bucket A */ symbols: Symbol[], tokenText: string, target: ScriptTarget, host: LanguageServiceHost): void { + function getSymbolsFromOtherSourceFileExports(symbols: Symbol[], tokenText: string, target: ScriptTarget): void { const tokenTextLowerCase = tokenText.toLowerCase(); + const seenResolvedModules = createMap(); - /** Bucket B */ - const aliasesToAlreadyIncludedSymbols = createMap(); - /** Bucket C */ - const aliasesToReturnIfOriginalsAreMissing = createMap<{ alias: Symbol, moduleSymbol: Symbol }>(); - codefix.forEachExternalModuleToImportFrom(typeChecker, host, preferences, program.redirectTargetsMap, sourceFile, program.getSourceFiles(), moduleSymbol => { + codefix.forEachExternalModuleToImportFrom(typeChecker, sourceFile, program.getSourceFiles(), moduleSymbol => { // Perf -- ignore other modules if this is a request for details if (detailsEntryId && detailsEntryId.source && stripQuotes(moduleSymbol.name) !== detailsEntryId.source) { return; @@ -1333,58 +1295,32 @@ namespace ts.Completions { symbolToOriginInfoMap[getSymbolId(resolvedModuleSymbol)] = { kind: SymbolOriginInfoKind.Export, moduleSymbol, isDefaultExport: false }; } - for (const symbol of typeChecker.getExportsOfModule(moduleSymbol)) { - // If this is `export { _break as break };` (a keyword) -- skip this and prefer the keyword completion. - if (some(symbol.declarations, d => isExportSpecifier(d) && !!d.propertyName && isIdentifierANonContextualKeyword(d.name))) { + for (let symbol of typeChecker.getExportsOfModule(moduleSymbol)) { + // Don't add a completion for a re-export, only for the original. + // The actual import fix might end up coming from a re-export -- we don't compute that until getting completion details. + // This is just to avoid adding duplicate completion entries. + // + // If `symbol.parent !== ...`, this is an `export * from "foo"` re-export. Those don't create new symbols. + if (typeChecker.getMergedSymbol(symbol.parent!) !== resolvedModuleSymbol + || some(symbol.declarations, d => + // If `!!d.name.originalKeywordKind`, this is `export { _break as break };` -- skip this and prefer the keyword completion. + // If `!!d.parent.parent.moduleSpecifier`, this is `export { foo } from "foo"` re-export, which creates a new symbol (thus isn't caught by the first check). + isExportSpecifier(d) && (d.propertyName ? isIdentifierANonContextualKeyword(d.name) : !!d.parent.parent.moduleSpecifier))) { continue; } - // If `symbol.parent !== moduleSymbol`, this is an `export * from "foo"` re-export. Those don't create new symbols. - const isExportStarFromReExport = typeChecker.getMergedSymbol(symbol.parent!) !== resolvedModuleSymbol; - // If `!!d.parent.parent.moduleSpecifier`, this is `export { foo } from "foo"` re-export, which creates a new symbol (thus isn't caught by the first check). - if (isExportStarFromReExport || some(symbol.declarations, d => isExportSpecifier(d) && !d.propertyName && !!d.parent.parent.moduleSpecifier)) { - // Walk the export chain back one module (step 1 or 2 in diagrammed example). - // Or, in the case of `export * from "foo"`, `symbol` already points to the original export, so just use that. - const nearestExportSymbolId = getSymbolId(isExportStarFromReExport ? symbol : Debug.assertDefined(getNearestExportSymbol(symbol))); - const symbolHasBeenSeen = !!symbolToOriginInfoMap[nearestExportSymbolId] || aliasesToAlreadyIncludedSymbols.has(nearestExportSymbolId.toString()); - if (!symbolHasBeenSeen) { - aliasesToReturnIfOriginalsAreMissing.set(nearestExportSymbolId.toString(), { alias: symbol, moduleSymbol }); - aliasesToAlreadyIncludedSymbols.set(getSymbolId(symbol).toString(), true); - } - else { - // Perf - we know this symbol is an alias to one that’s already covered in `symbols`, so store it here - // in case another symbol re-exports this one; that way we can short-circuit as soon as we see this symbol id. - addToSeen(aliasesToAlreadyIncludedSymbols, getSymbolId(symbol)); - } - } - else { - // This is not a re-export, so see if we have any aliases pending and remove them (step 3 in diagrammed example) - aliasesToReturnIfOriginalsAreMissing.delete(getSymbolId(symbol).toString()); - pushSymbol(symbol, moduleSymbol); - } - } - }); - // By this point, any potential duplicates that were actually duplicates have been - // removed, so the rest need to be added. (Step 4 in diagrammed example) - aliasesToReturnIfOriginalsAreMissing.forEach(({ alias, moduleSymbol }) => pushSymbol(alias, moduleSymbol)); + const isDefaultExport = symbol.escapedName === InternalSymbolName.Default; + if (isDefaultExport) { + symbol = getLocalSymbolForExportDefault(symbol) || symbol; + } - function pushSymbol(symbol: Symbol, moduleSymbol: Symbol) { - const isDefaultExport = symbol.escapedName === InternalSymbolName.Default; - if (isDefaultExport) { - symbol = getLocalSymbolForExportDefault(symbol) || symbol; - } - const origin: SymbolOriginInfoExport = { kind: SymbolOriginInfoKind.Export, moduleSymbol, isDefaultExport }; - if (detailsEntryId || stringContainsCharactersInOrder(getSymbolName(symbol, origin, target).toLowerCase(), tokenTextLowerCase)) { - symbols.push(symbol); - symbolToSortTextMap[getSymbolId(symbol)] = SortText.AutoImportSuggestions; - symbolToOriginInfoMap[getSymbolId(symbol)] = origin; + const origin: SymbolOriginInfoExport = { kind: SymbolOriginInfoKind.Export, moduleSymbol, isDefaultExport }; + if (detailsEntryId || stringContainsCharactersInOrder(getSymbolName(symbol, origin, target).toLowerCase(), tokenTextLowerCase)) { + symbols.push(symbol); + symbolToSortTextMap[getSymbolId(symbol)] = SortText.AutoImportSuggestions; + symbolToOriginInfoMap[getSymbolId(symbol)] = origin; + } } - } - } - - function getNearestExportSymbol(fromSymbol: Symbol) { - return findAlias(typeChecker, fromSymbol, alias => { - return some(alias.declarations, d => isExportSpecifier(d) || !!d.localSymbol); }); } @@ -1513,7 +1449,7 @@ namespace ts.Completions { // 3. at the end of a regular expression (due to trailing flags like '/foo/g'). return (isRegularExpressionLiteral(contextToken) || isStringTextContainingNode(contextToken)) && ( rangeContainsPositionExclusive(createTextRangeFromSpan(createTextSpanFromNode(contextToken)), position) || - position === contextToken.end && (!!contextToken.isUnterminated || isRegularExpressionLiteral(contextToken))); + position === contextToken.end && (!!contextToken.isUnterminated || isRegularExpressionLiteral(contextToken))); } /** @@ -1617,7 +1553,7 @@ namespace ts.Completions { * Relevant symbols are stored in the captured 'symbols' variable. */ function tryGetClassLikeCompletionSymbols(): GlobalsSearch { - const decl = tryGetObjectTypeDeclarationCompletionContainer(sourceFile, contextToken, location); + const decl = tryGetObjectTypeDeclarationCompletionContainer(sourceFile, contextToken, location, position); if (!decl) return GlobalsSearch.Continue; // We're looking up possible property names from parent type. @@ -2023,8 +1959,8 @@ namespace ts.Completions { return baseSymbols.filter(propertySymbol => !existingMemberNames.has(propertySymbol.escapedName) && - !!propertySymbol.declarations && - !(getDeclarationModifierFlagsFromSymbol(propertySymbol) & ModifierFlags.Private)); + !!propertySymbol.declarations && + !(getDeclarationModifierFlagsFromSymbol(propertySymbol) & ModifierFlags.Private)); } /** @@ -2126,16 +2062,20 @@ namespace ts.Completions { case KeywordCompletionFilters.None: return false; case KeywordCompletionFilters.All: - return kind === SyntaxKind.AsyncKeyword || SyntaxKind.AwaitKeyword || !isContextualKeyword(kind) && !isClassMemberCompletionKeyword(kind) || kind === SyntaxKind.DeclareKeyword || kind === SyntaxKind.ModuleKeyword + return isFunctionLikeBodyKeyword(kind) + || kind === SyntaxKind.DeclareKeyword + || kind === SyntaxKind.ModuleKeyword || isTypeKeyword(kind) && kind !== SyntaxKind.UndefinedKeyword; + case KeywordCompletionFilters.FunctionLikeBodyKeywords: + return isFunctionLikeBodyKeyword(kind); case KeywordCompletionFilters.ClassElementKeywords: return isClassMemberCompletionKeyword(kind); case KeywordCompletionFilters.InterfaceElementKeywords: return isInterfaceOrTypeLiteralCompletionKeyword(kind); case KeywordCompletionFilters.ConstructorParameterKeywords: return isParameterPropertyModifier(kind); - case KeywordCompletionFilters.FunctionLikeBodyKeywords: - return isFunctionLikeBodyKeyword(kind); + case KeywordCompletionFilters.TypeAssertionKeywords: + return isTypeKeyword(kind) || kind === SyntaxKind.ConstKeyword; case KeywordCompletionFilters.TypeKeywords: return isTypeKeyword(kind); default: @@ -2196,7 +2136,9 @@ namespace ts.Completions { } function isFunctionLikeBodyKeyword(kind: SyntaxKind) { - return kind === SyntaxKind.AsyncKeyword || kind === SyntaxKind.AwaitKeyword || !isContextualKeyword(kind) && !isClassMemberCompletionKeyword(kind); + return kind === SyntaxKind.AsyncKeyword + || kind === SyntaxKind.AwaitKeyword + || !isContextualKeyword(kind) && !isClassMemberCompletionKeyword(kind); } function keywordForNode(node: Node): SyntaxKind { @@ -2234,7 +2176,7 @@ namespace ts.Completions { * Returns the immediate owning class declaration of a context token, * on the condition that one exists and that the context implies completion should be given. */ - function tryGetObjectTypeDeclarationCompletionContainer(sourceFile: SourceFile, contextToken: Node | undefined, location: Node): ObjectTypeDeclaration | undefined { + function tryGetObjectTypeDeclarationCompletionContainer(sourceFile: SourceFile, contextToken: Node | undefined, location: Node, position: number): ObjectTypeDeclaration | undefined { // class c { method() { } | method2() { } } switch (location.kind) { case SyntaxKind.SyntaxList: @@ -2244,9 +2186,15 @@ namespace ts.Completions { if (cls && !findChildOfKind(cls, SyntaxKind.CloseBraceToken, sourceFile)) { return cls; } + break; + case SyntaxKind.Identifier: // class c extends React.Component { a: () => 1\n compon| } + if (isFromObjectTypeDeclaration(location)) { + return findAncestor(location, isObjectTypeDeclaration); + } } if (!contextToken) return undefined; + switch (contextToken.kind) { case SyntaxKind.SemicolonToken: // class c {getValue(): number; | } case SyntaxKind.CloseBraceToken: // class c { method() { } | } @@ -2258,7 +2206,13 @@ namespace ts.Completions { case SyntaxKind.CommaToken: // class c {getValue(): number, | } return tryCast(contextToken.parent, isObjectTypeDeclaration); default: - if (!isFromObjectTypeDeclaration(contextToken)) return undefined; + if (!isFromObjectTypeDeclaration(contextToken)) { + // class c extends React.Component { a: () => 1\n| } + if (getLineAndCharacterOfPosition(sourceFile, contextToken.getEnd()).line !== getLineAndCharacterOfPosition(sourceFile, position).line && isObjectTypeDeclaration(location)) { + return location; + } + return undefined; + } const isValidKeyword = isClassLike(contextToken.parent.parent) ? isClassMemberCompletionKeyword : isInterfaceOrTypeLiteralCompletionKeyword; return (isValidKeyword(contextToken.kind) || contextToken.kind === SyntaxKind.AsteriskToken || isIdentifier(contextToken) && isValidKeyword(stringToToken(contextToken.text)!)) // TODO: GH#18217 ? contextToken.parent.parent as ObjectTypeDeclaration : undefined; @@ -2295,13 +2249,4 @@ namespace ts.Completions { function binaryExpressionMayBeOpenTag({ left }: BinaryExpression): boolean { return nodeIsMissing(left); } - - function findAlias(typeChecker: TypeChecker, symbol: Symbol, predicate: (symbol: Symbol) => boolean): Symbol | undefined { - let currentAlias: Symbol | undefined = symbol; - while (currentAlias.flags & SymbolFlags.Alias && (currentAlias = typeChecker.getImmediateAliasedSymbol(currentAlias))) { - if (predicate(currentAlias)) { - return currentAlias; - } - } - } } diff --git a/src/services/formatting/formatting.ts b/src/services/formatting/formatting.ts index 01c09a4989ce7..ed6b71efb7523 100644 --- a/src/services/formatting/formatting.ts +++ b/src/services/formatting/formatting.ts @@ -490,6 +490,9 @@ namespace ts.formatting { else if (SmartIndenter.childStartsOnTheSameLineWithElseInIfStatement(parent, node, startLine, sourceFile)) { return { indentation: parentDynamicIndentation.getIndentation(), delta }; } + else if (SmartIndenter.argumentStartsOnSameLineAsPreviousArgument(parent, node, startLine, sourceFile)) { + return { indentation: parentDynamicIndentation.getIndentation(), delta }; + } else { return { indentation: parentDynamicIndentation.getIndentation() + parentDynamicIndentation.getDelta(node), delta }; } diff --git a/src/services/formatting/smartIndenter.ts b/src/services/formatting/smartIndenter.ts index 0c9e7b186f79a..7a8bfb5f5d509 100644 --- a/src/services/formatting/smartIndenter.ts +++ b/src/services/formatting/smartIndenter.ts @@ -322,6 +322,25 @@ namespace ts.formatting { return false; } + export function argumentStartsOnSameLineAsPreviousArgument(parent: Node, child: TextRangeWithKind, childStartLine: number, sourceFile: SourceFileLike): boolean { + if (isCallOrNewExpression(parent)) { + if (!parent.arguments) return false; + + const currentNode = Debug.assertDefined(find(parent.arguments, arg => arg.pos === child.pos)); + const currentIndex = parent.arguments.indexOf(currentNode); + if (currentIndex === 0) return false; // Can't look at previous node if first + + const previousNode = parent.arguments[currentIndex - 1]; + const lineOfPreviousNode = getLineAndCharacterOfPosition(sourceFile, previousNode.getEnd()).line; + + if (childStartLine === lineOfPreviousNode) { + return true; + } + } + + return false; + } + export function getContainingList(node: Node, sourceFile: SourceFile): NodeArray | undefined { return node.parent && getListByRange(node.getStart(sourceFile), node.getEnd(), node.parent, sourceFile); } diff --git a/src/services/outliningElementsCollector.ts b/src/services/outliningElementsCollector.ts index bc6d65a9aaa19..a23eddf0628d5 100644 --- a/src/services/outliningElementsCollector.ts +++ b/src/services/outliningElementsCollector.ts @@ -198,6 +198,8 @@ namespace ts.OutliningElementsCollector { return spanForObjectOrArrayLiteral(n, SyntaxKind.OpenBracketToken); case SyntaxKind.JsxElement: return spanForJSXElement(n); + case SyntaxKind.JsxFragment: + return spanForJSXFragment(n); case SyntaxKind.JsxSelfClosingElement: case SyntaxKind.JsxOpeningElement: return spanForJSXAttributes((n).attributes); @@ -210,6 +212,12 @@ namespace ts.OutliningElementsCollector { return createOutliningSpan(textSpan, OutliningSpanKind.Code, textSpan, /*autoCollapse*/ false, bannerText); } + function spanForJSXFragment(node: JsxFragment): OutliningSpan | undefined { + const textSpan = createTextSpanFromBounds(node.openingFragment.getStart(sourceFile), node.closingFragment.getEnd()); + const bannerText = "<>..."; + return createOutliningSpan(textSpan, OutliningSpanKind.Code, textSpan, /*autoCollapse*/ false, bannerText); + } + function spanForJSXAttributes(node: JsxAttributes): OutliningSpan | undefined { if (node.properties.length === 0) { return undefined; diff --git a/src/services/services.ts b/src/services/services.ts index 2f000bc0f2e95..fab6f88b779e0 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -1453,7 +1453,7 @@ namespace ts { function getCompletionEntrySymbol(fileName: string, position: number, name: string, source?: string): Symbol | undefined { synchronizeHostData(); - return Completions.getCompletionEntrySymbol(program, log, getValidSourceFile(fileName), position, { name, source }, host); + return Completions.getCompletionEntrySymbol(program, log, getValidSourceFile(fileName), position, { name, source }); } function getQuickInfoAtPosition(fileName: string, position: number): QuickInfo | undefined { diff --git a/src/services/stringCompletions.ts b/src/services/stringCompletions.ts index 58195b5cb3c50..b287ebdb406a9 100644 --- a/src/services/stringCompletions.ts +++ b/src/services/stringCompletions.ts @@ -627,6 +627,30 @@ namespace ts.Completions.StringCompletions { } } + function findPackageJsons(directory: string, host: LanguageServiceHost): string[] { + const paths: string[] = []; + forEachAncestorDirectory(directory, ancestor => { + const currentConfigPath = findConfigFile(ancestor, (f) => tryFileExists(host, f), "package.json"); + if (!currentConfigPath) { + return true; // break out + } + paths.push(currentConfigPath); + }); + return paths; + } + + function findPackageJson(directory: string, host: LanguageServiceHost): string | undefined { + let packageJson: string | undefined; + forEachAncestorDirectory(directory, ancestor => { + if (ancestor === "node_modules") return true; + packageJson = findConfigFile(ancestor, (f) => tryFileExists(host, f), "package.json"); + if (packageJson) { + return true; // break out + } + }); + return packageJson; + } + function enumerateNodeModulesVisibleToScript(host: LanguageServiceHost, scriptPath: string): ReadonlyArray { if (!host.readFile || !host.fileExists) return emptyArray; @@ -682,6 +706,31 @@ namespace ts.Completions.StringCompletions { const nodeModulesDependencyKeys: ReadonlyArray = ["dependencies", "devDependencies", "peerDependencies", "optionalDependencies"]; + function tryGetDirectories(host: LanguageServiceHost, directoryName: string): string[] { + return tryIOAndConsumeErrors(host, host.getDirectories, directoryName) || []; + } + + function tryReadDirectory(host: LanguageServiceHost, path: string, extensions?: ReadonlyArray, exclude?: ReadonlyArray, include?: ReadonlyArray): ReadonlyArray { + return tryIOAndConsumeErrors(host, host.readDirectory, path, extensions, exclude, include) || emptyArray; + } + + function tryFileExists(host: LanguageServiceHost, path: string): boolean { + return tryIOAndConsumeErrors(host, host.fileExists, path); + } + + function tryDirectoryExists(host: LanguageServiceHost, path: string): boolean { + return tryAndIgnoreErrors(() => directoryProbablyExists(path, host)) || false; + } + + function tryIOAndConsumeErrors(host: LanguageServiceHost, toApply: ((...a: any[]) => T) | undefined, ...args: any[]) { + return tryAndIgnoreErrors(() => toApply && toApply.apply(host, args)); + } + + function tryAndIgnoreErrors(cb: () => T): T | undefined { + try { return cb(); } + catch { return undefined; } + } + function containsSlash(fragment: string) { return stringContains(fragment, directorySeparator); } diff --git a/src/services/types.ts b/src/services/types.ts index b97125734f7c5..099263063a851 100644 --- a/src/services/types.ts +++ b/src/services/types.ts @@ -892,7 +892,7 @@ namespace ts { } export interface CompletionInfo { - /** Not true for all glboal completions. This will be true if the enclosing scope matches a few syntax kinds. See `isSnippetScope`. */ + /** Not true for all global completions. This will be true if the enclosing scope matches a few syntax kinds. See `isSnippetScope`. */ isGlobalCompletion: boolean; isMemberCompletion: boolean; diff --git a/src/services/utilities.ts b/src/services/utilities.ts index f4be995c032b8..46e0ee085a115 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -1224,6 +1224,7 @@ namespace ts { SyntaxKind.NullKeyword, SyntaxKind.NumberKeyword, SyntaxKind.ObjectKeyword, + SyntaxKind.ReadonlyKeyword, SyntaxKind.StringKeyword, SyntaxKind.SymbolKeyword, SyntaxKind.TrueKeyword, @@ -1636,23 +1637,6 @@ namespace ts { return !!location.parent && isImportOrExportSpecifier(location.parent) && location.parent.propertyName === location; } - /** - * Strip off existed single quotes or double quotes from a given string - * - * @return non-quoted string - */ - export function stripQuotes(name: string) { - const length = name.length; - if (length >= 2 && name.charCodeAt(0) === name.charCodeAt(length - 1) && startsWithQuote(name)) { - return name.substring(1, length - 1); - } - return name; - } - - export function startsWithQuote(name: string): boolean { - return isSingleOrDoubleQuote(name.charCodeAt(0)); - } - export function scriptKindIs(fileName: string, host: LanguageServiceHost, ...scriptKinds: ScriptKind[]): boolean { const scriptKind = getScriptKind(fileName, host); return some(scriptKinds, k => k === scriptKind); @@ -1751,8 +1735,8 @@ namespace ts { function getSynthesizedDeepCloneWorker(node: T, renameMap?: Map, checker?: TypeChecker, callback?: (originalNode: Node, clone: Node) => any): T { const visited = (renameMap || checker || callback) ? - visitEachChild(node, wrapper, nullTransformationContext) : - visitEachChild(node, getSynthesizedDeepClone, nullTransformationContext); + visitEachChild(node, wrapper, nullTransformationContext) : + visitEachChild(node, getSynthesizedDeepClone, nullTransformationContext); if (visited === node) { // This only happens for leaf nodes - internal nodes always see their children change. @@ -2038,53 +2022,4 @@ namespace ts { // If even 2/5 places have a semicolon, the user probably wants semicolons return withSemicolon / withoutSemicolon > 1 / nStatementsToObserve; } - - export function tryGetDirectories(host: LanguageServiceHost, directoryName: string): string[] { - return tryIOAndConsumeErrors(host, host.getDirectories, directoryName) || []; - } - - export function tryReadDirectory(host: LanguageServiceHost, path: string, extensions?: ReadonlyArray, exclude?: ReadonlyArray, include?: ReadonlyArray): ReadonlyArray { - return tryIOAndConsumeErrors(host, host.readDirectory, path, extensions, exclude, include) || emptyArray; - } - - export function tryFileExists(host: LanguageServiceHost, path: string): boolean { - return tryIOAndConsumeErrors(host, host.fileExists, path); - } - - export function tryDirectoryExists(host: LanguageServiceHost, path: string): boolean { - return tryAndIgnoreErrors(() => directoryProbablyExists(path, host)) || false; - } - - export function tryAndIgnoreErrors(cb: () => T): T | undefined { - try { return cb(); } - catch { return undefined; } - } - - export function tryIOAndConsumeErrors(host: LanguageServiceHost, toApply: ((...a: any[]) => T) | undefined, ...args: any[]) { - return tryAndIgnoreErrors(() => toApply && toApply.apply(host, args)); - } - - export function findPackageJsons(directory: string, host: LanguageServiceHost): string[] { - const paths: string[] = []; - forEachAncestorDirectory(directory, ancestor => { - const currentConfigPath = findConfigFile(ancestor, (f) => tryFileExists(host, f), "package.json"); - if (!currentConfigPath) { - return true; // break out - } - paths.push(currentConfigPath); - }); - return paths; - } - - export function findPackageJson(directory: string, host: LanguageServiceHost): string | undefined { - let packageJson: string | undefined; - forEachAncestorDirectory(directory, ancestor => { - if (ancestor === "node_modules") return true; - packageJson = findConfigFile(ancestor, (f) => tryFileExists(host, f), "package.json"); - if (packageJson) { - return true; // break out - } - }); - return packageJson; - } } diff --git a/src/testRunner/unittests/publicApi.ts b/src/testRunner/unittests/publicApi.ts index 17b2519c9282c..a31104de62ac9 100644 --- a/src/testRunner/unittests/publicApi.ts +++ b/src/testRunner/unittests/publicApi.ts @@ -31,3 +31,18 @@ describe("Public APIs", () => { verifyApi("tsserverlibrary.d.ts"); }); }); + +describe("Public APIs:: token to string", () => { + function assertDefinedTokenToString(initial: ts.SyntaxKind, last: ts.SyntaxKind) { + for (let t = initial; t <= last; t++) { + assert.isDefined(ts.tokenToString(t), `Expected tokenToString defined for ${ts.Debug.formatSyntaxKind(t)}`); + } + } + + it("for punctuations", () => { + assertDefinedTokenToString(ts.SyntaxKind.FirstPunctuation, ts.SyntaxKind.LastPunctuation); + }); + it("for keywords", () => { + assertDefinedTokenToString(ts.SyntaxKind.FirstKeyword, ts.SyntaxKind.LastKeyword); + }); +}); diff --git a/src/testRunner/unittests/tsserver/projects.ts b/src/testRunner/unittests/tsserver/projects.ts index 409ce5c525f74..abb21669f8a4a 100644 --- a/src/testRunner/unittests/tsserver/projects.ts +++ b/src/testRunner/unittests/tsserver/projects.ts @@ -1467,5 +1467,22 @@ var x = 10;` openFilesForSession([{ file, projectRootPath }], session); } }); + + it("assert when removing project", () => { + const host = createServerHost([commonFile1, commonFile2, libFile]); + const service = createProjectService(host); + service.openClientFile(commonFile1.path); + const project = service.inferredProjects[0]; + checkProjectActualFiles(project, [commonFile1.path, libFile.path]); + // Intentionally create scriptinfo and attach it to project + const info = service.getOrCreateScriptInfoForNormalizedPath(commonFile2.path as server.NormalizedPath, /*openedByClient*/ false)!; + info.attachToProject(project); + try { + service.applyChangesInOpenFiles(/*openFiles*/ undefined, /*changedFiles*/ undefined, [commonFile1.path]); + } + catch (e) { + assert.isTrue(e.message.indexOf("Debug Failure. False expression: Found script Info still attached to project") === 0); + } + }); }); } diff --git a/src/testRunner/unittests/tsserver/typingsInstaller.ts b/src/testRunner/unittests/tsserver/typingsInstaller.ts index b02adbbd094aa..79b4f01aa06f9 100644 --- a/src/testRunner/unittests/tsserver/typingsInstaller.ts +++ b/src/testRunner/unittests/tsserver/typingsInstaller.ts @@ -1,6 +1,6 @@ namespace ts.projectSystem { import validatePackageName = JsTyping.validatePackageName; - import PackageNameValidationResult = JsTyping.PackageNameValidationResult; + import NameValidationResult = JsTyping.NameValidationResult; interface InstallerParams { globalTypingsCacheLocation?: string; @@ -948,7 +948,8 @@ namespace ts.projectSystem { path: "/a/b/app.js", content: ` import * as fs from "fs"; - import * as commander from "commander";` + import * as commander from "commander"; + import * as component from "@ember/component";` }; const cachePath = "/a/cache"; const node = { @@ -959,14 +960,19 @@ namespace ts.projectSystem { path: cachePath + "/node_modules/@types/commander/index.d.ts", content: "export let y: string" }; + const emberComponentDirectory = "ember__component"; + const emberComponent = { + path: `${cachePath}/node_modules/@types/${emberComponentDirectory}/index.d.ts`, + content: "export let x: number" + }; const host = createServerHost([file]); const installer = new (class extends Installer { constructor() { super(host, { globalTypingsCacheLocation: cachePath, typesRegistry: createTypesRegistry("node", "commander") }); } installWorker(_requestId: number, _args: string[], _cwd: string, cb: TI.RequestCompletedAction) { - const installedTypings = ["@types/node", "@types/commander"]; - const typingFiles = [node, commander]; + const installedTypings = ["@types/node", "@types/commander", `@types/${emberComponentDirectory}`]; + const typingFiles = [node, commander, emberComponent]; executeCommand(this, host, installedTypings, typingFiles, cb); } })(); @@ -980,9 +986,10 @@ namespace ts.projectSystem { assert.isTrue(host.fileExists(node.path), "typings for 'node' should be created"); assert.isTrue(host.fileExists(commander.path), "typings for 'commander' should be created"); + assert.isTrue(host.fileExists(emberComponent.path), "typings for 'commander' should be created"); host.checkTimeoutQueueLengthAndRun(2); - checkProjectActualFiles(service.inferredProjects[0], [file.path, node.path, commander.path]); + checkProjectActualFiles(service.inferredProjects[0], [file.path, node.path, commander.path, emberComponent.path]); }); it("should redo resolution that resolved to '.js' file after typings are installed", () => { @@ -1263,21 +1270,44 @@ namespace ts.projectSystem { for (let i = 0; i < 8; i++) { packageName += packageName; } - assert.equal(validatePackageName(packageName), PackageNameValidationResult.NameTooLong); + assert.equal(validatePackageName(packageName), NameValidationResult.NameTooLong); + }); + it("package name cannot start with dot", () => { + assert.equal(validatePackageName(".foo"), NameValidationResult.NameStartsWithDot); + }); + it("package name cannot start with underscore", () => { + assert.equal(validatePackageName("_foo"), NameValidationResult.NameStartsWithUnderscore); + }); + it("package non URI safe characters are not supported", () => { + assert.equal(validatePackageName(" scope "), NameValidationResult.NameContainsNonURISafeCharacters); + assert.equal(validatePackageName("; say ‘Hello from TypeScript!’ #"), NameValidationResult.NameContainsNonURISafeCharacters); + assert.equal(validatePackageName("a/b/c"), NameValidationResult.NameContainsNonURISafeCharacters); + }); + it("scoped package name is supported", () => { + assert.equal(validatePackageName("@scope/bar"), NameValidationResult.Ok); + }); + it("scoped name in scoped package name cannot start with dot", () => { + assert.deepEqual(validatePackageName("@.scope/bar"), { name: ".scope", isScopeName: true, result: NameValidationResult.NameStartsWithDot }); + assert.deepEqual(validatePackageName("@.scope/.bar"), { name: ".scope", isScopeName: true, result: NameValidationResult.NameStartsWithDot }); + }); + it("scope name in scoped package name cannot start with underscore", () => { + assert.deepEqual(validatePackageName("@_scope/bar"), { name: "_scope", isScopeName: true, result: NameValidationResult.NameStartsWithUnderscore }); + assert.deepEqual(validatePackageName("@_scope/_bar"), { name: "_scope", isScopeName: true, result: NameValidationResult.NameStartsWithUnderscore }); }); - it("name cannot start with dot", () => { - assert.equal(validatePackageName(".foo"), PackageNameValidationResult.NameStartsWithDot); + it("scope name in scoped package name with non URI safe characters are not supported", () => { + assert.deepEqual(validatePackageName("@ scope /bar"), { name: " scope ", isScopeName: true, result: NameValidationResult.NameContainsNonURISafeCharacters }); + assert.deepEqual(validatePackageName("@; say ‘Hello from TypeScript!’ #/bar"), { name: "; say ‘Hello from TypeScript!’ #", isScopeName: true, result: NameValidationResult.NameContainsNonURISafeCharacters }); + assert.deepEqual(validatePackageName("@ scope / bar "), { name: " scope ", isScopeName: true, result: NameValidationResult.NameContainsNonURISafeCharacters }); }); - it("name cannot start with underscore", () => { - assert.equal(validatePackageName("_foo"), PackageNameValidationResult.NameStartsWithUnderscore); + it("package name in scoped package name cannot start with dot", () => { + assert.deepEqual(validatePackageName("@scope/.bar"), { name: ".bar", isScopeName: false, result: NameValidationResult.NameStartsWithDot }); }); - it("scoped packages not supported", () => { - assert.equal(validatePackageName("@scope/bar"), PackageNameValidationResult.ScopedPackagesNotSupported); + it("package name in scoped package name cannot start with underscore", () => { + assert.deepEqual(validatePackageName("@scope/_bar"), { name: "_bar", isScopeName: false, result: NameValidationResult.NameStartsWithUnderscore }); }); - it("non URI safe characters are not supported", () => { - assert.equal(validatePackageName(" scope "), PackageNameValidationResult.NameContainsNonURISafeCharacters); - assert.equal(validatePackageName("; say ‘Hello from TypeScript!’ #"), PackageNameValidationResult.NameContainsNonURISafeCharacters); - assert.equal(validatePackageName("a/b/c"), PackageNameValidationResult.NameContainsNonURISafeCharacters); + it("package name in scoped package name with non URI safe characters are not supported", () => { + assert.deepEqual(validatePackageName("@scope/ bar "), { name: " bar ", isScopeName: false, result: NameValidationResult.NameContainsNonURISafeCharacters }); + assert.deepEqual(validatePackageName("@scope/; say ‘Hello from TypeScript!’ #"), { name: "; say ‘Hello from TypeScript!’ #", isScopeName: false, result: NameValidationResult.NameContainsNonURISafeCharacters }); }); }); @@ -1309,7 +1339,7 @@ namespace ts.projectSystem { projectService.openClientFile(f1.path); installer.checkPendingCommands(/*expectedCount*/ 0); - assert.isTrue(messages.indexOf("Package name '; say ‘Hello from TypeScript!’ #' contains non URI safe characters") > 0, "should find package with invalid name"); + assert.isTrue(messages.indexOf("'; say ‘Hello from TypeScript!’ #':: Package name '; say ‘Hello from TypeScript!’ #' contains non URI safe characters") > 0, "should find package with invalid name"); }); }); diff --git a/src/tsserver/server.ts b/src/tsserver/server.ts index 43dc4638418ab..a9fbf2f3b6af8 100644 --- a/src/tsserver/server.ts +++ b/src/tsserver/server.ts @@ -248,7 +248,7 @@ namespace ts.server { isKnownTypesPackageName(name: string): boolean { // We want to avoid looking this up in the registry as that is expensive. So first check that it's actually an NPM package. const validationResult = JsTyping.validatePackageName(name); - if (validationResult !== JsTyping.PackageNameValidationResult.Ok) { + if (validationResult !== JsTyping.NameValidationResult.Ok) { return false; } diff --git a/src/typingsInstallerCore/typingsInstaller.ts b/src/typingsInstallerCore/typingsInstaller.ts index df83f1a677c39..17dae3b4dcb21 100644 --- a/src/typingsInstallerCore/typingsInstaller.ts +++ b/src/typingsInstallerCore/typingsInstaller.ts @@ -268,27 +268,28 @@ namespace ts.server.typingsInstaller { } private filterTypings(typingsToInstall: ReadonlyArray): ReadonlyArray { - return typingsToInstall.filter(typing => { - if (this.missingTypingsSet.get(typing)) { - if (this.log.isEnabled()) this.log.writeLine(`'${typing}' is in missingTypingsSet - skipping...`); - return false; + return mapDefined(typingsToInstall, typing => { + const typingKey = mangleScopedPackageName(typing); + if (this.missingTypingsSet.get(typingKey)) { + if (this.log.isEnabled()) this.log.writeLine(`'${typing}':: '${typingKey}' is in missingTypingsSet - skipping...`); + return undefined; } const validationResult = JsTyping.validatePackageName(typing); - if (validationResult !== JsTyping.PackageNameValidationResult.Ok) { + if (validationResult !== JsTyping.NameValidationResult.Ok) { // add typing name to missing set so we won't process it again - this.missingTypingsSet.set(typing, true); + this.missingTypingsSet.set(typingKey, true); if (this.log.isEnabled()) this.log.writeLine(JsTyping.renderPackageNameValidationFailure(validationResult, typing)); - return false; + return undefined; } - if (!this.typesRegistry.has(typing)) { - if (this.log.isEnabled()) this.log.writeLine(`Entry for package '${typing}' does not exist in local types registry - skipping...`); - return false; + if (!this.typesRegistry.has(typingKey)) { + if (this.log.isEnabled()) this.log.writeLine(`'${typing}':: Entry for package '${typingKey}' does not exist in local types registry - skipping...`); + return undefined; } - if (this.packageNameToTypingLocation.get(typing) && JsTyping.isTypingUpToDate(this.packageNameToTypingLocation.get(typing)!, this.typesRegistry.get(typing)!)) { - if (this.log.isEnabled()) this.log.writeLine(`'${typing}' already has an up-to-date typing - skipping...`); - return false; + if (this.packageNameToTypingLocation.get(typingKey) && JsTyping.isTypingUpToDate(this.packageNameToTypingLocation.get(typingKey)!, this.typesRegistry.get(typingKey)!)) { + if (this.log.isEnabled()) this.log.writeLine(`'${typing}':: '${typingKey}' already has an up-to-date typing - skipping...`); + return undefined; } - return true; + return typingKey; }); } diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 808b8e20e9e4f..029107eef069a 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -1155,6 +1155,7 @@ declare namespace ts { expression: JsxTagNameExpression; } interface JsxAttributes extends ObjectLiteralExpressionBase { + kind: SyntaxKind.JsxAttributes; parent: JsxOpeningLikeElement; } interface JsxOpeningElement extends Expression { @@ -2599,7 +2600,7 @@ declare namespace ts { UMD = 3, System = 4, ES2015 = 5, - ESNext = 6 + ESNext = 99 } enum JsxEmit { None = 0, @@ -2639,9 +2640,9 @@ declare namespace ts { ES2018 = 5, ES2019 = 6, ES2020 = 7, - ESNext = 8, + ESNext = 99, JSON = 100, - Latest = 8 + Latest = 99 } enum LanguageVariant { Standard = 0, @@ -5403,7 +5404,7 @@ declare namespace ts { argumentCount: number; } interface CompletionInfo { - /** Not true for all glboal completions. This will be true if the enclosing scope matches a few syntax kinds. See `isSnippetScope`. */ + /** Not true for all global completions. This will be true if the enclosing scope matches a few syntax kinds. See `isSnippetScope`. */ isGlobalCompletion: boolean; isMemberCompletion: boolean; /** diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index d829440260acd..8b79e16eadc1d 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -1155,6 +1155,7 @@ declare namespace ts { expression: JsxTagNameExpression; } interface JsxAttributes extends ObjectLiteralExpressionBase { + kind: SyntaxKind.JsxAttributes; parent: JsxOpeningLikeElement; } interface JsxOpeningElement extends Expression { @@ -2599,7 +2600,7 @@ declare namespace ts { UMD = 3, System = 4, ES2015 = 5, - ESNext = 6 + ESNext = 99 } enum JsxEmit { None = 0, @@ -2639,9 +2640,9 @@ declare namespace ts { ES2018 = 5, ES2019 = 6, ES2020 = 7, - ESNext = 8, + ESNext = 99, JSON = 100, - Latest = 8 + Latest = 99 } enum LanguageVariant { Standard = 0, @@ -5403,7 +5404,7 @@ declare namespace ts { argumentCount: number; } interface CompletionInfo { - /** Not true for all glboal completions. This will be true if the enclosing scope matches a few syntax kinds. See `isSnippetScope`. */ + /** Not true for all global completions. This will be true if the enclosing scope matches a few syntax kinds. See `isSnippetScope`. */ isGlobalCompletion: boolean; isMemberCompletion: boolean; /** diff --git a/tests/baselines/reference/castOfYield.errors.txt b/tests/baselines/reference/castOfYield.errors.txt index 90725000c909d..0d40a4dcd987d 100644 --- a/tests/baselines/reference/castOfYield.errors.txt +++ b/tests/baselines/reference/castOfYield.errors.txt @@ -1,8 +1,8 @@ -error TS2318: Cannot find global type 'Generator'. +error TS2318: Cannot find global type 'IterableIterator'. tests/cases/compiler/castOfYield.ts(4,14): error TS1109: Expression expected. -!!! error TS2318: Cannot find global type 'Generator'. +!!! error TS2318: Cannot find global type 'IterableIterator'. ==== tests/cases/compiler/castOfYield.ts (1 errors) ==== function* f() { (yield 0); diff --git a/tests/baselines/reference/controlFlowElementAccess2.js b/tests/baselines/reference/controlFlowElementAccess2.js new file mode 100644 index 0000000000000..050fc15b8af1f --- /dev/null +++ b/tests/baselines/reference/controlFlowElementAccess2.js @@ -0,0 +1,25 @@ +//// [controlFlowElementAccess2.ts] +declare const config: { + [key: string]: boolean | { prop: string }; +}; + +if (typeof config['works'] !== 'boolean') { + config.works.prop = 'test'; // ok + config['works'].prop = 'test'; // error, config['works']: boolean | { 'prop': string } +} +if (typeof config.works !== 'boolean') { + config['works'].prop = 'test'; // error, config['works']: boolean | { 'prop': string } + config.works.prop = 'test'; // ok +} + + +//// [controlFlowElementAccess2.js] +"use strict"; +if (typeof config['works'] !== 'boolean') { + config.works.prop = 'test'; // ok + config['works'].prop = 'test'; // error, config['works']: boolean | { 'prop': string } +} +if (typeof config.works !== 'boolean') { + config['works'].prop = 'test'; // error, config['works']: boolean | { 'prop': string } + config.works.prop = 'test'; // ok +} diff --git a/tests/baselines/reference/controlFlowElementAccess2.symbols b/tests/baselines/reference/controlFlowElementAccess2.symbols new file mode 100644 index 0000000000000..5cdd890a75973 --- /dev/null +++ b/tests/baselines/reference/controlFlowElementAccess2.symbols @@ -0,0 +1,37 @@ +=== tests/cases/conformance/controlFlow/controlFlowElementAccess2.ts === +declare const config: { +>config : Symbol(config, Decl(controlFlowElementAccess2.ts, 0, 13)) + + [key: string]: boolean | { prop: string }; +>key : Symbol(key, Decl(controlFlowElementAccess2.ts, 1, 5)) +>prop : Symbol(prop, Decl(controlFlowElementAccess2.ts, 1, 30)) + +}; + +if (typeof config['works'] !== 'boolean') { +>config : Symbol(config, Decl(controlFlowElementAccess2.ts, 0, 13)) + + config.works.prop = 'test'; // ok +>config.works.prop : Symbol(prop, Decl(controlFlowElementAccess2.ts, 1, 30)) +>config : Symbol(config, Decl(controlFlowElementAccess2.ts, 0, 13)) +>prop : Symbol(prop, Decl(controlFlowElementAccess2.ts, 1, 30)) + + config['works'].prop = 'test'; // error, config['works']: boolean | { 'prop': string } +>config['works'].prop : Symbol(prop, Decl(controlFlowElementAccess2.ts, 1, 30)) +>config : Symbol(config, Decl(controlFlowElementAccess2.ts, 0, 13)) +>prop : Symbol(prop, Decl(controlFlowElementAccess2.ts, 1, 30)) +} +if (typeof config.works !== 'boolean') { +>config : Symbol(config, Decl(controlFlowElementAccess2.ts, 0, 13)) + + config['works'].prop = 'test'; // error, config['works']: boolean | { 'prop': string } +>config['works'].prop : Symbol(prop, Decl(controlFlowElementAccess2.ts, 1, 30)) +>config : Symbol(config, Decl(controlFlowElementAccess2.ts, 0, 13)) +>prop : Symbol(prop, Decl(controlFlowElementAccess2.ts, 1, 30)) + + config.works.prop = 'test'; // ok +>config.works.prop : Symbol(prop, Decl(controlFlowElementAccess2.ts, 1, 30)) +>config : Symbol(config, Decl(controlFlowElementAccess2.ts, 0, 13)) +>prop : Symbol(prop, Decl(controlFlowElementAccess2.ts, 1, 30)) +} + diff --git a/tests/baselines/reference/controlFlowElementAccess2.types b/tests/baselines/reference/controlFlowElementAccess2.types new file mode 100644 index 0000000000000..65dca4de50226 --- /dev/null +++ b/tests/baselines/reference/controlFlowElementAccess2.types @@ -0,0 +1,63 @@ +=== tests/cases/conformance/controlFlow/controlFlowElementAccess2.ts === +declare const config: { +>config : { [key: string]: boolean | { prop: string; }; } + + [key: string]: boolean | { prop: string }; +>key : string +>prop : string + +}; + +if (typeof config['works'] !== 'boolean') { +>typeof config['works'] !== 'boolean' : boolean +>typeof config['works'] : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" +>config['works'] : boolean | { prop: string; } +>config : { [key: string]: boolean | { prop: string; }; } +>'works' : "works" +>'boolean' : "boolean" + + config.works.prop = 'test'; // ok +>config.works.prop = 'test' : "test" +>config.works.prop : string +>config.works : { prop: string; } +>config : { [key: string]: boolean | { prop: string; }; } +>works : { prop: string; } +>prop : string +>'test' : "test" + + config['works'].prop = 'test'; // error, config['works']: boolean | { 'prop': string } +>config['works'].prop = 'test' : "test" +>config['works'].prop : string +>config['works'] : { prop: string; } +>config : { [key: string]: boolean | { prop: string; }; } +>'works' : "works" +>prop : string +>'test' : "test" +} +if (typeof config.works !== 'boolean') { +>typeof config.works !== 'boolean' : boolean +>typeof config.works : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" +>config.works : boolean | { prop: string; } +>config : { [key: string]: boolean | { prop: string; }; } +>works : boolean | { prop: string; } +>'boolean' : "boolean" + + config['works'].prop = 'test'; // error, config['works']: boolean | { 'prop': string } +>config['works'].prop = 'test' : "test" +>config['works'].prop : string +>config['works'] : { prop: string; } +>config : { [key: string]: boolean | { prop: string; }; } +>'works' : "works" +>prop : string +>'test' : "test" + + config.works.prop = 'test'; // ok +>config.works.prop = 'test' : "test" +>config.works.prop : string +>config.works : { prop: string; } +>config : { [key: string]: boolean | { prop: string; }; } +>works : { prop: string; } +>prop : string +>'test' : "test" +} + diff --git a/tests/baselines/reference/docker/azure-sdk.log b/tests/baselines/reference/docker/azure-sdk.log index 5991387679e43..a75af93aee143 100644 --- a/tests/baselines/reference/docker/azure-sdk.log +++ b/tests/baselines/reference/docker/azure-sdk.log @@ -1,20 +1,15 @@ Exit Code: 1 Standard output: -Rush Multi-Project Build Tool 5.7.3 - https://rushjs.io +Rush Multi-Project Build Tool 5.10.1 - https://rushjs.io Starting "rush rebuild" Executing a maximum of 1 simultaneous processes... [@azure/cosmos] started -npm ERR! code ELIFECYCLE -npm ERR! errno 2 -npm ERR! @azure/cosmos@X.X.X compile: `echo Using TypeScript && tsc --version && tsc -p tsconfig.prod.json --pretty` -npm ERR! Exit status 2 -npm ERR! -npm ERR! Failed at the @azure/cosmos@X.X.X compile script. -npm ERR! This is probably not a problem with npm. There is likely additional logging output above. -npm ERR! A complete log of this run can be found in: -npm ERR! /root/.npm/_logs/2019-07-11T13_39_53_628Z-debug.log +XX of XX: [@azure/cosmos] completed successfully in ? seconds +[@azure/event-processor-host] started +XX of XX: [@azure/event-processor-host] completed successfully in ? seconds [@azure/service-bus] started +Warning: You have changed the public API signature for this project. Updating review/service-bus.api.md [@azure/storage-blob] started XX of XX: [@azure/storage-blob] completed successfully in ? seconds [@azure/storage-file] started @@ -23,6 +18,8 @@ XX of XX: [@azure/storage-file] completed successfully in ? seconds XX of XX: [@azure/storage-queue] completed successfully in ? seconds [@azure/template] started XX of XX: [@azure/template] completed successfully in ? seconds +[testhub] started +XX of XX: [testhub] completed successfully in ? seconds [@azure/abort-controller] started XX of XX: [@azure/abort-controller] completed successfully in ? seconds [@azure/core-asynciterator-polyfill] started @@ -38,7 +35,7 @@ npm ERR! npm ERR! Failed at the @azure/core-http@X.X.X-preview.1 build:tsc script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm ERR! A complete log of this run can be found in: -npm ERR! /root/.npm/_logs/2019-07-11T13_41_08_804Z-debug.log +npm ERR! /root/.npm/_logs/2019-07-19T13_40_31_496Z-debug.log ERROR: "build:tsc" exited with 2. npm ERR! code ELIFECYCLE npm ERR! errno 1 @@ -48,20 +45,17 @@ npm ERR! npm ERR! Failed at the @azure/core-http@X.X.X-preview.1 build:lib script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm ERR! A complete log of this run can be found in: -npm ERR! /root/.npm/_logs/2019-07-11T13_41_08_852Z-debug.log +npm ERR! /root/.npm/_logs/2019-07-19T13_40_31_533Z-debug.log ERROR: "build:lib" exited with 1. [@azure/core-paging] started XX of XX: [@azure/core-paging] completed successfully in ? seconds -[@azure/event-processor-host] started -XX of XX: [@azure/event-processor-host] completed successfully in ? seconds -[testhub] started -XX of XX: [testhub] completed successfully in ? seconds -SUCCESS (10) +SUCCESS (11) ================================ @azure/abort-controller (? seconds) @azure/core-asynciterator-polyfill (? seconds) @azure/core-auth (? seconds) @azure/core-paging (? seconds) +@azure/cosmos (? seconds) @azure/event-processor-host (? seconds) @azure/storage-blob (? seconds) @azure/storage-file (? seconds) @@ -69,6 +63,11 @@ SUCCESS (10) @azure/template (? seconds) testhub (? seconds) ================================ +SUCCESS WITH WARNINGS (1) +================================ +@azure/service-bus (? seconds) +Warning: You have changed the public API signature for this project. Updating review/service-bus.api.md +================================ BLOCKED (7) ================================ @azure/core-amqp @@ -79,7 +78,7 @@ BLOCKED (7) @azure/keyvault-keys @azure/keyvault-secrets ================================ -FAILURE (3) +FAILURE (1) ================================ @azure/core-http (? seconds) npm ERR! code ELIFECYCLE @@ -90,7 +89,7 @@ npm ERR! npm ERR! Failed at the @azure/core-http@X.X.X-preview.1 build:tsc script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm ERR! A complete log of this run can be found in: -npm ERR! /root/.npm/_logs/2019-07-11T13_41_08_804Z-debug.log +npm ERR! /root/.npm/_logs/2019-07-19T13_40_31_496Z-debug.log ERROR: "build:tsc" exited with 2. npm ERR! code ELIFECYCLE npm ERR! errno 1 @@ -100,24 +99,8 @@ npm ERR! npm ERR! Failed at the @azure/core-http@X.X.X-preview.1 build:lib script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm ERR! A complete log of this run can be found in: -npm ERR! /root/.npm/_logs/2019-07-11T13_41_08_852Z-debug.log +npm ERR! /root/.npm/_logs/2019-07-19T13_40_31_533Z-debug.log ERROR: "build:lib" exited with 1. -@azure/cosmos ( ? seconds) -npm ERR! code ELIFECYCLE -npm ERR! errno 2 -npm ERR! @azure/cosmos@X.X.X compile: `echo Using TypeScript && tsc --version && tsc -p tsconfig.prod.json --pretty` -npm ERR! Exit status 2 -npm ERR! -npm ERR! Failed at the @azure/cosmos@X.X.X compile script. -npm ERR! This is probably not a problem with npm. There is likely additional logging output above. -npm ERR! A complete log of this run can be found in: -npm ERR! /root/.npm/_logs/2019-07-11T13_39_53_628Z-debug.log -@azure/service-bus ( ? seconds) ->>> @azure/service-bus -tsc -p . && rollup -c 2>&1 && npm run extract-api -error TS2318: Cannot find global type 'AsyncGenerator'. -src/receiver.ts(193,32): error TS2739: Type '{}' is missing the following properties from type 'AsyncIterableIterator': [Symbol.asyncIterator], next -src/receiver.ts(742,32): error TS2322: Type '{}' is not assignable to type 'AsyncIterableIterator'. ================================ Error: Project(s) failed to build rush rebuild - Errors! ( ? seconds) @@ -126,8 +109,7 @@ rush rebuild - Errors! ( ? seconds) Standard error: Your version of Node.js (X.X.X) has not been tested with this release of Rush. The Rush team will not accept issue reports for it. Please consider upgrading Rush or downgrading Node.js. -XX of XX: [@azure/cosmos] failed to build! -XX of XX: [@azure/service-bus] failed to build! +XX of XX: [@azure/service-bus] completed with warnings in ? seconds XX of XX: [@azure/core-http] failed to build! XX of XX: [@azure/core-arm] blocked by [@azure/core-http]! XX of XX: [@azure/identity] blocked by [@azure/core-http]! @@ -137,5 +119,3 @@ XX of XX: [@azure/keyvault-certificates] blocked by [@azure/core-http]! XX of XX: [@azure/keyvault-keys] blocked by [@azure/core-http]! XX of XX: [@azure/keyvault-secrets] blocked by [@azure/core-http]! [@azure/core-http] Returned error code: 1 -[@azure/cosmos] Returned error code: 2 -[@azure/service-bus] Returned error code: 2 diff --git a/tests/baselines/reference/docker/office-ui-fabric.log b/tests/baselines/reference/docker/office-ui-fabric.log index 70e9ab2cc7b1c..888e20cac4b10 100644 --- a/tests/baselines/reference/docker/office-ui-fabric.log +++ b/tests/baselines/reference/docker/office-ui-fabric.log @@ -10,12 +10,24 @@ XX of XX: [@uifabric/prettier-rules] completed successfully in ? seconds XX of XX: [@uifabric/tslint-rules] completed successfully in ? seconds [@uifabric/codepen-loader] started ts-jest[versions] (WARN) Version X.X.X-insiders.xxxxxxxx of typescript installed has not been tested with ts-jest. If you're experiencing issues, consider using a supported version (>=2.7.0 <4.0.0). Please do not report issues in ts-jest if you are using unsupported versions. + PASS src/__tests__/codepenTransform.test.ts + codepen transform + ✓ handles examples with function components (256ms) + ✓ handles examples with class components (38ms) + ✓ handles examples importing exampleData (125ms) + ✓ handles examples importing TestImages (33ms) + ✓ handles examples importing PeopleExampleData (270ms) +Test Suites: 1 passed, 1 total +Tests: 5 passed, 5 total +Snapshots: 4 passed, 4 total +Time: ?s +Ran all test suites. [@uifabric/build] started XX of XX: [@uifabric/build] completed successfully in ? seconds [@uifabric/migration] started XX of XX: [@uifabric/migration] completed successfully in ? seconds [@uifabric/set-version] started -ts-jest[versions] (WARN) Version X.X.X-insiders.xxxxxxxx of typescript installed has not been tested with ts-jest. If you're experiencing issues, consider using a supported version (>=2.7.0 <4.0.0). Please do not report issues in ts-jest if you are using unsupported versions. +XX of XX: [@uifabric/set-version] completed successfully in ? seconds [@uifabric/merge-styles] started ts-jest[versions] (WARN) Version X.X.X-insiders.xxxxxxxx of typescript installed has not been tested with ts-jest. If you're experiencing issues, consider using a supported version (>=2.7.0 <4.0.0). Please do not report issues in ts-jest if you are using unsupported versions. [@uifabric/jest-serializer-merge-styles] started @@ -204,7 +216,7 @@ ts-jest[versions] (WARN) Version X.X.X-insiders.xxxxxxxx of typescript installed [XX:XX:XX XM] x Error detected while running 'jest' [XX:XX:XX XM] x ------------------------------------ [XX:XX:XX XM] x Error: Command failed: /usr/local/bin/node /office-ui-fabric-react/common/temp/node_modules/jest/bin/jest.js --config /office-ui-fabric-react/packages/foundation/jest.config.js --passWithNoTests --colors - at ChildProcess. (/office-ui-fabric-react/common/temp/node_modules/.registry.npmjs.org/just-scripts-utils/0.8.1/node_modules/just-scripts-utils/lib/exec.js:70:31) + at ChildProcess. (/office-ui-fabric-react/common/temp/node_modules/.registry.npmjs.org/just-scripts-utils/0.8.2/node_modules/just-scripts-utils/lib/exec.js:70:31) at ChildProcess.emit (events.js:203:13) at ChildProcess.EventEmitter.emit (domain.js:494:23) at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12) @@ -216,27 +228,38 @@ ts-jest[versions] (WARN) Version X.X.X-insiders.xxxxxxxx of typescript installed XX of XX: [@uifabric/icons] completed successfully in ? seconds [@uifabric/webpack-utils] started XX of XX: [@uifabric/webpack-utils] completed successfully in ? seconds -SUCCESS (8) +SUCCESS (9) ================================ @uifabric/build (? seconds) @uifabric/file-type-icons (? seconds) @uifabric/icons (? seconds) @uifabric/migration (? seconds) @uifabric/prettier-rules (? seconds) +@uifabric/set-version (? seconds) @uifabric/test-utilities (? seconds) @uifabric/tslint-rules (? seconds) @uifabric/webpack-utils (? seconds) ================================ -SUCCESS WITH WARNINGS (6) +SUCCESS WITH WARNINGS (5) ================================ @uifabric/codepen-loader (? seconds) ts-jest[versions] (WARN) Version X.X.X-insiders.xxxxxxxx of typescript installed has not been tested with ts-jest. If you're experiencing issues, consider using a supported version (>=2.7.0 <4.0.0). Please do not report issues in ts-jest if you are using unsupported versions. + PASS src/__tests__/codepenTransform.test.ts + codepen transform + ✓ handles examples with function components (256ms) + ✓ handles examples with class components (38ms) + ✓ handles examples importing exampleData (125ms) + ✓ handles examples importing TestImages (33ms) + ✓ handles examples importing PeopleExampleData (270ms) +Test Suites: 1 passed, 1 total +Tests: 5 passed, 5 total +Snapshots: 4 passed, 4 total +Time: ?s +Ran all test suites. @uifabric/jest-serializer-merge-styles (? seconds) ts-jest[versions] (WARN) Version X.X.X-insiders.xxxxxxxx of typescript installed has not been tested with ts-jest. If you're experiencing issues, consider using a supported version (>=2.7.0 <4.0.0). Please do not report issues in ts-jest if you are using unsupported versions. @uifabric/merge-styles (? seconds) ts-jest[versions] (WARN) Version X.X.X-insiders.xxxxxxxx of typescript installed has not been tested with ts-jest. If you're experiencing issues, consider using a supported version (>=2.7.0 <4.0.0). Please do not report issues in ts-jest if you are using unsupported versions. -@uifabric/set-version (? seconds) -ts-jest[versions] (WARN) Version X.X.X-insiders.xxxxxxxx of typescript installed has not been tested with ts-jest. If you're experiencing issues, consider using a supported version (>=2.7.0 <4.0.0). Please do not report issues in ts-jest if you are using unsupported versions. @uifabric/styling (? seconds) ts-jest[versions] (WARN) Version X.X.X-insiders.xxxxxxxx of typescript installed has not been tested with ts-jest. If you're experiencing issues, consider using a supported version (>=2.7.0 <4.0.0). Please do not report issues in ts-jest if you are using unsupported versions. @uifabric/utilities (? seconds) @@ -296,7 +319,7 @@ ts-jest[versions] (WARN) Version X.X.X-insiders.xxxxxxxx of typescript installed [XX:XX:XX XM] x Error detected while running 'jest' [XX:XX:XX XM] x ------------------------------------ [XX:XX:XX XM] x Error: Command failed: /usr/local/bin/node /office-ui-fabric-react/common/temp/node_modules/jest/bin/jest.js --config /office-ui-fabric-react/packages/foundation/jest.config.js --passWithNoTests --colors - at ChildProcess. (/office-ui-fabric-react/common/temp/node_modules/.registry.npmjs.org/just-scripts-utils/0.8.1/node_modules/just-scripts-utils/lib/exec.js:70:31) + at ChildProcess. (/office-ui-fabric-react/common/temp/node_modules/.registry.npmjs.org/just-scripts-utils/0.8.2/node_modules/just-scripts-utils/lib/exec.js:70:31) at ChildProcess.emit (events.js:203:13) at ChildProcess.EventEmitter.emit (domain.js:494:23) at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12) @@ -313,7 +336,6 @@ rush rebuild - Errors! ( ? seconds) Standard error: Your version of Node.js (X.X.X) has not been tested with this release of Rush. The Rush team will not accept issue reports for it. Please consider upgrading Rush or downgrading Node.js. XX of XX: [@uifabric/codepen-loader] completed with warnings in ? seconds -XX of XX: [@uifabric/set-version] completed with warnings in ? seconds XX of XX: [@uifabric/merge-styles] completed with warnings in ? seconds XX of XX: [@uifabric/jest-serializer-merge-styles] completed with warnings in ? seconds XX of XX: [@uifabric/utilities] completed with warnings in ? seconds diff --git a/tests/baselines/reference/generatorReturnTypeFallback.1.symbols b/tests/baselines/reference/generatorReturnTypeFallback.1.symbols new file mode 100644 index 0000000000000..9c2b38be4c380 --- /dev/null +++ b/tests/baselines/reference/generatorReturnTypeFallback.1.symbols @@ -0,0 +1,7 @@ +=== tests/cases/conformance/generators/generatorReturnTypeFallback.1.ts === +// Allow generators to fallback to IterableIterator if they do not need a type for the sent value while in strictNullChecks mode. +function* f() { +>f : Symbol(f, Decl(generatorReturnTypeFallback.1.ts, 0, 0)) + + yield 1; +} diff --git a/tests/baselines/reference/generatorReturnTypeFallback.1.types b/tests/baselines/reference/generatorReturnTypeFallback.1.types new file mode 100644 index 0000000000000..8603cb356cae5 --- /dev/null +++ b/tests/baselines/reference/generatorReturnTypeFallback.1.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/generators/generatorReturnTypeFallback.1.ts === +// Allow generators to fallback to IterableIterator if they do not need a type for the sent value while in strictNullChecks mode. +function* f() { +>f : () => IterableIterator + + yield 1; +>yield 1 : any +>1 : 1 +} diff --git a/tests/baselines/reference/generatorReturnTypeFallback.2.errors.txt b/tests/baselines/reference/generatorReturnTypeFallback.2.errors.txt new file mode 100644 index 0000000000000..9cf7569ef3fc1 --- /dev/null +++ b/tests/baselines/reference/generatorReturnTypeFallback.2.errors.txt @@ -0,0 +1,10 @@ +error TS2318: Cannot find global type 'IterableIterator'. + + +!!! error TS2318: Cannot find global type 'IterableIterator'. +==== tests/cases/conformance/generators/generatorReturnTypeFallback.2.ts (0 errors) ==== + // Allow generators to fallback to IterableIterator if they do not need a type for the sent value while in strictNullChecks mode. + // Report an error if IterableIterator cannot be found. + function* f() { + yield 1; + } \ No newline at end of file diff --git a/tests/baselines/reference/generatorReturnTypeFallback.2.symbols b/tests/baselines/reference/generatorReturnTypeFallback.2.symbols new file mode 100644 index 0000000000000..5cd344e538cac --- /dev/null +++ b/tests/baselines/reference/generatorReturnTypeFallback.2.symbols @@ -0,0 +1,8 @@ +=== tests/cases/conformance/generators/generatorReturnTypeFallback.2.ts === +// Allow generators to fallback to IterableIterator if they do not need a type for the sent value while in strictNullChecks mode. +// Report an error if IterableIterator cannot be found. +function* f() { +>f : Symbol(f, Decl(generatorReturnTypeFallback.2.ts, 0, 0)) + + yield 1; +} diff --git a/tests/baselines/reference/generatorReturnTypeFallback.2.types b/tests/baselines/reference/generatorReturnTypeFallback.2.types new file mode 100644 index 0000000000000..36730010f7661 --- /dev/null +++ b/tests/baselines/reference/generatorReturnTypeFallback.2.types @@ -0,0 +1,10 @@ +=== tests/cases/conformance/generators/generatorReturnTypeFallback.2.ts === +// Allow generators to fallback to IterableIterator if they do not need a type for the sent value while in strictNullChecks mode. +// Report an error if IterableIterator cannot be found. +function* f() { +>f : () => {} + + yield 1; +>yield 1 : any +>1 : 1 +} diff --git a/tests/baselines/reference/generatorReturnTypeFallback.3.errors.txt b/tests/baselines/reference/generatorReturnTypeFallback.3.errors.txt new file mode 100644 index 0000000000000..a365ba8c6cd79 --- /dev/null +++ b/tests/baselines/reference/generatorReturnTypeFallback.3.errors.txt @@ -0,0 +1,10 @@ +error TS2318: Cannot find global type 'Generator'. + + +!!! error TS2318: Cannot find global type 'Generator'. +==== tests/cases/conformance/generators/generatorReturnTypeFallback.3.ts (0 errors) ==== + // Do not allow generators to fallback to IterableIterator while in strictNullChecks mode if they need a type for the sent value. + // NOTE: In non-strictNullChecks mode, `undefined` (the default sent value) is assignable to everything. + function* f() { + const x: string = yield 1; + } \ No newline at end of file diff --git a/tests/baselines/reference/generatorReturnTypeFallback.3.symbols b/tests/baselines/reference/generatorReturnTypeFallback.3.symbols new file mode 100644 index 0000000000000..17252fab306ad --- /dev/null +++ b/tests/baselines/reference/generatorReturnTypeFallback.3.symbols @@ -0,0 +1,9 @@ +=== tests/cases/conformance/generators/generatorReturnTypeFallback.3.ts === +// Do not allow generators to fallback to IterableIterator while in strictNullChecks mode if they need a type for the sent value. +// NOTE: In non-strictNullChecks mode, `undefined` (the default sent value) is assignable to everything. +function* f() { +>f : Symbol(f, Decl(generatorReturnTypeFallback.3.ts, 0, 0)) + + const x: string = yield 1; +>x : Symbol(x, Decl(generatorReturnTypeFallback.3.ts, 3, 9)) +} diff --git a/tests/baselines/reference/generatorReturnTypeFallback.3.types b/tests/baselines/reference/generatorReturnTypeFallback.3.types new file mode 100644 index 0000000000000..634f3f2277d0a --- /dev/null +++ b/tests/baselines/reference/generatorReturnTypeFallback.3.types @@ -0,0 +1,11 @@ +=== tests/cases/conformance/generators/generatorReturnTypeFallback.3.ts === +// Do not allow generators to fallback to IterableIterator while in strictNullChecks mode if they need a type for the sent value. +// NOTE: In non-strictNullChecks mode, `undefined` (the default sent value) is assignable to everything. +function* f() { +>f : () => {} + + const x: string = yield 1; +>x : string +>yield 1 : any +>1 : 1 +} diff --git a/tests/baselines/reference/generatorReturnTypeFallback.4.symbols b/tests/baselines/reference/generatorReturnTypeFallback.4.symbols new file mode 100644 index 0000000000000..3be221fffcaa4 --- /dev/null +++ b/tests/baselines/reference/generatorReturnTypeFallback.4.symbols @@ -0,0 +1,9 @@ +=== tests/cases/conformance/generators/generatorReturnTypeFallback.4.ts === +// Allow generators to fallback to IterableIterator if they are not in strictNullChecks mode +// NOTE: In non-strictNullChecks mode, `undefined` (the default sent value) is assignable to everything. +function* f() { +>f : Symbol(f, Decl(generatorReturnTypeFallback.4.ts, 0, 0)) + + const x: string = yield 1; +>x : Symbol(x, Decl(generatorReturnTypeFallback.4.ts, 3, 9)) +} diff --git a/tests/baselines/reference/generatorReturnTypeFallback.4.types b/tests/baselines/reference/generatorReturnTypeFallback.4.types new file mode 100644 index 0000000000000..2879058f37faf --- /dev/null +++ b/tests/baselines/reference/generatorReturnTypeFallback.4.types @@ -0,0 +1,11 @@ +=== tests/cases/conformance/generators/generatorReturnTypeFallback.4.ts === +// Allow generators to fallback to IterableIterator if they are not in strictNullChecks mode +// NOTE: In non-strictNullChecks mode, `undefined` (the default sent value) is assignable to everything. +function* f() { +>f : () => IterableIterator + + const x: string = yield 1; +>x : string +>yield 1 : any +>1 : 1 +} diff --git a/tests/baselines/reference/generatorReturnTypeFallback.5.symbols b/tests/baselines/reference/generatorReturnTypeFallback.5.symbols new file mode 100644 index 0000000000000..411ce92a4421a --- /dev/null +++ b/tests/baselines/reference/generatorReturnTypeFallback.5.symbols @@ -0,0 +1,8 @@ +=== tests/cases/conformance/generators/generatorReturnTypeFallback.5.ts === +// Allow generators to fallback to IterableIterator if they do not need a type for the sent value while in strictNullChecks mode. +function* f(): IterableIterator { +>f : Symbol(f, Decl(generatorReturnTypeFallback.5.ts, 0, 0)) +>IterableIterator : Symbol(IterableIterator, Decl(lib.es2015.iterable.d.ts, --, --)) + + yield 1; +} diff --git a/tests/baselines/reference/generatorReturnTypeFallback.5.types b/tests/baselines/reference/generatorReturnTypeFallback.5.types new file mode 100644 index 0000000000000..d0ed412746538 --- /dev/null +++ b/tests/baselines/reference/generatorReturnTypeFallback.5.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/generators/generatorReturnTypeFallback.5.ts === +// Allow generators to fallback to IterableIterator if they do not need a type for the sent value while in strictNullChecks mode. +function* f(): IterableIterator { +>f : () => IterableIterator + + yield 1; +>yield 1 : undefined +>1 : 1 +} diff --git a/tests/baselines/reference/generatorTypeCheck25.types b/tests/baselines/reference/generatorTypeCheck25.types index d0498c2da16ea..12dbfeaede961 100644 --- a/tests/baselines/reference/generatorTypeCheck25.types +++ b/tests/baselines/reference/generatorTypeCheck25.types @@ -17,15 +17,15 @@ var g3: () => Iterable = function* () { >function* () { yield; yield new Bar; yield new Baz; yield *[new Bar]; yield *[new Baz];} : () => Generator yield; ->yield : any +>yield : undefined yield new Bar; ->yield new Bar : any +>yield new Bar : undefined >new Bar : Bar >Bar : typeof Bar yield new Baz; ->yield new Baz : any +>yield new Baz : undefined >new Baz : Baz >Baz : typeof Baz diff --git a/tests/baselines/reference/generatorTypeCheck28.types b/tests/baselines/reference/generatorTypeCheck28.types index 9cd4e5e82cecb..6921c946a39d7 100644 --- a/tests/baselines/reference/generatorTypeCheck28.types +++ b/tests/baselines/reference/generatorTypeCheck28.types @@ -14,7 +14,7 @@ function* g(): IterableIterator<(x: string) => number> { >iterator : symbol yield x => x.length; ->yield x => x.length : any +>yield x => x.length : undefined >x => x.length : (x: string) => number >x : string >x.length : number diff --git a/tests/baselines/reference/generatorTypeCheck45.types b/tests/baselines/reference/generatorTypeCheck45.types index cf40924194775..18d3e9a5fc2cb 100644 --- a/tests/baselines/reference/generatorTypeCheck45.types +++ b/tests/baselines/reference/generatorTypeCheck45.types @@ -12,7 +12,7 @@ foo("", function* () { yield x => x.length }, p => undefined); // T is fixed, sh >foo : (x: T, fun: () => Iterator<(x: T) => U, any, undefined>, fun2: (y: U) => T) => T >"" : "" >function* () { yield x => x.length } : () => Generator<(x: string) => number, void, unknown> ->yield x => x.length : any +>yield x => x.length : undefined >x => x.length : (x: string) => number >x : string >x.length : number diff --git a/tests/baselines/reference/generatorTypeCheck46.types b/tests/baselines/reference/generatorTypeCheck46.types index cd565d55911ee..283188193b77f 100644 --- a/tests/baselines/reference/generatorTypeCheck46.types +++ b/tests/baselines/reference/generatorTypeCheck46.types @@ -24,7 +24,7 @@ foo("", function* () { >iterator : symbol yield x => x.length ->yield x => x.length : any +>yield x => x.length : undefined >x => x.length : (x: string) => number >x : string >x.length : number diff --git a/tests/baselines/reference/generatorTypeCheck62.types b/tests/baselines/reference/generatorTypeCheck62.types index be5635a07fc66..ed957295c3123 100644 --- a/tests/baselines/reference/generatorTypeCheck62.types +++ b/tests/baselines/reference/generatorTypeCheck62.types @@ -32,7 +32,7 @@ export function strategy(stratName: string, gen: (a: T >stratName : string } yield next; ->yield next : any +>yield next : undefined >next : T } } @@ -70,7 +70,7 @@ export const Nothing2: Strategy = strategy("Nothing", function*(state: St >state : State yield state; ->yield state : any +>yield state : undefined >state : State }); @@ -84,7 +84,7 @@ export const Nothing3: Strategy = strategy("Nothing", function* (state: S >state : State yield ; ->yield : any +>yield : undefined return state; >state : State diff --git a/tests/baselines/reference/generatorTypeCheck63.types b/tests/baselines/reference/generatorTypeCheck63.types index 8a1d03dcb164c..64d67083e6173 100644 --- a/tests/baselines/reference/generatorTypeCheck63.types +++ b/tests/baselines/reference/generatorTypeCheck63.types @@ -32,7 +32,7 @@ export function strategy(stratName: string, gen: (a: T >stratName : string } yield next; ->yield next : any +>yield next : undefined >next : T } } @@ -97,7 +97,7 @@ export const Nothing3: Strategy = strategy("Nothing", function* (state: S >state : State yield state; ->yield state : any +>yield state : undefined >state : State return 1; diff --git a/tests/baselines/reference/generatorYieldContextualType.symbols b/tests/baselines/reference/generatorYieldContextualType.symbols new file mode 100644 index 0000000000000..80d20b90d752e --- /dev/null +++ b/tests/baselines/reference/generatorYieldContextualType.symbols @@ -0,0 +1,44 @@ +=== tests/cases/conformance/generators/generatorYieldContextualType.ts === +declare function f1(gen: () => Generator): void; +>f1 : Symbol(f1, Decl(generatorYieldContextualType.ts, 0, 0)) +>T : Symbol(T, Decl(generatorYieldContextualType.ts, 0, 20)) +>R : Symbol(R, Decl(generatorYieldContextualType.ts, 0, 22)) +>S : Symbol(S, Decl(generatorYieldContextualType.ts, 0, 25)) +>gen : Symbol(gen, Decl(generatorYieldContextualType.ts, 0, 29)) +>Generator : Symbol(Generator, Decl(lib.es2015.generator.d.ts, --, --)) +>R : Symbol(R, Decl(generatorYieldContextualType.ts, 0, 22)) +>T : Symbol(T, Decl(generatorYieldContextualType.ts, 0, 20)) +>S : Symbol(S, Decl(generatorYieldContextualType.ts, 0, 25)) + +f1<0, 0, 1>(function* () { +>f1 : Symbol(f1, Decl(generatorYieldContextualType.ts, 0, 0)) + + const a = yield 0; +>a : Symbol(a, Decl(generatorYieldContextualType.ts, 2, 6)) + + return 0; +}); + +declare function f2(gen: () => Generator | AsyncGenerator): void; +>f2 : Symbol(f2, Decl(generatorYieldContextualType.ts, 4, 3)) +>T : Symbol(T, Decl(generatorYieldContextualType.ts, 6, 20)) +>R : Symbol(R, Decl(generatorYieldContextualType.ts, 6, 22)) +>S : Symbol(S, Decl(generatorYieldContextualType.ts, 6, 25)) +>gen : Symbol(gen, Decl(generatorYieldContextualType.ts, 6, 29)) +>Generator : Symbol(Generator, Decl(lib.es2015.generator.d.ts, --, --)) +>R : Symbol(R, Decl(generatorYieldContextualType.ts, 6, 22)) +>T : Symbol(T, Decl(generatorYieldContextualType.ts, 6, 20)) +>S : Symbol(S, Decl(generatorYieldContextualType.ts, 6, 25)) +>AsyncGenerator : Symbol(AsyncGenerator, Decl(lib.es2018.asyncgenerator.d.ts, --, --)) +>R : Symbol(R, Decl(generatorYieldContextualType.ts, 6, 22)) +>T : Symbol(T, Decl(generatorYieldContextualType.ts, 6, 20)) +>S : Symbol(S, Decl(generatorYieldContextualType.ts, 6, 25)) + +f2<0, 0, 1>(async function* () { +>f2 : Symbol(f2, Decl(generatorYieldContextualType.ts, 4, 3)) + + const a = yield 0; +>a : Symbol(a, Decl(generatorYieldContextualType.ts, 8, 6)) + + return 0; +}); diff --git a/tests/baselines/reference/generatorYieldContextualType.types b/tests/baselines/reference/generatorYieldContextualType.types new file mode 100644 index 0000000000000..5caccffa93399 --- /dev/null +++ b/tests/baselines/reference/generatorYieldContextualType.types @@ -0,0 +1,38 @@ +=== tests/cases/conformance/generators/generatorYieldContextualType.ts === +declare function f1(gen: () => Generator): void; +>f1 : (gen: () => Generator) => void +>gen : () => Generator + +f1<0, 0, 1>(function* () { +>f1<0, 0, 1>(function* () { const a = yield 0; return 0;}) : void +>f1 : (gen: () => Generator) => void +>function* () { const a = yield 0; return 0;} : () => Generator<0, 0, unknown> + + const a = yield 0; +>a : 1 +>yield 0 : 1 +>0 : 0 + + return 0; +>0 : 0 + +}); + +declare function f2(gen: () => Generator | AsyncGenerator): void; +>f2 : (gen: () => Generator | AsyncGenerator) => void +>gen : () => Generator | AsyncGenerator + +f2<0, 0, 1>(async function* () { +>f2<0, 0, 1>(async function* () { const a = yield 0; return 0;}) : void +>f2 : (gen: () => Generator | AsyncGenerator) => void +>async function* () { const a = yield 0; return 0;} : () => AsyncGenerator<0, 0, unknown> + + const a = yield 0; +>a : 1 +>yield 0 : 1 +>0 : 0 + + return 0; +>0 : 0 + +}); diff --git a/tests/baselines/reference/jsdocParameterParsingInvalidName.js b/tests/baselines/reference/jsdocParameterParsingInvalidName.js new file mode 100644 index 0000000000000..4001ece1aec41 --- /dev/null +++ b/tests/baselines/reference/jsdocParameterParsingInvalidName.js @@ -0,0 +1,20 @@ +//// [jsdocParameterParsingInvalidName.ts] +class c { + /** + * @param {string} [`foo] + */ + method(foo) { + } +} + +//// [jsdocParameterParsingInvalidName.js] +var c = /** @class */ (function () { + function c() { + } + /** + * @param {string} [`foo] + */ + c.prototype.method = function (foo) { + }; + return c; +}()); diff --git a/tests/baselines/reference/jsdocParameterParsingInvalidName.symbols b/tests/baselines/reference/jsdocParameterParsingInvalidName.symbols new file mode 100644 index 0000000000000..037731d247779 --- /dev/null +++ b/tests/baselines/reference/jsdocParameterParsingInvalidName.symbols @@ -0,0 +1,12 @@ +=== tests/cases/compiler/jsdocParameterParsingInvalidName.ts === +class c { +>c : Symbol(c, Decl(jsdocParameterParsingInvalidName.ts, 0, 0)) + + /** + * @param {string} [`foo] + */ + method(foo) { +>method : Symbol(c.method, Decl(jsdocParameterParsingInvalidName.ts, 0, 9)) +>foo : Symbol(foo, Decl(jsdocParameterParsingInvalidName.ts, 4, 11)) + } +} diff --git a/tests/baselines/reference/jsdocParameterParsingInvalidName.types b/tests/baselines/reference/jsdocParameterParsingInvalidName.types new file mode 100644 index 0000000000000..d6ec561cdf22a --- /dev/null +++ b/tests/baselines/reference/jsdocParameterParsingInvalidName.types @@ -0,0 +1,12 @@ +=== tests/cases/compiler/jsdocParameterParsingInvalidName.ts === +class c { +>c : c + + /** + * @param {string} [`foo] + */ + method(foo) { +>method : (foo: any) => void +>foo : any + } +} diff --git a/tests/baselines/reference/quotedConstructors.errors.txt b/tests/baselines/reference/quotedConstructors.errors.txt deleted file mode 100644 index 9e70452ff4062..0000000000000 --- a/tests/baselines/reference/quotedConstructors.errors.txt +++ /dev/null @@ -1,30 +0,0 @@ -tests/cases/conformance/classes/constructorDeclarations/quotedConstructors.ts(2,5): error TS18005: Quoted constructors have previously been interpreted as methods, which is incorrect. In TypeScript 3.6, they will be correctly parsed as constructors. In the meantime, consider using 'constructor()' to write a constructor, or '["constructor"]()' to write a method. -tests/cases/conformance/classes/constructorDeclarations/quotedConstructors.ts(6,5): error TS18005: Quoted constructors have previously been interpreted as methods, which is incorrect. In TypeScript 3.6, they will be correctly parsed as constructors. In the meantime, consider using 'constructor()' to write a constructor, or '["constructor"]()' to write a method. -tests/cases/conformance/classes/constructorDeclarations/quotedConstructors.ts(14,5): error TS18005: Quoted constructors have previously been interpreted as methods, which is incorrect. In TypeScript 3.6, they will be correctly parsed as constructors. In the meantime, consider using 'constructor()' to write a constructor, or '["constructor"]()' to write a method. - - -==== tests/cases/conformance/classes/constructorDeclarations/quotedConstructors.ts (3 errors) ==== - class C { - "constructor"() {} // Error in 3.5 - ~~~~~~~~~~~~~ -!!! error TS18005: Quoted constructors have previously been interpreted as methods, which is incorrect. In TypeScript 3.6, they will be correctly parsed as constructors. In the meantime, consider using 'constructor()' to write a constructor, or '["constructor"]()' to write a method. - } - - class D { - 'constructor'() {} // Error in 3.5 - ~~~~~~~~~~~~~ -!!! error TS18005: Quoted constructors have previously been interpreted as methods, which is incorrect. In TypeScript 3.6, they will be correctly parsed as constructors. In the meantime, consider using 'constructor()' to write a constructor, or '["constructor"]()' to write a method. - } - - class E { - ['constructor']() {} - } - - new class { - "constructor"() {} // Error in 3.5 - ~~~~~~~~~~~~~ -!!! error TS18005: Quoted constructors have previously been interpreted as methods, which is incorrect. In TypeScript 3.6, they will be correctly parsed as constructors. In the meantime, consider using 'constructor()' to write a constructor, or '["constructor"]()' to write a method. - }; - - var o = { "constructor"() {} }; - \ No newline at end of file diff --git a/tests/baselines/reference/quotedConstructors.js b/tests/baselines/reference/quotedConstructors.js index c9a662e6af526..36b57718f0a49 100644 --- a/tests/baselines/reference/quotedConstructors.js +++ b/tests/baselines/reference/quotedConstructors.js @@ -1,46 +1,68 @@ //// [quotedConstructors.ts] class C { - "constructor"() {} // Error in 3.5 + "constructor"() { + console.log(this); + } } class D { - 'constructor'() {} // Error in 3.5 + 'constructor'() { + console.log(this); + } } class E { - ['constructor']() {} + ['constructor']() { + console.log(this); + } } new class { - "constructor"() {} // Error in 3.5 + "constructor"() { + console.log(this); + } }; var o = { "constructor"() {} }; + +class F { + "\x63onstructor"() { + console.log(this); + } +} //// [quotedConstructors.js] var C = /** @class */ (function () { function C() { + console.log(this); } - C.prototype["constructor"] = function () { }; // Error in 3.5 return C; }()); var D = /** @class */ (function () { function D() { + console.log(this); } - D.prototype['constructor'] = function () { }; // Error in 3.5 return D; }()); var E = /** @class */ (function () { function E() { } - E.prototype['constructor'] = function () { }; + E.prototype['constructor'] = function () { + console.log(this); + }; return E; }()); new /** @class */ (function () { function class_1() { + console.log(this); } - class_1.prototype["constructor"] = function () { }; // Error in 3.5 return class_1; }()); var o = { "constructor": function () { } }; +var F = /** @class */ (function () { + function F() { + console.log(this); + } + return F; +}()); diff --git a/tests/baselines/reference/quotedConstructors.symbols b/tests/baselines/reference/quotedConstructors.symbols index be68e48484754..a4476a25ae5e8 100644 --- a/tests/baselines/reference/quotedConstructors.symbols +++ b/tests/baselines/reference/quotedConstructors.symbols @@ -2,32 +2,65 @@ class C { >C : Symbol(C, Decl(quotedConstructors.ts, 0, 0)) - "constructor"() {} // Error in 3.5 ->"constructor" : Symbol(C["constructor"], Decl(quotedConstructors.ts, 0, 9)) + "constructor"() { + console.log(this); +>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>console : Symbol(console, Decl(lib.dom.d.ts, --, --)) +>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>this : Symbol(C, Decl(quotedConstructors.ts, 0, 0)) + } } class D { ->D : Symbol(D, Decl(quotedConstructors.ts, 2, 1)) +>D : Symbol(D, Decl(quotedConstructors.ts, 4, 1)) - 'constructor'() {} // Error in 3.5 ->'constructor' : Symbol(D['constructor'], Decl(quotedConstructors.ts, 4, 9)) + 'constructor'() { + console.log(this); +>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>console : Symbol(console, Decl(lib.dom.d.ts, --, --)) +>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>this : Symbol(D, Decl(quotedConstructors.ts, 4, 1)) + } } class E { ->E : Symbol(E, Decl(quotedConstructors.ts, 6, 1)) +>E : Symbol(E, Decl(quotedConstructors.ts, 10, 1)) - ['constructor']() {} ->['constructor'] : Symbol(E['constructor'], Decl(quotedConstructors.ts, 8, 9)) ->'constructor' : Symbol(E['constructor'], Decl(quotedConstructors.ts, 8, 9)) + ['constructor']() { +>['constructor'] : Symbol(E['constructor'], Decl(quotedConstructors.ts, 12, 9)) +>'constructor' : Symbol(E['constructor'], Decl(quotedConstructors.ts, 12, 9)) + + console.log(this); +>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>console : Symbol(console, Decl(lib.dom.d.ts, --, --)) +>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>this : Symbol(E, Decl(quotedConstructors.ts, 10, 1)) + } } new class { - "constructor"() {} // Error in 3.5 ->"constructor" : Symbol((Anonymous class)["constructor"], Decl(quotedConstructors.ts, 12, 11)) - + "constructor"() { + console.log(this); +>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>console : Symbol(console, Decl(lib.dom.d.ts, --, --)) +>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>this : Symbol((Anonymous class), Decl(quotedConstructors.ts, 18, 3)) + } }; var o = { "constructor"() {} }; ->o : Symbol(o, Decl(quotedConstructors.ts, 16, 3)) ->"constructor" : Symbol("constructor", Decl(quotedConstructors.ts, 16, 9)) +>o : Symbol(o, Decl(quotedConstructors.ts, 24, 3)) +>"constructor" : Symbol("constructor", Decl(quotedConstructors.ts, 24, 9)) + +class F { +>F : Symbol(F, Decl(quotedConstructors.ts, 24, 31)) + + "\x63onstructor"() { + console.log(this); +>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>console : Symbol(console, Decl(lib.dom.d.ts, --, --)) +>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>this : Symbol(F, Decl(quotedConstructors.ts, 24, 31)) + } +} diff --git a/tests/baselines/reference/quotedConstructors.types b/tests/baselines/reference/quotedConstructors.types index 907a2152a80ac..65be89ff815a9 100644 --- a/tests/baselines/reference/quotedConstructors.types +++ b/tests/baselines/reference/quotedConstructors.types @@ -2,32 +2,57 @@ class C { >C : C - "constructor"() {} // Error in 3.5 ->"constructor" : () => void + "constructor"() { + console.log(this); +>console.log(this) : void +>console.log : (message?: any, ...optionalParams: any[]) => void +>console : Console +>log : (message?: any, ...optionalParams: any[]) => void +>this : this + } } class D { >D : D - 'constructor'() {} // Error in 3.5 ->'constructor' : () => void + 'constructor'() { + console.log(this); +>console.log(this) : void +>console.log : (message?: any, ...optionalParams: any[]) => void +>console : Console +>log : (message?: any, ...optionalParams: any[]) => void +>this : this + } } class E { >E : E - ['constructor']() {} + ['constructor']() { >['constructor'] : () => void >'constructor' : "constructor" + + console.log(this); +>console.log(this) : void +>console.log : (message?: any, ...optionalParams: any[]) => void +>console : Console +>log : (message?: any, ...optionalParams: any[]) => void +>this : this + } } new class { ->new class { "constructor"() {} // Error in 3.5} : (Anonymous class) ->class { "constructor"() {} // Error in 3.5} : typeof (Anonymous class) - - "constructor"() {} // Error in 3.5 ->"constructor" : () => void +>new class { "constructor"() { console.log(this); }} : (Anonymous class) +>class { "constructor"() { console.log(this); }} : typeof (Anonymous class) + "constructor"() { + console.log(this); +>console.log(this) : void +>console.log : (message?: any, ...optionalParams: any[]) => void +>console : Console +>log : (message?: any, ...optionalParams: any[]) => void +>this : this + } }; var o = { "constructor"() {} }; @@ -35,3 +60,16 @@ var o = { "constructor"() {} }; >{ "constructor"() {} } : { "constructor"(): void; } >"constructor" : () => void +class F { +>F : F + + "\x63onstructor"() { + console.log(this); +>console.log(this) : void +>console.log : (message?: any, ...optionalParams: any[]) => void +>console : Console +>log : (message?: any, ...optionalParams: any[]) => void +>this : this + } +} + diff --git a/tests/baselines/reference/spreadOfParamsFromGeneratorMakesRequiredParams.errors.txt b/tests/baselines/reference/spreadOfParamsFromGeneratorMakesRequiredParams.errors.txt index 1b1f93ffc3f5f..393e21edb6c53 100644 --- a/tests/baselines/reference/spreadOfParamsFromGeneratorMakesRequiredParams.errors.txt +++ b/tests/baselines/reference/spreadOfParamsFromGeneratorMakesRequiredParams.errors.txt @@ -1,8 +1,8 @@ -error TS2318: Cannot find global type 'Generator'. +error TS2318: Cannot find global type 'IterableIterator'. tests/cases/compiler/spreadOfParamsFromGeneratorMakesRequiredParams.ts(6,1): error TS2554: Expected 2 arguments, but got 1. -!!! error TS2318: Cannot find global type 'Generator'. +!!! error TS2318: Cannot find global type 'IterableIterator'. ==== tests/cases/compiler/spreadOfParamsFromGeneratorMakesRequiredParams.ts (1 errors) ==== declare function call any>( fn: Fn, diff --git a/tests/baselines/reference/templateStringWithEmbeddedYieldKeyword.errors.txt b/tests/baselines/reference/templateStringWithEmbeddedYieldKeyword.errors.txt index a96993063732a..ce0d781d8246c 100644 --- a/tests/baselines/reference/templateStringWithEmbeddedYieldKeyword.errors.txt +++ b/tests/baselines/reference/templateStringWithEmbeddedYieldKeyword.errors.txt @@ -1,8 +1,8 @@ -error TS2318: Cannot find global type 'Generator'. +error TS2318: Cannot find global type 'IterableIterator'. tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeyword.ts(1,15): error TS1005: '(' expected. -!!! error TS2318: Cannot find global type 'Generator'. +!!! error TS2318: Cannot find global type 'IterableIterator'. ==== tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeyword.ts (1 errors) ==== function* gen { ~ diff --git a/tests/baselines/reference/tsbuild/sample1/initial-Build/when-target-option-changes.js b/tests/baselines/reference/tsbuild/sample1/initial-Build/when-target-option-changes.js index 895ac5e4bc5b1..c31d39c06474b 100644 --- a/tests/baselines/reference/tsbuild/sample1/initial-Build/when-target-option-changes.js +++ b/tests/baselines/reference/tsbuild/sample1/initial-Build/when-target-option-changes.js @@ -70,7 +70,7 @@ export function multiply(a, b) { return a * b; } "incremental": true, "listFiles": true, "listEmittedFiles": true, - "target": 8, + "target": 99, "configFilePath": "./tsconfig.json" }, "referencedMap": {}, diff --git a/tests/baselines/reference/typeInferenceCacheInvalidation.js b/tests/baselines/reference/typeInferenceCacheInvalidation.js new file mode 100644 index 0000000000000..bda29ad8b70b9 --- /dev/null +++ b/tests/baselines/reference/typeInferenceCacheInvalidation.js @@ -0,0 +1,37 @@ +//// [typeInferenceCacheInvalidation.ts] +// Repro from #32230 + +type Callback = (foo: TFoo, bar: TBar) => any + +declare function example>( + foo: TFoo, + callback: TCallback, + bar: TBar, +): TCallback + +example(42, (foo, bar) => ({ + t: () => { + let s: string = bar; + } +}), '42'); + +example(42, (foo, bar) => ({ + t() { + let s: string = bar; + } +}), '42'); + + +//// [typeInferenceCacheInvalidation.js] +"use strict"; +// Repro from #32230 +example(42, function (foo, bar) { return ({ + t: function () { + var s = bar; + } +}); }, '42'); +example(42, function (foo, bar) { return ({ + t: function () { + var s = bar; + } +}); }, '42'); diff --git a/tests/baselines/reference/typeInferenceCacheInvalidation.symbols b/tests/baselines/reference/typeInferenceCacheInvalidation.symbols new file mode 100644 index 0000000000000..e9e1949dc9132 --- /dev/null +++ b/tests/baselines/reference/typeInferenceCacheInvalidation.symbols @@ -0,0 +1,64 @@ +=== tests/cases/compiler/typeInferenceCacheInvalidation.ts === +// Repro from #32230 + +type Callback = (foo: TFoo, bar: TBar) => any +>Callback : Symbol(Callback, Decl(typeInferenceCacheInvalidation.ts, 0, 0)) +>TFoo : Symbol(TFoo, Decl(typeInferenceCacheInvalidation.ts, 2, 14)) +>TBar : Symbol(TBar, Decl(typeInferenceCacheInvalidation.ts, 2, 19)) +>foo : Symbol(foo, Decl(typeInferenceCacheInvalidation.ts, 2, 29)) +>TFoo : Symbol(TFoo, Decl(typeInferenceCacheInvalidation.ts, 2, 14)) +>bar : Symbol(bar, Decl(typeInferenceCacheInvalidation.ts, 2, 39)) +>TBar : Symbol(TBar, Decl(typeInferenceCacheInvalidation.ts, 2, 19)) + +declare function example>( +>example : Symbol(example, Decl(typeInferenceCacheInvalidation.ts, 2, 57)) +>TFoo : Symbol(TFoo, Decl(typeInferenceCacheInvalidation.ts, 4, 25)) +>TBar : Symbol(TBar, Decl(typeInferenceCacheInvalidation.ts, 4, 30)) +>TCallback : Symbol(TCallback, Decl(typeInferenceCacheInvalidation.ts, 4, 36)) +>Callback : Symbol(Callback, Decl(typeInferenceCacheInvalidation.ts, 0, 0)) +>TFoo : Symbol(TFoo, Decl(typeInferenceCacheInvalidation.ts, 4, 25)) +>TBar : Symbol(TBar, Decl(typeInferenceCacheInvalidation.ts, 4, 30)) + + foo: TFoo, +>foo : Symbol(foo, Decl(typeInferenceCacheInvalidation.ts, 4, 77)) +>TFoo : Symbol(TFoo, Decl(typeInferenceCacheInvalidation.ts, 4, 25)) + + callback: TCallback, +>callback : Symbol(callback, Decl(typeInferenceCacheInvalidation.ts, 5, 14)) +>TCallback : Symbol(TCallback, Decl(typeInferenceCacheInvalidation.ts, 4, 36)) + + bar: TBar, +>bar : Symbol(bar, Decl(typeInferenceCacheInvalidation.ts, 6, 24)) +>TBar : Symbol(TBar, Decl(typeInferenceCacheInvalidation.ts, 4, 30)) + +): TCallback +>TCallback : Symbol(TCallback, Decl(typeInferenceCacheInvalidation.ts, 4, 36)) + +example(42, (foo, bar) => ({ +>example : Symbol(example, Decl(typeInferenceCacheInvalidation.ts, 2, 57)) +>foo : Symbol(foo, Decl(typeInferenceCacheInvalidation.ts, 10, 13)) +>bar : Symbol(bar, Decl(typeInferenceCacheInvalidation.ts, 10, 17)) + + t: () => { +>t : Symbol(t, Decl(typeInferenceCacheInvalidation.ts, 10, 28)) + + let s: string = bar; +>s : Symbol(s, Decl(typeInferenceCacheInvalidation.ts, 12, 11)) +>bar : Symbol(bar, Decl(typeInferenceCacheInvalidation.ts, 10, 17)) + } +}), '42'); + +example(42, (foo, bar) => ({ +>example : Symbol(example, Decl(typeInferenceCacheInvalidation.ts, 2, 57)) +>foo : Symbol(foo, Decl(typeInferenceCacheInvalidation.ts, 16, 13)) +>bar : Symbol(bar, Decl(typeInferenceCacheInvalidation.ts, 16, 17)) + + t() { +>t : Symbol(t, Decl(typeInferenceCacheInvalidation.ts, 16, 28)) + + let s: string = bar; +>s : Symbol(s, Decl(typeInferenceCacheInvalidation.ts, 18, 11)) +>bar : Symbol(bar, Decl(typeInferenceCacheInvalidation.ts, 16, 17)) + } +}), '42'); + diff --git a/tests/baselines/reference/typeInferenceCacheInvalidation.types b/tests/baselines/reference/typeInferenceCacheInvalidation.types new file mode 100644 index 0000000000000..35911fafb392b --- /dev/null +++ b/tests/baselines/reference/typeInferenceCacheInvalidation.types @@ -0,0 +1,63 @@ +=== tests/cases/compiler/typeInferenceCacheInvalidation.ts === +// Repro from #32230 + +type Callback = (foo: TFoo, bar: TBar) => any +>Callback : Callback +>foo : TFoo +>bar : TBar + +declare function example>( +>example : >(foo: TFoo, callback: TCallback, bar: TBar) => TCallback + + foo: TFoo, +>foo : TFoo + + callback: TCallback, +>callback : TCallback + + bar: TBar, +>bar : TBar + +): TCallback + +example(42, (foo, bar) => ({ +>example(42, (foo, bar) => ({ t: () => { let s: string = bar; }}), '42') : (foo: number, bar: string) => { t: () => void; } +>example : >(foo: TFoo, callback: TCallback, bar: TBar) => TCallback +>42 : 42 +>(foo, bar) => ({ t: () => { let s: string = bar; }}) : (foo: number, bar: string) => { t: () => void; } +>foo : number +>bar : string +>({ t: () => { let s: string = bar; }}) : { t: () => void; } +>{ t: () => { let s: string = bar; }} : { t: () => void; } + + t: () => { +>t : () => void +>() => { let s: string = bar; } : () => void + + let s: string = bar; +>s : string +>bar : string + } +}), '42'); +>'42' : "42" + +example(42, (foo, bar) => ({ +>example(42, (foo, bar) => ({ t() { let s: string = bar; }}), '42') : (foo: number, bar: string) => { t(): void; } +>example : >(foo: TFoo, callback: TCallback, bar: TBar) => TCallback +>42 : 42 +>(foo, bar) => ({ t() { let s: string = bar; }}) : (foo: number, bar: string) => { t(): void; } +>foo : number +>bar : string +>({ t() { let s: string = bar; }}) : { t(): void; } +>{ t() { let s: string = bar; }} : { t(): void; } + + t() { +>t : () => void + + let s: string = bar; +>s : string +>bar : string + } +}), '42'); +>'42' : "42" + diff --git a/tests/baselines/reference/types.asyncGenerators.es2018.1.types b/tests/baselines/reference/types.asyncGenerators.es2018.1.types index ad35f2a796f5c..24da9312c1537 100644 --- a/tests/baselines/reference/types.asyncGenerators.es2018.1.types +++ b/tests/baselines/reference/types.asyncGenerators.es2018.1.types @@ -78,7 +78,7 @@ const assignability1: () => AsyncIterableIterator = async function * () >async function * () { yield 1;} : () => AsyncGenerator yield 1; ->yield 1 : any +>yield 1 : undefined >1 : 1 }; @@ -87,7 +87,7 @@ const assignability2: () => AsyncIterableIterator = async function * () >async function * () { yield Promise.resolve(1);} : () => AsyncGenerator yield Promise.resolve(1); ->yield Promise.resolve(1) : any +>yield Promise.resolve(1) : undefined >Promise.resolve(1) : Promise >Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } >Promise : PromiseConstructor @@ -138,7 +138,7 @@ const assignability6: () => AsyncIterable = async function * () { >async function * () { yield 1;} : () => AsyncGenerator yield 1; ->yield 1 : any +>yield 1 : undefined >1 : 1 }; @@ -147,7 +147,7 @@ const assignability7: () => AsyncIterable = async function * () { >async function * () { yield Promise.resolve(1);} : () => AsyncGenerator yield Promise.resolve(1); ->yield Promise.resolve(1) : any +>yield Promise.resolve(1) : undefined >Promise.resolve(1) : Promise >Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } >Promise : PromiseConstructor @@ -198,7 +198,7 @@ const assignability11: () => AsyncIterator = async function * () { >async function * () { yield 1;} : () => AsyncGenerator yield 1; ->yield 1 : any +>yield 1 : undefined >1 : 1 }; @@ -207,7 +207,7 @@ const assignability12: () => AsyncIterator = async function * () { >async function * () { yield Promise.resolve(1);} : () => AsyncGenerator yield Promise.resolve(1); ->yield Promise.resolve(1) : any +>yield Promise.resolve(1) : undefined >Promise.resolve(1) : Promise >Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } >Promise : PromiseConstructor diff --git a/tests/baselines/reference/types.asyncGenerators.es2018.2.types b/tests/baselines/reference/types.asyncGenerators.es2018.2.types index 23bf7225eb938..022ddd297a24f 100644 --- a/tests/baselines/reference/types.asyncGenerators.es2018.2.types +++ b/tests/baselines/reference/types.asyncGenerators.es2018.2.types @@ -32,7 +32,7 @@ const assignability1: () => AsyncIterableIterator = async function * () >async function * () { yield "a";} : () => AsyncGenerator yield "a"; ->yield "a" : any +>yield "a" : undefined >"a" : "a" }; @@ -65,7 +65,7 @@ const assignability4: () => AsyncIterable = async function * () { >async function * () { yield "a";} : () => AsyncGenerator yield "a"; ->yield "a" : any +>yield "a" : undefined >"a" : "a" }; @@ -98,7 +98,7 @@ const assignability7: () => AsyncIterator = async function * () { >async function * () { yield "a";} : () => AsyncGenerator yield "a"; ->yield "a" : any +>yield "a" : undefined >"a" : "a" }; diff --git a/tests/baselines/reference/types.forAwait.es2018.3.errors.txt b/tests/baselines/reference/types.forAwait.es2018.3.errors.txt index 1aca869fb0c68..296ac0d066bc1 100644 --- a/tests/baselines/reference/types.forAwait.es2018.3.errors.txt +++ b/tests/baselines/reference/types.forAwait.es2018.3.errors.txt @@ -1,11 +1,11 @@ -error TS2318: Cannot find global type 'AsyncGenerator'. +error TS2318: Cannot find global type 'AsyncIterableIterator'. tests/cases/conformance/types/forAwait/types.forAwait.es2018.3.ts(3,27): error TS2504: Type '{}' must have a '[Symbol.asyncIterator]()' method that returns an async iterator. tests/cases/conformance/types/forAwait/types.forAwait.es2018.3.ts(5,21): error TS2504: Type '{}' must have a '[Symbol.asyncIterator]()' method that returns an async iterator. tests/cases/conformance/types/forAwait/types.forAwait.es2018.3.ts(10,27): error TS2504: Type '{}' must have a '[Symbol.asyncIterator]()' method that returns an async iterator. tests/cases/conformance/types/forAwait/types.forAwait.es2018.3.ts(12,21): error TS2504: Type '{}' must have a '[Symbol.asyncIterator]()' method that returns an async iterator. -!!! error TS2318: Cannot find global type 'AsyncGenerator'. +!!! error TS2318: Cannot find global type 'AsyncIterableIterator'. ==== tests/cases/conformance/types/forAwait/types.forAwait.es2018.3.ts (4 errors) ==== async function f1() { let y: number; diff --git a/tests/baselines/reference/uniqueSymbols.types b/tests/baselines/reference/uniqueSymbols.types index da2f989521805..02ededf7b1f99 100644 --- a/tests/baselines/reference/uniqueSymbols.types +++ b/tests/baselines/reference/uniqueSymbols.types @@ -839,7 +839,7 @@ const o3: Context = { >method3 : () => AsyncGenerator yield s; // yield type should not widen due to contextual type ->yield s : any +>yield s : undefined >s : unique symbol }, @@ -847,7 +847,7 @@ const o3: Context = { >method4 : () => Generator yield s; // yield type should not widen due to contextual type ->yield s : any +>yield s : undefined >s : unique symbol }, diff --git a/tests/baselines/reference/uniqueSymbolsDeclarations.types b/tests/baselines/reference/uniqueSymbolsDeclarations.types index b8c32385f4bc0..db198153153f9 100644 --- a/tests/baselines/reference/uniqueSymbolsDeclarations.types +++ b/tests/baselines/reference/uniqueSymbolsDeclarations.types @@ -832,7 +832,7 @@ const o4: Context = { >method3 : () => AsyncGenerator yield s; // yield type should not widen due to contextual type ->yield s : any +>yield s : undefined >s : unique symbol }, @@ -840,7 +840,7 @@ const o4: Context = { >method4 : () => Generator yield s; // yield type should not widen due to contextual type ->yield s : any +>yield s : undefined >s : unique symbol }, diff --git a/tests/baselines/reference/user/adonis-framework.log b/tests/baselines/reference/user/adonis-framework.log index e3b19b5de04f0..6243a7a15dba3 100644 --- a/tests/baselines/reference/user/adonis-framework.log +++ b/tests/baselines/reference/user/adonis-framework.log @@ -30,7 +30,7 @@ node_modules/adonis-framework/src/Encryption/index.js(87,15): error TS2304: Cann node_modules/adonis-framework/src/Encryption/index.js(101,21): error TS2769: No overload matches this call. Overload 1 of 4, '(data: Binary, input_encoding: undefined, output_encoding: Utf8AsciiBinaryEncoding): string', gave the following error. Argument of type '"base64"' is not assignable to parameter of type 'undefined'. - Overload 2 of 4, '(data: string, input_encoding: "binary" | "base64" | "hex" | undefined, output_encoding: Utf8AsciiBinaryEncoding): string', gave the following error. + Overload 2 of 4, '(data: string, input_encoding: "base64" | "binary" | "hex" | undefined, output_encoding: Utf8AsciiBinaryEncoding): string', gave the following error. Argument of type 'string' is not assignable to parameter of type 'Utf8AsciiBinaryEncoding'. node_modules/adonis-framework/src/Encryption/index.js(114,15): error TS2304: Cannot find name 'Mixed'. node_modules/adonis-framework/src/Encryption/index.js(119,23): error TS2554: Expected 2 arguments, but got 1. diff --git a/tests/baselines/reference/user/chrome-devtools-frontend.log b/tests/baselines/reference/user/chrome-devtools-frontend.log index 87a3cd23c38b6..2d4e456d7593a 100644 --- a/tests/baselines/reference/user/chrome-devtools-frontend.log +++ b/tests/baselines/reference/user/chrome-devtools-frontend.log @@ -3178,8 +3178,6 @@ node_modules/chrome-devtools-frontend/front_end/bindings/DebuggerWorkspaceBindin node_modules/chrome-devtools-frontend/front_end/bindings/DebuggerWorkspaceBinding.js(51,31): error TS2339: Property 'remove' does not exist on type 'Map'. node_modules/chrome-devtools-frontend/front_end/bindings/DebuggerWorkspaceBinding.js(65,14): error TS7014: Function type, which lacks return-type annotation, implicitly has an 'any' return type. node_modules/chrome-devtools-frontend/front_end/bindings/DebuggerWorkspaceBinding.js(76,14): error TS7014: Function type, which lacks return-type annotation, implicitly has an 'any' return type. -node_modules/chrome-devtools-frontend/front_end/bindings/DebuggerWorkspaceBinding.js(85,5): error TS2322: Type 'StackTraceTopFrameLocation' is not assignable to type '{ update(): void; uiLocation(): UILocation; dispose(): void; isBlackboxed(): boolean; }'. - Property '_updateScheduled' does not exist on type '{ update(): void; uiLocation(): UILocation; dispose(): void; isBlackboxed(): boolean; }'. node_modules/chrome-devtools-frontend/front_end/bindings/DebuggerWorkspaceBinding.js(90,14): error TS7014: Function type, which lacks return-type annotation, implicitly has an 'any' return type. node_modules/chrome-devtools-frontend/front_end/bindings/DebuggerWorkspaceBinding.js(195,22): error TS2694: Namespace 'Common' has no exported member 'Event'. node_modules/chrome-devtools-frontend/front_end/bindings/DebuggerWorkspaceBinding.js(207,34): error TS2339: Property 'valuesArray' does not exist on type 'Set'. @@ -3287,12 +3285,6 @@ node_modules/chrome-devtools-frontend/front_end/bindings_test_runner/IsolatedFil node_modules/chrome-devtools-frontend/front_end/bindings_test_runner/IsolatedFilesystemTestRunner.js(275,8): error TS2551: Property '_entry' does not exist on type 'typeof TestFileSystem'. Did you mean 'Entry'? node_modules/chrome-devtools-frontend/front_end/bindings_test_runner/IsolatedFilesystemTestRunner.js(276,8): error TS2339: Property '_modificationTimesDelta' does not exist on type 'typeof TestFileSystem'. node_modules/chrome-devtools-frontend/front_end/bindings_test_runner/OverridesTestRunner.js(7,13): error TS1064: The return type of an async function or method must be the global Promise type. -node_modules/chrome-devtools-frontend/front_end/bindings_test_runner/PersistenceTestRunner.js(45,46): error TS2345: Argument of type '(bindingCreated: (arg0: PersistenceBinding) => any, bindingRemoved: (arg0: PersistenceBinding) => any) => DefaultMapping' is not assignable to parameter of type '(arg0: (arg0: PersistenceBinding) => any, arg1: (arg0: PersistenceBinding) => any) => { dispose: () => void; }'. - Type 'DefaultMapping' is not assignable to type '{ dispose: () => void; }'. - Property '_workspace' does not exist on type '{ dispose: () => void; }'. -node_modules/chrome-devtools-frontend/front_end/bindings_test_runner/PersistenceTestRunner.js(54,46): error TS2345: Argument of type '(bindingCreated: (arg0: PersistenceBinding) => any, bindingRemoved: (arg0: PersistenceBinding) => any) => TestMapping' is not assignable to parameter of type '(arg0: (arg0: PersistenceBinding) => any, arg1: (arg0: PersistenceBinding) => any) => { dispose: () => void; }'. - Type 'TestMapping' is not assignable to type '{ dispose: () => void; }'. - Property '_onBindingAdded' does not exist on type '{ dispose: () => void; }'. node_modules/chrome-devtools-frontend/front_end/changes/ChangesHighlighter.js(7,51): error TS2694: Namespace 'Changes.ChangesView' has no exported member 'Row'. node_modules/chrome-devtools-frontend/front_end/changes/ChangesHighlighter.js(9,56): error TS2694: Namespace 'Changes.ChangesHighlighter' has no exported member 'DiffState'. node_modules/chrome-devtools-frontend/front_end/changes/ChangesHighlighter.js(10,75): error TS2694: Namespace 'Changes.ChangesHighlighter' has no exported member 'DiffState'. @@ -4029,8 +4021,6 @@ node_modules/chrome-devtools-frontend/front_end/console/ConsoleView.js(232,15): node_modules/chrome-devtools-frontend/front_end/console/ConsoleView.js(232,51): error TS2339: Property 'ConsoleView' does not exist on type '{ new (): Console; prototype: Console; }'. node_modules/chrome-devtools-frontend/front_end/console/ConsoleView.js(233,20): error TS2339: Property 'ConsoleView' does not exist on type '{ new (): Console; prototype: Console; }'. node_modules/chrome-devtools-frontend/front_end/console/ConsoleView.js(241,76): error TS2339: Property 'ConsoleFilter' does not exist on type '{ new (): Console; prototype: Console; }'. -node_modules/chrome-devtools-frontend/front_end/console/ConsoleView.js(287,5): error TS2322: Type 'ConsoleViewMessage' is not assignable to type '{ willHide(): void; wasShown(): void; element(): Element; }'. - Property '_message' does not exist on type '{ willHide(): void; wasShown(): void; element(): Element; }'. node_modules/chrome-devtools-frontend/front_end/console/ConsoleView.js(312,24): error TS2694: Namespace 'Common' has no exported member 'Event'. node_modules/chrome-devtools-frontend/front_end/console/ConsoleView.js(411,7): error TS2322: Type 'Promise' is not assignable to type 'Promise'. node_modules/chrome-devtools-frontend/front_end/console/ConsoleView.js(419,5): error TS2322: Type 'Promise' is not assignable to type 'Promise'. @@ -4460,8 +4450,6 @@ node_modules/chrome-devtools-frontend/front_end/coverage/CoverageListView.js(285 node_modules/chrome-devtools-frontend/front_end/coverage/CoverageListView.js(286,45): error TS2339: Property 'withThousandsSeparator' does not exist on type 'NumberConstructor'. node_modules/chrome-devtools-frontend/front_end/coverage/CoverageListView.js(290,33): error TS2339: Property 'createChild' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/coverage/CoverageModel.js(34,42): error TS2694: Namespace 'Protocol' has no exported member 'Profiler'. -node_modules/chrome-devtools-frontend/front_end/coverage/CoverageModel.js(103,46): error TS2345: Argument of type 'CSSStyleSheetHeader' is not assignable to parameter of type '{ contentURL(): string; contentType(): ResourceType; contentEncoded(): Promise; requestContent(): Promise; searchInContent(query: string, caseSensitive: boolean, isRegex: boolean): Promise<...>; }'. - Property '_cssModel' does not exist on type '{ contentURL(): string; contentType(): ResourceType; contentEncoded(): Promise; requestContent(): Promise; searchInContent(query: string, caseSensitive: boolean, isRegex: boolean): Promise<...>; }'. node_modules/chrome-devtools-frontend/front_end/coverage/CoverageModel.js(131,31): error TS2694: Namespace 'Protocol' has no exported member 'Profiler'. node_modules/chrome-devtools-frontend/front_end/coverage/CoverageModel.js(170,31): error TS2694: Namespace 'Protocol' has no exported member 'CSS'. node_modules/chrome-devtools-frontend/front_end/coverage/CoverageModel.js(175,64): error TS2694: Namespace 'Coverage' has no exported member 'RangeUseCount'. @@ -5850,8 +5838,6 @@ node_modules/chrome-devtools-frontend/front_end/emulation/AdvancedApp.js(124,22) node_modules/chrome-devtools-frontend/front_end/emulation/AdvancedApp.js(142,44): error TS2339: Property 'style' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/emulation/AdvancedApp.js(169,22): error TS2694: Namespace 'Common' has no exported member 'Event'. node_modules/chrome-devtools-frontend/front_end/emulation/AdvancedApp.js(174,57): error TS2339: Property 'window' does not exist on type 'Element'. -node_modules/chrome-devtools-frontend/front_end/emulation/AdvancedApp.js(199,5): error TS2322: Type 'AdvancedApp' is not assignable to type '{ presentUI(document: Document): void; }'. - Property '_rootSplitWidget' does not exist on type '{ presentUI(document: Document): void; }'. node_modules/chrome-devtools-frontend/front_end/emulation/DeviceModeModel.js(9,1): error TS8022: JSDoc '@extends' is not attached to a class. node_modules/chrome-devtools-frontend/front_end/emulation/DeviceModeModel.js(56,42): error TS2694: Namespace 'Emulation.EmulatedDevice' has no exported member 'Mode'. node_modules/chrome-devtools-frontend/front_end/emulation/DeviceModeModel.js(65,17): error TS7014: Function type, which lacks return-type annotation, implicitly has an 'any' return type. @@ -6515,7 +6501,8 @@ node_modules/chrome-devtools-frontend/front_end/formatter_worker/acorn/acorn_loo node_modules/chrome-devtools-frontend/front_end/formatter_worker/acorn/acorn_loose.js(258,55): error TS2339: Property 'end' does not exist on type 'true'. node_modules/chrome-devtools-frontend/front_end/formatter_worker/acorn/acorn_loose.js(1365,5): error TS2339: Property 'next' does not exist on type 'LooseParser'. node_modules/chrome-devtools-frontend/front_end/formatter_worker/acorn/acorn_loose.js(1366,12): error TS2339: Property 'parseTopLevel' does not exist on type 'LooseParser'. -node_modules/chrome-devtools-frontend/front_end/har_importer/HARImporter.js(26,11): error TS2403: Subsequent variable declarations must have the same type. Variable 'page' must be of type 'any', but here has type 'HARPage'. +node_modules/chrome-devtools-frontend/front_end/har_importer/HARImporter.js(16,32): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type. +node_modules/chrome-devtools-frontend/front_end/har_importer/HARImporter.js(16,52): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type. node_modules/chrome-devtools-frontend/front_end/har_importer/HARImporter.js(46,5): error TS2322: Type 'Date' is not assignable to type 'number'. node_modules/chrome-devtools-frontend/front_end/heap_profiler_test_runner/HeapProfilerTestRunner.js(320,70): error TS2339: Property 'heap_profiler' does not exist on type 'any[]'. node_modules/chrome-devtools-frontend/front_end/heap_profiler_test_runner/HeapProfilerTestRunner.js(321,35): error TS2339: Property 'heap_profiler' does not exist on type 'any[]'. @@ -6584,36 +6571,15 @@ node_modules/chrome-devtools-frontend/front_end/heap_snapshot_worker/HeapSnapsho node_modules/chrome-devtools-frontend/front_end/heap_snapshot_worker/HeapSnapshot.js(1974,10): error TS2339: Property 'countDelta' does not exist on type 'Diff'. node_modules/chrome-devtools-frontend/front_end/heap_snapshot_worker/HeapSnapshot.js(1975,10): error TS2339: Property 'sizeDelta' does not exist on type 'Diff'. node_modules/chrome-devtools-frontend/front_end/heap_snapshot_worker/HeapSnapshot.js(2021,80): error TS2339: Property 'edges' does not exist on type 'void'. -node_modules/chrome-devtools-frontend/front_end/heap_snapshot_worker/HeapSnapshot.js(2021,89): error TS2345: Argument of type 'HeapSnapshotEdgeIndexProvider' is not assignable to parameter of type '{ itemForIndex(newIndex: number): { itemIndex(): number; serialize(): any; }; }'. - Types of property 'itemForIndex' are incompatible. - Type '(index: number) => HeapSnapshotEdge' is not assignable to type '(newIndex: number) => { itemIndex(): number; serialize(): any; }'. - Type 'HeapSnapshotEdge' is not assignable to type '{ itemIndex(): number; serialize(): any; }'. - Property '_snapshot' does not exist on type '{ itemIndex(): number; serialize(): any; }'. node_modules/chrome-devtools-frontend/front_end/heap_snapshot_worker/HeapSnapshot.js(2032,80): error TS2339: Property 'edges' does not exist on type 'void'. -node_modules/chrome-devtools-frontend/front_end/heap_snapshot_worker/HeapSnapshot.js(2032,89): error TS2345: Argument of type 'HeapSnapshotEdgeIndexProvider' is not assignable to parameter of type '{ itemForIndex(newIndex: number): { itemIndex(): number; serialize(): any; }; }'. node_modules/chrome-devtools-frontend/front_end/heap_snapshot_worker/HeapSnapshot.js(2057,80): error TS2339: Property 'retainers' does not exist on type 'void'. -node_modules/chrome-devtools-frontend/front_end/heap_snapshot_worker/HeapSnapshot.js(2057,93): error TS2345: Argument of type 'HeapSnapshotRetainerEdgeIndexProvider' is not assignable to parameter of type '{ itemForIndex(newIndex: number): { itemIndex(): number; serialize(): any; }; }'. - Types of property 'itemForIndex' are incompatible. - Type '(index: number) => HeapSnapshotRetainerEdge' is not assignable to type '(newIndex: number) => { itemIndex(): number; serialize(): any; }'. - Type 'HeapSnapshotRetainerEdge' is not assignable to type '{ itemIndex(): number; serialize(): any; }'. - Property '_snapshot' does not exist on type '{ itemIndex(): number; serialize(): any; }'. node_modules/chrome-devtools-frontend/front_end/heap_snapshot_worker/HeapSnapshot.js(2126,33): error TS2339: Property 'AggregatedInfo' does not exist on type 'typeof HeapSnapshot'. node_modules/chrome-devtools-frontend/front_end/heap_snapshot_worker/HeapSnapshot.js(2205,12): error TS2339: Property 'sort' does not exist on type 'HeapSnapshotItemProvider'. -node_modules/chrome-devtools-frontend/front_end/heap_snapshot_worker/HeapSnapshot.js(2244,13): error TS2345: Argument of type 'HeapSnapshotEdgeIterator' is not assignable to parameter of type '{ hasNext(): boolean; item(): { itemIndex(): number; serialize(): any; }; next(): void; }'. - Types of property 'item' are incompatible. - Type '() => HeapSnapshotEdge' is not assignable to type '() => { itemIndex(): number; serialize(): any; }'. - Type 'HeapSnapshotEdge' is not assignable to type '{ itemIndex(): number; serialize(): any; }'. node_modules/chrome-devtools-frontend/front_end/heap_snapshot_worker/HeapSnapshot.js(2283,13): error TS2339: Property 'nodeIndex' does not exist on type 'void'. node_modules/chrome-devtools-frontend/front_end/heap_snapshot_worker/HeapSnapshot.js(2287,13): error TS2339: Property 'nodeIndex' does not exist on type 'void'. node_modules/chrome-devtools-frontend/front_end/heap_snapshot_worker/HeapSnapshot.js(2322,28): error TS2339: Property 'sortRange' does not exist on type 'number[]'. node_modules/chrome-devtools-frontend/front_end/heap_snapshot_worker/HeapSnapshot.js(2324,28): error TS2339: Property 'sortRange' does not exist on type 'number[]'. node_modules/chrome-devtools-frontend/front_end/heap_snapshot_worker/HeapSnapshot.js(2326,28): error TS2339: Property 'sortRange' does not exist on type 'number[]'. -node_modules/chrome-devtools-frontend/front_end/heap_snapshot_worker/HeapSnapshot.js(2340,68): error TS2345: Argument of type 'HeapSnapshotNodeIndexProvider' is not assignable to parameter of type '{ itemForIndex(newIndex: number): { itemIndex(): number; serialize(): any; }; }'. - Types of property 'itemForIndex' are incompatible. - Type '(index: number) => HeapSnapshotNode' is not assignable to type '(newIndex: number) => { itemIndex(): number; serialize(): any; }'. - Type 'HeapSnapshotNode' is not assignable to type '{ itemIndex(): number; serialize(): any; }'. - Property '_snapshot' does not exist on type '{ itemIndex(): number; serialize(): any; }'. -node_modules/chrome-devtools-frontend/front_end/heap_snapshot_worker/HeapSnapshot.js(2341,15): error TS2345: Argument of type 'HeapSnapshotNodeIndexProvider' is not assignable to parameter of type '{ itemForIndex(newIndex: number): { itemIndex(): number; serialize(): any; }; }'. node_modules/chrome-devtools-frontend/front_end/heap_snapshot_worker/HeapSnapshot.js(2353,12): error TS2339: Property 'nodeIndex' does not exist on type 'void'. node_modules/chrome-devtools-frontend/front_end/heap_snapshot_worker/HeapSnapshot.js(2354,16): error TS2339: Property 'id' does not exist on type 'void'. node_modules/chrome-devtools-frontend/front_end/heap_snapshot_worker/HeapSnapshot.js(2397,13): error TS2339: Property 'nodeIndex' does not exist on type 'void'. @@ -7332,8 +7298,6 @@ node_modules/chrome-devtools-frontend/front_end/network/NetworkItemView.js(62,40 node_modules/chrome-devtools-frontend/front_end/network/NetworkItemView.js(65,37): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/network/NetworkLogView.js(86,48): error TS2694: Namespace 'Network.NetworkLogView' has no exported member 'Filter'. node_modules/chrome-devtools-frontend/front_end/network/NetworkLogView.js(88,40): error TS2694: Namespace 'Network.NetworkLogView' has no exported member 'Filter'. -node_modules/chrome-devtools-frontend/front_end/network/NetworkLogView.js(114,37): error TS2345: Argument of type 'NetworkFrameGrouper' is not assignable to parameter of type '{ groupNodeForRequest: (request: NetworkRequest) => NetworkGroupNode; reset: () => void; }'. - Property '_parentView' does not exist on type '{ groupNodeForRequest: (request: NetworkRequest) => NetworkGroupNode; reset: () => void; }'. node_modules/chrome-devtools-frontend/front_end/network/NetworkLogView.js(124,33): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/network/NetworkLogView.js(144,44): error TS2339: Property 'createChild' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/network/NetworkLogView.js(147,57): error TS2555: Expected at least 2 arguments, but got 1. @@ -7671,8 +7635,6 @@ node_modules/chrome-devtools-frontend/front_end/network/ResourceWebSocketFrameVi node_modules/chrome-devtools-frontend/front_end/network/ResourceWebSocketFrameView.js(241,34): error TS2694: Namespace 'SDK.NetworkRequest' has no exported member 'WebSocketFrame'. node_modules/chrome-devtools-frontend/front_end/network/ResourceWebSocketFrameView.js(250,14): error TS2339: Property 'createTextChild' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/network/ResourceWebSocketFrameView.js(251,14): error TS2339: Property 'title' does not exist on type 'Element'. -node_modules/chrome-devtools-frontend/front_end/network/ResourceWebSocketFrameView.js(292,5): error TS2322: Type 'StaticContentProvider' is not assignable to type '{ contentURL(): string; contentType(): ResourceType; contentEncoded(): Promise; requestContent(): Promise; searchInContent(query: string, caseSensitive: boolean, isRegex: boolean): Promise<...>; }'. - Property '_contentURL' does not exist on type '{ contentURL(): string; contentType(): ResourceType; contentEncoded(): Promise; requestContent(): Promise; searchInContent(query: string, caseSensitive: boolean, isRegex: boolean): Promise<...>; }'. node_modules/chrome-devtools-frontend/front_end/network_log/HAREntry.js(130,29): error TS2339: Property 'localizedFailDescription' does not exist on type 'NetworkRequest'. node_modules/chrome-devtools-frontend/front_end/network_log/HAREntry.js(150,36): error TS2694: Namespace 'NetworkLog.HAREntry' has no exported member 'Timing'. node_modules/chrome-devtools-frontend/front_end/network_log/HAREntry.js(319,21): error TS2339: Property 'Timing' does not exist on type 'typeof HAREntry'. @@ -8585,8 +8547,6 @@ node_modules/chrome-devtools-frontend/front_end/profiler/CPUProfileFlameChart.js node_modules/chrome-devtools-frontend/front_end/profiler/CPUProfileFlameChart.js(481,40): error TS2339: Property 'window' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/profiler/CPUProfileView.js(61,23): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/profiler/CPUProfileView.js(63,23): error TS2555: Expected at least 2 arguments, but got 1. -node_modules/chrome-devtools-frontend/front_end/profiler/CPUProfileView.js(73,5): error TS2322: Type 'CPUFlameChartDataProvider' is not assignable to type '{ minimumBoundary(): number; totalTime(): number; formatValue(value: number, precision?: number): string; maxStackDepth(): number; timelineData(): TimelineData; prepareHighlightedEntryInfo(entryIndex: number): Element; ... 6 more ...; textColor(entryIndex: number): string; }'. - Property '_cpuProfile' does not exist on type '{ minimumBoundary(): number; totalTime(): number; formatValue(value: number, precision?: number): string; maxStackDepth(): number; timelineData(): TimelineData; prepareHighlightedEntryInfo(entryIndex: number): Element; ... 6 more ...; textColor(entryIndex: number): string; }'. node_modules/chrome-devtools-frontend/front_end/profiler/CPUProfileView.js(82,50): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/profiler/CPUProfileView.js(85,29): error TS2339: Property 'instance' does not exist on type 'typeof CPUProfileType'. node_modules/chrome-devtools-frontend/front_end/profiler/CPUProfileView.js(115,37): error TS2555: Expected at least 2 arguments, but got 1. @@ -8611,8 +8571,6 @@ node_modules/chrome-devtools-frontend/front_end/profiler/CPUProfileView.js(405,7 node_modules/chrome-devtools-frontend/front_end/profiler/CPUProfileView.js(407,31): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/profiler/HeapProfileView.js(31,23): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/profiler/HeapProfileView.js(33,23): error TS2555: Expected at least 2 arguments, but got 1. -node_modules/chrome-devtools-frontend/front_end/profiler/HeapProfileView.js(43,5): error TS2322: Type 'HeapFlameChartDataProvider' is not assignable to type '{ minimumBoundary(): number; totalTime(): number; formatValue(value: number, precision?: number): string; maxStackDepth(): number; timelineData(): TimelineData; prepareHighlightedEntryInfo(entryIndex: number): Element; ... 6 more ...; textColor(entryIndex: number): string; }'. - Property '_profile' does not exist on type '{ minimumBoundary(): number; totalTime(): number; formatValue(value: number, precision?: number): string; maxStackDepth(): number; timelineData(): TimelineData; prepareHighlightedEntryInfo(entryIndex: number): Element; ... 6 more ...; textColor(entryIndex: number): string; }'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapProfileView.js(52,59): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/profiler/HeapProfileView.js(54,38): error TS2339: Property 'instance' does not exist on type 'typeof SamplingHeapProfileType'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapProfileView.js(82,37): error TS2555: Expected at least 2 arguments, but got 1. @@ -8688,10 +8646,6 @@ node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotDataGrids.j node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotDataGrids.js(700,24): error TS2694: Namespace 'Protocol' has no exported member 'HeapProfiler'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotDataGrids.js(713,67): error TS2339: Property '_name' does not exist on type 'HeapSnapshotGridNode'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotDataGrids.js(717,30): error TS2339: Property 'populateNodeBySnapshotObjectId' does not exist on type 'HeapSnapshotGridNode'. -node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotDataGrids.js(776,11): error TS2345: Argument of type 'HeapSnapshotConstructorNode' is not assignable to parameter of type 'HeapSnapshotGridNode'. - Types of property 'createProvider' are incompatible. - Type '() => HeapSnapshotProviderProxy' is not assignable to type '() => { dispose(): void; nodePosition(snapshotObjectId: number): Promise; isEmpty(): Promise; serializeItemsRange(startPosition: number, endPosition: number): Promise<...>; sortAndRewind(comparator: ComparatorConfig): Promise<...>; }'. - Type 'HeapSnapshotProviderProxy' is not assignable to type '{ dispose(): void; nodePosition(snapshotObjectId: number): Promise; isEmpty(): Promise; serializeItemsRange(startPosition: number, endPosition: number): Promise<...>; sortAndRewind(comparator: ComparatorConfig): Promise<...>; }'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotDataGrids.js(822,56): error TS2694: Namespace 'DataGrid.DataGrid' has no exported member 'ColumnDescriptor'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotDataGrids.js(823,36): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotDataGrids.js(824,40): error TS2555: Expected at least 2 arguments, but got 1. @@ -8700,10 +8654,6 @@ node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotDataGrids.j node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotDataGrids.js(828,23): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotDataGrids.js(834,41): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotDataGrids.js(835,39): error TS2555: Expected at least 2 arguments, but got 1. -node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotDataGrids.js(887,40): error TS2345: Argument of type 'HeapSnapshotDiffNode' is not assignable to parameter of type 'HeapSnapshotGridNode'. - Types of property 'createProvider' are incompatible. - Type '() => HeapSnapshotDiffNodesProvider' is not assignable to type '() => { dispose(): void; nodePosition(snapshotObjectId: number): Promise; isEmpty(): Promise; serializeItemsRange(startPosition: number, endPosition: number): Promise<...>; sortAndRewind(comparator: ComparatorConfig): Promise<...>; }'. - Type 'HeapSnapshotDiffNodesProvider' is not assignable to type '{ dispose(): void; nodePosition(snapshotObjectId: number): Promise; isEmpty(): Promise; serializeItemsRange(startPosition: number, endPosition: number): Promise<...>; sortAndRewind(comparator: ComparatorConfig): Promise<...>; }'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotDataGrids.js(902,56): error TS2694: Namespace 'DataGrid.DataGrid' has no exported member 'ColumnDescriptor'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotDataGrids.js(903,39): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotDataGrids.js(904,35): error TS2555: Expected at least 2 arguments, but got 1. @@ -8739,36 +8689,13 @@ node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.j node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(580,12): error TS2339: Property 'style' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(581,10): error TS2339: Property 'heapSnapshotNode' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(602,82): error TS2555: Expected at least 2 arguments, but got 1. -node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(682,3): error TS2416: Property 'createProvider' in type 'HeapSnapshotObjectNode' is not assignable to the same property in base type 'HeapSnapshotGenericObjectNode'. - Type '() => HeapSnapshotProviderProxy' is not assignable to type '() => { dispose(): void; nodePosition(snapshotObjectId: number): Promise; isEmpty(): Promise; serializeItemsRange(startPosition: number, endPosition: number): Promise<...>; sortAndRewind(comparator: ComparatorConfig): Promise<...>; }'. -node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(682,3): error TS2416: Property 'createProvider' in type 'HeapSnapshotObjectNode' is not assignable to the same property in base type 'HeapSnapshotGenericObjectNode'. - Type '() => HeapSnapshotProviderProxy' is not assignable to type '() => { dispose(): void; nodePosition(snapshotObjectId: number): Promise; isEmpty(): Promise; serializeItemsRange(startPosition: number, endPosition: number): Promise<...>; sortAndRewind(comparator: ComparatorConfig): Promise<...>; }'. - Type 'HeapSnapshotProviderProxy' is not assignable to type '{ dispose(): void; nodePosition(snapshotObjectId: number): Promise; isEmpty(): Promise; serializeItemsRange(startPosition: number, endPosition: number): Promise<...>; sortAndRewind(comparator: ComparatorConfig): Promise<...>; }'. - Property '_worker' does not exist on type '{ dispose(): void; nodePosition(snapshotObjectId: number): Promise; isEmpty(): Promise; serializeItemsRange(startPosition: number, endPosition: number): Promise<...>; sortAndRewind(comparator: ComparatorConfig): Promise<...>; }'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(804,15): error TS2577: Return type annotation circularly references itself. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(871,36): error TS2339: Property 'withThousandsSeparator' does not exist on type 'NumberConstructor'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(874,34): error TS2339: Property 'withThousandsSeparator' does not exist on type 'NumberConstructor'. -node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(892,3): error TS2416: Property 'createProvider' in type 'HeapSnapshotInstanceNode' is not assignable to the same property in base type 'HeapSnapshotGenericObjectNode'. - Type '() => HeapSnapshotProviderProxy' is not assignable to type '() => { dispose(): void; nodePosition(snapshotObjectId: number): Promise; isEmpty(): Promise; serializeItemsRange(startPosition: number, endPosition: number): Promise<...>; sortAndRewind(comparator: ComparatorConfig): Promise<...>; }'. -node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(892,3): error TS2416: Property 'createProvider' in type 'HeapSnapshotInstanceNode' is not assignable to the same property in base type 'HeapSnapshotGenericObjectNode'. - Type '() => HeapSnapshotProviderProxy' is not assignable to type '() => { dispose(): void; nodePosition(snapshotObjectId: number): Promise; isEmpty(): Promise; serializeItemsRange(startPosition: number, endPosition: number): Promise<...>; sortAndRewind(comparator: ComparatorConfig): Promise<...>; }'. - Type 'HeapSnapshotProviderProxy' is not assignable to type '{ dispose(): void; nodePosition(snapshotObjectId: number): Promise; isEmpty(): Promise; serializeItemsRange(startPosition: number, endPosition: number): Promise<...>; sortAndRewind(comparator: ComparatorConfig): Promise<...>; }'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(966,23): error TS2339: Property 'withThousandsSeparator' does not exist on type 'NumberConstructor'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(968,29): error TS2339: Property 'withThousandsSeparator' does not exist on type 'NumberConstructor'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(969,30): error TS2339: Property 'withThousandsSeparator' does not exist on type 'NumberConstructor'. -node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(980,3): error TS2416: Property 'createProvider' in type 'HeapSnapshotConstructorNode' is not assignable to the same property in base type 'HeapSnapshotGridNode'. - Type '() => HeapSnapshotProviderProxy' is not assignable to type '() => { dispose(): void; nodePosition(snapshotObjectId: number): Promise; isEmpty(): Promise; serializeItemsRange(startPosition: number, endPosition: number): Promise<...>; sortAndRewind(comparator: ComparatorConfig): Promise<...>; }'. -node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(980,3): error TS2416: Property 'createProvider' in type 'HeapSnapshotConstructorNode' is not assignable to the same property in base type 'HeapSnapshotGridNode'. - Type '() => HeapSnapshotProviderProxy' is not assignable to type '() => { dispose(): void; nodePosition(snapshotObjectId: number): Promise; isEmpty(): Promise; serializeItemsRange(startPosition: number, endPosition: number): Promise<...>; sortAndRewind(comparator: ComparatorConfig): Promise<...>; }'. - Type 'HeapSnapshotProviderProxy' is not assignable to type '{ dispose(): void; nodePosition(snapshotObjectId: number): Promise; isEmpty(): Promise; serializeItemsRange(startPosition: number, endPosition: number): Promise<...>; sortAndRewind(comparator: ComparatorConfig): Promise<...>; }'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(981,27): error TS2339: Property 'snapshot' does not exist on type 'HeapSnapshotSortableDataGrid'. -node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(1001,5): error TS2322: Type '(HeapSnapshotGridNode | this)[]' is not assignable to type 'HeapSnapshotGridNode[]'. - Type 'HeapSnapshotGridNode | this' is not assignable to type 'HeapSnapshotGridNode'. - Type 'this' is not assignable to type 'HeapSnapshotGridNode'. - Type 'HeapSnapshotConstructorNode' is not assignable to type 'HeapSnapshotGridNode'. - Types of property 'createProvider' are incompatible. - Type '() => HeapSnapshotProviderProxy' is not assignable to type '() => { dispose(): void; nodePosition(snapshotObjectId: number): Promise; isEmpty(): Promise; serializeItemsRange(startPosition: number, endPosition: number): Promise<...>; sortAndRewind(comparator: ComparatorConfig): Promise<...>; }'. - Type 'HeapSnapshotProviderProxy' is not assignable to type '{ dispose(): void; nodePosition(snapshotObjectId: number): Promise; isEmpty(): Promise; serializeItemsRange(startPosition: number, endPosition: number): Promise<...>; sortAndRewind(comparator: ComparatorConfig): Promise<...>; }'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(1019,14): error TS2339: Property '_searchMatched' does not exist on type 'HeapSnapshotConstructorNode'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(1029,81): error TS2339: Property 'snapshot' does not exist on type 'HeapSnapshotSortableDataGrid'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(1140,22): error TS2339: Property 'pushAll' does not exist on type 'any[]'. @@ -8778,12 +8705,6 @@ node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.j node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(1181,27): error TS2339: Property 'withThousandsSeparator' does not exist on type 'NumberConstructor'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(1182,29): error TS2339: Property 'withThousandsSeparator' does not exist on type 'NumberConstructor'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(1183,65): error TS2339: Property 'withThousandsSeparator' does not exist on type 'NumberConstructor'. -node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(1191,3): error TS2416: Property 'createProvider' in type 'HeapSnapshotDiffNode' is not assignable to the same property in base type 'HeapSnapshotGridNode'. - Type '() => HeapSnapshotDiffNodesProvider' is not assignable to type '() => { dispose(): void; nodePosition(snapshotObjectId: number): Promise; isEmpty(): Promise; serializeItemsRange(startPosition: number, endPosition: number): Promise<...>; sortAndRewind(comparator: ComparatorConfig): Promise<...>; }'. -node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(1191,3): error TS2416: Property 'createProvider' in type 'HeapSnapshotDiffNode' is not assignable to the same property in base type 'HeapSnapshotGridNode'. - Type '() => HeapSnapshotDiffNodesProvider' is not assignable to type '() => { dispose(): void; nodePosition(snapshotObjectId: number): Promise; isEmpty(): Promise; serializeItemsRange(startPosition: number, endPosition: number): Promise<...>; sortAndRewind(comparator: ComparatorConfig): Promise<...>; }'. - Type 'HeapSnapshotDiffNodesProvider' is not assignable to type '{ dispose(): void; nodePosition(snapshotObjectId: number): Promise; isEmpty(): Promise; serializeItemsRange(startPosition: number, endPosition: number): Promise<...>; sortAndRewind(comparator: ComparatorConfig): Promise<...>; }'. - Property '_addedNodesProvider' does not exist on type '{ dispose(): void; nodePosition(snapshotObjectId: number): Promise; isEmpty(): Promise; serializeItemsRange(startPosition: number, endPosition: number): Promise<...>; sortAndRewind(comparator: ComparatorConfig): Promise<...>; }'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(1194,14): error TS2339: Property 'snapshot' does not exist on type 'HeapSnapshotSortableDataGrid'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(1194,53): error TS2339: Property 'baseSnapshot' does not exist on type 'HeapSnapshotSortableDataGrid'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(1195,14): error TS2339: Property 'baseSnapshot' does not exist on type 'HeapSnapshotSortableDataGrid'. @@ -9497,8 +9418,6 @@ node_modules/chrome-devtools-frontend/front_end/screencast/ScreencastApp.js(16,6 Types of parameters 'screenCaptureModel' and 'model' are incompatible. Type 'T' is not assignable to type 'ScreenCaptureModel'. node_modules/chrome-devtools-frontend/front_end/screencast/ScreencastApp.js(85,35): error TS2345: Argument of type 'ScreencastView' is not assignable to parameter of type 'boolean'. -node_modules/chrome-devtools-frontend/front_end/screencast/ScreencastApp.js(121,5): error TS2322: Type 'ScreencastApp' is not assignable to type '{ presentUI(document: Document): void; }'. - Property '_enabledSetting' does not exist on type '{ presentUI(document: Document): void; }'. node_modules/chrome-devtools-frontend/front_end/screencast/ScreencastView.js(56,42): error TS2339: Property 'createChild' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/screencast/ScreencastView.js(152,24): error TS2694: Namespace 'Protocol' has no exported member 'Page'. node_modules/chrome-devtools-frontend/front_end/screencast/ScreencastView.js(193,22): error TS2694: Namespace 'Common' has no exported member 'Event'. @@ -9672,7 +9591,6 @@ node_modules/chrome-devtools-frontend/front_end/sdk/CSSStyleDeclaration.js(8,24) node_modules/chrome-devtools-frontend/front_end/sdk/CSSStyleDeclaration.js(41,47): error TS2694: Namespace 'Protocol' has no exported member 'CSS'. node_modules/chrome-devtools-frontend/front_end/sdk/CSSStyleDeclaration.js(50,24): error TS2694: Namespace 'Protocol' has no exported member 'CSS'. node_modules/chrome-devtools-frontend/front_end/sdk/CSSStyleSheetHeader.js(11,24): error TS2694: Namespace 'Protocol' has no exported member 'CSS'. -node_modules/chrome-devtools-frontend/front_end/sdk/CSSStyleSheetHeader.js(40,5): error TS2322: Type 'StaticContentProvider' is not assignable to type '{ contentURL(): string; contentType(): ResourceType; contentEncoded(): Promise; requestContent(): Promise; searchInContent(query: string, caseSensitive: boolean, isRegex: boolean): Promise<...>; }'. node_modules/chrome-devtools-frontend/front_end/sdk/Connections.js(10,52): error TS2694: Namespace 'Protocol.InspectorBackend.Connection' has no exported member 'Params'. node_modules/chrome-devtools-frontend/front_end/sdk/Connections.js(34,22): error TS2694: Namespace 'Common' has no exported member 'Event'. node_modules/chrome-devtools-frontend/front_end/sdk/Connections.js(41,22): error TS2694: Namespace 'Common' has no exported member 'Event'. @@ -10410,7 +10328,6 @@ node_modules/chrome-devtools-frontend/front_end/sdk/ScreenCaptureModel.js(152,24 node_modules/chrome-devtools-frontend/front_end/sdk/ScreenCaptureModel.js(160,24): error TS2694: Namespace 'Protocol' has no exported member 'Page'. node_modules/chrome-devtools-frontend/front_end/sdk/Script.js(39,24): error TS2694: Namespace 'Protocol' has no exported member 'Runtime'. node_modules/chrome-devtools-frontend/front_end/sdk/Script.js(143,52): error TS2339: Property 'debuggerAgent' does not exist on type 'Target'. -node_modules/chrome-devtools-frontend/front_end/sdk/Script.js(159,5): error TS2322: Type 'StaticContentProvider' is not assignable to type '{ contentURL(): string; contentType(): ResourceType; contentEncoded(): Promise; requestContent(): Promise; searchInContent(query: string, caseSensitive: boolean, isRegex: boolean): Promise<...>; }'. node_modules/chrome-devtools-frontend/front_end/sdk/Script.js(174,43): error TS2339: Property 'debuggerAgent' does not exist on type 'Target'. node_modules/chrome-devtools-frontend/front_end/sdk/Script.js(190,14): error TS7014: Function type, which lacks return-type annotation, implicitly has an 'any' return type. node_modules/chrome-devtools-frontend/front_end/sdk/Script.js(190,50): error TS2694: Namespace 'Protocol' has no exported member 'Runtime'. @@ -10475,9 +10392,6 @@ node_modules/chrome-devtools-frontend/front_end/sdk/SourceMap.js(196,28): error node_modules/chrome-devtools-frontend/front_end/sdk/SourceMap.js(198,25): error TS2339: Property '_base64Map' does not exist on type 'typeof TextSourceMap'. node_modules/chrome-devtools-frontend/front_end/sdk/SourceMap.js(200,27): error TS2339: Property '_base64Map' does not exist on type 'typeof TextSourceMap'. node_modules/chrome-devtools-frontend/front_end/sdk/SourceMap.js(272,30): error TS2339: Property 'keysArray' does not exist on type 'Map'. -node_modules/chrome-devtools-frontend/front_end/sdk/SourceMap.js(284,7): error TS2322: Type 'StaticContentProvider' is not assignable to type '{ contentURL(): string; contentType(): ResourceType; contentEncoded(): Promise; requestContent(): Promise; searchInContent(query: string, caseSensitive: boolean, isRegex: boolean): Promise<...>; }'. -node_modules/chrome-devtools-frontend/front_end/sdk/SourceMap.js(285,5): error TS2322: Type 'CompilerSourceMappingContentProvider' is not assignable to type '{ contentURL(): string; contentType(): ResourceType; contentEncoded(): Promise; requestContent(): Promise; searchInContent(query: string, caseSensitive: boolean, isRegex: boolean): Promise<...>; }'. - Property '_sourceURL' does not exist on type '{ contentURL(): string; contentType(): ResourceType; contentEncoded(): Promise; requestContent(): Promise; searchInContent(query: string, caseSensitive: boolean, isRegex: boolean): Promise<...>; }'. node_modules/chrome-devtools-frontend/front_end/sdk/SourceMap.js(325,26): error TS2339: Property 'upperBound' does not exist on type 'SourceMapEntry[]'. node_modules/chrome-devtools-frontend/front_end/sdk/SourceMap.js(338,26): error TS2339: Property 'lowerBound' does not exist on type 'SourceMapEntry[]'. node_modules/chrome-devtools-frontend/front_end/sdk/SourceMap.js(339,25): error TS2339: Property 'upperBound' does not exist on type 'SourceMapEntry[]'. @@ -10502,9 +10416,6 @@ node_modules/chrome-devtools-frontend/front_end/sdk/SourceMapManager.js(141,49): 'string' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint '{}'. node_modules/chrome-devtools-frontend/front_end/sdk/SourceMapManager.js(146,44): error TS2345: Argument of type 'string' is not assignable to parameter of type 'K'. 'string' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint '{}'. -node_modules/chrome-devtools-frontend/front_end/sdk/SourceMapManager.js(159,36): error TS2352: Conversion of type 'TextSourceMap' to type '{ compiledURL(): string; url(): string; sourceURLs(): string[]; sourceContentProvider(sourceURL: string, contentType: ResourceType): { contentURL(): string; contentType(): ResourceType; contentEncoded(): Promise<...>; requestContent(): Promise<...>; searchInContent(query: string, caseSensitive: boolean, isRegex: boo...' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. -node_modules/chrome-devtools-frontend/front_end/sdk/SourceMapManager.js(159,36): error TS2352: Conversion of type 'TextSourceMap' to type '{ compiledURL(): string; url(): string; sourceURLs(): string[]; sourceContentProvider(sourceURL: string, contentType: ResourceType): { contentURL(): string; contentType(): ResourceType; contentEncoded(): Promise<...>; requestContent(): Promise<...>; searchInContent(query: string, caseSensitive: boolean, isRegex: boo...' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. - Property '_json' does not exist on type '{ compiledURL(): string; url(): string; sourceURLs(): string[]; sourceContentProvider(sourceURL: string, contentType: ResourceType): { contentURL(): string; contentType(): ResourceType; contentEncoded(): Promise<...>; requestContent(): Promise<...>; searchInContent(query: string, caseSensitive: boolean, isRegex: boo...'. node_modules/chrome-devtools-frontend/front_end/sdk/SourceMapManager.js(163,12): error TS2339: Property 'catchException' does not exist on type 'Promise'. node_modules/chrome-devtools-frontend/front_end/sdk/SourceMapManager.js(173,60): error TS2345: Argument of type 'string' is not assignable to parameter of type 'K'. 'string' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint '{}'. @@ -10563,12 +10474,6 @@ node_modules/chrome-devtools-frontend/front_end/sdk/TargetManager.js(329,32): er node_modules/chrome-devtools-frontend/front_end/sdk/TargetManager.js(351,42): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/sdk/TargetManager.js(352,12): error TS2339: Property 'runtimeAgent' does not exist on type 'Target'. node_modules/chrome-devtools-frontend/front_end/sdk/TargetManager.js(356,52): error TS2694: Namespace 'Protocol.InspectorBackend.Connection' has no exported member 'Params'. -node_modules/chrome-devtools-frontend/front_end/sdk/TargetManager.js(364,7): error TS2322: Type 'WebSocketConnection' is not assignable to type '{ sendMessage(message: string): void; disconnect(): Promise; }'. - Property '_socket' does not exist on type '{ sendMessage(message: string): void; disconnect(): Promise; }'. -node_modules/chrome-devtools-frontend/front_end/sdk/TargetManager.js(366,7): error TS2322: Type 'StubConnection' is not assignable to type '{ sendMessage(message: string): void; disconnect(): Promise; }'. - Property '_onMessage' does not exist on type '{ sendMessage(message: string): void; disconnect(): Promise; }'. -node_modules/chrome-devtools-frontend/front_end/sdk/TargetManager.js(368,7): error TS2322: Type 'MainConnection' is not assignable to type '{ sendMessage(message: string): void; disconnect(): Promise; }'. - Property '_onMessage' does not exist on type '{ sendMessage(message: string): void; disconnect(): Promise; }'. node_modules/chrome-devtools-frontend/front_end/sdk/TargetManager.js(381,14): error TS7014: Function type, which lacks return-type annotation, implicitly has an 'any' return type. node_modules/chrome-devtools-frontend/front_end/sdk/TargetManager.js(401,38): error TS2339: Property 'targetAgent' does not exist on type 'Target'. node_modules/chrome-devtools-frontend/front_end/sdk/TargetManager.js(406,18): error TS2339: Property 'registerTargetDispatcher' does not exist on type 'Target'. @@ -10580,8 +10485,6 @@ node_modules/chrome-devtools-frontend/front_end/sdk/TargetManager.js(530,24): er node_modules/chrome-devtools-frontend/front_end/sdk/TargetManager.js(552,12): error TS2339: Property 'runtimeAgent' does not exist on type 'Target'. node_modules/chrome-devtools-frontend/front_end/sdk/TargetManager.js(581,24): error TS2694: Namespace 'Protocol' has no exported member 'TargetAgent'. node_modules/chrome-devtools-frontend/front_end/sdk/TargetManager.js(583,52): error TS2694: Namespace 'Protocol.InspectorBackend.Connection' has no exported member 'Params'. -node_modules/chrome-devtools-frontend/front_end/sdk/TargetManager.js(589,5): error TS2322: Type 'ChildConnection' is not assignable to type '{ sendMessage(message: string): void; disconnect(): Promise; }'. - Property '_agent' does not exist on type '{ sendMessage(message: string): void; disconnect(): Promise; }'. node_modules/chrome-devtools-frontend/front_end/sdk/TargetManager.js(598,24): error TS2694: Namespace 'Protocol' has no exported member 'TargetAgent'. node_modules/chrome-devtools-frontend/front_end/sdk/TargetManager.js(600,52): error TS2694: Namespace 'Protocol.InspectorBackend.Connection' has no exported member 'Params'. node_modules/chrome-devtools-frontend/front_end/sdk/TracingManager.js(13,42): error TS2694: Namespace 'SDK.TracingManager' has no exported member 'EventPayload'. @@ -10822,8 +10725,6 @@ node_modules/chrome-devtools-frontend/front_end/snippets/ScriptSnippetModel.js(5 Types of parameters 'debuggerModel' and 'model' are incompatible. Type 'T' is not assignable to type 'DebuggerModel'. node_modules/chrome-devtools-frontend/front_end/snippets/ScriptSnippetModel.js(70,35): error TS2339: Property 'remove' does not exist on type 'Map'. -node_modules/chrome-devtools-frontend/front_end/snippets/ScriptSnippetModel.js(113,5): error TS2322: Type 'SnippetsProject' is not assignable to type '{ workspace(): Workspace; id(): string; type(): string; isServiceProject(): boolean; displayName(): string; requestMetadata(uiSourceCode: UISourceCode): Promise; ... 17 more ...; uiSourceCodes(): UISourceCode[]; }'. - Property '_model' does not exist on type '{ workspace(): Workspace; id(): string; type(): string; isServiceProject(): boolean; displayName(): string; requestMetadata(uiSourceCode: UISourceCode): Promise; ... 17 more ...; uiSourceCodes(): UISourceCode[]; }'. node_modules/chrome-devtools-frontend/front_end/snippets/ScriptSnippetModel.js(146,22): error TS2694: Namespace 'Common' has no exported member 'Event'. node_modules/chrome-devtools-frontend/front_end/snippets/ScriptSnippetModel.js(165,36): error TS2339: Property 'remove' does not exist on type 'Map'. node_modules/chrome-devtools-frontend/front_end/snippets/ScriptSnippetModel.js(172,14): error TS7014: Function type, which lacks return-type annotation, implicitly has an 'any' return type. @@ -13496,14 +13397,8 @@ node_modules/chrome-devtools-frontend/front_end/ui/View.js(254,15): error TS2355 node_modules/chrome-devtools-frontend/front_end/ui/View.js(263,1): error TS8022: JSDoc '@extends' is not attached to a class. node_modules/chrome-devtools-frontend/front_end/ui/View.js(267,15): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value. node_modules/chrome-devtools-frontend/front_end/ui/View.js(282,15): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value. -node_modules/chrome-devtools-frontend/front_end/ui/View.js(299,41): error TS2345: Argument of type 'ProvidedView' is not assignable to parameter of type '{ viewId(): string; title(): string; isCloseable(): boolean; isTransient(): boolean; toolbarItems(): Promise; widget(): Promise; disposeView(): void; }'. - Property '_extension' does not exist on type '{ viewId(): string; title(): string; isCloseable(): boolean; isTransient(): boolean; toolbarItems(): Promise; widget(): Promise; disposeView(): void; }'. node_modules/chrome-devtools-frontend/front_end/ui/View.js(326,21): error TS2339: Property 'showView' does not exist on type '_Location'. node_modules/chrome-devtools-frontend/front_end/ui/View.js(371,23): error TS2339: Property 'showView' does not exist on type '_Location'. -node_modules/chrome-devtools-frontend/front_end/ui/View.js(401,5): error TS2322: Type '_TabbedLocation' is not assignable to type '{ tabbedPane(): TabbedPane; enableMoreTabsButton(): void; }'. - Property '_tabbedPane' does not exist on type '{ tabbedPane(): TabbedPane; enableMoreTabsButton(): void; }'. -node_modules/chrome-devtools-frontend/front_end/ui/View.js(411,5): error TS2322: Type '_StackLocation' is not assignable to type '{ appendApplicableItems(locationName: string): void; appendView(view: { viewId(): string; title(): string; isCloseable(): boolean; isTransient(): boolean; toolbarItems(): Promise; widget(): Promise<...>; disposeView(): void; }, insertBefore?: { ...; }): void; showView(view: { ...; }, insertBefore?: { ...'. - Property '_vbox' does not exist on type '{ appendApplicableItems(locationName: string): void; appendView(view: { viewId(): string; title(): string; isCloseable(): boolean; isTransient(): boolean; toolbarItems(): Promise; widget(): Promise<...>; disposeView(): void; }, insertBefore?: { ...; }): void; showView(view: { ...; }, insertBefore?: { ...'. node_modules/chrome-devtools-frontend/front_end/ui/View.js(440,18): error TS2339: Property 'tabIndex' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/ui/View.js(454,38): error TS2339: Property 'hasFocus' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/ui/View.js(461,44): error TS2769: No overload matches this call. diff --git a/tests/baselines/reference/user/lodash.log b/tests/baselines/reference/user/lodash.log index 954077ce729c7..1c358238f8d5c 100644 --- a/tests/baselines/reference/user/lodash.log +++ b/tests/baselines/reference/user/lodash.log @@ -382,8 +382,6 @@ node_modules/lodash/nthArg.js(28,26): error TS2345: Argument of type 'number | u node_modules/lodash/omit.js(48,32): error TS2345: Argument of type 'number' is not assignable to parameter of type 'boolean'. node_modules/lodash/orderBy.js(18,10): error TS1003: Identifier expected. node_modules/lodash/orderBy.js(18,10): error TS8024: JSDoc '@param' tag has name '', but there is no parameter with that name. -node_modules/lodash/org.js(8,22): error TS2307: Cannot find module 'moment'. -node_modules/lodash/org.js(9,19): error TS2307: Cannot find module 'ncp'. node_modules/lodash/parseInt.js(24,10): error TS1003: Identifier expected. node_modules/lodash/parseInt.js(24,10): error TS8024: JSDoc '@param' tag has name '', but there is no parameter with that name. node_modules/lodash/partial.js(48,9): error TS2339: Property 'placeholder' does not exist on type 'Function'. diff --git a/tests/baselines/reference/user/npmlog.log b/tests/baselines/reference/user/npmlog.log index 1e6284674e3ea..6b6e315d99628 100644 --- a/tests/baselines/reference/user/npmlog.log +++ b/tests/baselines/reference/user/npmlog.log @@ -8,9 +8,9 @@ node_modules/npmlog/log.js(194,37): error TS2345: Argument of type 'any[]' is no Property '0' is missing in type 'any[]' but required in type '[any, ...any[]]'. node_modules/npmlog/log.js(218,12): error TS2551: Property '_paused' does not exist on type 'typeof EventEmitter'. Did you mean 'pause'? node_modules/npmlog/log.js(271,16): error TS2769: No overload matches this call. - Overload 1 of 2, '(buffer: string | Uint8Array | Buffer, cb?: ((err?: Error | null | undefined) => void) | undefined): boolean', gave the following error. - Argument of type 'string | undefined' is not assignable to parameter of type 'string | Uint8Array | Buffer'. - Type 'undefined' is not assignable to type 'string | Uint8Array | Buffer'. + Overload 1 of 2, '(buffer: string | Uint8Array, cb?: ((err?: Error | null | undefined) => void) | undefined): boolean', gave the following error. + Argument of type 'string | undefined' is not assignable to parameter of type 'string | Uint8Array'. + Type 'undefined' is not assignable to type 'string | Uint8Array'. Overload 2 of 2, '(str: string, encoding?: string | undefined, cb?: ((err?: Error | null | undefined) => void) | undefined): boolean', gave the following error. Argument of type 'string | undefined' is not assignable to parameter of type 'string'. Type 'undefined' is not assignable to type 'string'. diff --git a/tests/baselines/reference/user/uglify-js.log b/tests/baselines/reference/user/uglify-js.log index a01073ce3a23f..78c15c035b599 100644 --- a/tests/baselines/reference/user/uglify-js.log +++ b/tests/baselines/reference/user/uglify-js.log @@ -41,7 +41,7 @@ node_modules/uglify-js/lib/compress.js(3839,12): error TS2339: Property 'push' d node_modules/uglify-js/lib/compress.js(3914,38): error TS2554: Expected 0 arguments, but got 1. node_modules/uglify-js/lib/compress.js(3935,24): error TS2339: Property 'parent' does not exist on type 'TreeTransformer'. node_modules/uglify-js/lib/compress.js(3945,28): error TS2339: Property 'parent' does not exist on type 'TreeTransformer'. -node_modules/uglify-js/lib/compress.js(4114,21): error TS2403: Subsequent variable declarations must have the same type. Variable 'defs' must be of type 'Dictionary & { set: (key: any, val: any) => Dictionary & { set: ...; add: (key: any, val: any) => Dictionary & { set: ...; add: ...; get: (key: any) => any; del: (key: any) => Dictionary & { set: ...; ... 8 more ...; toObject: () => any; }; ... 5 more ...; toObject: () => any; }; ... 7 more ...; toObject: () => any;...', but here has type 'any'. +node_modules/uglify-js/lib/compress.js(4114,21): error TS2403: Subsequent variable declarations must have the same type. Variable 'defs' must be of type 'Dictionary & { set: (key: any, val: any) => Dictionary & ...; add: (key: any, val: any) => Dictionary & ...; get: (key: any) => any; del: (key: any) => Dictionary & ...; has: (key: any) => boolean; ... 4 more ...; toObject: () => any; }', but here has type 'any'. node_modules/uglify-js/lib/compress.js(4166,17): error TS2447: The '|=' operator is not allowed for boolean types. Consider using '||' instead. node_modules/uglify-js/lib/compress.js(4229,45): error TS2554: Expected 0 arguments, but got 1. node_modules/uglify-js/lib/compress.js(4340,33): error TS2554: Expected 0 arguments, but got 1. diff --git a/tests/cases/compiler/jsdocParameterParsingInvalidName.ts b/tests/cases/compiler/jsdocParameterParsingInvalidName.ts new file mode 100644 index 0000000000000..6c3c93d182e65 --- /dev/null +++ b/tests/cases/compiler/jsdocParameterParsingInvalidName.ts @@ -0,0 +1,7 @@ +class c { + /** + * @param {string} [`foo] + */ + method(foo) { + } +} \ No newline at end of file diff --git a/tests/cases/compiler/typeInferenceCacheInvalidation.ts b/tests/cases/compiler/typeInferenceCacheInvalidation.ts new file mode 100644 index 0000000000000..d037f139ec5fd --- /dev/null +++ b/tests/cases/compiler/typeInferenceCacheInvalidation.ts @@ -0,0 +1,23 @@ +// @strict: true + +// Repro from #32230 + +type Callback = (foo: TFoo, bar: TBar) => any + +declare function example>( + foo: TFoo, + callback: TCallback, + bar: TBar, +): TCallback + +example(42, (foo, bar) => ({ + t: () => { + let s: string = bar; + } +}), '42'); + +example(42, (foo, bar) => ({ + t() { + let s: string = bar; + } +}), '42'); diff --git a/tests/cases/conformance/classes/constructorDeclarations/quotedConstructors.ts b/tests/cases/conformance/classes/constructorDeclarations/quotedConstructors.ts index 3ab45c72810cd..c03ce26cc2f6e 100644 --- a/tests/cases/conformance/classes/constructorDeclarations/quotedConstructors.ts +++ b/tests/cases/conformance/classes/constructorDeclarations/quotedConstructors.ts @@ -1,17 +1,31 @@ class C { - "constructor"() {} // Error in 3.5 + "constructor"() { + console.log(this); + } } class D { - 'constructor'() {} // Error in 3.5 + 'constructor'() { + console.log(this); + } } class E { - ['constructor']() {} + ['constructor']() { + console.log(this); + } } new class { - "constructor"() {} // Error in 3.5 + "constructor"() { + console.log(this); + } }; var o = { "constructor"() {} }; + +class F { + "\x63onstructor"() { + console.log(this); + } +} diff --git a/tests/cases/conformance/controlFlow/controlFlowElementAccess2.ts b/tests/cases/conformance/controlFlow/controlFlowElementAccess2.ts new file mode 100644 index 0000000000000..fa0592c973ee3 --- /dev/null +++ b/tests/cases/conformance/controlFlow/controlFlowElementAccess2.ts @@ -0,0 +1,13 @@ +// @strict: true +declare const config: { + [key: string]: boolean | { prop: string }; +}; + +if (typeof config['works'] !== 'boolean') { + config.works.prop = 'test'; // ok + config['works'].prop = 'test'; // error, config['works']: boolean | { 'prop': string } +} +if (typeof config.works !== 'boolean') { + config['works'].prop = 'test'; // error, config['works']: boolean | { 'prop': string } + config.works.prop = 'test'; // ok +} diff --git a/tests/cases/conformance/generators/generatorReturnTypeFallback.1.ts b/tests/cases/conformance/generators/generatorReturnTypeFallback.1.ts new file mode 100644 index 0000000000000..dbf249d7e275b --- /dev/null +++ b/tests/cases/conformance/generators/generatorReturnTypeFallback.1.ts @@ -0,0 +1,9 @@ +// @target: esnext +// @lib: es5,es2015.iterable +// @noemit: true +// @strict: true + +// Allow generators to fallback to IterableIterator if they do not need a type for the sent value while in strictNullChecks mode. +function* f() { + yield 1; +} \ No newline at end of file diff --git a/tests/cases/conformance/generators/generatorReturnTypeFallback.2.ts b/tests/cases/conformance/generators/generatorReturnTypeFallback.2.ts new file mode 100644 index 0000000000000..4579f05387a6c --- /dev/null +++ b/tests/cases/conformance/generators/generatorReturnTypeFallback.2.ts @@ -0,0 +1,10 @@ +// @target: esnext +// @lib: es5 +// @noemit: true +// @strict: true + +// Allow generators to fallback to IterableIterator if they do not need a type for the sent value while in strictNullChecks mode. +// Report an error if IterableIterator cannot be found. +function* f() { + yield 1; +} \ No newline at end of file diff --git a/tests/cases/conformance/generators/generatorReturnTypeFallback.3.ts b/tests/cases/conformance/generators/generatorReturnTypeFallback.3.ts new file mode 100644 index 0000000000000..388d8bee7ee3b --- /dev/null +++ b/tests/cases/conformance/generators/generatorReturnTypeFallback.3.ts @@ -0,0 +1,10 @@ +// @target: esnext +// @lib: es5,es2015.iterable +// @noemit: true +// @strict: true + +// Do not allow generators to fallback to IterableIterator while in strictNullChecks mode if they need a type for the sent value. +// NOTE: In non-strictNullChecks mode, `undefined` (the default sent value) is assignable to everything. +function* f() { + const x: string = yield 1; +} \ No newline at end of file diff --git a/tests/cases/conformance/generators/generatorReturnTypeFallback.4.ts b/tests/cases/conformance/generators/generatorReturnTypeFallback.4.ts new file mode 100644 index 0000000000000..3fc9d4f50c6f2 --- /dev/null +++ b/tests/cases/conformance/generators/generatorReturnTypeFallback.4.ts @@ -0,0 +1,10 @@ +// @target: esnext +// @lib: es5,es2015.iterable +// @noemit: true +// @strict: false + +// Allow generators to fallback to IterableIterator if they are not in strictNullChecks mode +// NOTE: In non-strictNullChecks mode, `undefined` (the default sent value) is assignable to everything. +function* f() { + const x: string = yield 1; +} \ No newline at end of file diff --git a/tests/cases/conformance/generators/generatorReturnTypeFallback.5.ts b/tests/cases/conformance/generators/generatorReturnTypeFallback.5.ts new file mode 100644 index 0000000000000..b495d3ff7b692 --- /dev/null +++ b/tests/cases/conformance/generators/generatorReturnTypeFallback.5.ts @@ -0,0 +1,9 @@ +// @target: esnext +// @lib: es5,es2015.iterable +// @noemit: true +// @strict: true + +// Allow generators to fallback to IterableIterator if they do not need a type for the sent value while in strictNullChecks mode. +function* f(): IterableIterator { + yield 1; +} \ No newline at end of file diff --git a/tests/cases/conformance/generators/generatorYieldContextualType.ts b/tests/cases/conformance/generators/generatorYieldContextualType.ts new file mode 100644 index 0000000000000..20cad6a91893c --- /dev/null +++ b/tests/cases/conformance/generators/generatorYieldContextualType.ts @@ -0,0 +1,14 @@ +// @target: esnext +// @strict: true +// @noEmit: true +declare function f1(gen: () => Generator): void; +f1<0, 0, 1>(function* () { + const a = yield 0; + return 0; +}); + +declare function f2(gen: () => Generator | AsyncGenerator): void; +f2<0, 0, 1>(async function* () { + const a = yield 0; + return 0; +}); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixRemoveUnnecessaryAwait.ts b/tests/cases/fourslash/codeFixRemoveUnnecessaryAwait.ts index b8e1de4605e27..3e209cd59f208 100644 --- a/tests/cases/fourslash/codeFixRemoveUnnecessaryAwait.ts +++ b/tests/cases/fourslash/codeFixRemoveUnnecessaryAwait.ts @@ -1,5 +1,6 @@ /// ////declare class C { foo(): void } +////declare function getC(): { Class: C }; ////declare function foo(): string; ////async function f() { //// await ""; @@ -7,6 +8,8 @@ //// (await foo()).toLowerCase(); //// (await 0).toFixed(); //// (await new C).foo(); +//// (await function() { }()); +//// new (await getC()).Class(); ////} verify.codeFix({ @@ -14,6 +17,7 @@ verify.codeFix({ index: 0, newFileContent: `declare class C { foo(): void } +declare function getC(): { Class: C }; declare function foo(): string; async function f() { ""; @@ -21,6 +25,8 @@ async function f() { (await foo()).toLowerCase(); (await 0).toFixed(); (await new C).foo(); + (await function() { }()); + new (await getC()).Class(); }` }); @@ -29,6 +35,7 @@ verify.codeFixAll({ fixId: "removeUnnecessaryAwait", newFileContent: `declare class C { foo(): void } +declare function getC(): { Class: C }; declare function foo(): string; async function f() { ""; @@ -36,5 +43,7 @@ async function f() { foo().toLowerCase(); (0).toFixed(); (new C).foo(); + (function() { } ()); + new (getC()).Class(); }` }); diff --git a/tests/cases/fourslash/completionEntryAfterASIExpressionInClass.ts b/tests/cases/fourslash/completionEntryAfterASIExpressionInClass.ts new file mode 100644 index 0000000000000..61271140ad0af --- /dev/null +++ b/tests/cases/fourslash/completionEntryAfterASIExpressionInClass.ts @@ -0,0 +1,21 @@ +/// + +//// class Parent { +//// protected shouldWork() { +//// console.log(); +//// } +//// } +//// +//// class Child extends Parent { +//// // this assumes ASI, but on next line wants to +//// x = () => 1 +//// shoul/*insideid*/ +//// } +//// +//// class ChildTwo extends Parent { +//// // this assumes ASI, but on next line wants to +//// x = () => 1 +//// /*root*/ //nothing +//// } + +verify.completions({ marker: ["insideid", "root"], includes: "shouldWork", isNewIdentifierLocation: true }); diff --git a/tests/cases/fourslash/completionInFunctionLikeBody_includesPrimitiveTypes.ts b/tests/cases/fourslash/completionInFunctionLikeBody_includesPrimitiveTypes.ts new file mode 100644 index 0000000000000..bc94936ab4353 --- /dev/null +++ b/tests/cases/fourslash/completionInFunctionLikeBody_includesPrimitiveTypes.ts @@ -0,0 +1,27 @@ +/// + +//// class Foo { } +//// class Bar { } +//// function includesTypes() { +//// new Foo ////f -////f(); +////f(); //// ////f2 ////f2 -////f2(); +////f2(); //// ////f2 { const markerName = test.markerName(marker) || ""; - const typeOnly = markerName.endsWith("TypeOnly") || marker.data && marker.data.typeOnly; const valueOnly = markerName.endsWith("ValueOnly"); verify.completions({ marker, - includes: typeOnly ? "Type" : valueOnly ? "x" : ["Type", "x"], - excludes: typeOnly ? "x" : valueOnly ? "Type" : [], + includes: valueOnly ? "x" : "Type", + excludes: valueOnly ? "Type" : "x", isNewIdentifierLocation: marker.data && marker.data.newId || false, }); }); diff --git a/tests/cases/fourslash/completionListIsGlobalCompletion.ts b/tests/cases/fourslash/completionListIsGlobalCompletion.ts index ea89155a771c4..91cd1a0f9c7e5 100644 --- a/tests/cases/fourslash/completionListIsGlobalCompletion.ts +++ b/tests/cases/fourslash/completionListIsGlobalCompletion.ts @@ -48,5 +48,5 @@ verify.completions( { marker: "13", exact: globals, isGlobalCompletion: false }, { marker: "15", exact: globals, isGlobalCompletion: true, isNewIdentifierLocation: true }, { marker: "16", exact: [...x, completion.globalThisEntry, ...completion.globalsVars, completion.undefinedVarEntry], isGlobalCompletion: false }, - { marker: "17", exact: completion.globalKeywordsPlusUndefined, isGlobalCompletion: false }, + { marker: "17", exact: completion.globalKeywords, isGlobalCompletion: false }, ); diff --git a/tests/cases/fourslash/completionsAfterLessThanToken.ts b/tests/cases/fourslash/completionsAfterLessThanToken.ts new file mode 100644 index 0000000000000..c236f85e1fe62 --- /dev/null +++ b/tests/cases/fourslash/completionsAfterLessThanToken.ts @@ -0,0 +1,12 @@ +/// + +//// function f() { +//// const k: Record - -//@noEmit: true - -//@Filename: /package.json -////{ -//// "dependencies": { -//// "react": "*" -//// } -////} - -//@Filename: /node_modules/@types/react/index.d.ts -////export declare var React: any; - -//@Filename: /node_modules/@types/react/package.json -////{ -//// "name": "@types/react" -////} - -//@Filename: /node_modules/@types/fake-react/index.d.ts -////export declare var ReactFake: any; - -//@Filename: /node_modules/@types/fake-react/package.json -////{ -//// "name": "@types/fake-react" -////} - -//@Filename: /src/index.ts -////const x = Re/**/ - -verify.completions({ - marker: test.marker(""), - isNewIdentifierLocation: true, - includes: { - name: "React", - hasAction: true, - source: "/node_modules/@types/react/index", - sortText: completion.SortText.AutoImportSuggestions - }, - excludes: "ReactFake", - preferences: { - includeCompletionsForModuleExports: true - } -}); diff --git a/tests/cases/fourslash/completionsImport_filteredByPackageJson_@typesOnly.ts b/tests/cases/fourslash/completionsImport_filteredByPackageJson_@typesOnly.ts deleted file mode 100644 index b0d2c01e3dbe9..0000000000000 --- a/tests/cases/fourslash/completionsImport_filteredByPackageJson_@typesOnly.ts +++ /dev/null @@ -1,44 +0,0 @@ -/// - -//@noEmit: true - -//@Filename: /package.json -////{ -//// "devDependencies": { -//// "@types/react": "*" -//// } -////} - -//@Filename: /node_modules/@types/react/index.d.ts -////export declare var React: any; - -//@Filename: /node_modules/@types/react/package.json -////{ -//// "name": "@types/react" -////} - -//@Filename: /node_modules/@types/fake-react/index.d.ts -////export declare var ReactFake: any; - -//@Filename: /node_modules/@types/fake-react/package.json -////{ -//// "name": "@types/fake-react" -////} - -//@Filename: /src/index.ts -////const x = Re/**/ - -verify.completions({ - marker: test.marker(""), - isNewIdentifierLocation: true, - includes: { - name: "React", - hasAction: true, - source: "/node_modules/@types/react/index", - sortText: completion.SortText.AutoImportSuggestions - }, - excludes: "ReactFake", - preferences: { - includeCompletionsForModuleExports: true - } -}); diff --git a/tests/cases/fourslash/completionsImport_filteredByPackageJson_ambient.ts b/tests/cases/fourslash/completionsImport_filteredByPackageJson_ambient.ts deleted file mode 100644 index 3dcb9eb66904f..0000000000000 --- a/tests/cases/fourslash/completionsImport_filteredByPackageJson_ambient.ts +++ /dev/null @@ -1,30 +0,0 @@ -/// - -//@noEmit: true - -//@Filename: /package.json -////{ -//// "dependencies": { -//// } -////} - -//@Filename: /node_modules/@types/node/timers.d.ts -////declare module "timers" { -//// function setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timeout; -////} - -//@Filename: /node_modules/@types/node/package.json -////{ -//// "name": "@types/node", -////} - -//@Filename: /src/index.ts -////setTimeo/**/ - -verify.completions({ - marker: test.marker(""), - exact: completion.globals, - preferences: { - includeCompletionsForModuleExports: true - } -}); diff --git a/tests/cases/fourslash/completionsImport_filteredByPackageJson_direct.ts b/tests/cases/fourslash/completionsImport_filteredByPackageJson_direct.ts deleted file mode 100644 index aa7845daed3d1..0000000000000 --- a/tests/cases/fourslash/completionsImport_filteredByPackageJson_direct.ts +++ /dev/null @@ -1,46 +0,0 @@ -/// - -//@noEmit: true - -//@Filename: /package.json -////{ -//// "dependencies": { -//// "react": "*" -//// } -////} - -//@Filename: /node_modules/react/index.d.ts -////export declare var React: any; - -//@Filename: /node_modules/react/package.json -////{ -//// "name": "react", -//// "types": "./index.d.ts" -////} - -//@Filename: /node_modules/fake-react/index.d.ts -////export declare var ReactFake: any; - -//@Filename: /node_modules/fake-react/package.json -////{ -//// "name": "fake-react", -//// "types": "./index.d.ts" -////} - -//@Filename: /src/index.ts -////const x = Re/**/ - -verify.completions({ - marker: test.marker(""), - isNewIdentifierLocation: true, - includes: { - name: "React", - hasAction: true, - source: "/node_modules/react/index", - sortText: completion.SortText.AutoImportSuggestions - }, - excludes: "ReactFake", - preferences: { - includeCompletionsForModuleExports: true - } -}); diff --git a/tests/cases/fourslash/completionsImport_filteredByPackageJson_nested.ts b/tests/cases/fourslash/completionsImport_filteredByPackageJson_nested.ts deleted file mode 100644 index e940c43e32c6d..0000000000000 --- a/tests/cases/fourslash/completionsImport_filteredByPackageJson_nested.ts +++ /dev/null @@ -1,66 +0,0 @@ -/// - -//@noEmit: true - -//@Filename: /package.json -////{ -//// "dependencies": { -//// "react": "*" -//// } -////} - -//@Filename: /node_modules/react/index.d.ts -////export declare var React: any; - -//@Filename: /node_modules/react/package.json -////{ -//// "name": "react", -//// "types": "./index.d.ts" -////} - -//@Filename: /dir/package.json -////{ -//// "dependencies": { -//// "redux": "*" -//// } -////} - -//@Filename: /dir/node_modules/redux/package.json -////{ -//// "name": "redux", -//// "types": "./index.d.ts" -////} - -//@Filename: /dir/node_modules/redux/index.d.ts -////export declare var Redux: any; - -//@Filename: /dir/index.ts -////const x = Re/**/ - -verify.completions({ - marker: test.marker(""), - isNewIdentifierLocation: true, - includes: { - name: "React", - hasAction: true, - source: "/node_modules/react/index", - sortText: completion.SortText.AutoImportSuggestions - }, - preferences: { - includeCompletionsForModuleExports: true - } -}); - -verify.completions({ - marker: test.marker(""), - isNewIdentifierLocation: true, - includes: { - name: "Redux", - hasAction: true, - source: "/dir/node_modules/redux/index", - sortText: completion.SortText.AutoImportSuggestions - }, - preferences: { - includeCompletionsForModuleExports: true - } -}); diff --git a/tests/cases/fourslash/completionsImport_filteredByPackageJson_reexport.ts b/tests/cases/fourslash/completionsImport_filteredByPackageJson_reexport.ts deleted file mode 100644 index 8e17a3c3a449b..0000000000000 --- a/tests/cases/fourslash/completionsImport_filteredByPackageJson_reexport.ts +++ /dev/null @@ -1,58 +0,0 @@ -/// - -//@noEmit: true - -//@Filename: /package.json -////{ -//// "dependencies": { -//// "@emotion/core": "*" -//// } -////} - -//@Filename: /node_modules/@emotion/css/index.d.ts -////export declare const css: any; -////const css2: any; -////export { css2 }; - -//@Filename: /node_modules/@emotion/css/package.json -////{ -//// "name": "@emotion/css", -//// "types": "./index.d.ts" -////} - -//@Filename: /node_modules/@emotion/core/index.d.ts -////import { css2 } from "@emotion/css"; -////export { css } from "@emotion/css"; -////export { css2 }; - -//@Filename: /node_modules/@emotion/core/package.json -////{ -//// "name": "@emotion/core", -//// "types": "./index.d.ts" -////} - -//@Filename: /src/index.ts -////cs/**/ - -verify.completions({ - marker: test.marker(""), - includes: [ - completion.undefinedVarEntry, - { - name: "css", - source: "/node_modules/@emotion/core/index", - hasAction: true, - sortText: completion.SortText.AutoImportSuggestions - }, - { - name: "css2", - source: "/node_modules/@emotion/core/index", - hasAction: true, - sortText: completion.SortText.AutoImportSuggestions - }, - ...completion.statementKeywordsWithTypes - ], - preferences: { - includeCompletionsForModuleExports: true - } -}); diff --git a/tests/cases/fourslash/completionsImport_filteredByPackageJson_reexport2.ts b/tests/cases/fourslash/completionsImport_filteredByPackageJson_reexport2.ts deleted file mode 100644 index eb946ce17b42c..0000000000000 --- a/tests/cases/fourslash/completionsImport_filteredByPackageJson_reexport2.ts +++ /dev/null @@ -1,58 +0,0 @@ -/// - -//@noEmit: true - -//@Filename: /package.json -////{ -//// "dependencies": { -//// "b_": "*", -//// "_c": "*" -//// } -////} - -//@Filename: /node_modules/a/index.d.ts -////export const foo = 0; - -//@Filename: /node_modules/a/package.json -////{ -//// "name": "a", -//// "types": "./index.d.ts" -////} - -//@Filename: /node_modules/b_/index.d.ts -////export { foo } from "a"; - -//@Filename: /node_modules/b_/package.json -////{ -//// "name": "b_", -//// "types": "./index.d.ts" -////} - -//@Filename: /node_modules/_c/index.d.ts -////export { foo } from "b_"; - -//@Filename: /node_modules/_c/package.json -////{ -//// "name": "_c", -//// "types": "./index.d.ts" -////} - -//@Filename: /src/index.ts -////fo/**/ - -verify.completions({ - marker: test.marker(""), - includes: [ - completion.undefinedVarEntry, - { - name: "foo", - source: "/node_modules/b_/index", - hasAction: true, - sortText: completion.SortText.AutoImportSuggestions - }, - ...completion.statementKeywordsWithTypes - ], - preferences: { - includeCompletionsForModuleExports: true - } -}); diff --git a/tests/cases/fourslash/completionsImport_filteredByPackageJson_reexport3.ts b/tests/cases/fourslash/completionsImport_filteredByPackageJson_reexport3.ts deleted file mode 100644 index 8533461e0b805..0000000000000 --- a/tests/cases/fourslash/completionsImport_filteredByPackageJson_reexport3.ts +++ /dev/null @@ -1,48 +0,0 @@ -/// - -//@noEmit: true - -//@Filename: /package.json -////{ -//// "dependencies": { -//// "b": "*", -//// } -////} - -//@Filename: /node_modules/a/index.d.ts -////export const foo = 0; - -//@Filename: /node_modules/a/package.json -////{ -//// "name": "a", -//// "types": "./index.d.ts" -////} - -//@Filename: /node_modules/b/index.d.ts -////export * from "a"; - -//@Filename: /node_modules/b/package.json -////{ -//// "name": "b", -//// "types": "./index.d.ts" -////} - -//@Filename: /src/index.ts -////fo/**/ - -verify.completions({ - marker: test.marker(""), - includes: [ - completion.undefinedVarEntry, - { - name: "foo", - source: "/node_modules/b/index", - hasAction: true, - sortText: completion.SortText.AutoImportSuggestions - }, - ...completion.statementKeywordsWithTypes - ], - preferences: { - includeCompletionsForModuleExports: true - } -}); diff --git a/tests/cases/fourslash/completionsImport_filteredByPackageJson_reexport4.ts b/tests/cases/fourslash/completionsImport_filteredByPackageJson_reexport4.ts deleted file mode 100644 index 83ac6526b2586..0000000000000 --- a/tests/cases/fourslash/completionsImport_filteredByPackageJson_reexport4.ts +++ /dev/null @@ -1,57 +0,0 @@ -/// - -//@noEmit: true - -//@Filename: /package.json -////{ -//// "dependencies": { -//// "c": "*", -//// } -////} - -//@Filename: /node_modules/a/index.d.ts -////export const foo = 0; - -//@Filename: /node_modules/a/package.json -////{ -//// "name": "a", -//// "types": "./index.d.ts" -////} - -//@Filename: /node_modules/b/index.d.ts -////export * from "a"; - -//@Filename: /node_modules/b/package.json -////{ -//// "name": "b", -//// "types": "./index.d.ts" -////} - -//@Filename: /node_modules/c/index.d.ts -////export * from "a"; - -//@Filename: /node_modules/c/package.json -////{ -//// "name": "c", -//// "types": "./index.d.ts" -////} - -//@Filename: /src/index.ts -////fo/**/ - -verify.completions({ - marker: test.marker(""), - includes: [ - completion.undefinedVarEntry, - { - name: "foo", - source: "/node_modules/c/index", - hasAction: true, - sortText: completion.SortText.AutoImportSuggestions - }, - ...completion.statementKeywordsWithTypes - ], - preferences: { - includeCompletionsForModuleExports: true - } -}); diff --git a/tests/cases/fourslash/completionsImport_ofAlias.ts b/tests/cases/fourslash/completionsImport_ofAlias.ts index 1319391eb0bf1..9a9cb4a2b18c1 100644 --- a/tests/cases/fourslash/completionsImport_ofAlias.ts +++ b/tests/cases/fourslash/completionsImport_ofAlias.ts @@ -16,9 +16,6 @@ // @Filename: /a_reexport_2.ts ////export * from "./a"; -// @Filename: /a_reexport_3.ts -////export { foo } from "./a_reexport"; - // @Filename: /b.ts ////fo/**/ @@ -27,13 +24,13 @@ verify.completions({ includes: [ completion.undefinedVarEntry, { - name: "foo", - source: "/a", - sourceDisplay: "./a", - text: "(alias) const foo: 0\nexport foo", - kind: "alias", - hasAction: true, - sortText: completion.SortText.AutoImportSuggestions + name: "foo", + source: "/a", + sourceDisplay: "./a", + text: "(alias) const foo: 0\nexport foo", + kind: "alias", + hasAction: true, + sortText: completion.SortText.AutoImportSuggestions }, ...completion.statementKeywordsWithTypes, ], diff --git a/tests/cases/fourslash/completionsIsPossiblyTypeArgumentPosition.ts b/tests/cases/fourslash/completionsIsPossiblyTypeArgumentPosition.ts index 4161c31b795e3..704fe0d8347a0 100644 --- a/tests/cases/fourslash/completionsIsPossiblyTypeArgumentPosition.ts +++ b/tests/cases/fourslash/completionsIsPossiblyTypeArgumentPosition.ts @@ -9,11 +9,11 @@ ////x + {| "valueOnly": true |} ////x < {| "valueOnly": true |} ////f < {| "valueOnly": true |} -////g < {| "valueOnly": false |} -////const something: C<{| "valueOnly": false |}; -////const something2: C(): callAndConstruct; (): string; }; ////interface callAndConstruct {} @@ -24,7 +24,7 @@ for (const marker of test.markers()) { verify.completions({ marker, includes: "x", excludes: "T" }); } else { - verify.completions({ marker, includes: ["x", "T"] }); + verify.completions({ marker, includes: "T", excludes: "x" }); } } diff --git a/tests/cases/fourslash/completionsTypeAssertionKeywords.ts b/tests/cases/fourslash/completionsTypeAssertionKeywords.ts new file mode 100644 index 0000000000000..100ab6e51e25e --- /dev/null +++ b/tests/cases/fourslash/completionsTypeAssertionKeywords.ts @@ -0,0 +1,13 @@ +/// + +////const a = { +//// b: 42 as /*0*/ +////}; +//// +////1 as /*1*/ +//// +////const b = 42 as /*2*/ +//// +////var c = 42 + +verify.completions({ marker: test.markers(), exact: completion.typeAssertionKeywords }); diff --git a/tests/cases/fourslash/consistenceOnIndentionsOfObjectsInAListAfterFormatting.ts b/tests/cases/fourslash/consistenceOnIndentionsOfObjectsInAListAfterFormatting.ts index 14ada2060267c..bbcdaec9cad6b 100644 --- a/tests/cases/fourslash/consistenceOnIndentionsOfObjectsInAListAfterFormatting.ts +++ b/tests/cases/fourslash/consistenceOnIndentionsOfObjectsInAListAfterFormatting.ts @@ -8,4 +8,4 @@ format.document(); goTo.marker("1"); verify.currentLineContentIs("}, {"); goTo.marker("2"); -verify.currentLineContentIs(" });"); \ No newline at end of file +verify.currentLineContentIs("});"); diff --git a/tests/cases/fourslash/documentHighlightsInvalidModifierLocations.ts b/tests/cases/fourslash/documentHighlightsInvalidModifierLocations.ts index f008e63246461..baa203901fd26 100644 --- a/tests/cases/fourslash/documentHighlightsInvalidModifierLocations.ts +++ b/tests/cases/fourslash/documentHighlightsInvalidModifierLocations.ts @@ -6,5 +6,5 @@ ////function f([|readonly|] p) {} for (const r of test.ranges()) { - verify.documentHighlightsOf(r, [r]); + verify.documentHighlightsOf(r, test.ranges()); } diff --git a/tests/cases/fourslash/formatMultipleFunctionArguments.ts b/tests/cases/fourslash/formatMultipleFunctionArguments.ts new file mode 100644 index 0000000000000..32e6d0eea8971 --- /dev/null +++ b/tests/cases/fourslash/formatMultipleFunctionArguments.ts @@ -0,0 +1,44 @@ +/// + +//// +//// someRandomFunction({ +//// prop1: 1, +//// prop2: 2 +//// }, { +//// prop3: 3, +//// prop4: 4 +//// }, { +//// prop5: 5, +//// prop6: 6 +//// }); +//// +//// someRandomFunction( +//// { prop7: 1, prop8: 2 }, +//// { prop9: 3, prop10: 4 }, +//// { +//// prop11: 5, +//// prop2: 6 +//// } +//// ); + +format.document(); +verify.currentFileContentIs(` +someRandomFunction({ + prop1: 1, + prop2: 2 +}, { + prop3: 3, + prop4: 4 +}, { + prop5: 5, + prop6: 6 +}); + +someRandomFunction( + { prop7: 1, prop8: 2 }, + { prop9: 3, prop10: 4 }, + { + prop11: 5, + prop2: 6 + } +);`); diff --git a/tests/cases/fourslash/fourslash.ts b/tests/cases/fourslash/fourslash.ts index d74523ea7fd67..cbb6df28585d3 100644 --- a/tests/cases/fourslash/fourslash.ts +++ b/tests/cases/fourslash/fourslash.ts @@ -685,7 +685,6 @@ declare namespace completion { export const globalInJsKeywords: ReadonlyArray; export const insideMethodKeywords: ReadonlyArray; export const insideMethodInJsKeywords: ReadonlyArray; - export const globalKeywordsPlusUndefined: ReadonlyArray; export const globalsVars: ReadonlyArray; export function globalsInsideFunction(plus: ReadonlyArray): ReadonlyArray; export function globalsInJsInsideFunction(plus: ReadonlyArray): ReadonlyArray; @@ -696,6 +695,7 @@ declare namespace completion { export const typeKeywords: ReadonlyArray; export const globalTypes: ReadonlyArray; export function globalTypesPlus(plus: ReadonlyArray): ReadonlyArray; + export const typeAssertionKeywords: ReadonlyArray; export const classElementKeywords: ReadonlyArray; export const classElementInJsKeywords: ReadonlyArray; export const constructorParameterKeywords: ReadonlyArray; diff --git a/tests/cases/fourslash/getJSXOutliningSpans.tsx b/tests/cases/fourslash/getJSXOutliningSpans.tsx index fa4f541b1939b..f00eac19d5cd0 100644 --- a/tests/cases/fourslash/getJSXOutliningSpans.tsx +++ b/tests/cases/fourslash/getJSXOutliningSpans.tsx @@ -25,9 +25,12 @@ //// md: 5 //// }|]}|] //// /> +//// [|<> +//// text +//// |] //// |] //// ); //// }|] ////}|] -verify.outliningSpansInCurrentFile(test.ranges(), "code"); +verify.outliningSpansInCurrentFile(test.ranges(), "code"); \ No newline at end of file diff --git a/tests/cases/fourslash/importNameCodeFixNewImportNodeModules8.ts b/tests/cases/fourslash/importNameCodeFixNewImportNodeModules8.ts index acfddd587f7ae..f048f0d30d253 100644 --- a/tests/cases/fourslash/importNameCodeFixNewImportNodeModules8.ts +++ b/tests/cases/fourslash/importNameCodeFixNewImportNodeModules8.ts @@ -3,7 +3,7 @@ //// [|f1/*0*/('');|] // @Filename: package.json -//// { "dependencies": { "@scope/package-name": "latest" } } +//// { "dependencies": { "package-name": "latest" } } // @Filename: node_modules/@scope/package-name/bin/lib/index.d.ts //// export function f1(text: string): string; diff --git a/tests/cases/user/prettier/prettier b/tests/cases/user/prettier/prettier index 1e471a007968b..7f938c71ffda2 160000 --- a/tests/cases/user/prettier/prettier +++ b/tests/cases/user/prettier/prettier @@ -1 +1 @@ -Subproject commit 1e471a007968b7490563b91ed6909ae6046f3fe8 +Subproject commit 7f938c71ffda293eb1b69adf8bd12b7c11f9113b