Merge branch 'master'

This commit is contained in:
Josh Goldberg
2020-05-04 19:54:30 -04:00
444 changed files with 8486 additions and 1763 deletions
+1 -1
View File
@@ -14,6 +14,6 @@ contact_links:
name: "TypeScript FAQ"
url: "https://github.com/microsoft/TypeScript/wiki/FAQ"
-
about: "Please raise issues about the site on it's own repo."
about: "Please raise issues about the site on its own repo."
name: Website
url: "https://github.com/microsoft/TypeScript-Website/issues/new"
+1 -1
View File
@@ -2,7 +2,7 @@
"name": "typescript",
"author": "Microsoft Corp.",
"homepage": "https://www.typescriptlang.org/",
"version": "3.9.0",
"version": "4.0.0",
"license": "Apache-2.0",
"description": "TypeScript is a language for application scale JavaScript development",
"keywords": [
+6 -16
View File
@@ -320,16 +320,6 @@ namespace ts {
}
}
function setValueDeclaration(symbol: Symbol, node: Declaration): void {
const { valueDeclaration } = symbol;
if (!valueDeclaration ||
(isAssignmentDeclaration(valueDeclaration) && !isAssignmentDeclaration(node)) ||
(valueDeclaration.kind !== node.kind && isEffectiveModuleDeclaration(valueDeclaration))) {
// other kinds of value declarations take precedence over modules and assignment declarations
symbol.valueDeclaration = node;
}
}
// Should not be called on a declaration with a computed property name,
// unless it is a well known Symbol.
function getDeclarationName(node: Declaration): __String | undefined {
@@ -423,7 +413,7 @@ namespace ts {
function declareSymbol(symbolTable: SymbolTable, parent: Symbol | undefined, node: Declaration, includes: SymbolFlags, excludes: SymbolFlags, isReplaceableByMethod?: boolean): Symbol {
Debug.assert(!hasDynamicName(node));
const isDefaultExport = hasModifier(node, ModifierFlags.Default);
const isDefaultExport = hasModifier(node, ModifierFlags.Default) || isExportSpecifier(node) && node.name.escapedText === "default";
// The exported symbol for an export default function/class node is always named "default"
const name = isDefaultExport && parent ? InternalSymbolName.Default : getDeclarationName(node);
@@ -659,7 +649,7 @@ namespace ts {
}
// We create a return control flow graph for IIFEs and constructors. For constructors
// we use the return control flow graph in strict property initialization checks.
currentReturnTarget = isIIFE || node.kind === SyntaxKind.Constructor ? createBranchLabel() : undefined;
currentReturnTarget = isIIFE || node.kind === SyntaxKind.Constructor || (isInJSFile && (node.kind === SyntaxKind.FunctionDeclaration || node.kind === SyntaxKind.FunctionExpression)) ? createBranchLabel() : undefined;
currentExceptionTarget = undefined;
currentBreakTarget = undefined;
currentContinueTarget = undefined;
@@ -680,8 +670,8 @@ namespace ts {
if (currentReturnTarget) {
addAntecedent(currentReturnTarget, currentFlow);
currentFlow = finishFlowLabel(currentReturnTarget);
if (node.kind === SyntaxKind.Constructor) {
(<ConstructorDeclaration>node).returnFlowNode = currentFlow;
if (node.kind === SyntaxKind.Constructor || (isInJSFile && (node.kind === SyntaxKind.FunctionDeclaration || node.kind === SyntaxKind.FunctionExpression))) {
(<FunctionLikeDeclaration>node).returnFlowNode = currentFlow;
}
}
if (!isIIFE) {
@@ -2974,7 +2964,7 @@ namespace ts {
function bindSpecialPropertyAssignment(node: BindablePropertyAssignmentExpression) {
// Class declarations in Typescript do not allow property declarations
const parentSymbol = lookupSymbolForPropertyAccess(node.left.expression);
const parentSymbol = lookupSymbolForPropertyAccess(node.left.expression, container) || lookupSymbolForPropertyAccess(node.left.expression, blockScopeContainer) ;
if (!isInJSFile(node) && !isFunctionSymbol(parentSymbol)) {
return;
}
@@ -3083,7 +3073,7 @@ namespace ts {
}
function bindPropertyAssignment(name: BindableStaticNameExpression, propertyAccess: BindableStaticAccessExpression, isPrototypeProperty: boolean, containerIsClass: boolean) {
let namespaceSymbol = lookupSymbolForPropertyAccess(name);
let namespaceSymbol = lookupSymbolForPropertyAccess(name, container) || lookupSymbolForPropertyAccess(name, blockScopeContainer);
const isToplevel = isTopLevelNamespaceAssignment(propertyAccess);
namespaceSymbol = bindPotentiallyMissingNamespaces(namespaceSymbol, propertyAccess.expression, isToplevel, isPrototypeProperty, containerIsClass);
bindPotentiallyNewExpandoMemberToNamespace(propertyAccess, namespaceSymbol, isPrototypeProperty);
+409 -170
View File
@@ -55,7 +55,9 @@ namespace ts {
const enum WideningKind {
Normal,
GeneratorYield
FunctionReturn,
GeneratorNext,
GeneratorYield,
}
const enum TypeFacts {
@@ -404,6 +406,7 @@ namespace ts {
},
getParameterType: getTypeAtPosition,
getPromisedTypeOfPromise,
getAwaitedType: type => getAwaitedType(type),
getReturnTypeOfSignature,
isNullableType,
getNullableType,
@@ -825,6 +828,7 @@ namespace ts {
/** Key is "/path/to/a.ts|/path/to/b.ts". */
let amalgamatedDuplicates: Map<DuplicateInfoForFiles> | undefined;
const reverseMappedCache = createMap<Type | undefined>();
let inInferTypeForHomomorphicMappedType = false;
let ambientModulesCache: Symbol[] | undefined;
/**
* List of every ambient module with a "*" wildcard.
@@ -1113,12 +1117,8 @@ namespace ts {
target.constEnumOnlyModule = false;
}
target.flags |= source.flags;
if (source.valueDeclaration &&
(!target.valueDeclaration ||
isAssignmentDeclaration(target.valueDeclaration) && !isAssignmentDeclaration(source.valueDeclaration) ||
isEffectiveModuleDeclaration(target.valueDeclaration) && !isEffectiveModuleDeclaration(source.valueDeclaration))) {
// other kinds of value declarations take precedence over modules and assignment declarations
target.valueDeclaration = source.valueDeclaration;
if (source.valueDeclaration) {
setValueDeclaration(target, source.valueDeclaration);
}
addRange(target.declarations, source.declarations);
if (source.members) {
@@ -1366,7 +1366,7 @@ namespace ts {
return sourceFiles.indexOf(declarationFile) <= sourceFiles.indexOf(useFile);
}
if (declaration.pos <= usage.pos) {
if (declaration.pos <= usage.pos && !(isPropertyDeclaration(declaration) && isThisProperty(usage.parent) && !declaration.initializer && !declaration.exclamationToken)) {
// declaration is before usage
if (declaration.kind === SyntaxKind.BindingElement) {
// still might be illegal if declaration and usage are both binding elements (eg var [a = b, b = b] = [1, 2])
@@ -1423,9 +1423,10 @@ namespace ts {
return true;
}
if (isUsedInFunctionOrInstanceProperty(usage, declaration)) {
if (compilerOptions.target === ScriptTarget.ESNext && !!compilerOptions.useDefineForClassFields && getContainingClass(declaration)) {
return (isPropertyDeclaration(declaration) || isParameterPropertyDeclaration(declaration, declaration.parent)) &&
!isPropertyImmediatelyReferencedWithinDeclaration(declaration, usage, /*stopAtAnyPropertyDeclaration*/ true);
if (compilerOptions.target === ScriptTarget.ESNext && !!compilerOptions.useDefineForClassFields
&& getContainingClass(declaration)
&& (isPropertyDeclaration(declaration) || isParameterPropertyDeclaration(declaration, declaration.parent))) {
return !isPropertyImmediatelyReferencedWithinDeclaration(declaration, usage, /*stopAtAnyPropertyDeclaration*/ true);
}
else {
return true;
@@ -1526,6 +1527,63 @@ namespace ts {
}
}
function useOuterVariableScopeInParameter(result: Symbol, location: Node, lastLocation: Node) {
const target = getEmitScriptTarget(compilerOptions);
const functionLocation = <FunctionLikeDeclaration>location;
if (isParameter(lastLocation) && functionLocation.body && result.valueDeclaration.pos >= functionLocation.body.pos && result.valueDeclaration.end <= functionLocation.body.end) {
// check for several cases where we introduce temporaries that require moving the name/initializer of the parameter to the body
// - static field in a class expression
// - optional chaining pre-es2020
// - nullish coalesce pre-es2020
// - spread assignment in binding pattern pre-es2017
if (target >= ScriptTarget.ES2015) {
const links = getNodeLinks(functionLocation);
if (links.declarationRequiresScopeChange === undefined) {
links.declarationRequiresScopeChange = forEach(functionLocation.parameters, requiresScopeChange) || false;
}
return !links.declarationRequiresScopeChange;
}
}
return false;
function requiresScopeChange(node: ParameterDeclaration): boolean {
return requiresScopeChangeWorker(node.name)
|| !!node.initializer && requiresScopeChangeWorker(node.initializer);
}
function requiresScopeChangeWorker(node: Node): boolean {
switch (node.kind) {
case SyntaxKind.ArrowFunction:
case SyntaxKind.FunctionExpression:
case SyntaxKind.FunctionDeclaration:
case SyntaxKind.Constructor:
// do not descend into these
return false;
case SyntaxKind.MethodDeclaration:
case SyntaxKind.GetAccessor:
case SyntaxKind.SetAccessor:
case SyntaxKind.PropertyAssignment:
return requiresScopeChangeWorker((node as MethodDeclaration | AccessorDeclaration | PropertyAssignment).name);
case SyntaxKind.PropertyDeclaration:
// static properties in classes introduce temporary variables
if (hasStaticModifier(node)) {
return target < ScriptTarget.ESNext || !compilerOptions.useDefineForClassFields;
}
return requiresScopeChangeWorker((node as PropertyDeclaration).name);
default:
// null coalesce and optional chain pre-es2020 produce temporary variables
if (isNullishCoalesce(node) || isOptionalChain(node)) {
return target < ScriptTarget.ES2020;
}
if (isBindingElement(node) && node.dotDotDotToken && isObjectBindingPattern(node.parent)) {
return target < ScriptTarget.ES2017;
}
if (isTypeNode(node)) return false;
return forEachChild(node, requiresScopeChangeWorker) || false;
}
}
}
/**
* Resolve a given name for a given meaning at a given location. An error is reported if the name was not found and
* the nameNotFoundMessage argument is not undefined. Returns the resolved symbol, or undefined if no symbol with
@@ -1560,7 +1618,7 @@ namespace ts {
let lastLocation: Node | undefined;
let lastSelfReferenceLocation: Node | undefined;
let propertyWithInvalidInitializer: Node | undefined;
let associatedDeclarationForContainingInitializer: ParameterDeclaration | BindingElement | undefined;
let associatedDeclarationForContainingInitializerOrBindingName: ParameterDeclaration | BindingElement | undefined;
let withinDeferredContext = false;
const errorLocation = location;
let grandparent: Node;
@@ -1589,9 +1647,7 @@ namespace ts {
}
if (meaning & result.flags & SymbolFlags.Variable) {
// expression inside parameter will lookup as normal variable scope when targeting es2015+
const functionLocation = <FunctionLikeDeclaration>location;
if (compilerOptions.target && compilerOptions.target >= ScriptTarget.ES2015 && isParameter(lastLocation) &&
functionLocation.body && result.valueDeclaration.pos >= functionLocation.body.pos && result.valueDeclaration.end <= functionLocation.body.end) {
if (useOuterVariableScopeInParameter(result, location, lastLocation)) {
useResult = false;
}
else if (result.flags & SymbolFlags.FunctionScopedVariable) {
@@ -1819,15 +1875,21 @@ namespace ts {
location = getJSDocHost(location);
break;
case SyntaxKind.Parameter:
if (lastLocation && lastLocation === (location as ParameterDeclaration).initializer) {
associatedDeclarationForContainingInitializer = location as ParameterDeclaration;
if (lastLocation && (
lastLocation === (location as ParameterDeclaration).initializer ||
lastLocation === (location as ParameterDeclaration).name && isBindingPattern(lastLocation))) {
if (!associatedDeclarationForContainingInitializerOrBindingName) {
associatedDeclarationForContainingInitializerOrBindingName = location as ParameterDeclaration;
}
}
break;
case SyntaxKind.BindingElement:
if (lastLocation && lastLocation === (location as BindingElement).initializer) {
if (lastLocation && (
lastLocation === (location as BindingElement).initializer ||
lastLocation === (location as BindingElement).name && isBindingPattern(lastLocation))) {
const root = getRootDeclaration(location);
if (root.kind === SyntaxKind.Parameter) {
associatedDeclarationForContainingInitializer = location as BindingElement;
associatedDeclarationForContainingInitializerOrBindingName = location as BindingElement;
}
}
break;
@@ -1938,17 +2000,17 @@ namespace ts {
}
}
// If we're in a parameter initializer, we can't reference the values of the parameter whose initializer we're within or parameters to the right
if (result && associatedDeclarationForContainingInitializer && !withinDeferredContext && (meaning & SymbolFlags.Value) === SymbolFlags.Value) {
// If we're in a parameter initializer or binding name, we can't reference the values of the parameter whose initializer we're within or parameters to the right
if (result && associatedDeclarationForContainingInitializerOrBindingName && !withinDeferredContext && (meaning & SymbolFlags.Value) === SymbolFlags.Value) {
const candidate = getMergedSymbol(getLateBoundSymbol(result));
const root = (getRootDeclaration(associatedDeclarationForContainingInitializer) as ParameterDeclaration);
const root = (getRootDeclaration(associatedDeclarationForContainingInitializerOrBindingName) as ParameterDeclaration);
// A parameter initializer or binding pattern initializer within a parameter cannot refer to itself
if (candidate === getSymbolOfNode(associatedDeclarationForContainingInitializer)) {
error(errorLocation, Diagnostics.Parameter_0_cannot_be_referenced_in_its_initializer, declarationNameToString(associatedDeclarationForContainingInitializer.name));
if (candidate === getSymbolOfNode(associatedDeclarationForContainingInitializerOrBindingName)) {
error(errorLocation, Diagnostics.Parameter_0_cannot_reference_itself, declarationNameToString(associatedDeclarationForContainingInitializerOrBindingName.name));
}
// And it cannot refer to any declarations which come after it
else if (candidate.valueDeclaration && candidate.valueDeclaration.pos > associatedDeclarationForContainingInitializer.pos && root.parent.locals && lookup(root.parent.locals, candidate.escapedName, meaning) === candidate) {
error(errorLocation, Diagnostics.Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it, declarationNameToString(associatedDeclarationForContainingInitializer.name), declarationNameToString(<Identifier>errorLocation));
else if (candidate.valueDeclaration && candidate.valueDeclaration.pos > associatedDeclarationForContainingInitializerOrBindingName.pos && root.parent.locals && lookup(root.parent.locals, candidate.escapedName, meaning) === candidate) {
error(errorLocation, Diagnostics.Parameter_0_cannot_reference_identifier_1_declared_after_it, declarationNameToString(associatedDeclarationForContainingInitializerOrBindingName.name), declarationNameToString(<Identifier>errorLocation));
}
}
if (result && errorLocation && meaning & SymbolFlags.Value && result.flags & SymbolFlags.Alias) {
@@ -3453,12 +3515,16 @@ namespace ts {
return mapDefined(candidates, candidate => getAliasForSymbolInContainer(candidate, symbol) ? candidate : undefined);
function fileSymbolIfFileSymbolExportEqualsContainer(d: Declaration) {
const fileSymbol = getExternalModuleContainer(d);
const exported = fileSymbol && fileSymbol.exports && fileSymbol.exports.get(InternalSymbolName.ExportEquals);
return exported && container && getSymbolIfSameReference(exported, container) ? fileSymbol : undefined;
return container && getFileSymbolIfFileSymbolExportEqualsContainer(d, container);
}
}
function getFileSymbolIfFileSymbolExportEqualsContainer(d: Declaration, container: Symbol) {
const fileSymbol = getExternalModuleContainer(d);
const exported = fileSymbol && fileSymbol.exports && fileSymbol.exports.get(InternalSymbolName.ExportEquals);
return exported && getSymbolIfSameReference(exported, container) ? fileSymbol : undefined;
}
function getAliasForSymbolInContainer(container: Symbol, symbol: Symbol) {
if (container === getParentOfSymbol(symbol)) {
// fast path, `symbol` is either already the alias or isn't aliased
@@ -4146,8 +4212,12 @@ namespace ts {
context.flags &= ~NodeBuilderFlags.InTypeAlias;
if (!type) {
context.encounteredError = true;
return undefined!; // TODO: GH#18217
if (!(context.flags & NodeBuilderFlags.AllowEmptyUnionOrIntersection)) {
context.encounteredError = true;
return undefined!; // TODO: GH#18217
}
context.approximateLength += 3;
return createKeywordTypeNode(SyntaxKind.AnyKeyword);
}
if (!(context.flags & NodeBuilderFlags.NoTypeReduction)) {
@@ -5074,7 +5144,13 @@ namespace ts {
}
function getSpecifierForModuleSymbol(symbol: Symbol, context: NodeBuilderContext) {
const file = getDeclarationOfKind<SourceFile>(symbol, SyntaxKind.SourceFile);
let file = getDeclarationOfKind<SourceFile>(symbol, SyntaxKind.SourceFile);
if (!file) {
const equivalentFileSymbol = firstDefined(symbol.declarations, d => getFileSymbolIfFileSymbolExportEqualsContainer(d, symbol));
if (equivalentFileSymbol) {
file = getDeclarationOfKind<SourceFile>(equivalentFileSymbol, SyntaxKind.SourceFile);
}
}
if (file && file.moduleName !== undefined) {
// Use the amd name if it is available
return file.moduleName;
@@ -5458,7 +5534,7 @@ namespace ts {
function serializeReturnTypeForSignature(context: NodeBuilderContext, type: Type, signature: Signature, includePrivateSymbol?: (s: Symbol) => void, bundled?: boolean) {
if (type !== errorType && context.enclosingDeclaration) {
const annotation = signature.declaration && getEffectiveReturnTypeNode(signature.declaration);
if (!!findAncestor(annotation, n => n === context.enclosingDeclaration) && annotation && getTypeFromTypeNode(annotation) === type) {
if (!!findAncestor(annotation, n => n === context.enclosingDeclaration) && annotation && instantiateType(getTypeFromTypeNode(annotation), signature.mapper) === type) {
const result = serializeExistingTypeNode(context, annotation, includePrivateSymbol, bundled);
if (result) {
return result;
@@ -5496,6 +5572,9 @@ namespace ts {
if (isJSDocNonNullableType(node)) {
return visitNode(node.type, visitExistingNodeTreeSymbols);
}
if (isJSDocVariadicType(node)) {
return createArrayTypeNode(visitNode((node as JSDocVariadicType).type, visitExistingNodeTreeSymbols));
}
if (isTypeReferenceNode(node) && isIdentifier(node.typeName) && node.typeName.escapedText === "") {
return setOriginalNode(createKeywordTypeNode(SyntaxKind.AnyKeyword), node);
}
@@ -5522,8 +5601,8 @@ namespace ts {
mapDefined(node.parameters, (p, i) => p.name && isIdentifier(p.name) && p.name.escapedText === "new" ? (newTypeNode = p.type, undefined) : createParameter(
/*decorators*/ undefined,
/*modifiers*/ undefined,
p.dotDotDotToken,
p.name || p.dotDotDotToken ? `args` : `arg${i}`,
getEffectiveDotDotDotForParameter(p),
p.name || getEffectiveDotDotDotForParameter(p) ? `args` : `arg${i}`,
p.questionToken,
visitNode(p.type, visitExistingNodeTreeSymbols),
/*initializer*/ undefined
@@ -5537,8 +5616,8 @@ namespace ts {
map(node.parameters, (p, i) => createParameter(
/*decorators*/ undefined,
/*modifiers*/ undefined,
p.dotDotDotToken,
p.name || p.dotDotDotToken ? `args` : `arg${i}`,
getEffectiveDotDotDotForParameter(p),
p.name || getEffectiveDotDotDotForParameter(p) ? `args` : `arg${i}`,
p.questionToken,
visitNode(p.type, visitExistingNodeTreeSymbols),
/*initializer*/ undefined
@@ -5582,6 +5661,10 @@ namespace ts {
return visitEachChild(node, visitExistingNodeTreeSymbols, nullTransformationContext);
function getEffectiveDotDotDotForParameter(p: ParameterDeclaration) {
return p.dotDotDotToken || (p.type && isJSDocVariadicType(p.type) ? createToken(SyntaxKind.DotDotDotToken) : undefined);
}
function rewriteModuleSpecifier(parent: ImportTypeNode, lit: StringLiteral) {
if (bundled) {
if (context.tracker && context.tracker.moduleResolverHost) {
@@ -5854,7 +5937,7 @@ namespace ts {
function serializeSymbolWorker(symbol: Symbol, isPrivate: boolean, propertyAsAlias: boolean) {
const symbolName = unescapeLeadingUnderscores(symbol.escapedName);
const isDefault = symbol.escapedName === InternalSymbolName.Default;
if (isStringANonContextualKeyword(symbolName) && !isDefault) {
if (!(context.flags & NodeBuilderFlags.AllowAnonymousIdentifier) && isStringANonContextualKeyword(symbolName) && !isDefault) {
// Oh no. We cannot use this symbol's name as it's name... It's likely some jsdoc had an invalid name like `export` or `default` :(
context.encounteredError = true;
// TODO: Issue error via symbol tracker?
@@ -6026,14 +6109,19 @@ namespace ts {
serializeAsNamespaceDeclaration(realMembers, localName, modifierFlags, !!(symbol.flags & (SymbolFlags.Function | SymbolFlags.Assignment)));
}
if (length(mergedMembers)) {
const containingFile = getSourceFileOfNode(context.enclosingDeclaration);
const localName = getInternalSymbolName(symbol, symbolName);
const nsBody = createModuleBlock([createExportDeclaration(
/*decorators*/ undefined,
/*modifiers*/ undefined,
createNamedExports(map(filter(mergedMembers, n => n.escapedName !== InternalSymbolName.ExportEquals), s => {
createNamedExports(mapDefined(filter(mergedMembers, n => n.escapedName !== InternalSymbolName.ExportEquals), s => {
const name = unescapeLeadingUnderscores(s.escapedName);
const localName = getInternalSymbolName(s, name);
const aliasDecl = s.declarations && getDeclarationOfAliasSymbol(s);
if (containingFile && (aliasDecl ? containingFile !== getSourceFileOfNode(aliasDecl) : !some(s.declarations, d => getSourceFileOfNode(d) === containingFile))) {
context.tracker?.reportNonlocalAugmentation?.(containingFile, symbol, s);
return undefined;
}
const target = aliasDecl && getTargetOfAliasDeclaration(aliasDecl, /*dontRecursivelyResolve*/ true);
includePrivateSymbol(target || s);
const targetName = target ? getInternalSymbolName(target, unescapeLeadingUnderscores(target.escapedName)) : localName;
@@ -6210,7 +6298,7 @@ namespace ts {
...!length(baseTypes) ? [] : [createHeritageClause(SyntaxKind.ExtendsKeyword, map(baseTypes, b => serializeBaseType(b, staticBaseType, localName)))],
...!length(implementsTypes) ? [] : [createHeritageClause(SyntaxKind.ImplementsKeyword, map(implementsTypes, b => serializeBaseType(b, staticBaseType, localName)))]
];
const symbolProps = getPropertiesOfType(classType);
const symbolProps = getNonInterhitedProperties(classType, baseTypes, getPropertiesOfType(classType));
const publicSymbolProps = filter(symbolProps, s => {
// `valueDeclaration` could be undefined if inherited from
// a union/intersection base type, but inherited properties
@@ -7192,10 +7280,6 @@ namespace ts {
return symbol && getSymbolLinks(symbol).type || getTypeForVariableLikeDeclaration(node, /*includeOptionality*/ false);
}
function isComputedNonLiteralName(name: PropertyName): boolean {
return name.kind === SyntaxKind.ComputedPropertyName && !isStringOrNumericLiteralLike(name.expression);
}
function getRestType(source: Type, properties: PropertyName[], symbol: Symbol | undefined): Type {
source = filterType(source, t => !(t.flags & TypeFlags.Nullable));
if (source.flags & TypeFlags.Never) {
@@ -7306,8 +7390,8 @@ namespace ts {
if (strictNullChecks && declaration.flags & NodeFlags.Ambient && isParameterDeclaration(declaration)) {
parentType = getNonNullableType(parentType);
}
// Filter `undefined` from the type we check against if the parent has an initializer (which handles the `undefined` case implicitly)
else if (strictNullChecks && pattern.parent.initializer) {
// Filter `undefined` from the type we check against if the parent has an initializer and that initializer is not possibly `undefined`
else if (strictNullChecks && pattern.parent.initializer && !(getTypeFacts(getTypeOfInitializer(pattern.parent.initializer)) & TypeFacts.EQUndefined)) {
parentType = getTypeWithFacts(parentType, TypeFacts.NEUndefined);
}
@@ -7484,6 +7568,16 @@ namespace ts {
return addOptionality(type, isOptional);
}
if (isPropertyDeclaration(declaration) && (noImplicitAny || isInJSFile(declaration))) {
// We have a property declaration with no type annotation or initializer, in noImplicitAny mode or a .js file.
// Use control flow analysis of this.xxx assignments the constructor to determine the type of the property.
const constructor = findConstructorDeclaration(declaration.parent);
const type = constructor ? getFlowTypeInConstructor(declaration.symbol, constructor) :
getModifierFlags(declaration) & ModifierFlags.Ambient ? getTypeOfPropertyInBaseClass(declaration.symbol) :
undefined;
return type && addOptionality(type, isOptional);
}
if (isJsxAttribute(declaration)) {
// if JSX attribute doesn't have initializer, by default the attribute will have boolean value of true.
// I.e <Elem attr /> is sugar for <Elem attr={true} />
@@ -7500,6 +7594,59 @@ namespace ts {
return undefined;
}
function isConstructorDeclaredProperty(symbol: Symbol) {
// A propery is considered a constructor declared property when all declaration sites are this.xxx assignments,
// when no declaration sites have JSDoc type annotations, and when at least one declaration site is in the body of
// a class constructor.
if (symbol.valueDeclaration && isBinaryExpression(symbol.valueDeclaration)) {
const links = getSymbolLinks(symbol);
if (links.isConstructorDeclaredProperty === undefined) {
links.isConstructorDeclaredProperty = !!getDeclaringConstructor(symbol) && every(symbol.declarations, declaration =>
isBinaryExpression(declaration) &&
getAssignmentDeclarationKind(declaration) === AssignmentDeclarationKind.ThisProperty &&
(declaration.left.kind !== SyntaxKind.ElementAccessExpression || isStringOrNumericLiteralLike((<ElementAccessExpression>declaration.left).argumentExpression)) &&
!getAnnotatedTypeForAssignmentDeclaration(/*declaredType*/ undefined, declaration, symbol, declaration));
}
return links.isConstructorDeclaredProperty;
}
return false;
}
function isAutoTypedProperty(symbol: Symbol) {
// A property is auto-typed when its declaration has no type annotation or initializer and we're in
// noImplicitAny mode or a .js file.
const declaration = symbol.valueDeclaration;
return declaration && isPropertyDeclaration(declaration) && !getEffectiveTypeAnnotationNode(declaration) &&
!declaration.initializer && (noImplicitAny || isInJSFile(declaration));
}
function getDeclaringConstructor(symbol: Symbol) {
for (const declaration of symbol.declarations) {
const container = getThisContainer(declaration, /*includeArrowFunctions*/ false);
if (container && (container.kind === SyntaxKind.Constructor || isJSConstructor(container))) {
return <ConstructorDeclaration>container;
}
}
}
function getFlowTypeInConstructor(symbol: Symbol, constructor: ConstructorDeclaration) {
const reference = createPropertyAccess(createThis(), unescapeLeadingUnderscores(symbol.escapedName));
reference.expression.parent = reference;
reference.parent = constructor;
reference.flowNode = constructor.returnFlowNode;
const flowType = getFlowTypeOfProperty(reference, symbol);
if (noImplicitAny && (flowType === autoType || flowType === autoArrayType)) {
error(symbol.valueDeclaration, Diagnostics.Member_0_implicitly_has_an_1_type, symbolToString(symbol), typeToString(flowType));
}
// We don't infer a type if assignments are only null or undefined.
return everyType(flowType, isNullableType) ? undefined : convertAutoToAny(flowType);
}
function getFlowTypeOfProperty(reference: Node, prop: Symbol | undefined) {
const initialType = prop && (!isAutoTypedProperty(prop) || getModifierFlags(prop.valueDeclaration) & ModifierFlags.Ambient) && getTypeOfPropertyInBaseClass(prop) || undefinedType;
return getFlowTypeOfReference(reference, autoType, initialType);
}
function getWidenedTypeForAssignmentDeclaration(symbol: Symbol, resolvedSymbol?: Symbol) {
// function/class/{} initializers are themselves containers, so they won't merge in the same way as other initializers
const container = getAssignedExpandoInitializer(symbol.valueDeclaration);
@@ -7511,52 +7658,60 @@ namespace ts {
const containerObjectType = getJSContainerObjectType(symbol.valueDeclaration, symbol, container);
return containerObjectType || getWidenedLiteralType(checkExpressionCached(container));
}
let type;
let definedInConstructor = false;
let definedInMethod = false;
let jsdocType: Type | undefined;
let types: Type[] | undefined;
for (const declaration of symbol.declarations) {
const expression = (isBinaryExpression(declaration) || isCallExpression(declaration)) ? declaration :
isAccessExpression(declaration) ? isBinaryExpression(declaration.parent) ? declaration.parent : declaration :
undefined;
if (!expression) {
continue; // Non-assignment declaration merged in (eg, an Identifier to mark the thing as a namespace) - skip over it and pull type info from elsewhere
}
const kind = isAccessExpression(expression)
? getAssignmentDeclarationPropertyAccessKind(expression)
: getAssignmentDeclarationKind(expression);
if (kind === AssignmentDeclarationKind.ThisProperty) {
if (isDeclarationInConstructor(expression)) {
definedInConstructor = true;
}
else {
definedInMethod = true;
}
}
if (!isCallExpression(expression)) {
jsdocType = getAnnotatedTypeForAssignmentDeclaration(jsdocType, expression, symbol, declaration);
}
if (!jsdocType) {
(types || (types = [])).push((isBinaryExpression(expression) || isCallExpression(expression)) ? getInitializerTypeFromAssignmentDeclaration(symbol, resolvedSymbol, expression, kind) : neverType);
}
// We use control flow analysis to determine the type of the property if the property qualifies as a constructor
// declared property and the resulting control flow type isn't just undefined or null.
if (isConstructorDeclaredProperty(symbol)) {
type = getFlowTypeInConstructor(symbol, getDeclaringConstructor(symbol)!);
}
let type = jsdocType;
if (!type) {
if (!length(types)) {
return errorType; // No types from any declarations :(
}
let constructorTypes = definedInConstructor ? getConstructorDefinedThisAssignmentTypes(types!, symbol.declarations) : undefined;
// use only the constructor types unless they were only assigned null | undefined (including widening variants)
if (definedInMethod) {
const propType = getTypeOfAssignmentDeclarationPropertyOfBaseType(symbol);
if (propType) {
(constructorTypes || (constructorTypes = [])).push(propType);
definedInConstructor = true;
let jsdocType: Type | undefined;
let types: Type[] | undefined;
for (const declaration of symbol.declarations) {
const expression = (isBinaryExpression(declaration) || isCallExpression(declaration)) ? declaration :
isAccessExpression(declaration) ? isBinaryExpression(declaration.parent) ? declaration.parent : declaration :
undefined;
if (!expression) {
continue; // Non-assignment declaration merged in (eg, an Identifier to mark the thing as a namespace) - skip over it and pull type info from elsewhere
}
const kind = isAccessExpression(expression)
? getAssignmentDeclarationPropertyAccessKind(expression)
: getAssignmentDeclarationKind(expression);
if (kind === AssignmentDeclarationKind.ThisProperty) {
if (isDeclarationInConstructor(expression)) {
definedInConstructor = true;
}
else {
definedInMethod = true;
}
}
if (!isCallExpression(expression)) {
jsdocType = getAnnotatedTypeForAssignmentDeclaration(jsdocType, expression, symbol, declaration);
}
if (!jsdocType) {
(types || (types = [])).push((isBinaryExpression(expression) || isCallExpression(expression)) ? getInitializerTypeFromAssignmentDeclaration(symbol, resolvedSymbol, expression, kind) : neverType);
}
}
const sourceTypes = some(constructorTypes, t => !!(t.flags & ~TypeFlags.Nullable)) ? constructorTypes : types; // TODO: GH#18217
type = getUnionType(sourceTypes!, UnionReduction.Subtype);
type = jsdocType;
if (!type) {
if (!length(types)) {
return errorType; // No types from any declarations :(
}
let constructorTypes = definedInConstructor ? getConstructorDefinedThisAssignmentTypes(types!, symbol.declarations) : undefined;
// use only the constructor types unless they were only assigned null | undefined (including widening variants)
if (definedInMethod) {
const propType = getTypeOfPropertyInBaseClass(symbol);
if (propType) {
(constructorTypes || (constructorTypes = [])).push(propType);
definedInConstructor = true;
}
}
const sourceTypes = some(constructorTypes, t => !!(t.flags & ~TypeFlags.Nullable)) ? constructorTypes : types; // TODO: GH#18217
type = getUnionType(sourceTypes!, UnionReduction.Subtype);
}
}
const widened = getWidenedType(addOptionality(type, definedInMethod && !definedInConstructor));
if (filterType(widened, t => !!(t.flags & ~TypeFlags.Nullable)) === neverType) {
@@ -7649,11 +7804,38 @@ namespace ts {
resolvedSymbol.exports = createSymbolTable();
}
(resolvedSymbol || symbol).exports!.forEach((s, name) => {
if (members.has(name)) {
const exportedMember = exportedType.members.get(name)!;
const union = createSymbol(s.flags | exportedMember.flags, name);
union.type = getUnionType([getTypeOfSymbol(s), getTypeOfSymbol(exportedMember)]);
members.set(name, union);
const exportedMember = members.get(name)!;
if (exportedMember && exportedMember !== s) {
if (s.flags & SymbolFlags.Value) {
// If the member has an additional value-like declaration, union the types from the two declarations,
// but issue an error if they occurred in two different files. The purpose is to support a JS file with
// a pattern like:
//
// module.exports = { a: true };
// module.exports.a = 3;
//
// but we may have a JS file with `module.exports = { a: true }` along with a TypeScript module augmentation
// declaring an `export const a: number`. In that case, we issue a duplicate identifier error, because
// it's unclear what that's supposed to mean, so it's probably a mistake.
if (getSourceFileOfNode(s.valueDeclaration) !== getSourceFileOfNode(exportedMember.valueDeclaration)) {
const unescapedName = unescapeLeadingUnderscores(s.escapedName);
const exportedMemberName = tryCast(exportedMember.valueDeclaration, isNamedDeclaration)?.name || exportedMember.valueDeclaration;
addRelatedInfo(
error(s.valueDeclaration, Diagnostics.Duplicate_identifier_0, unescapedName),
createDiagnosticForNode(exportedMemberName, Diagnostics._0_was_also_declared_here, unescapedName));
addRelatedInfo(
error(exportedMemberName, Diagnostics.Duplicate_identifier_0, unescapedName),
createDiagnosticForNode(s.valueDeclaration, Diagnostics._0_was_also_declared_here, unescapedName));
}
const union = createSymbol(s.flags | exportedMember.flags, name);
union.type = getUnionType([getTypeOfSymbol(s), getTypeOfSymbol(exportedMember)]);
union.valueDeclaration = exportedMember.valueDeclaration;
union.declarations = concatenate(exportedMember.declarations, s.declarations);
members.set(name, union);
}
else {
members.set(name, mergeSymbol(s, exportedMember));
}
}
else {
members.set(name, s);
@@ -7701,21 +7883,6 @@ namespace ts {
});
}
/** check for definition in base class if any declaration is in a class */
function getTypeOfAssignmentDeclarationPropertyOfBaseType(property: Symbol) {
const parentDeclaration = forEach(property.declarations, d => {
const parent = getThisContainer(d, /*includeArrowFunctions*/ false).parent;
return isClassLike(parent) && parent;
});
if (parentDeclaration) {
const classType = getDeclaredTypeOfSymbol(getSymbolOfNode(parentDeclaration)) as InterfaceType;
const baseClassType = classType && getBaseTypes(classType)[0];
if (baseClassType) {
return getTypeOfPropertyOfType(baseClassType, property.escapedName);
}
}
}
// Return the type implied by a binding pattern element. This is the type of the initializer of the element if
// one is present. Otherwise, if the element is itself a binding pattern, it is the type implied by the binding
// pattern. Otherwise, it is the type any.
@@ -9538,7 +9705,7 @@ namespace ts {
const indexTypes: Type[] = [];
let isAnyReadonly = false;
for (const type of types) {
const indexInfo = getIndexInfoOfType(type, kind);
const indexInfo = getIndexInfoOfType(getApparentType(type), kind);
if (!indexInfo) {
return undefined;
}
@@ -10368,10 +10535,10 @@ namespace ts {
}
function createUnionOrIntersectionProperty(containingType: UnionOrIntersectionType, name: __String): Symbol | undefined {
const propSet = createMap<Symbol>();
let singleProp: Symbol | undefined;
let propSet: Map<Symbol> | undefined;
let indexTypes: Type[] | undefined;
const isUnion = containingType.flags & TypeFlags.Union;
const excludeModifiers = isUnion ? ModifierFlags.NonPublicAccessibilityModifier : 0;
// Flags we want to propagate to the result if they exist in all source symbols
let optionalFlag = isUnion ? SymbolFlags.None : SymbolFlags.Optional;
let syntheticFlag = CheckFlags.SyntheticMethod;
@@ -10381,16 +10548,25 @@ namespace ts {
if (!(type === errorType || type.flags & TypeFlags.Never)) {
const prop = getPropertyOfType(type, name);
const modifiers = prop ? getDeclarationModifierFlagsFromSymbol(prop) : 0;
if (prop && !(modifiers & excludeModifiers)) {
if (prop) {
if (isUnion) {
optionalFlag |= (prop.flags & SymbolFlags.Optional);
}
else {
optionalFlag &= prop.flags;
}
const id = "" + getSymbolId(prop);
if (!propSet.has(id)) {
propSet.set(id, prop);
if (!singleProp) {
singleProp = prop;
}
else if (prop !== singleProp) {
if (!propSet) {
propSet = createMap<Symbol>();
propSet.set("" + getSymbolId(singleProp), singleProp);
}
const id = "" + getSymbolId(prop);
if (!propSet.has(id)) {
propSet.set(id, prop);
}
}
checkFlags |= (isReadonlySymbol(prop) ? CheckFlags.Readonly : 0) |
(!(modifiers & ModifierFlags.NonPublicAccessibilityModifier) ? CheckFlags.ContainsPublic : 0) |
@@ -10417,13 +10593,15 @@ namespace ts {
}
}
}
if (!propSet.size) {
if (!singleProp || isUnion && (propSet || checkFlags & CheckFlags.Partial) && checkFlags & (CheckFlags.ContainsPrivate | CheckFlags.ContainsProtected)) {
// No property was found, or, in a union, a property has a private or protected declaration in one
// constituent, but is missing or has a different declaration in another constituent.
return undefined;
}
const props = arrayFrom(propSet.values());
if (props.length === 1 && !(checkFlags & CheckFlags.ReadPartial) && !indexTypes) {
return props[0];
if (!propSet && !(checkFlags & CheckFlags.ReadPartial) && !indexTypes) {
return singleProp;
}
const props = propSet ? arrayFrom(propSet.values()) : [singleProp];
let declarations: Declaration[] | undefined;
let firstType: Type | undefined;
let nameType: Type | undefined;
@@ -12704,6 +12882,9 @@ namespace ts {
if (accessFlags & AccessFlags.CacheSymbol) {
getNodeLinks(accessNode!).resolvedSymbol = prop;
}
if (isThisPropertyAccessInConstructor(accessExpression, prop)) {
return autoType;
}
}
const propType = getTypeOfSymbol(prop);
return accessExpression && getAssignmentTargetKind(accessExpression) !== AssignmentKind.Definite ?
@@ -14117,7 +14298,7 @@ namespace ts {
function instantiateType(type: Type, mapper: TypeMapper | undefined): Type;
function instantiateType(type: Type | undefined, mapper: TypeMapper | undefined): Type | undefined;
function instantiateType(type: Type | undefined, mapper: TypeMapper | undefined): Type | undefined {
if (!type || !mapper) {
if (!(type && mapper && couldContainTypeVariables(type))) {
return type;
}
if (instantiationDepth === 50 || instantiationCount >= 5000000) {
@@ -14153,37 +14334,23 @@ namespace ts {
}
if (flags & TypeFlags.Object) {
const objectFlags = (<ObjectType>type).objectFlags;
if (objectFlags & ObjectFlags.Anonymous) {
// If the anonymous type originates in a declaration of a function, method, class, or
// interface, in an object type literal, or in an object literal expression, we may need
// to instantiate the type because it might reference a type parameter.
return couldContainTypeVariables(type) ?
getObjectTypeInstantiation(<AnonymousType>type, mapper) : type;
}
if (objectFlags & ObjectFlags.Mapped) {
return getObjectTypeInstantiation(<AnonymousType>type, mapper);
}
if (objectFlags & ObjectFlags.Reference) {
if ((<TypeReference>type).node) {
return getObjectTypeInstantiation(<TypeReference>type, mapper);
if (objectFlags & (ObjectFlags.Reference | ObjectFlags.Anonymous | ObjectFlags.Mapped)) {
if (objectFlags & ObjectFlags.Reference && !((<TypeReference>type).node)) {
const resolvedTypeArguments = (<TypeReference>type).resolvedTypeArguments;
const newTypeArguments = instantiateTypes(resolvedTypeArguments, mapper);
return newTypeArguments !== resolvedTypeArguments ? createTypeReference((<TypeReference>type).target, newTypeArguments) : type;
}
const resolvedTypeArguments = (<TypeReference>type).resolvedTypeArguments;
const newTypeArguments = instantiateTypes(resolvedTypeArguments, mapper);
return newTypeArguments !== resolvedTypeArguments ? createTypeReference((<TypeReference>type).target, newTypeArguments) : type;
return getObjectTypeInstantiation(<TypeReference | AnonymousType | MappedType>type, mapper);
}
return type;
}
if ((flags & TypeFlags.Intersection) || (flags & TypeFlags.Union && !(flags & TypeFlags.Primitive))) {
if (!couldContainTypeVariables(type)) {
return type;
}
if (flags & TypeFlags.UnionOrIntersection) {
const types = (<UnionOrIntersectionType>type).types;
const newTypes = instantiateTypes(types, mapper);
return newTypes === types
? type
: (flags & TypeFlags.Intersection)
? getIntersectionType(newTypes, type.aliasSymbol, instantiateTypes(type.aliasTypeArguments, mapper))
: getUnionType(newTypes, UnionReduction.Literal, type.aliasSymbol, instantiateTypes(type.aliasTypeArguments, mapper));
return newTypes === types ? type :
flags & TypeFlags.Intersection ?
getIntersectionType(newTypes, type.aliasSymbol, instantiateTypes(type.aliasTypeArguments, mapper)) :
getUnionType(newTypes, UnionReduction.Literal, type.aliasSymbol, instantiateTypes(type.aliasTypeArguments, mapper));
}
if (flags & TypeFlags.Index) {
return getIndexType(instantiateType((<IndexType>type).type, mapper));
@@ -16541,7 +16708,7 @@ namespace ts {
if (!targetProperty) continue outer;
if (sourceProperty === targetProperty) continue;
// We compare the source property to the target in the context of a single discriminant type.
const related = propertyRelatedTo(source, target, sourceProperty, targetProperty, _ => combination[i], /*reportErrors*/ false, IntersectionState.None);
const related = propertyRelatedTo(source, target, sourceProperty, targetProperty, _ => combination[i], /*reportErrors*/ false, IntersectionState.None, /*skipOptional*/ strictNullChecks || relation === comparableRelation);
// If the target property could not be found, or if the properties were not related,
// then this constituent is not a match.
if (!related) {
@@ -16639,7 +16806,7 @@ namespace ts {
}
}
function propertyRelatedTo(source: Type, target: Type, sourceProp: Symbol, targetProp: Symbol, getTypeOfSourceProperty: (sym: Symbol) => Type, reportErrors: boolean, intersectionState: IntersectionState): Ternary {
function propertyRelatedTo(source: Type, target: Type, sourceProp: Symbol, targetProp: Symbol, getTypeOfSourceProperty: (sym: Symbol) => Type, reportErrors: boolean, intersectionState: IntersectionState, skipOptional: boolean): Ternary {
const sourcePropFlags = getDeclarationModifierFlagsFromSymbol(sourceProp);
const targetPropFlags = getDeclarationModifierFlagsFromSymbol(targetProp);
if (sourcePropFlags & ModifierFlags.Private || targetPropFlags & ModifierFlags.Private) {
@@ -16682,7 +16849,7 @@ namespace ts {
return Ternary.False;
}
// When checking for comparability, be more lenient with optional properties.
if (relation !== comparableRelation && sourceProp.flags & SymbolFlags.Optional && !(targetProp.flags & SymbolFlags.Optional)) {
if (!skipOptional && sourceProp.flags & SymbolFlags.Optional && !(targetProp.flags & SymbolFlags.Optional)) {
// TypeScript 1.0 spec (April 2014): 3.8.3
// S is a subtype of a type T, and T is a supertype of S if ...
// S' and T are object types and, for each member M in T..
@@ -16812,7 +16979,7 @@ namespace ts {
if (!(targetProp.flags & SymbolFlags.Prototype) && (!numericNamesOnly || isNumericLiteralName(name) || name === "length")) {
const sourceProp = getPropertyOfType(source, name);
if (sourceProp && sourceProp !== targetProp) {
const related = propertyRelatedTo(source, target, sourceProp, targetProp, getTypeOfSymbol, reportErrors, intersectionState);
const related = propertyRelatedTo(source, target, sourceProp, targetProp, getTypeOfSymbol, reportErrors, intersectionState, relation === comparableRelation);
if (!related) {
return Ternary.False;
}
@@ -17299,7 +17466,14 @@ namespace ts {
// Return the declaring class type of a property or undefined if property not declared in class
function getDeclaringClass(prop: Symbol) {
return prop.parent && prop.parent.flags & SymbolFlags.Class ? getDeclaredTypeOfSymbol(getParentOfSymbol(prop)!) : undefined;
return prop.parent && prop.parent.flags & SymbolFlags.Class ? <InterfaceType>getDeclaredTypeOfSymbol(getParentOfSymbol(prop)!) : undefined;
}
// Return the inherited type of the given property or undefined if property doesn't exist in a base class.
function getTypeOfPropertyInBaseClass(property: Symbol) {
const classType = getDeclaringClass(property);
const baseClassType = classType && getBaseTypes(classType)[0];
return baseClassType && getTypeOfPropertyOfType(baseClassType, property.escapedName);
}
// Return true if some underlying source property is declared in a class that derives
@@ -18095,7 +18269,7 @@ namespace ts {
}
function reportErrorsFromWidening(declaration: Declaration, type: Type, wideningKind?: WideningKind) {
if (produceDiagnostics && noImplicitAny && getObjectFlags(type) & ObjectFlags.ContainsWideningType) {
if (produceDiagnostics && noImplicitAny && getObjectFlags(type) & ObjectFlags.ContainsWideningType && (!wideningKind || !getContextualSignatureForFunctionLikeDeclaration(declaration as FunctionLikeDeclaration))) {
// Report implicit any error within type if possible, otherwise report error on declaration
if (!reportWideningErrorsInType(type)) {
reportImplicitAny(declaration, type, wideningKind);
@@ -18223,16 +18397,25 @@ namespace ts {
return !!(objectFlags & ObjectFlags.CouldContainTypeVariables);
}
const result = !!(type.flags & TypeFlags.Instantiable ||
objectFlags & ObjectFlags.Reference && ((<TypeReference>type).node || forEach(getTypeArguments(<TypeReference>type), couldContainTypeVariables)) ||
objectFlags & ObjectFlags.Anonymous && type.symbol && type.symbol.flags & (SymbolFlags.Function | SymbolFlags.Method | SymbolFlags.Class | SymbolFlags.TypeLiteral | SymbolFlags.ObjectLiteral) && type.symbol.declarations ||
objectFlags & (ObjectFlags.Mapped | ObjectFlags.ObjectRestType) ||
type.flags & TypeFlags.UnionOrIntersection && !(type.flags & TypeFlags.EnumLiteral) && some((<UnionOrIntersectionType>type).types, couldContainTypeVariables));
type.flags & TypeFlags.Object && !isNonGenericTopLevelType(type) && (
objectFlags & ObjectFlags.Reference && ((<TypeReference>type).node || forEach(getTypeArguments(<TypeReference>type), couldContainTypeVariables)) ||
objectFlags & ObjectFlags.Anonymous && type.symbol && type.symbol.flags & (SymbolFlags.Function | SymbolFlags.Method | SymbolFlags.Class | SymbolFlags.TypeLiteral | SymbolFlags.ObjectLiteral) && type.symbol.declarations ||
objectFlags & (ObjectFlags.Mapped | ObjectFlags.ObjectRestType)) ||
type.flags & TypeFlags.UnionOrIntersection && !(type.flags & TypeFlags.EnumLiteral) && !isNonGenericTopLevelType(type) && some((<UnionOrIntersectionType>type).types, couldContainTypeVariables));
if (type.flags & TypeFlags.ObjectFlagsType) {
(<ObjectFlagsType>type).objectFlags |= ObjectFlags.CouldContainTypeVariablesComputed | (result ? ObjectFlags.CouldContainTypeVariables : 0);
}
return result;
}
function isNonGenericTopLevelType(type: Type) {
if (type.aliasSymbol && !type.aliasTypeArguments) {
const declaration = getDeclarationOfKind(type.aliasSymbol, SyntaxKind.TypeAliasDeclaration);
return !!(declaration && findAncestor(declaration.parent, n => n.kind === SyntaxKind.SourceFile ? true : n.kind === SyntaxKind.ModuleDeclaration ? false : "quit"));
}
return false;
}
function isTypeParameterAtTopLevel(type: Type, typeParameter: TypeParameter): boolean {
return !!(type === typeParameter ||
type.flags & TypeFlags.UnionOrIntersection && some((<UnionOrIntersectionType>type).types, t => isTypeParameterAtTopLevel(t, typeParameter)) ||
@@ -18268,12 +18451,16 @@ namespace ts {
* variable T[P] (i.e. we treat the type T[P] as the type variable we're inferring for).
*/
function inferTypeForHomomorphicMappedType(source: Type, target: MappedType, constraint: IndexType): Type | undefined {
if (inInferTypeForHomomorphicMappedType) {
return undefined;
}
const key = source.id + "," + target.id + "," + constraint.id;
if (reverseMappedCache.has(key)) {
return reverseMappedCache.get(key);
}
reverseMappedCache.set(key, undefined);
inInferTypeForHomomorphicMappedType = true;
const type = createReverseMappedType(source, target, constraint);
inInferTypeForHomomorphicMappedType = false;
reverseMappedCache.set(key, type);
return type;
}
@@ -19390,6 +19577,9 @@ namespace ts {
if (flags & TypeFlags.NonPrimitive) {
return strictNullChecks ? TypeFacts.ObjectStrictFacts : TypeFacts.ObjectFacts;
}
if (flags & TypeFlags.Never) {
return TypeFacts.None;
}
if (flags & TypeFlags.Instantiable) {
return getTypeFacts(getBaseConstraintOfType(type) || unknownType);
}
@@ -19626,7 +19816,7 @@ namespace ts {
const filtered = filter(types, f);
return filtered === types ? type : getUnionTypeFromSortedList(filtered, (<UnionType>type).objectFlags);
}
return f(type) ? type : neverType;
return type.flags & TypeFlags.Never || f(type) ? type : neverType;
}
function countTypes(type: Type) {
@@ -20112,7 +20302,7 @@ namespace ts {
if (isEmptyArrayAssignment(node)) {
return getEvolvingArrayType(neverType);
}
const assignedType = getBaseTypeOfLiteralType(getInitialOrAssignedType(flow));
const assignedType = getWidenedLiteralType(getInitialOrAssignedType(flow));
return isTypeAssignableTo(assignedType, declaredType) ? assignedType : anyArrayType;
}
if (declaredType.flags & TypeFlags.Union) {
@@ -20454,7 +20644,7 @@ namespace ts {
}
function narrowByInKeyword(type: Type, literal: LiteralExpression, assumeTrue: boolean) {
if (type.flags & (TypeFlags.Union | TypeFlags.Object | TypeFlags.Intersection) || isThisTypeParameter(type)) {
if (type.flags & (TypeFlags.Union | TypeFlags.Object) || isThisTypeParameter(type)) {
const propName = escapeLeadingUnderscores(literal.text);
return filterType(type, t => isTypePresencePossible(t, propName, assumeTrue));
}
@@ -21559,6 +21749,10 @@ namespace ts {
const fileSymbol = getSymbolOfNode(container);
return fileSymbol && getTypeOfSymbol(fileSymbol);
}
else if (container.externalModuleIndicator) {
// TODO: Maybe issue a better error than 'object is possibly undefined'
return undefinedType;
}
else if (includeGlobalThis) {
return getTypeOfSymbol(globalThisSymbol);
}
@@ -24048,6 +24242,10 @@ namespace ts {
return false;
}
function isThisPropertyAccessInConstructor(node: ElementAccessExpression | PropertyAccessExpression | QualifiedName, prop: Symbol) {
return isThisProperty(node) && (isAutoTypedProperty(prop) || isConstructorDeclaredProperty(prop)) && getThisContainer(node, /*includeArrowFunctions*/ true) === getDeclaringConstructor(prop);
}
function checkPropertyAccessExpressionOrQualifiedName(node: PropertyAccessExpression | QualifiedName, left: Expression | QualifiedName, leftType: Type, right: Identifier | PrivateIdentifier) {
const parentSymbol = getNodeLinks(left).resolvedSymbol;
const assignmentKind = getAssignmentTargetKind(node);
@@ -24122,7 +24320,7 @@ namespace ts {
error(right, Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, idText(right));
return errorType;
}
propType = getConstraintForLocation(getTypeOfSymbol(prop), node);
propType = isThisPropertyAccessInConstructor(node, prop) ? autoType : getConstraintForLocation(getTypeOfSymbol(prop), node);
}
return getFlowTypeOfAccessExpression(node, prop, propType, right);
}
@@ -24137,6 +24335,9 @@ namespace ts {
prop && !(prop.flags & (SymbolFlags.Variable | SymbolFlags.Property | SymbolFlags.Accessor)) && !(prop.flags & SymbolFlags.Method && propType.flags & TypeFlags.Union)) {
return propType;
}
if (propType === autoType) {
return getFlowTypeOfProperty(node, prop);
}
// If strict null checks and strict property initialization checks are enabled, if we have
// a this.xxx property access, if the property is an instance property without an initializer,
// and if we are in a constructor of the same class as the property declaration, assume that
@@ -27047,15 +27248,13 @@ namespace ts {
}
if (returnType || yieldType || nextType) {
const contextualSignature = getContextualSignatureForFunctionLikeDeclaration(func);
if (!contextualSignature) {
if (yieldType) reportErrorsFromWidening(func, yieldType, WideningKind.GeneratorYield);
if (returnType) reportErrorsFromWidening(func, returnType);
if (nextType) reportErrorsFromWidening(func, nextType);
}
if (yieldType) reportErrorsFromWidening(func, yieldType, WideningKind.GeneratorYield);
if (returnType) reportErrorsFromWidening(func, returnType, WideningKind.FunctionReturn);
if (nextType) reportErrorsFromWidening(func, nextType, WideningKind.GeneratorNext);
if (returnType && isUnitType(returnType) ||
yieldType && isUnitType(yieldType) ||
nextType && isUnitType(nextType)) {
const contextualSignature = getContextualSignatureForFunctionLikeDeclaration(func);
const contextualType = !contextualSignature ? undefined :
contextualSignature === getSignatureFromDeclaration(func) ? isGenerator ? undefined : returnType :
instantiateContextualType(getReturnTypeOfSignature(contextualSignature), func);
@@ -27583,12 +27782,23 @@ namespace ts {
}
const links = getNodeLinks(expr);
const symbol = getExportSymbolOfValueSymbolIfExported(links.resolvedSymbol);
if (symbol && isReadonlySymbol(symbol)) {
error(expr, Diagnostics.The_operand_of_a_delete_operator_cannot_be_a_read_only_property);
if (symbol) {
if (isReadonlySymbol(symbol)) {
error(expr, Diagnostics.The_operand_of_a_delete_operator_cannot_be_a_read_only_property);
}
checkDeleteExpressionMustBeOptional(expr, getTypeOfSymbol(symbol));
}
return booleanType;
}
function checkDeleteExpressionMustBeOptional(expr: AccessExpression, type: Type) {
const AnyOrUnknownOrNeverFlags = TypeFlags.AnyOrUnknown | TypeFlags.Never;
if (strictNullChecks && !(type.flags & AnyOrUnknownOrNeverFlags) && !(getFalsyFlags(type) & TypeFlags.Undefined)) {
error(expr, Diagnostics.The_operand_of_a_delete_operator_must_be_optional);
}
}
function checkTypeOfExpression(node: TypeOfExpression): Type {
checkExpression(node.expression);
return typeofType;
@@ -28243,6 +28453,12 @@ namespace ts {
case SyntaxKind.GreaterThanGreaterThanGreaterThanToken:
case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken:
reportOperatorError();
break;
case SyntaxKind.AsteriskAsteriskToken:
case SyntaxKind.AsteriskAsteriskEqualsToken:
if (languageVersion < ScriptTarget.ES2016) {
error(errorNode, Diagnostics.Exponentiation_cannot_be_performed_on_bigint_values_unless_the_target_option_is_set_to_es2016_or_later);
}
}
resultType = bigintType;
}
@@ -29677,8 +29893,9 @@ namespace ts {
// - The constructor declares parameter properties
// or the containing class declares instance member variables with initializers.
const superCallShouldBeFirst =
some((<ClassDeclaration>node.parent).members, isInstancePropertyWithInitializerOrPrivateIdentifierProperty) ||
some(node.parameters, p => hasModifier(p, ModifierFlags.ParameterPropertyModifier));
(compilerOptions.target !== ScriptTarget.ESNext || !compilerOptions.useDefineForClassFields) &&
(some((<ClassDeclaration>node.parent).members, isInstancePropertyWithInitializerOrPrivateIdentifierProperty) ||
some(node.parameters, p => hasModifier(p, ModifierFlags.ParameterPropertyModifier)));
// Skip past any prologue directives to find the first statement
// to ensure that it was a super call.
@@ -30584,7 +30801,7 @@ namespace ts {
if (globalPromiseType !== emptyGenericType && !isReferenceToType(returnType, globalPromiseType)) {
// The promise type was not a valid type reference to the global promise type, so we
// report an error and return the unknown type.
error(returnTypeNode, Diagnostics.The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type);
error(returnTypeNode, Diagnostics.The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_Did_you_mean_to_write_Promise_0, typeToString(getAwaitedType(returnType) || voidType));
return;
}
}
@@ -31831,7 +32048,9 @@ namespace ts {
let childExpression = childNode.parent;
while (testedExpression && childExpression) {
if (isIdentifier(testedExpression) && isIdentifier(childExpression)) {
if (isIdentifier(testedExpression) && isIdentifier(childExpression) ||
testedExpression.kind === SyntaxKind.ThisKeyword && childExpression.kind === SyntaxKind.ThisKeyword
) {
return getSymbolAtLocation(testedExpression) === getSymbolAtLocation(childExpression);
}
@@ -33481,6 +33700,26 @@ namespace ts {
}
}
function getNonInterhitedProperties(type: InterfaceType, baseTypes: BaseType[], properties: Symbol[]) {
if (!length(baseTypes)) {
return properties;
}
const seen = createUnderscoreEscapedMap<Symbol>();
forEach(properties, p => { seen.set(p.escapedName, p); });
for (const base of baseTypes) {
const properties = getPropertiesOfType(getTypeWithThisArgument(base, type.thisType));
for (const prop of properties) {
const existing = seen.get(prop.escapedName);
if (existing && !isPropertyIdenticalTo(existing, prop)) {
seen.delete(prop.escapedName);
}
}
}
return arrayFrom(seen.values());
}
function checkInheritedPropertiesAreIdentical(type: InterfaceType, typeNode: Node): boolean {
const baseTypes = getBaseTypes(type);
if (baseTypes.length < 2) {
+1 -1
View File
@@ -1721,7 +1721,7 @@ namespace ts {
errors.push(createDiagnosticForNodeInSourceFile(sourceFile, element.name, Diagnostics.String_literal_with_double_quotes_expected));
}
const textOfKey = getTextOfPropertyName(element.name);
const textOfKey = isComputedNonLiteralName(element.name) ? undefined : getTextOfPropertyName(element.name);
const keyText = textOfKey && unescapeLeadingUnderscores(textOfKey);
const option = keyText && knownOptions ? knownOptions.get(keyText) : undefined;
if (keyText && extraKeyDiagnostics && !option) {
+22
View File
@@ -844,6 +844,28 @@ namespace ts {
return to;
}
/**
* Combines two arrays, values, or undefineds into the smallest container that can accommodate the resulting set:
*
* ```
* undefined -> undefined -> undefined
* T -> undefined -> T
* T -> T -> T[]
* T[] -> undefined -> T[] (no-op)
* T[] -> T -> T[] (append)
* T[] -> T[] -> T[] (concatenate)
* ```
*/
export function combine<T>(xs: T | readonly T[] | undefined, ys: T | readonly T[] | undefined): T | readonly T[] | undefined;
export function combine<T>(xs: T | T[] | undefined, ys: T | T[] | undefined): T | T[] | undefined;
export function combine<T>(xs: T | T[] | undefined, ys: T | T[] | undefined) {
if (xs === undefined) return ys;
if (ys === undefined) return xs;
if (isArray(xs)) return isArray(ys) ? concatenate(xs, ys) : append(xs, ys);
if (isArray(ys)) return append(ys, xs);
return [xs, ys];
}
/**
* Gets the actual offset into an array for a relative offset. Negative offsets indicate a
* position offset from the end of the array.
+1 -1
View File
@@ -1,7 +1,7 @@
namespace ts {
// WARNING: The script `configurePrerelease.ts` uses a regexp to parse out these values.
// If changing the text in this section, be sure to test `configurePrerelease` too.
export const versionMajorMinor = "3.9";
export const versionMajorMinor = "4.0";
/** The version of the TypeScript compiler release */
export const version = `${versionMajorMinor}.0-dev`;
+27 -3
View File
@@ -215,7 +215,7 @@
"category": "Error",
"code": 1063
},
"The return type of an async function or method must be the global Promise<T> type.": {
"The return type of an async function or method must be the global Promise<T> type. Did you mean to write 'Promise<{0}>'?": {
"category": "Error",
"code": 1064
},
@@ -1477,11 +1477,11 @@
"category": "Error",
"code": 2371
},
"Parameter '{0}' cannot be referenced in its initializer.": {
"Parameter '{0}' cannot reference itself.": {
"category": "Error",
"code": 2372
},
"Initializer of parameter '{0}' cannot reference identifier '{1}' declared after it.": {
"Parameter '{0}' cannot reference identifier '{1}' declared after it.": {
"category": "Error",
"code": 2373
},
@@ -2963,6 +2963,14 @@
"category": "Error",
"code": 2789
},
"The operand of a 'delete' operator must be optional.": {
"category": "Error",
"code": 2790
},
"Exponentiation cannot be performed on 'bigint' values unless the 'target' option is set to 'es2016' or later.": {
"category": "Error",
"code": 2791
},
"Import declaration '{0}' is using private name '{1}'.": {
"category": "Error",
@@ -4384,6 +4392,14 @@
"category": "Error",
"code": 6231
},
"Declaration augments declaration in another file. This cannot be serialized.": {
"category": "Error",
"code": 6232
},
"This is the declaration being augmented. Consider moving the augmenting declaration into the same file.": {
"category": "Error",
"code": 6233
},
"Projects to reference": {
"category": "Message",
@@ -5181,6 +5197,14 @@
"category": "Message",
"code": 90035
},
"Replace '{0}' with 'Promise<{1}>'": {
"category": "Message",
"code": 90036
},
"Fix all incorrect return type of an async functions": {
"category": "Message",
"code": 90037
},
"Declare a private field named '{0}'.": {
"category": "Message",
"code": 90053
+23 -9
View File
@@ -2366,16 +2366,10 @@ namespace ts {
function emitParenthesizedExpression(node: ParenthesizedExpression) {
const openParenPos = emitTokenWithComment(SyntaxKind.OpenParenToken, node.pos, writePunctuation, node);
const leadingNewlines = preserveSourceNewlines && getLeadingLineTerminatorCount(node, [node.expression], ListFormat.None);
if (leadingNewlines) {
writeLinesAndIndent(leadingNewlines, /*writeLinesIfNotIndenting*/ false);
}
const indented = writeLineSeparatorsAndIndentBefore(node.expression, node);
emitExpression(node.expression);
const trailingNewlines = preserveSourceNewlines && getClosingLineTerminatorCount(node, [node.expression], ListFormat.None);
if (trailingNewlines) {
writeLine(trailingNewlines);
}
decreaseIndentIf(leadingNewlines);
writeLineSeparatorsAfter(node.expression, node);
decreaseIndentIf(indented);
emitTokenWithComment(SyntaxKind.CloseParenToken, node.expression ? node.expression.end : openParenPos, writePunctuation, node);
}
@@ -3293,12 +3287,15 @@ namespace ts {
writePunctuation("<");
if (isJsxOpeningElement(node)) {
const indented = writeLineSeparatorsAndIndentBefore(node.tagName, node);
emitJsxTagName(node.tagName);
emitTypeArguments(node, node.typeArguments);
if (node.attributes.properties && node.attributes.properties.length > 0) {
writeSpace();
}
emit(node.attributes);
writeLineSeparatorsAfter(node.attributes, node);
decreaseIndentIf(indented);
}
writePunctuation(">");
@@ -4302,6 +4299,7 @@ namespace ts {
return getEffectiveLines(
includeComments => getLinesBetweenPositionAndPrecedingNonWhitespaceCharacter(
firstChild.pos,
parentNode.pos,
currentSourceFile!,
includeComments));
}
@@ -4359,6 +4357,7 @@ namespace ts {
return getEffectiveLines(
includeComments => getLinesBetweenPositionAndNextNonWhitespaceCharacter(
lastChild.end,
parentNode.end,
currentSourceFile!,
includeComments));
}
@@ -4398,6 +4397,21 @@ namespace ts {
return lines;
}
function writeLineSeparatorsAndIndentBefore(node: Node, parent: Node): boolean {
const leadingNewlines = preserveSourceNewlines && getLeadingLineTerminatorCount(parent, [node], ListFormat.None);
if (leadingNewlines) {
writeLinesAndIndent(leadingNewlines, /*writeLinesIfNotIndenting*/ false);
}
return !!leadingNewlines;
}
function writeLineSeparatorsAfter(node: Node, parent: Node) {
const trailingNewlines = preserveSourceNewlines && getClosingLineTerminatorCount(parent, [node], ListFormat.None);
if (trailingNewlines) {
writeLine(trailingNewlines);
}
}
function synthesizedNodeStartsOnNewLine(node: Node, format: ListFormat) {
if (nodeIsSynthesized(node)) {
const startsOnNewLine = getStartsOnNewLine(node);
+8 -5
View File
@@ -4,11 +4,14 @@ namespace ts {
enableEmitNotification: noop,
enableSubstitution: noop,
endLexicalEnvironment: returnUndefined,
getCompilerOptions: notImplemented,
getCompilerOptions: () => ({}),
getEmitHost: notImplemented,
getEmitResolver: notImplemented,
setLexicalEnvironmentFlags: noop,
getLexicalEnvironmentFlags: () => 0,
hoistFunctionDeclaration: noop,
hoistVariableDeclaration: noop,
addInitializationStatement: noop,
isEmitNotificationEnabled: notImplemented,
isSubstitutionEnabled: notImplemented,
onEmitNode: noop,
@@ -852,13 +855,13 @@ namespace ts {
* This function needs to be called whenever we transform the statement
* list of a source file, namespace, or function-like body.
*/
export function addCustomPrologue(target: Statement[], source: readonly Statement[], statementOffset: number, visitor?: (node: Node) => VisitResult<Node>): number;
export function addCustomPrologue(target: Statement[], source: readonly Statement[], statementOffset: number | undefined, visitor?: (node: Node) => VisitResult<Node>): number | undefined;
export function addCustomPrologue(target: Statement[], source: readonly Statement[], statementOffset: number | undefined, visitor?: (node: Node) => VisitResult<Node>): number | undefined {
export function addCustomPrologue(target: Statement[], source: readonly Statement[], statementOffset: number, visitor?: (node: Node) => VisitResult<Node>, filter?: (node: Node) => boolean): number;
export function addCustomPrologue(target: Statement[], source: readonly Statement[], statementOffset: number | undefined, visitor?: (node: Node) => VisitResult<Node>, filter?: (node: Node) => boolean): number | undefined;
export function addCustomPrologue(target: Statement[], source: readonly Statement[], statementOffset: number | undefined, visitor?: (node: Node) => VisitResult<Node>, filter: (node: Node) => boolean = returnTrue): number | undefined {
const numStatements = source.length;
while (statementOffset !== undefined && statementOffset < numStatements) {
const statement = source[statementOffset];
if (getEmitFlags(statement) & EmitFlags.CustomPrologue) {
if (getEmitFlags(statement) & EmitFlags.CustomPrologue && filter(statement)) {
append(target, visitor ? visitNode(statement, visitor, isStatement) : statement);
}
else {
+1 -1
View File
@@ -1803,7 +1803,7 @@ namespace ts {
}
// Stop searching if the line is not empty and not a comment
const lineText = file.text.slice(lineStarts[line - 1], lineStarts[line]).trim();
const lineText = file.text.slice(lineStarts[line], lineStarts[line + 1]).trim();
if (lineText !== "" && !/^(\s*)\/\/(.*)$/.test(lineText)) {
return -1;
}
+56 -1
View File
@@ -148,8 +148,12 @@ namespace ts {
const enabledSyntaxKindFeatures = new Array<SyntaxKindFeatureFlags>(SyntaxKind.Count);
let lexicalEnvironmentVariableDeclarations: VariableDeclaration[];
let lexicalEnvironmentFunctionDeclarations: FunctionDeclaration[];
let lexicalEnvironmentStatements: Statement[];
let lexicalEnvironmentFlags = LexicalEnvironmentFlags.None;
let lexicalEnvironmentVariableDeclarationsStack: VariableDeclaration[][] = [];
let lexicalEnvironmentFunctionDeclarationsStack: FunctionDeclaration[][] = [];
let lexicalEnvironmentStatementsStack: Statement[][] = [];
let lexicalEnvironmentFlagsStack: LexicalEnvironmentFlags[] = [];
let lexicalEnvironmentStackOffset = 0;
let lexicalEnvironmentSuspended = false;
let emitHelpers: EmitHelper[] | undefined;
@@ -168,8 +172,11 @@ namespace ts {
suspendLexicalEnvironment,
resumeLexicalEnvironment,
endLexicalEnvironment,
setLexicalEnvironmentFlags,
getLexicalEnvironmentFlags,
hoistVariableDeclaration,
hoistFunctionDeclaration,
addInitializationStatement,
requestEmitHelper,
readEmitHelpers,
enableSubstitution,
@@ -313,6 +320,9 @@ namespace ts {
else {
lexicalEnvironmentVariableDeclarations.push(decl);
}
if (lexicalEnvironmentFlags & LexicalEnvironmentFlags.InParameters) {
lexicalEnvironmentFlags |= LexicalEnvironmentFlags.VariablesHoistedInParameters;
}
}
/**
@@ -321,6 +331,7 @@ namespace ts {
function hoistFunctionDeclaration(func: FunctionDeclaration): void {
Debug.assert(state > TransformationState.Uninitialized, "Cannot modify the lexical environment during initialization.");
Debug.assert(state < TransformationState.Completed, "Cannot modify the lexical environment after transformation has completed.");
setEmitFlags(func, EmitFlags.CustomPrologue);
if (!lexicalEnvironmentFunctionDeclarations) {
lexicalEnvironmentFunctionDeclarations = [func];
}
@@ -329,6 +340,21 @@ namespace ts {
}
}
/**
* Adds an initialization statement to the top of the lexical environment.
*/
function addInitializationStatement(node: Statement): void {
Debug.assert(state > TransformationState.Uninitialized, "Cannot modify the lexical environment during initialization.");
Debug.assert(state < TransformationState.Completed, "Cannot modify the lexical environment after transformation has completed.");
setEmitFlags(node, EmitFlags.CustomPrologue);
if (!lexicalEnvironmentStatements) {
lexicalEnvironmentStatements = [node];
}
else {
lexicalEnvironmentStatements.push(node);
}
}
/**
* Starts a new lexical environment. Any existing hoisted variable or function declarations
* are pushed onto a stack, and the related storage variables are reset.
@@ -344,9 +370,13 @@ namespace ts {
// transformation.
lexicalEnvironmentVariableDeclarationsStack[lexicalEnvironmentStackOffset] = lexicalEnvironmentVariableDeclarations;
lexicalEnvironmentFunctionDeclarationsStack[lexicalEnvironmentStackOffset] = lexicalEnvironmentFunctionDeclarations;
lexicalEnvironmentStatementsStack[lexicalEnvironmentStackOffset] = lexicalEnvironmentStatements;
lexicalEnvironmentFlagsStack[lexicalEnvironmentStackOffset] = lexicalEnvironmentFlags;
lexicalEnvironmentStackOffset++;
lexicalEnvironmentVariableDeclarations = undefined!;
lexicalEnvironmentFunctionDeclarations = undefined!;
lexicalEnvironmentStatements = undefined!;
lexicalEnvironmentFlags = LexicalEnvironmentFlags.None;
}
/** Suspends the current lexical environment, usually after visiting a parameter list. */
@@ -375,7 +405,9 @@ namespace ts {
Debug.assert(!lexicalEnvironmentSuspended, "Lexical environment is suspended.");
let statements: Statement[] | undefined;
if (lexicalEnvironmentVariableDeclarations || lexicalEnvironmentFunctionDeclarations) {
if (lexicalEnvironmentVariableDeclarations ||
lexicalEnvironmentFunctionDeclarations ||
lexicalEnvironmentStatements) {
if (lexicalEnvironmentFunctionDeclarations) {
statements = [...lexicalEnvironmentFunctionDeclarations];
}
@@ -395,19 +427,42 @@ namespace ts {
statements.push(statement);
}
}
if (lexicalEnvironmentStatements) {
if (!statements) {
statements = [...lexicalEnvironmentStatements];
}
else {
statements = [...statements, ...lexicalEnvironmentStatements];
}
}
}
// Restore the previous lexical environment.
lexicalEnvironmentStackOffset--;
lexicalEnvironmentVariableDeclarations = lexicalEnvironmentVariableDeclarationsStack[lexicalEnvironmentStackOffset];
lexicalEnvironmentFunctionDeclarations = lexicalEnvironmentFunctionDeclarationsStack[lexicalEnvironmentStackOffset];
lexicalEnvironmentStatements = lexicalEnvironmentStatementsStack[lexicalEnvironmentStackOffset];
lexicalEnvironmentFlags = lexicalEnvironmentFlagsStack[lexicalEnvironmentStackOffset];
if (lexicalEnvironmentStackOffset === 0) {
lexicalEnvironmentVariableDeclarationsStack = [];
lexicalEnvironmentFunctionDeclarationsStack = [];
lexicalEnvironmentStatementsStack = [];
lexicalEnvironmentFlagsStack = [];
}
return statements;
}
function setLexicalEnvironmentFlags(flags: LexicalEnvironmentFlags, value: boolean): void {
lexicalEnvironmentFlags = value ?
lexicalEnvironmentFlags | flags :
lexicalEnvironmentFlags & ~flags;
}
function getLexicalEnvironmentFlags(): LexicalEnvironmentFlags {
return lexicalEnvironmentFlags;
}
function requestEmitHelper(helper: EmitHelper): void {
Debug.assert(state > TransformationState.Uninitialized, "Cannot modify the transformation context during initialization.");
Debug.assert(state < TransformationState.Completed, "Cannot modify the transformation context after transformation has completed.");
+1 -1
View File
@@ -606,7 +606,7 @@ namespace ts {
createConstructor(
/*decorators*/ undefined,
/*modifiers*/ undefined,
parameters,
parameters ?? [],
body
),
constructor || node
+13 -1
View File
@@ -76,7 +76,8 @@ namespace ts {
reportLikelyUnsafeImportRequiredError,
moduleResolverHost: host,
trackReferencedAmbientModule,
trackExternalModuleSymbolOfImportTypeNode
trackExternalModuleSymbolOfImportTypeNode,
reportNonlocalAugmentation
};
let errorNameNode: DeclarationName | undefined;
@@ -190,6 +191,17 @@ namespace ts {
}
}
function reportNonlocalAugmentation(containingFile: SourceFile, parentSymbol: Symbol, symbol: Symbol) {
const primaryDeclaration = find(parentSymbol.declarations, d => getSourceFileOfNode(d) === containingFile)!;
const augmentingDeclarations = filter(symbol.declarations, d => getSourceFileOfNode(d) !== containingFile);
for (const augmentations of augmentingDeclarations) {
context.addDiagnostic(addRelatedInfo(
createDiagnosticForNode(augmentations, Diagnostics.Declaration_augments_declaration_in_another_file_This_cannot_be_serialized),
createDiagnosticForNode(primaryDeclaration, Diagnostics.This_is_the_declaration_being_augmented_Consider_moving_the_augmenting_declaration_into_the_same_file)
));
}
}
function transformDeclarationsForJS(sourceFile: SourceFile, bundled?: boolean) {
const oldDiag = getSymbolAccessibilityDiagnostic;
getSymbolAccessibilityDiagnostic = (s) => ({
+2
View File
@@ -1853,6 +1853,8 @@ namespace ts {
// ensureUseStrict is false because no new prologue-directive should be added.
// addStandardPrologue will put already-existing directives at the beginning of the target statement-array
statementOffset = addStandardPrologue(prologue, body.statements, /*ensureUseStrict*/ false);
statementOffset = addCustomPrologue(statements, body.statements, statementOffset, visitor, isHoistedFunction);
statementOffset = addCustomPrologue(statements, body.statements, statementOffset, visitor, isHoistedVariableStatement);
}
multiLine = addDefaultValueAssignmentsIfNeeded(statements, node) || multiLine;
+138 -27
View File
@@ -5,6 +5,38 @@ namespace ts {
AsyncMethodsWithSuper = 1 << 0
}
// Facts we track as we traverse the tree
const enum HierarchyFacts {
None = 0,
//
// Ancestor facts
//
HasLexicalThis = 1 << 0,
IterationContainer = 1 << 1,
// NOTE: do not add more ancestor flags without also updating AncestorFactsMask below.
//
// Ancestor masks
//
AncestorFactsMask = (IterationContainer << 1) - 1,
SourceFileIncludes = HasLexicalThis,
SourceFileExcludes = IterationContainer,
StrictModeSourceFileIncludes = None,
ClassOrFunctionIncludes = HasLexicalThis,
ClassOrFunctionExcludes = IterationContainer,
ArrowFunctionIncludes = None,
ArrowFunctionExcludes = ClassOrFunctionExcludes,
IterationStatementIncludes = IterationContainer,
IterationStatementExcludes = None,
}
export function transformES2018(context: TransformationContext) {
const {
resumeLexicalEnvironment,
@@ -26,7 +58,7 @@ namespace ts {
let enabledSubstitutions: ESNextSubstitutionFlags;
let enclosingFunctionFlags: FunctionFlags;
let enclosingSuperContainerFlags: NodeCheckFlags = 0;
let hasLexicalThis: boolean;
let hierarchyFacts: HierarchyFacts = 0;
let currentSourceFile: SourceFile;
let taggedTemplateStringDeclarations: VariableDeclaration[];
@@ -40,6 +72,30 @@ namespace ts {
return chainBundle(transformSourceFile);
function affectsSubtree(excludeFacts: HierarchyFacts, includeFacts: HierarchyFacts) {
return hierarchyFacts !== (hierarchyFacts & ~excludeFacts | includeFacts);
}
/**
* Sets the `HierarchyFacts` for this node prior to visiting this node's subtree, returning the facts set prior to modification.
* @param excludeFacts The existing `HierarchyFacts` to reset before visiting the subtree.
* @param includeFacts The new `HierarchyFacts` to set before visiting the subtree.
*/
function enterSubtree(excludeFacts: HierarchyFacts, includeFacts: HierarchyFacts) {
const ancestorFacts = hierarchyFacts;
hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & HierarchyFacts.AncestorFactsMask;
return ancestorFacts;
}
/**
* Restores the `HierarchyFacts` for this node's ancestor after visiting this node's
* subtree.
* @param ancestorFacts The `HierarchyFacts` of the ancestor to restore after visiting the subtree.
*/
function exitSubtree(ancestorFacts: HierarchyFacts) {
hierarchyFacts = ancestorFacts;
}
function recordTaggedTemplateString(temp: Identifier) {
taggedTemplateStringDeclarations = append(
taggedTemplateStringDeclarations,
@@ -75,11 +131,11 @@ namespace ts {
return node;
}
function doWithLexicalThis<T, U>(cb: (value: T) => U, value: T) {
if (!hasLexicalThis) {
hasLexicalThis = true;
function doWithHierarchyFacts<T, U>(cb: (value: T) => U, value: T, excludeFacts: HierarchyFacts, includeFacts: HierarchyFacts) {
if (affectsSubtree(excludeFacts, includeFacts)) {
const ancestorFacts = enterSubtree(excludeFacts, includeFacts);
const result = cb(value);
hasLexicalThis = false;
exitSubtree(ancestorFacts);
return result;
}
return cb(value);
@@ -112,26 +168,66 @@ namespace ts {
return visitVariableStatement(node as VariableStatement);
case SyntaxKind.VariableDeclaration:
return visitVariableDeclaration(node as VariableDeclaration);
case SyntaxKind.DoStatement:
case SyntaxKind.WhileStatement:
case SyntaxKind.ForInStatement:
return doWithHierarchyFacts(
visitDefault,
node,
HierarchyFacts.IterationStatementExcludes,
HierarchyFacts.IterationStatementIncludes);
case SyntaxKind.ForOfStatement:
return visitForOfStatement(node as ForOfStatement, /*outermostLabeledStatement*/ undefined);
case SyntaxKind.ForStatement:
return visitForStatement(node as ForStatement);
return doWithHierarchyFacts(
visitForStatement,
node as ForStatement,
HierarchyFacts.IterationStatementExcludes,
HierarchyFacts.IterationStatementIncludes);
case SyntaxKind.VoidExpression:
return visitVoidExpression(node as VoidExpression);
case SyntaxKind.Constructor:
return doWithLexicalThis(visitConstructorDeclaration, node as ConstructorDeclaration);
return doWithHierarchyFacts(
visitConstructorDeclaration,
node as ConstructorDeclaration,
HierarchyFacts.ClassOrFunctionExcludes,
HierarchyFacts.ClassOrFunctionIncludes);
case SyntaxKind.MethodDeclaration:
return doWithLexicalThis(visitMethodDeclaration, node as MethodDeclaration);
return doWithHierarchyFacts(
visitMethodDeclaration,
node as MethodDeclaration,
HierarchyFacts.ClassOrFunctionExcludes,
HierarchyFacts.ClassOrFunctionIncludes);
case SyntaxKind.GetAccessor:
return doWithLexicalThis(visitGetAccessorDeclaration, node as GetAccessorDeclaration);
return doWithHierarchyFacts(
visitGetAccessorDeclaration,
node as GetAccessorDeclaration,
HierarchyFacts.ClassOrFunctionExcludes,
HierarchyFacts.ClassOrFunctionIncludes);
case SyntaxKind.SetAccessor:
return doWithLexicalThis(visitSetAccessorDeclaration, node as SetAccessorDeclaration);
return doWithHierarchyFacts(
visitSetAccessorDeclaration,
node as SetAccessorDeclaration,
HierarchyFacts.ClassOrFunctionExcludes,
HierarchyFacts.ClassOrFunctionIncludes);
case SyntaxKind.FunctionDeclaration:
return doWithLexicalThis(visitFunctionDeclaration, node as FunctionDeclaration);
return doWithHierarchyFacts(
visitFunctionDeclaration,
node as FunctionDeclaration,
HierarchyFacts.ClassOrFunctionExcludes,
HierarchyFacts.ClassOrFunctionIncludes);
case SyntaxKind.FunctionExpression:
return doWithLexicalThis(visitFunctionExpression, node as FunctionExpression);
return doWithHierarchyFacts(
visitFunctionExpression,
node as FunctionExpression,
HierarchyFacts.ClassOrFunctionExcludes,
HierarchyFacts.ClassOrFunctionIncludes);
case SyntaxKind.ArrowFunction:
return visitArrowFunction(node as ArrowFunction);
return doWithHierarchyFacts(
visitArrowFunction,
node as ArrowFunction,
HierarchyFacts.ArrowFunctionExcludes,
HierarchyFacts.ArrowFunctionIncludes);
case SyntaxKind.Parameter:
return visitParameter(node as ParameterDeclaration);
case SyntaxKind.ExpressionStatement:
@@ -152,7 +248,11 @@ namespace ts {
return visitEachChild(node, visitor, context);
case SyntaxKind.ClassDeclaration:
case SyntaxKind.ClassExpression:
return doWithLexicalThis(visitDefault, node);
return doWithHierarchyFacts(
visitDefault,
node,
HierarchyFacts.ClassOrFunctionExcludes,
HierarchyFacts.ClassOrFunctionIncludes);
default:
return visitEachChild(node, visitor, context);
}
@@ -231,7 +331,7 @@ namespace ts {
if (statement.kind === SyntaxKind.ForOfStatement && (<ForOfStatement>statement).awaitModifier) {
return visitForOfStatement(<ForOfStatement>statement, node);
}
return restoreEnclosingLabel(visitEachChild(statement, visitor, context), node);
return restoreEnclosingLabel(visitNode(statement, visitor, isStatement, liftToBlock), node);
}
return visitEachChild(node, visitor, context);
}
@@ -311,14 +411,20 @@ namespace ts {
}
function visitSourceFile(node: SourceFile): SourceFile {
const ancestorFacts = enterSubtree(
HierarchyFacts.SourceFileExcludes,
isEffectiveStrictModeSourceFile(node, compilerOptions) ?
HierarchyFacts.StrictModeSourceFileIncludes :
HierarchyFacts.SourceFileIncludes);
exportedVariableStatement = false;
hasLexicalThis = !isEffectiveStrictModeSourceFile(node, compilerOptions);
const visited = visitEachChild(node, visitor, context);
const statement = concatenate(visited.statements, taggedTemplateStringDeclarations && [
createVariableStatement(/*modifiers*/ undefined,
createVariableDeclarationList(taggedTemplateStringDeclarations))
]);
return updateSourceFileNode(visited, setTextRange(createNodeArray(statement), node.statements));
const result = updateSourceFileNode(visited, setTextRange(createNodeArray(statement), node.statements));
exitSubtree(ancestorFacts);
return result;
}
function visitTaggedTemplateExpression(node: TaggedTemplateExpression) {
@@ -441,15 +547,15 @@ namespace ts {
* @param node A ForOfStatement.
*/
function visitForOfStatement(node: ForOfStatement, outermostLabeledStatement: LabeledStatement | undefined): VisitResult<Statement> {
const ancestorFacts = enterSubtree(HierarchyFacts.IterationStatementExcludes, HierarchyFacts.IterationStatementIncludes);
if (node.initializer.transformFlags & TransformFlags.ContainsObjectRestOrSpread) {
node = transformForOfStatementWithObjectRest(node);
}
if (node.awaitModifier) {
return transformForAwaitOfStatement(node, outermostLabeledStatement);
}
else {
return restoreEnclosingLabel(visitEachChild(node, visitor, context), outermostLabeledStatement);
}
const result = node.awaitModifier ?
transformForAwaitOfStatement(node, outermostLabeledStatement, ancestorFacts) :
restoreEnclosingLabel(visitEachChild(node, visitor, context), outermostLabeledStatement);
exitSubtree(ancestorFacts);
return result;
}
function transformForOfStatementWithObjectRest(node: ForOfStatement) {
@@ -528,7 +634,7 @@ namespace ts {
: createAwait(expression);
}
function transformForAwaitOfStatement(node: ForOfStatement, outermostLabeledStatement: LabeledStatement | undefined) {
function transformForAwaitOfStatement(node: ForOfStatement, outermostLabeledStatement: LabeledStatement | undefined, ancestorFacts: HierarchyFacts) {
const expression = visitNode(node.expression, visitor, isExpression);
const iterator = isIdentifier(expression) ? getGeneratedNameForNode(expression) : createTempVariable(/*recordTempVariable*/ undefined);
const result = isIdentifier(expression) ? getGeneratedNameForNode(iterator) : createTempVariable(/*recordTempVariable*/ undefined);
@@ -544,13 +650,18 @@ namespace ts {
hoistVariableDeclaration(errorRecord);
hoistVariableDeclaration(returnMethod);
// if we are enclosed in an outer loop ensure we reset 'errorRecord' per each iteration
const initializer = ancestorFacts & HierarchyFacts.IterationContainer ?
inlineExpressions([createAssignment(errorRecord, createVoidZero()), callValues]) :
callValues;
const forStatement = setEmitFlags(
setTextRange(
createFor(
/*initializer*/ setEmitFlags(
setTextRange(
createVariableDeclarationList([
setTextRange(createVariableDeclaration(iterator, /*type*/ undefined, callValues), node.expression),
setTextRange(createVariableDeclaration(iterator, /*type*/ undefined, initializer), node.expression),
createVariableDeclaration(result)
]),
node.expression
@@ -809,7 +920,7 @@ namespace ts {
visitLexicalEnvironment(node.body!.statements, visitor, context, statementOffset)
)
),
hasLexicalThis
!!(hierarchyFacts & HierarchyFacts.HasLexicalThis)
)
);
@@ -1115,7 +1226,7 @@ namespace ts {
context.requestEmitHelper(asyncGeneratorHelper);
// Mark this node as originally an async function
(generatorFunc.emitNode || (generatorFunc.emitNode = {} as EmitNode)).flags |= EmitFlags.AsyncFunctionBody;
(generatorFunc.emitNode || (generatorFunc.emitNode = {} as EmitNode)).flags |= EmitFlags.AsyncFunctionBody | EmitFlags.ReuseTempVariableScope;
return createCall(
getUnscopedHelperName("__asyncGenerator"),
+192 -188
View File
@@ -1,209 +1,213 @@
/*@internal*/
namespace ts {
export function transformES2020(context: TransformationContext) {
const {
hoistVariableDeclaration,
} = context;
export function transformES2020(context: TransformationContext) {
const {
hoistVariableDeclaration,
} = context;
return chainBundle(transformSourceFile);
return chainBundle(transformSourceFile);
function transformSourceFile(node: SourceFile) {
if (node.isDeclarationFile) {
return node;
}
function transformSourceFile(node: SourceFile) {
if (node.isDeclarationFile) {
return node;
}
return visitEachChild(node, visitor, context);
}
return visitEachChild(node, visitor, context);
}
function visitor(node: Node): VisitResult<Node> {
if ((node.transformFlags & TransformFlags.ContainsES2020) === 0) {
return node;
}
switch (node.kind) {
case SyntaxKind.PropertyAccessExpression:
case SyntaxKind.ElementAccessExpression:
case SyntaxKind.CallExpression:
if (node.flags & NodeFlags.OptionalChain) {
const updated = visitOptionalExpression(node as OptionalChain, /*captureThisArg*/ false, /*isDelete*/ false);
Debug.assertNotNode(updated, isSyntheticReference);
return updated;
}
return visitEachChild(node, visitor, context);
case SyntaxKind.BinaryExpression:
if ((<BinaryExpression>node).operatorToken.kind === SyntaxKind.QuestionQuestionToken) {
return transformNullishCoalescingExpression(<BinaryExpression>node);
}
return visitEachChild(node, visitor, context);
case SyntaxKind.DeleteExpression:
return visitDeleteExpression(node as DeleteExpression);
default:
return visitEachChild(node, visitor, context);
}
}
function visitor(node: Node): VisitResult<Node> {
if ((node.transformFlags & TransformFlags.ContainsES2020) === 0) {
return node;
}
switch (node.kind) {
case SyntaxKind.PropertyAccessExpression:
case SyntaxKind.ElementAccessExpression:
case SyntaxKind.CallExpression:
if (node.flags & NodeFlags.OptionalChain) {
const updated = visitOptionalExpression(node as OptionalChain, /*captureThisArg*/ false, /*isDelete*/ false);
Debug.assertNotNode(updated, isSyntheticReference);
return updated;
}
return visitEachChild(node, visitor, context);
case SyntaxKind.BinaryExpression:
if ((<BinaryExpression>node).operatorToken.kind === SyntaxKind.QuestionQuestionToken) {
return transformNullishCoalescingExpression(<BinaryExpression>node);
}
return visitEachChild(node, visitor, context);
case SyntaxKind.DeleteExpression:
return visitDeleteExpression(node as DeleteExpression);
default:
return visitEachChild(node, visitor, context);
}
}
function flattenChain(chain: OptionalChain) {
Debug.assertNotNode(chain, isNonNullChain);
const links: OptionalChain[] = [chain];
while (!chain.questionDotToken && !isTaggedTemplateExpression(chain)) {
chain = cast(skipPartiallyEmittedExpressions(chain.expression), isOptionalChain);
Debug.assertNotNode(chain, isNonNullChain);
links.unshift(chain);
}
return { expression: chain.expression, chain: links };
}
function flattenChain(chain: OptionalChain) {
Debug.assertNotNode(chain, isNonNullChain);
const links: OptionalChain[] = [chain];
while (!chain.questionDotToken && !isTaggedTemplateExpression(chain)) {
chain = cast(skipPartiallyEmittedExpressions(chain.expression), isOptionalChain);
Debug.assertNotNode(chain, isNonNullChain);
links.unshift(chain);
}
return { expression: chain.expression, chain: links };
}
function visitNonOptionalParenthesizedExpression(node: ParenthesizedExpression, captureThisArg: boolean, isDelete: boolean): Expression {
const expression = visitNonOptionalExpression(node.expression, captureThisArg, isDelete);
if (isSyntheticReference(expression)) {
// `(a.b)` -> { expression `((_a = a).b)`, thisArg: `_a` }
// `(a[b])` -> { expression `((_a = a)[b])`, thisArg: `_a` }
return createSyntheticReferenceExpression(updateParen(node, expression.expression), expression.thisArg);
}
return updateParen(node, expression);
}
function visitNonOptionalParenthesizedExpression(node: ParenthesizedExpression, captureThisArg: boolean, isDelete: boolean): Expression {
const expression = visitNonOptionalExpression(node.expression, captureThisArg, isDelete);
if (isSyntheticReference(expression)) {
// `(a.b)` -> { expression `((_a = a).b)`, thisArg: `_a` }
// `(a[b])` -> { expression `((_a = a)[b])`, thisArg: `_a` }
return createSyntheticReferenceExpression(updateParen(node, expression.expression), expression.thisArg);
}
return updateParen(node, expression);
}
function visitNonOptionalPropertyOrElementAccessExpression(node: AccessExpression, captureThisArg: boolean, isDelete: boolean): Expression {
if (isOptionalChain(node)) {
// If `node` is an optional chain, then it is the outermost chain of an optional expression.
return visitOptionalExpression(node, captureThisArg, isDelete);
}
function visitNonOptionalPropertyOrElementAccessExpression(node: AccessExpression, captureThisArg: boolean, isDelete: boolean): Expression {
if (isOptionalChain(node)) {
// If `node` is an optional chain, then it is the outermost chain of an optional expression.
return visitOptionalExpression(node, captureThisArg, isDelete);
}
let expression: Expression = visitNode(node.expression, visitor, isExpression);
Debug.assertNotNode(expression, isSyntheticReference);
let expression: Expression = visitNode(node.expression, visitor, isExpression);
Debug.assertNotNode(expression, isSyntheticReference);
let thisArg: Expression | undefined;
if (captureThisArg) {
if (shouldCaptureInTempVariable(expression)) {
thisArg = createTempVariable(hoistVariableDeclaration);
expression = createAssignment(thisArg, expression);
}
else {
thisArg = expression;
}
}
let thisArg: Expression | undefined;
if (captureThisArg) {
if (shouldCaptureInTempVariable(expression)) {
thisArg = createTempVariable(hoistVariableDeclaration);
expression = createAssignment(thisArg, expression);
// if (inParameterInitializer) tempVariableInParameter = true;
}
else {
thisArg = expression;
}
}
expression = node.kind === SyntaxKind.PropertyAccessExpression
? updatePropertyAccess(node, expression, visitNode(node.name, visitor, isIdentifier))
: updateElementAccess(node, expression, visitNode(node.argumentExpression, visitor, isExpression));
return thisArg ? createSyntheticReferenceExpression(expression, thisArg) : expression;
}
expression = node.kind === SyntaxKind.PropertyAccessExpression
? updatePropertyAccess(node, expression, visitNode(node.name, visitor, isIdentifier))
: updateElementAccess(node, expression, visitNode(node.argumentExpression, visitor, isExpression));
return thisArg ? createSyntheticReferenceExpression(expression, thisArg) : expression;
}
function visitNonOptionalCallExpression(node: CallExpression, captureThisArg: boolean): Expression {
if (isOptionalChain(node)) {
// If `node` is an optional chain, then it is the outermost chain of an optional expression.
return visitOptionalExpression(node, captureThisArg, /*isDelete*/ false);
}
return visitEachChild(node, visitor, context);
}
function visitNonOptionalCallExpression(node: CallExpression, captureThisArg: boolean): Expression {
if (isOptionalChain(node)) {
// If `node` is an optional chain, then it is the outermost chain of an optional expression.
return visitOptionalExpression(node, captureThisArg, /*isDelete*/ false);
}
return visitEachChild(node, visitor, context);
}
function visitNonOptionalExpression(node: Expression, captureThisArg: boolean, isDelete: boolean): Expression {
switch (node.kind) {
case SyntaxKind.ParenthesizedExpression: return visitNonOptionalParenthesizedExpression(node as ParenthesizedExpression, captureThisArg, isDelete);
case SyntaxKind.PropertyAccessExpression:
case SyntaxKind.ElementAccessExpression: return visitNonOptionalPropertyOrElementAccessExpression(node as AccessExpression, captureThisArg, isDelete);
case SyntaxKind.CallExpression: return visitNonOptionalCallExpression(node as CallExpression, captureThisArg);
default: return visitNode(node, visitor, isExpression);
}
}
function visitNonOptionalExpression(node: Expression, captureThisArg: boolean, isDelete: boolean): Expression {
switch (node.kind) {
case SyntaxKind.ParenthesizedExpression: return visitNonOptionalParenthesizedExpression(node as ParenthesizedExpression, captureThisArg, isDelete);
case SyntaxKind.PropertyAccessExpression:
case SyntaxKind.ElementAccessExpression: return visitNonOptionalPropertyOrElementAccessExpression(node as AccessExpression, captureThisArg, isDelete);
case SyntaxKind.CallExpression: return visitNonOptionalCallExpression(node as CallExpression, captureThisArg);
default: return visitNode(node, visitor, isExpression);
}
}
function visitOptionalExpression(node: OptionalChain, captureThisArg: boolean, isDelete: boolean): Expression {
const { expression, chain } = flattenChain(node);
const left = visitNonOptionalExpression(expression, isCallChain(chain[0]), /*isDelete*/ false);
const leftThisArg = isSyntheticReference(left) ? left.thisArg : undefined;
let leftExpression = isSyntheticReference(left) ? left.expression : left;
let capturedLeft: Expression = leftExpression;
if (shouldCaptureInTempVariable(leftExpression)) {
capturedLeft = createTempVariable(hoistVariableDeclaration);
leftExpression = createAssignment(capturedLeft, leftExpression);
}
let rightExpression = capturedLeft;
let thisArg: Expression | undefined;
for (let i = 0; i < chain.length; i++) {
const segment = chain[i];
switch (segment.kind) {
case SyntaxKind.PropertyAccessExpression:
case SyntaxKind.ElementAccessExpression:
if (i === chain.length - 1 && captureThisArg) {
if (shouldCaptureInTempVariable(rightExpression)) {
thisArg = createTempVariable(hoistVariableDeclaration);
rightExpression = createAssignment(thisArg, rightExpression);
}
else {
thisArg = rightExpression;
}
}
rightExpression = segment.kind === SyntaxKind.PropertyAccessExpression
? createPropertyAccess(rightExpression, visitNode(segment.name, visitor, isIdentifier))
: createElementAccess(rightExpression, visitNode(segment.argumentExpression, visitor, isExpression));
break;
case SyntaxKind.CallExpression:
if (i === 0 && leftThisArg) {
rightExpression = createFunctionCall(
rightExpression,
leftThisArg.kind === SyntaxKind.SuperKeyword ? createThis() : leftThisArg,
visitNodes(segment.arguments, visitor, isExpression)
);
}
else {
rightExpression = createCall(
rightExpression,
/*typeArguments*/ undefined,
visitNodes(segment.arguments, visitor, isExpression)
);
}
break;
}
setOriginalNode(rightExpression, segment);
}
function visitOptionalExpression(node: OptionalChain, captureThisArg: boolean, isDelete: boolean): Expression {
const { expression, chain } = flattenChain(node);
const left = visitNonOptionalExpression(expression, isCallChain(chain[0]), /*isDelete*/ false);
const leftThisArg = isSyntheticReference(left) ? left.thisArg : undefined;
let leftExpression = isSyntheticReference(left) ? left.expression : left;
let capturedLeft: Expression = leftExpression;
if (shouldCaptureInTempVariable(leftExpression)) {
capturedLeft = createTempVariable(hoistVariableDeclaration);
leftExpression = createAssignment(capturedLeft, leftExpression);
// if (inParameterInitializer) tempVariableInParameter = true;
}
let rightExpression = capturedLeft;
let thisArg: Expression | undefined;
for (let i = 0; i < chain.length; i++) {
const segment = chain[i];
switch (segment.kind) {
case SyntaxKind.PropertyAccessExpression:
case SyntaxKind.ElementAccessExpression:
if (i === chain.length - 1 && captureThisArg) {
if (shouldCaptureInTempVariable(rightExpression)) {
thisArg = createTempVariable(hoistVariableDeclaration);
rightExpression = createAssignment(thisArg, rightExpression);
// if (inParameterInitializer) tempVariableInParameter = true;
}
else {
thisArg = rightExpression;
}
}
rightExpression = segment.kind === SyntaxKind.PropertyAccessExpression
? createPropertyAccess(rightExpression, visitNode(segment.name, visitor, isIdentifier))
: createElementAccess(rightExpression, visitNode(segment.argumentExpression, visitor, isExpression));
break;
case SyntaxKind.CallExpression:
if (i === 0 && leftThisArg) {
rightExpression = createFunctionCall(
rightExpression,
leftThisArg.kind === SyntaxKind.SuperKeyword ? createThis() : leftThisArg,
visitNodes(segment.arguments, visitor, isExpression)
);
}
else {
rightExpression = createCall(
rightExpression,
/*typeArguments*/ undefined,
visitNodes(segment.arguments, visitor, isExpression)
);
}
break;
}
setOriginalNode(rightExpression, segment);
}
const target = isDelete
? createConditional(createNotNullCondition(leftExpression, capturedLeft, /*invert*/ true), createTrue(), createDelete(rightExpression))
: createConditional(createNotNullCondition(leftExpression, capturedLeft, /*invert*/ true), createVoidZero(), rightExpression);
return thisArg ? createSyntheticReferenceExpression(target, thisArg) : target;
}
const target = isDelete
? createConditional(createNotNullCondition(leftExpression, capturedLeft, /*invert*/ true), createTrue(), createDelete(rightExpression))
: createConditional(createNotNullCondition(leftExpression, capturedLeft, /*invert*/ true), createVoidZero(), rightExpression);
return thisArg ? createSyntheticReferenceExpression(target, thisArg) : target;
}
function createNotNullCondition(left: Expression, right: Expression, invert?: boolean) {
return createBinary(
createBinary(
left,
createToken(invert ? SyntaxKind.EqualsEqualsEqualsToken : SyntaxKind.ExclamationEqualsEqualsToken),
createNull()
),
createToken(invert ? SyntaxKind.BarBarToken : SyntaxKind.AmpersandAmpersandToken),
createBinary(
right,
createToken(invert ? SyntaxKind.EqualsEqualsEqualsToken : SyntaxKind.ExclamationEqualsEqualsToken),
createVoidZero()
)
);
}
function createNotNullCondition(left: Expression, right: Expression, invert?: boolean) {
return createBinary(
createBinary(
left,
createToken(invert ? SyntaxKind.EqualsEqualsEqualsToken : SyntaxKind.ExclamationEqualsEqualsToken),
createNull()
),
createToken(invert ? SyntaxKind.BarBarToken : SyntaxKind.AmpersandAmpersandToken),
createBinary(
right,
createToken(invert ? SyntaxKind.EqualsEqualsEqualsToken : SyntaxKind.ExclamationEqualsEqualsToken),
createVoidZero()
)
);
}
function transformNullishCoalescingExpression(node: BinaryExpression) {
let left = visitNode(node.left, visitor, isExpression);
let right = left;
if (shouldCaptureInTempVariable(left)) {
right = createTempVariable(hoistVariableDeclaration);
left = createAssignment(right, left);
}
return createConditional(
createNotNullCondition(left, right),
right,
visitNode(node.right, visitor, isExpression),
);
}
function transformNullishCoalescingExpression(node: BinaryExpression) {
let left = visitNode(node.left, visitor, isExpression);
let right = left;
if (shouldCaptureInTempVariable(left)) {
right = createTempVariable(hoistVariableDeclaration);
left = createAssignment(right, left);
// if (inParameterInitializer) tempVariableInParameter = true;
}
return createConditional(
createNotNullCondition(left, right),
right,
visitNode(node.right, visitor, isExpression),
);
}
function shouldCaptureInTempVariable(expression: Expression): boolean {
// don't capture identifiers and `this` in a temporary variable
// `super` cannot be captured as it's no real variable
return !isIdentifier(expression) &&
expression.kind !== SyntaxKind.ThisKeyword &&
expression.kind !== SyntaxKind.SuperKeyword;
}
function shouldCaptureInTempVariable(expression: Expression): boolean {
// don't capture identifiers and `this` in a temporary variable
// `super` cannot be captured as it's no real variable
return !isIdentifier(expression) &&
expression.kind !== SyntaxKind.ThisKeyword &&
expression.kind !== SyntaxKind.SuperKeyword;
}
function visitDeleteExpression(node: DeleteExpression) {
return isOptionalChain(skipParentheses(node.expression))
? setOriginalNode(visitNonOptionalExpression(node.expression, /*captureThisArg*/ false, /*isDelete*/ true), node)
: updateDelete(node, visitNode(node.expression, visitor, isExpression));
}
}
function visitDeleteExpression(node: DeleteExpression) {
return isOptionalChain(skipParentheses(node.expression))
? setOriginalNode(visitNonOptionalExpression(node.expression, /*captureThisArg*/ false, /*isDelete*/ true), node)
: updateDelete(node, visitNode(node.expression, visitor, isExpression));
}
}
}
+31 -12
View File
@@ -1107,6 +1107,7 @@ namespace ts {
exclamationToken?: ExclamationToken;
body?: Block | Expression;
/* @internal */ endFlowNode?: FlowNode;
/* @internal */ returnFlowNode?: FlowNode;
}
export type FunctionLikeDeclaration =
@@ -1152,7 +1153,6 @@ namespace ts {
kind: SyntaxKind.Constructor;
parent: ClassLikeDeclaration;
body?: FunctionBody;
/* @internal */ returnFlowNode?: FlowNode;
}
/** For when we encounter a semicolon in a class declaration. ES6 allows these as class elements. */
@@ -3421,6 +3421,8 @@ namespace ts {
getWidenedType(type: Type): Type;
/* @internal */
getPromisedTypeOfPromise(promise: Type, errorNode?: Node): Type | undefined;
/* @internal */
getAwaitedType(type: Type): Type | undefined;
getReturnTypeOfSignature(signature: Signature): Type;
/**
* Gets the type of a parameter at a given position in a signature.
@@ -3435,24 +3437,24 @@ namespace ts {
// TODO: GH#18217 `xToDeclaration` calls are frequently asserted as defined.
/** Note that the resulting nodes cannot be checked. */
typeToTypeNode(type: Type, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): TypeNode | undefined;
/* @internal */ typeToTypeNode(type: Type, enclosingDeclaration?: Node, flags?: NodeBuilderFlags, tracker?: SymbolTracker): TypeNode | undefined; // eslint-disable-line @typescript-eslint/unified-signatures
typeToTypeNode(type: Type, enclosingDeclaration: Node | undefined, flags: NodeBuilderFlags | undefined): TypeNode | undefined;
/* @internal */ typeToTypeNode(type: Type, enclosingDeclaration: Node | undefined, flags: NodeBuilderFlags | undefined, tracker?: SymbolTracker): TypeNode | undefined; // eslint-disable-line @typescript-eslint/unified-signatures
/** Note that the resulting nodes cannot be checked. */
signatureToSignatureDeclaration(signature: Signature, kind: SyntaxKind, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): SignatureDeclaration & {typeArguments?: NodeArray<TypeNode>} | undefined;
/* @internal */ signatureToSignatureDeclaration(signature: Signature, kind: SyntaxKind, enclosingDeclaration?: Node, flags?: NodeBuilderFlags, tracker?: SymbolTracker): SignatureDeclaration & {typeArguments?: NodeArray<TypeNode>} | undefined; // eslint-disable-line @typescript-eslint/unified-signatures
signatureToSignatureDeclaration(signature: Signature, kind: SyntaxKind, enclosingDeclaration: Node | undefined, flags: NodeBuilderFlags | undefined): SignatureDeclaration & {typeArguments?: NodeArray<TypeNode>} | undefined;
/* @internal */ signatureToSignatureDeclaration(signature: Signature, kind: SyntaxKind, enclosingDeclaration: Node | undefined, flags: NodeBuilderFlags | undefined, tracker?: SymbolTracker): SignatureDeclaration & {typeArguments?: NodeArray<TypeNode>} | undefined; // eslint-disable-line @typescript-eslint/unified-signatures
/** Note that the resulting nodes cannot be checked. */
indexInfoToIndexSignatureDeclaration(indexInfo: IndexInfo, kind: IndexKind, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): IndexSignatureDeclaration | undefined;
/* @internal */ indexInfoToIndexSignatureDeclaration(indexInfo: IndexInfo, kind: IndexKind, enclosingDeclaration?: Node, flags?: NodeBuilderFlags, tracker?: SymbolTracker): IndexSignatureDeclaration | undefined; // eslint-disable-line @typescript-eslint/unified-signatures
indexInfoToIndexSignatureDeclaration(indexInfo: IndexInfo, kind: IndexKind, enclosingDeclaration: Node | undefined, flags: NodeBuilderFlags | undefined): IndexSignatureDeclaration | undefined;
/* @internal */ indexInfoToIndexSignatureDeclaration(indexInfo: IndexInfo, kind: IndexKind, enclosingDeclaration: Node | undefined, flags: NodeBuilderFlags | undefined, tracker?: SymbolTracker): IndexSignatureDeclaration | undefined; // eslint-disable-line @typescript-eslint/unified-signatures
/** Note that the resulting nodes cannot be checked. */
symbolToEntityName(symbol: Symbol, meaning: SymbolFlags, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): EntityName | undefined;
symbolToEntityName(symbol: Symbol, meaning: SymbolFlags, enclosingDeclaration: Node | undefined, flags: NodeBuilderFlags | undefined): EntityName | undefined;
/** Note that the resulting nodes cannot be checked. */
symbolToExpression(symbol: Symbol, meaning: SymbolFlags, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): Expression | undefined;
symbolToExpression(symbol: Symbol, meaning: SymbolFlags, enclosingDeclaration: Node | undefined, flags: NodeBuilderFlags | undefined): Expression | undefined;
/** Note that the resulting nodes cannot be checked. */
symbolToTypeParameterDeclarations(symbol: Symbol, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): NodeArray<TypeParameterDeclaration> | undefined;
symbolToTypeParameterDeclarations(symbol: Symbol, enclosingDeclaration: Node | undefined, flags: NodeBuilderFlags | undefined): NodeArray<TypeParameterDeclaration> | undefined;
/** Note that the resulting nodes cannot be checked. */
symbolToParameterDeclaration(symbol: Symbol, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): ParameterDeclaration | undefined;
symbolToParameterDeclaration(symbol: Symbol, enclosingDeclaration: Node | undefined, flags: NodeBuilderFlags | undefined): ParameterDeclaration | undefined;
/** Note that the resulting nodes cannot be checked. */
typeParameterToDeclaration(parameter: TypeParameter, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): TypeParameterDeclaration | undefined;
typeParameterToDeclaration(parameter: TypeParameter, enclosingDeclaration: Node | undefined, flags: NodeBuilderFlags | undefined): TypeParameterDeclaration | undefined;
getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[];
getSymbolAtLocation(node: Node): Symbol | undefined;
@@ -4157,6 +4159,7 @@ namespace ts {
deferralParent?: Type; // Source union/intersection of a deferred type
cjsExportMerged?: Symbol; // Version of the symbol with all non export= exports merged with the export= target
typeOnlyDeclaration?: TypeOnlyCompatibleAliasDeclaration | false; // First resolved alias declaration that makes the symbol only usable in type constructs
isConstructorDeclaredProperty?: boolean; // Property declared through 'this.x = ...' assignment in constructor
}
/* @internal */
@@ -4323,6 +4326,7 @@ namespace ts {
instantiations?: Map<Type>; // Instantiations of generic type alias (undefined if non-generic)
isExhaustive?: boolean; // Is node an exhaustive switch statement
skipDirectInference?: true; // Flag set by the API `getContextualType` call on a node when `Completions` is passed to force the checker to skip making inferences to a node's type
declarationRequiresScopeChange?: boolean; // Set by `useOuterVariableScopeInParameter` in checker when downlevel emit would change the name resolution scope inside of a parameter.
}
export const enum TypeFlags {
@@ -5994,6 +5998,13 @@ namespace ts {
set?: Expression;
}
/* @internal */
export const enum LexicalEnvironmentFlags {
None = 0,
InParameters = 1 << 0, // currently visiting a parameter list
VariablesHoistedInParameters = 1 << 1 // a temp variable was hoisted while visiting a parameter list
}
export interface TransformationContext {
/*@internal*/ getEmitResolver(): EmitResolver;
/*@internal*/ getEmitHost(): EmitHost;
@@ -6004,6 +6015,9 @@ namespace ts {
/** Starts a new lexical environment. */
startLexicalEnvironment(): void;
/* @internal */ setLexicalEnvironmentFlags(flags: LexicalEnvironmentFlags, value: boolean): void;
/* @internal */ getLexicalEnvironmentFlags(): LexicalEnvironmentFlags;
/** Suspends the current lexical environment, usually after visiting a parameter list. */
suspendLexicalEnvironment(): void;
@@ -6019,6 +6033,10 @@ namespace ts {
/** Hoists a variable declaration to the containing scope. */
hoistVariableDeclaration(node: Identifier): void;
/** Adds an initialization statement to the top of the lexical environment. */
/* @internal */
addInitializationStatement(node: Statement): void;
/** Records a request for a non-scoped emit helper in the current context. */
requestEmitHelper(helper: EmitHelper): void;
@@ -6468,6 +6486,7 @@ namespace ts {
moduleResolverHost?: ModuleSpecifierResolutionHost & { getCommonSourceDirectory(): string };
trackReferencedAmbientModule?(decl: ModuleDeclaration, symbol: Symbol): void;
trackExternalModuleSymbolOfImportTypeNode?(symbol: Symbol): void;
reportNonlocalAugmentation?(containingFile: SourceFile, parentSymbol: Symbol, augmentingSymbol: Symbol): void;
}
export interface TextSpan {
+43 -8
View File
@@ -876,6 +876,10 @@ namespace ts {
return info.declaration ? declarationNameToString(info.declaration.parameters[0].name) : undefined;
}
export function isComputedNonLiteralName(name: PropertyName): boolean {
return name.kind === SyntaxKind.ComputedPropertyName && !isStringOrNumericLiteralLike(name.expression);
}
export function getTextOfPropertyName(name: PropertyName | NoSubstitutionTemplateLiteral): __String {
switch (name.kind) {
case SyntaxKind.Identifier:
@@ -1088,6 +1092,26 @@ namespace ts {
&& (<ExpressionStatement>node).expression.kind === SyntaxKind.StringLiteral;
}
export function isCustomPrologue(node: Statement) {
return !!(getEmitFlags(node) & EmitFlags.CustomPrologue);
}
export function isHoistedFunction(node: Statement) {
return isCustomPrologue(node)
&& isFunctionDeclaration(node);
}
function isHoistedVariable(node: VariableDeclaration) {
return isIdentifier(node.name)
&& !node.initializer;
}
export function isHoistedVariableStatement(node: Statement) {
return isCustomPrologue(node)
&& isVariableStatement(node)
&& every(node.declarationList.declarations, isHoistedVariable);
}
export function getLeadingCommentRangesOfNode(node: Node, sourceFileOfNode: SourceFile) {
return node.kind !== SyntaxKind.JsxText ? getLeadingCommentRanges(sourceFileOfNode.text, node.pos) : undefined;
}
@@ -1992,7 +2016,7 @@ namespace ts {
/**
* Get the assignment 'initializer' -- the righthand side-- when the initializer is container-like (See getExpandoInitializer).
* We treat the right hand side of assignments with container-like initalizers as declarations.
* We treat the right hand side of assignments with container-like initializers as declarations.
*/
export function getAssignedExpandoInitializer(node: Node | undefined): Expression | undefined {
if (node && node.parent && isBinaryExpression(node.parent) && node.parent.operatorToken.kind === SyntaxKind.EqualsToken) {
@@ -2290,6 +2314,17 @@ namespace ts {
!!getJSDocTypeTag(expr.parent);
}
export function setValueDeclaration(symbol: Symbol, node: Declaration): void {
const { valueDeclaration } = symbol;
if (!valueDeclaration ||
!(node.flags & NodeFlags.Ambient && !(valueDeclaration.flags & NodeFlags.Ambient)) &&
(isAssignmentDeclaration(valueDeclaration) && !isAssignmentDeclaration(node)) ||
(valueDeclaration.kind !== node.kind && isEffectiveModuleDeclaration(valueDeclaration))) {
// other kinds of value declarations take precedence over modules and assignment declarations
symbol.valueDeclaration = node;
}
}
export function isFunctionSymbol(symbol: Symbol | undefined) {
if (!symbol || !symbol.valueDeclaration) {
return false;
@@ -4776,19 +4811,19 @@ namespace ts {
return positionIsSynthesized(range.pos) ? -1 : skipTrivia(sourceFile.text, range.pos, /*stopAfterLineBreak*/ false, includeComments);
}
export function getLinesBetweenPositionAndPrecedingNonWhitespaceCharacter(pos: number, sourceFile: SourceFile, includeComments?: boolean) {
export function getLinesBetweenPositionAndPrecedingNonWhitespaceCharacter(pos: number, stopPos: number, sourceFile: SourceFile, includeComments?: boolean) {
const startPos = skipTrivia(sourceFile.text, pos, /*stopAfterLineBreak*/ false, includeComments);
const prevPos = getPreviousNonWhitespacePosition(startPos, sourceFile);
return getLinesBetweenPositions(sourceFile, prevPos || 0, startPos);
const prevPos = getPreviousNonWhitespacePosition(startPos, stopPos, sourceFile);
return getLinesBetweenPositions(sourceFile, prevPos ?? stopPos, startPos);
}
export function getLinesBetweenPositionAndNextNonWhitespaceCharacter(pos: number, sourceFile: SourceFile, includeComments?: boolean) {
export function getLinesBetweenPositionAndNextNonWhitespaceCharacter(pos: number, stopPos: number, sourceFile: SourceFile, includeComments?: boolean) {
const nextPos = skipTrivia(sourceFile.text, pos, /*stopAfterLineBreak*/ false, includeComments);
return getLinesBetweenPositions(sourceFile, pos, nextPos);
return getLinesBetweenPositions(sourceFile, pos, Math.min(stopPos, nextPos));
}
function getPreviousNonWhitespacePosition(pos: number, sourceFile: SourceFile) {
while (pos-- > 0) {
function getPreviousNonWhitespacePosition(pos: number, stopPos = 0, sourceFile: SourceFile) {
while (pos-- > stopPos) {
if (!isWhiteSpaceLike(sourceFile.text.charCodeAt(pos))) {
return pos;
}
+1 -1
View File
@@ -769,7 +769,7 @@ namespace ts {
const sig = find(type.members, isCallSignatureDeclaration);
return sig && sig.type;
}
if (isFunctionTypeNode(type)) {
if (isFunctionTypeNode(type) || isJSDocFunctionType(type)) {
return type.type;
}
}
+93 -4
View File
@@ -520,11 +520,18 @@ namespace ts {
return result;
}
function findSpanEnd<T>(array: readonly T[], test: (value: T) => boolean, start: number) {
let i = start;
while (i < array.length && test(array[i])) {
i++;
}
return i;
}
/**
* Merges generated lexical declarations into a new statement list.
*/
export function mergeLexicalEnvironment(statements: NodeArray<Statement>, declarations: readonly Statement[] | undefined): NodeArray<Statement>;
/**
* Appends generated lexical declarations to an array of statements.
*/
@@ -534,9 +541,91 @@ namespace ts {
return statements;
}
return isNodeArray(statements)
? setTextRange(createNodeArray(insertStatementsAfterStandardPrologue(statements.slice(), declarations)), statements)
: insertStatementsAfterStandardPrologue(statements, declarations);
// When we merge new lexical statements into an existing statement list, we merge them in the following manner:
//
// Given:
//
// | Left | Right |
// |------------------------------------|-------------------------------------|
// | [standard prologues (left)] | [standard prologues (right)] |
// | [hoisted functions (left)] | [hoisted functions (right)] |
// | [hoisted variables (left)] | [hoisted variables (right)] |
// | [lexical init statements (left)] | [lexical init statements (right)] |
// | [other statements (left)] | |
//
// The resulting statement list will be:
//
// | Result |
// |-------------------------------------|
// | [standard prologues (right)] |
// | [standard prologues (left)] |
// | [hoisted functions (right)] |
// | [hoisted functions (left)] |
// | [hoisted variables (right)] |
// | [hoisted variables (left)] |
// | [lexical init statements (right)] |
// | [lexical init statements (left)] |
// | [other statements (left)] |
//
// NOTE: It is expected that new lexical init statements must be evaluated before existing lexical init statements,
// as the prior transformation may depend on the evaluation of the lexical init statements to be in the correct state.
// find standard prologues on left in the following order: standard directives, hoisted functions, hoisted variables, other custom
const leftStandardPrologueEnd = findSpanEnd(statements, isPrologueDirective, 0);
const leftHoistedFunctionsEnd = findSpanEnd(statements, isHoistedFunction, leftStandardPrologueEnd);
const leftHoistedVariablesEnd = findSpanEnd(statements, isHoistedVariableStatement, leftHoistedFunctionsEnd);
// find standard prologues on right in the following order: standard directives, hoisted functions, hoisted variables, other custom
const rightStandardPrologueEnd = findSpanEnd(declarations, isPrologueDirective, 0);
const rightHoistedFunctionsEnd = findSpanEnd(declarations, isHoistedFunction, rightStandardPrologueEnd);
const rightHoistedVariablesEnd = findSpanEnd(declarations, isHoistedVariableStatement, rightHoistedFunctionsEnd);
const rightCustomPrologueEnd = findSpanEnd(declarations, isCustomPrologue, rightHoistedVariablesEnd);
Debug.assert(rightCustomPrologueEnd === declarations.length, "Expected declarations to be valid standard or custom prologues");
// splice prologues from the right into the left. We do this in reverse order
// so that we don't need to recompute the index on the left when we insert items.
const left = isNodeArray(statements) ? statements.slice() : statements;
// splice other custom prologues from right into left
if (rightCustomPrologueEnd > rightHoistedVariablesEnd) {
left.splice(leftHoistedVariablesEnd, 0, ...declarations.slice(rightHoistedVariablesEnd, rightCustomPrologueEnd));
}
// splice hoisted variables from right into left
if (rightHoistedVariablesEnd > rightHoistedFunctionsEnd) {
left.splice(leftHoistedFunctionsEnd, 0, ...declarations.slice(rightHoistedFunctionsEnd, rightHoistedVariablesEnd));
}
// splice hoisted functions from right into left
if (rightHoistedFunctionsEnd > rightStandardPrologueEnd) {
left.splice(leftStandardPrologueEnd, 0, ...declarations.slice(rightStandardPrologueEnd, rightHoistedFunctionsEnd));
}
// splice standard prologues from right into left (that are not already in left)
if (rightStandardPrologueEnd > 0) {
if (leftStandardPrologueEnd === 0) {
left.splice(0, 0, ...declarations.slice(0, rightStandardPrologueEnd));
}
else {
const leftPrologues = createMap<boolean>();
for (let i = 0; i < leftStandardPrologueEnd; i++) {
const leftPrologue = statements[i] as PrologueDirective;
leftPrologues.set(leftPrologue.expression.text, true);
}
for (let i = rightStandardPrologueEnd - 1; i >= 0; i--) {
const rightPrologue = declarations[i] as PrologueDirective;
if (!leftPrologues.has(rightPrologue.expression.text)) {
left.unshift(rightPrologue);
}
}
}
}
if (isNodeArray(statements)) {
return setTextRange(createNodeArray(left, statements.hasTrailingComma), statements);
}
return statements;
}
/**
+112 -1
View File
@@ -149,13 +149,124 @@ namespace ts {
* Starts a new lexical environment and visits a parameter list, suspending the lexical
* environment upon completion.
*/
export function visitParameterList(nodes: NodeArray<ParameterDeclaration>, visitor: Visitor, context: TransformationContext, nodesVisitor?: <T extends Node>(nodes: NodeArray<T>, visitor: Visitor, test?: (node: Node) => boolean, start?: number, count?: number) => NodeArray<T>): NodeArray<ParameterDeclaration>;
export function visitParameterList(nodes: NodeArray<ParameterDeclaration> | undefined, visitor: Visitor, context: TransformationContext, nodesVisitor?: <T extends Node>(nodes: NodeArray<T> | undefined, visitor: Visitor, test?: (node: Node) => boolean, start?: number, count?: number) => NodeArray<T> | undefined): NodeArray<ParameterDeclaration> | undefined;
export function visitParameterList(nodes: NodeArray<ParameterDeclaration> | undefined, visitor: Visitor, context: TransformationContext, nodesVisitor = visitNodes) {
let updated: NodeArray<ParameterDeclaration> | undefined;
context.startLexicalEnvironment();
const updated = nodesVisitor(nodes, visitor, isParameterDeclaration);
if (nodes) {
context.setLexicalEnvironmentFlags(LexicalEnvironmentFlags.InParameters, true);
updated = nodesVisitor(nodes, visitor, isParameterDeclaration);
// As of ES2015, any runtime execution of that occurs in for a parameter (such as evaluating an
// initializer or a binding pattern), occurs in its own lexical scope. As a result, any expression
// that we might transform that introduces a temporary variable would fail as the temporary variable
// exists in a different lexical scope. To address this, we move any binding patterns and initializers
// in a parameter list to the body if we detect a variable being hoisted while visiting a parameter list
// when the emit target is greater than ES2015.
if (context.getLexicalEnvironmentFlags() & LexicalEnvironmentFlags.VariablesHoistedInParameters &&
getEmitScriptTarget(context.getCompilerOptions()) >= ScriptTarget.ES2015) {
updated = addDefaultValueAssignmentsIfNeeded(updated, context);
}
context.setLexicalEnvironmentFlags(LexicalEnvironmentFlags.InParameters, false);
}
context.suspendLexicalEnvironment();
return updated;
}
function addDefaultValueAssignmentsIfNeeded(parameters: NodeArray<ParameterDeclaration>, context: TransformationContext) {
let result: ParameterDeclaration[] | undefined;
for (let i = 0; i < parameters.length; i++) {
const parameter = parameters[i];
const updated = addDefaultValueAssignmentIfNeeded(parameter, context);
if (result || updated !== parameter) {
if (!result) result = parameters.slice(0, i);
result[i] = updated;
}
}
if (result) {
return setTextRange(createNodeArray(result, parameters.hasTrailingComma), parameters);
}
return parameters;
}
function addDefaultValueAssignmentIfNeeded(parameter: ParameterDeclaration, context: TransformationContext) {
// A rest parameter cannot have a binding pattern or an initializer,
// so let's just ignore it.
return parameter.dotDotDotToken ? parameter :
isBindingPattern(parameter.name) ? addDefaultValueAssignmentForBindingPattern(parameter, context) :
parameter.initializer ? addDefaultValueAssignmentForInitializer(parameter, parameter.name, parameter.initializer, context) :
parameter;
}
function addDefaultValueAssignmentForBindingPattern(parameter: ParameterDeclaration, context: TransformationContext) {
context.addInitializationStatement(
createVariableStatement(
/*modifiers*/ undefined,
createVariableDeclarationList([
createVariableDeclaration(
parameter.name,
parameter.type,
parameter.initializer ?
createConditional(
createStrictEquality(
getGeneratedNameForNode(parameter),
createVoidZero()
),
parameter.initializer,
getGeneratedNameForNode(parameter)
) :
getGeneratedNameForNode(parameter)
),
])
)
);
return updateParameter(parameter,
parameter.decorators,
parameter.modifiers,
parameter.dotDotDotToken,
getGeneratedNameForNode(parameter),
parameter.questionToken,
parameter.type,
/*initializer*/ undefined);
}
function addDefaultValueAssignmentForInitializer(parameter: ParameterDeclaration, name: Identifier, initializer: Expression, context: TransformationContext) {
context.addInitializationStatement(
createIf(
createTypeCheck(getSynthesizedClone(name), "undefined"),
setEmitFlags(
setTextRange(
createBlock([
createExpressionStatement(
setEmitFlags(
setTextRange(
createAssignment(
setEmitFlags(getMutableClone(name), EmitFlags.NoSourceMap),
setEmitFlags(initializer, EmitFlags.NoSourceMap | getEmitFlags(initializer) | EmitFlags.NoComments)
),
parameter
),
EmitFlags.NoComments
)
)
]),
parameter
),
EmitFlags.SingleLine | EmitFlags.NoTrailingSourceMap | EmitFlags.NoTokenSourceMaps | EmitFlags.NoComments
)
)
);
return updateParameter(parameter,
parameter.decorators,
parameter.modifiers,
parameter.dotDotDotToken,
parameter.name,
parameter.questionToken,
parameter.type,
/*initializer*/ undefined);
}
/**
* Resumes a suspended lexical environment and visits a function body, ending the lexical
* environment and merging hoisted declarations upon completion.
+1
View File
@@ -51,6 +51,7 @@ declare namespace ts.server {
export interface InitializationFailedResponse extends TypingInstallerResponse {
readonly kind: EventInitializationFailed;
readonly message: string;
readonly stack?: string;
}
export interface ProjectResponse extends TypingInstallerResponse {
-9
View File
@@ -42,15 +42,6 @@ interface Array<T> {
* @param end If not specified, length of the this object is used as its default value.
*/
copyWithin(target: number, start: number, end?: number): this;
/**
* Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.
* @param start The zero-based location in the array from which to start removing elements.
* @param deleteCount The number of elements to remove. If deleteCount is omitted, or if its value is equal to or larger
* than array.length - start (that is, if it is equal to or greater than the number of elements left in the array,
* starting at start), then all the elements from start to the end of the array will be deleted.
*/
splice(start: number, deleteCount?: number): T[];
}
interface ArrayConstructor {
+1 -1
View File
@@ -1254,7 +1254,7 @@ interface Array<T> {
* @param start The zero-based location in the array from which to start removing elements.
* @param deleteCount The number of elements to remove.
*/
splice(start: number, deleteCount: number): T[];
splice(start: number, deleteCount?: number): T[];
/**
* Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.
* @param start The zero-based location in the array from which to start removing elements.
@@ -1180,7 +1180,7 @@
<Str Cat="Text">
<Val><![CDATA[Add 'export {}' to make this file into a module]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[添加 "export {}"将此文件变为模块]]></Val>
<Val><![CDATA[添加 "export {}"将此文件变为模块]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -3193,7 +3193,7 @@
<Str Cat="Text">
<Val><![CDATA[Compiler reserves name '{0}' when emitting private identifier downlevel.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[当发出专用标识符下层时,编译器预留名称 "{0}"。]]></Val>
<Val><![CDATA[当发出专用标识符下层时,编译器预留名称{0}。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -3642,6 +3642,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Declaration_augments_declaration_in_another_file_This_cannot_be_serialized_6232" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Declaration augments declaration in another file. This cannot be serialized.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[该声明扩充了另一文件中的声明。这无法被序列化。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_9005" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Declaration emit for this file requires using private name '{0}'. An explicit type annotation may unblock declaration emit.]]></Val>
@@ -4996,7 +5005,7 @@
<Str Cat="Text">
<Val><![CDATA[File '{0}' has an unsupported extension. The only supported extensions are {1}.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[文件 "{0}" 具有不受支持的扩展名。支持的扩展名只有 {1}。]]></Val>
<Val><![CDATA[文件{0}具有不受支持的扩展名。支持 {1} 扩展名。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -5641,7 +5650,7 @@
<Str Cat="Text">
<Val><![CDATA[Import default '{0}' from module "{1}"]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[从模块 "{1}" 导入默认的 "{0}"]]></Val>
<Val><![CDATA[从模块{1}导入默认的{0}]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -5832,15 +5841,6 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it_2373" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Initializer of parameter '{0}' cannot reference identifier '{1}' declared after it.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[参数“{0}”的初始化表达式不能引用在它之后声明的标识符“{1}”。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value_2525" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Initializer provides no value for this binding element and the binding element has no default value.]]></Val>
@@ -7188,6 +7188,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Only_numeric_enums_can_have_computed_members_but_this_expression_has_type_0_If_you_do_not_need_exhau_18033" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Only numeric enums can have computed members, but this expression has type '{0}'. If you do not need exhaustiveness checks, consider using an object literal instead.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[只有数字枚举可具有计算成员,但此表达式的类型为“{0}”。如果不需要全面性检查,请考虑改用对象文本。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword_2340" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Only public and protected methods of the base class are accessible via the 'super' keyword.]]></Val>
@@ -7399,7 +7408,7 @@
<Str Cat="Text">
<Val><![CDATA[Overload {0} of {1}, '{2}', gave the following error.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[{1} 个重载 中的第 {0} 个("{2}")出现以下错误。]]></Val>
<Val><![CDATA[第 {0} 个重载(共 {1} 个),“{2}”,出现以下错误。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -7449,11 +7458,20 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Parameter_0_cannot_be_referenced_in_its_initializer_2372" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Parameter_0_cannot_reference_identifier_1_declared_after_it_2373" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Parameter '{0}' cannot be referenced in its initializer.]]></Val>
<Val><![CDATA[Parameter '{0}' cannot reference identifier '{1}' declared after it.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[参数“{0}”的初始化表达式中不能引用该参数自身。]]></Val>
<Val><![CDATA[参数“{0}”不能引用在它之后声明的标识符“{1}”。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Parameter_0_cannot_reference_itself_2372" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Parameter '{0}' cannot reference itself.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[参数“{0}”不能引用它自身。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -10188,6 +10206,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";The_operand_of_a_delete_operator_must_be_optional_2790" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[The operand of a 'delete' operator must be optional.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA["delete" 运算符的操作数必须是可选的。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";The_operand_of_an_increment_or_decrement_operator_may_not_be_an_optional_property_access_2777" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[The operand of an increment or decrement operator may not be an optional property access.]]></Val>
@@ -10312,7 +10339,7 @@
<Str Cat="Text">
<Val><![CDATA[The shadowing declaration of '{0}' is defined here]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[在此处定义了 "{0}" 的隐藏声明]]></Val>
<Val><![CDATA[在此处定义了{0}”的阴影声明]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -10536,6 +10563,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";This_is_the_declaration_being_augmented_Consider_moving_the_augmenting_declaration_into_the_same_fil_6233" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[This is the declaration being augmented. Consider moving the augmenting declaration into the same file.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[这是正在扩充的声明。请考虑将扩充声明移到同一个文件中。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";This_may_be_converted_to_an_async_function_80006" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[This may be converted to an async function.]]></Val>
@@ -10759,7 +10795,7 @@
<Str Cat="Text">
<Val><![CDATA[Type '{0}' is missing the following properties from type '{1}': {2}]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[类型 "{0}" 缺少类型 "{1}" 中的以下属性: {2}]]></Val>
<Val><![CDATA[类型{0}缺少类型{1}中的以下属性: {2}]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -10768,7 +10804,7 @@
<Str Cat="Text">
<Val><![CDATA[Type '{0}' is missing the following properties from type '{1}': {2}, and {3} more.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[类型 "{0}" 缺少类型 "{1}" 的以下属性: {2} 及其他 {3} 项。]]></Val>
<Val><![CDATA[类型{0}缺少类型{1}的以下属性: {2} 及其他 {3} 项。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -11107,7 +11143,7 @@
<Str Cat="Text">
<Val><![CDATA[Type originates at this import. A namespace-style import cannot be called or constructed, and will cause a failure at runtime. Consider using a default import or import require here instead.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[此导入产生的类型。无法调用或构造命名空间样式的导入,这类导入将在运行时导致失败。请考虑改为使用默认导入或这里需要的导入。]]></Val>
<Val><![CDATA[此导入产生的类型。无法调用或构造命名空间样式的导入,这类导入将在运行时导致失败。请考虑改为使用默认导入或此处需要的导入。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -11668,7 +11704,7 @@
<Str Cat="Text">
<Val><![CDATA[Using compiler options of project reference redirect '{0}'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[使用项目引用重定向 "{0}" 的编译器选项。]]></Val>
<Val><![CDATA[使用项目引用重定向{0}的编译器选项。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -1180,7 +1180,7 @@
<Str Cat="Text">
<Val><![CDATA[Add 'export {}' to make this file into a module]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[新增 'export {}' 以將此檔案為模組]]></Val>
<Val><![CDATA[新增 'export {}' 以將此檔案為模組]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -3193,7 +3193,7 @@
<Str Cat="Text">
<Val><![CDATA[Compiler reserves name '{0}' when emitting private identifier downlevel.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[在下層發出私人識別碼時,編譯器會保留名稱 '{0}'。]]></Val>
<Val><![CDATA[降級發出私人識別碼時,編譯器會保留名稱 '{0}'。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -3642,6 +3642,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Declaration_augments_declaration_in_another_file_This_cannot_be_serialized_6232" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Declaration augments declaration in another file. This cannot be serialized.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[宣告會讓另一個檔案中的宣告增加。這無法序列化。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_9005" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Declaration emit for this file requires using private name '{0}'. An explicit type annotation may unblock declaration emit.]]></Val>
@@ -5832,15 +5841,6 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it_2373" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Initializer of parameter '{0}' cannot reference identifier '{1}' declared after it.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[參數 '{0}' 的初始設定式不得參考在其之後宣告的識別碼 '{1}'。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value_2525" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Initializer provides no value for this binding element and the binding element has no default value.]]></Val>
@@ -7188,6 +7188,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Only_numeric_enums_can_have_computed_members_but_this_expression_has_type_0_If_you_do_not_need_exhau_18033" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Only numeric enums can have computed members, but this expression has type '{0}'. If you do not need exhaustiveness checks, consider using an object literal instead.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[只有數值列舉才可以有計算成員,但此運算式的類型為 '{0}'。若您不需要詳細檢查,請考慮改用物件常值。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword_2340" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Only public and protected methods of the base class are accessible via the 'super' keyword.]]></Val>
@@ -7399,7 +7408,7 @@
<Str Cat="Text">
<Val><![CDATA[Overload {0} of {1}, '{2}', gave the following error.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[{1} 的多載 {0}'{2}',發生下列錯誤。]]></Val>
<Val><![CDATA[多載 {0} (共 {1})'{2}',發生下列錯誤。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -7449,11 +7458,20 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Parameter_0_cannot_be_referenced_in_its_initializer_2372" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Parameter_0_cannot_reference_identifier_1_declared_after_it_2373" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Parameter '{0}' cannot be referenced in its initializer.]]></Val>
<Val><![CDATA[Parameter '{0}' cannot reference identifier '{1}' declared after it.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[無法在參數 '{0}' 的初始設定式中參考此參數。]]></Val>
<Val><![CDATA[參數 '{0}' 不得參考在其之後宣告的識別碼 '{1}'。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Parameter_0_cannot_reference_itself_2372" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Parameter '{0}' cannot reference itself.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[參數 '{0}' 不得參考自身。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -7822,7 +7840,7 @@
<Str Cat="Text">
<Val><![CDATA[Prefix with 'declare']]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[在開頭放置 'declare']]></Val>
<Val><![CDATA[ 'declare' 開頭]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -10188,6 +10206,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";The_operand_of_a_delete_operator_must_be_optional_2790" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[The operand of a 'delete' operator must be optional.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA['delete' 運算子的運算元必須是非必須。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";The_operand_of_an_increment_or_decrement_operator_may_not_be_an_optional_property_access_2777" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[The operand of an increment or decrement operator may not be an optional property access.]]></Val>
@@ -10312,7 +10339,7 @@
<Str Cat="Text">
<Val><![CDATA[The shadowing declaration of '{0}' is defined here]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA['{0}' 的陰影宣告定義於此處]]></Val>
<Val><![CDATA['{0}' 的隱蔽宣告定義於此處]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -10536,6 +10563,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";This_is_the_declaration_being_augmented_Consider_moving_the_augmenting_declaration_into_the_same_fil_6233" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[This is the declaration being augmented. Consider moving the augmenting declaration into the same file.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[此宣告正在增加中。請考慮將正在增加的宣告移至相同的檔案中。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";This_may_be_converted_to_an_async_function_80006" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[This may be converted to an async function.]]></Val>
@@ -10759,7 +10795,7 @@
<Str Cat="Text">
<Val><![CDATA[Type '{0}' is missing the following properties from type '{1}': {2}]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[類型 '{0}' 缺少類型 '{1}' 中下列屬性: {2}]]></Val>
<Val><![CDATA[類型 '{0}' 類型 '{1}' 中缺少下列屬性: {2}]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -10768,7 +10804,7 @@
<Str Cat="Text">
<Val><![CDATA[Type '{0}' is missing the following properties from type '{1}': {2}, and {3} more.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[類型 '{0}' 缺少類型 '{1}' 中下列屬性: {2},以及另外 {3} 個。]]></Val>
<Val><![CDATA[類型 '{0}' 類型 '{1}' 中缺少下列屬性: {2},以及另外 {3} 個。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -11107,7 +11143,7 @@
<Str Cat="Text">
<Val><![CDATA[Type originates at this import. A namespace-style import cannot be called or constructed, and will cause a failure at runtime. Consider using a default import or import require here instead.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[類型源自此匯入。無法呼叫或建構命名空間樣式的匯入,而且可能會在執行階段導致失敗。請考慮改用預設匯入或此處要求的匯入。]]></Val>
<Val><![CDATA[類型源自此匯入。無法呼叫或建構命名空間樣式的匯入,而且可能會在執行階段導致失敗。請考慮改用預設匯入或此處匯入 require。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -3202,7 +3202,7 @@
<Str Cat="Text">
<Val><![CDATA[Compiler reserves name '{0}' when emitting private identifier downlevel.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Kompilátor si rezervuje název {0} při generování nižší úrovně privátního identifikátoru.]]></Val>
<Val><![CDATA[Kompilátor si rezervuje název {0} při generování privátního identifikátoru pro nižší úroveň.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -3651,6 +3651,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Declaration_augments_declaration_in_another_file_This_cannot_be_serialized_6232" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Declaration augments declaration in another file. This cannot be serialized.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Deklarace rozšiřuje deklaraci v jiném souboru. Toto není možné serializovat.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_9005" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Declaration emit for this file requires using private name '{0}'. An explicit type annotation may unblock declaration emit.]]></Val>
@@ -5650,7 +5659,7 @@
<Str Cat="Text">
<Val><![CDATA[Import default '{0}' from module "{1}"]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Importovat výchozí {0} z modulu {1}]]></Val>
<Val><![CDATA[Importovat výchozí hodnotu {0} z modulu {1}]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -5841,15 +5850,6 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it_2373" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Initializer of parameter '{0}' cannot reference identifier '{1}' declared after it.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Inicializátor parametru {0} nemůže odkazovat na identifikátor {1} deklarovaný po něm.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value_2525" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Initializer provides no value for this binding element and the binding element has no default value.]]></Val>
@@ -7197,6 +7197,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Only_numeric_enums_can_have_computed_members_but_this_expression_has_type_0_If_you_do_not_need_exhau_18033" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Only numeric enums can have computed members, but this expression has type '{0}'. If you do not need exhaustiveness checks, consider using an object literal instead.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Počítané členy můžou obsahovat jen číselné výčty, ale tento výraz je typu {0}. Pokud nepotřebujete kontroly úplnosti, zvažte místo něho použít objekt literálu.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword_2340" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Only public and protected methods of the base class are accessible via the 'super' keyword.]]></Val>
@@ -7458,11 +7467,20 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Parameter_0_cannot_be_referenced_in_its_initializer_2372" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Parameter_0_cannot_reference_identifier_1_declared_after_it_2373" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Parameter '{0}' cannot be referenced in its initializer.]]></Val>
<Val><![CDATA[Parameter '{0}' cannot reference identifier '{1}' declared after it.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Parametr {0} se nedá odkazovat v jeho vlastním inicializátoru.]]></Val>
<Val><![CDATA[Parametr {0} nemůže odkazovat na identifikátor {1} deklarovaný za ním.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Parameter_0_cannot_reference_itself_2372" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Parameter '{0}' cannot reference itself.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Parametr {0} nemůže odkazovat sám na sebe.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -10197,6 +10215,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";The_operand_of_a_delete_operator_must_be_optional_2790" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[The operand of a 'delete' operator must be optional.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Operand operátoru delete musí být nepovinný.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";The_operand_of_an_increment_or_decrement_operator_may_not_be_an_optional_property_access_2777" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[The operand of an increment or decrement operator may not be an optional property access.]]></Val>
@@ -10321,7 +10348,7 @@
<Str Cat="Text">
<Val><![CDATA[The shadowing declaration of '{0}' is defined here]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Překrývající se deklarace {0} je definovaná tady.]]></Val>
<Val><![CDATA[Překrývající deklarace {0} je definovaná tady.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -10545,6 +10572,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";This_is_the_declaration_being_augmented_Consider_moving_the_augmenting_declaration_into_the_same_fil_6233" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[This is the declaration being augmented. Consider moving the augmenting declaration into the same file.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Toto je deklarace, která se rozšiřuje. Zvažte možnost přesunout rozšiřující deklaraci do stejného souboru.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";This_may_be_converted_to_an_async_function_80006" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[This may be converted to an async function.]]></Val>
@@ -11116,7 +11152,7 @@
<Str Cat="Text">
<Val><![CDATA[Type originates at this import. A namespace-style import cannot be called or constructed, and will cause a failure at runtime. Consider using a default import or import require here instead.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Typ pochází z tohoto importu. Import stylu oboru názvů není možné zavolat ani vytvořit a při běhu způsobí chybu. Zvažte možnost použít tady místo toho výchozí import nebo požadavek na import.]]></Val>
<Val><![CDATA[Typ pochází z tohoto importu. Import stylu oboru názvů není možné zavolat ani vytvořit a při běhu způsobí chybu. Zvažte možnost použít tady místo toho výchozí import nebo importovat require.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -11677,7 +11713,7 @@
<Str Cat="Text">
<Val><![CDATA[Using compiler options of project reference redirect '{0}'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Používají se možnosti kompilátoru přesměrování odkazu projektu {0}.]]></Val>
<Val><![CDATA[Using compiler options of project reference redirect '{0}'.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -1177,7 +1177,7 @@
<Str Cat="Text">
<Val><![CDATA[Add 'export {}' to make this file into a module]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA["export {}" hinzufügen, um diese Datei zu einem Modul zu machen]]></Val>
<Val><![CDATA["export {}" hinzufügen, um diese Datei in ein Modul umzuwandeln]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -3190,7 +3190,7 @@
<Str Cat="Text">
<Val><![CDATA[Compiler reserves name '{0}' when emitting private identifier downlevel.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Der Compiler reserviert den Namen "{0}", wenn er einen älteren privaten Bezeichner ausgibt.]]></Val>
<Val><![CDATA[Der Compiler reserviert den Namen "{0}", wenn er einen privaten Bezeichner für Vorgängerversionen ausgibt.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -3639,6 +3639,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Declaration_augments_declaration_in_another_file_This_cannot_be_serialized_6232" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Declaration augments declaration in another file. This cannot be serialized.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Die Deklaration erweitert die Deklaration in einer anderen Datei. Dieser Vorgang kann nicht serialisiert werden.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_9005" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Declaration emit for this file requires using private name '{0}'. An explicit type annotation may unblock declaration emit.]]></Val>
@@ -5638,7 +5647,7 @@
<Str Cat="Text">
<Val><![CDATA[Import default '{0}' from module "{1}"]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Importstandard "{0}" aus Modul "{1}"]]></Val>
<Val><![CDATA[Standard "{0}" aus Modul "{1}" importieren]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -5829,15 +5838,6 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it_2373" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Initializer of parameter '{0}' cannot reference identifier '{1}' declared after it.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Der Initialisierer des Parameters "{0}" darf nicht auf den anschließend deklarierten Bezeichner "{1}" verweisen.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value_2525" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Initializer provides no value for this binding element and the binding element has no default value.]]></Val>
@@ -7185,6 +7185,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Only_numeric_enums_can_have_computed_members_but_this_expression_has_type_0_If_you_do_not_need_exhau_18033" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Only numeric enums can have computed members, but this expression has type '{0}'. If you do not need exhaustiveness checks, consider using an object literal instead.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Nur numerische Enumerationen können berechnete Member umfassen, aber dieser Ausdruck weist den Typ "{0}" auf. Wenn Sie keine Vollständigkeitsprüfung benötigen, erwägen Sie stattdessen die Verwendung eines Objektliterals.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword_2340" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Only public and protected methods of the base class are accessible via the 'super' keyword.]]></Val>
@@ -7446,11 +7455,20 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Parameter_0_cannot_be_referenced_in_its_initializer_2372" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Parameter_0_cannot_reference_identifier_1_declared_after_it_2373" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Parameter '{0}' cannot be referenced in its initializer.]]></Val>
<Val><![CDATA[Parameter '{0}' cannot reference identifier '{1}' declared after it.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Auf den Parameter "{0}" darf in diesem Initialisierer nicht verwiesen werden.]]></Val>
<Val><![CDATA[Der Parameter "{0}" darf nicht auf den anschließend deklarierten Bezeichner "{1}" verweisen.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Parameter_0_cannot_reference_itself_2372" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Parameter '{0}' cannot reference itself.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Der Parameter "{0}" kann nicht auf sich selbst verweisen.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -10182,6 +10200,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";The_operand_of_a_delete_operator_must_be_optional_2790" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[The operand of a 'delete' operator must be optional.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Der Operand eines delete-Operators muss optional sein.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";The_operand_of_an_increment_or_decrement_operator_may_not_be_an_optional_property_access_2777" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[The operand of an increment or decrement operator may not be an optional property access.]]></Val>
@@ -10306,7 +10333,7 @@
<Str Cat="Text">
<Val><![CDATA[The shadowing declaration of '{0}' is defined here]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Die Shadowing-Deklaration von "{0}" ist hier definiert.]]></Val>
<Val><![CDATA[Die verbergende Deklaration von "{0}" ist hier definiert.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -10530,6 +10557,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";This_is_the_declaration_being_augmented_Consider_moving_the_augmenting_declaration_into_the_same_fil_6233" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[This is the declaration being augmented. Consider moving the augmenting declaration into the same file.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Dies ist die erweiterte Deklaration. Die erweiternde Deklaration sollte in dieselbe Datei verschoben werden.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";This_may_be_converted_to_an_async_function_80006" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[This may be converted to an async function.]]></Val>
@@ -10753,7 +10789,7 @@
<Str Cat="Text">
<Val><![CDATA[Type '{0}' is missing the following properties from type '{1}': {2}]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Im Typ "{0}" fehlen die folgenden Eigenschaften von Typ "{1}": {2}]]></Val>
<Val><![CDATA[Im Typ "{0}" fehlen die folgenden Eigenschaften von Typ "{1}": "{2}".]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -10762,7 +10798,7 @@
<Str Cat="Text">
<Val><![CDATA[Type '{0}' is missing the following properties from type '{1}': {2}, and {3} more.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Im Typ "{0}" fehlen die folgenden Eigenschaften von Typ "{1}": {2} und {3} weitere.]]></Val>
<Val><![CDATA[Im Typ "{0}" fehlen die folgenden Eigenschaften von Typ "{1}": "{2}" und {3} weitere.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -11101,7 +11137,7 @@
<Str Cat="Text">
<Val><![CDATA[Type originates at this import. A namespace-style import cannot be called or constructed, and will cause a failure at runtime. Consider using a default import or import require here instead.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Der Typ stammt aus diesem Import. Ein Import im Namespacestil kann nicht aufgerufen oder erstellt werden und verursacht zur Laufzeit einen Fehler. Erwägen Sie hier stattdessen die Verwendung eines Standardimports oder die Verwendung von "import require".]]></Val>
<Val><![CDATA[Der Typ stammt aus diesem Import. Ein Import im Namespacestil kann nicht aufgerufen oder erstellt werden und verursacht zur Laufzeit einen Fehler. Erwägen Sie hier stattdessen die Verwendung eines Standardimports oder die den Import über "require".]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -445,7 +445,7 @@
<Str Cat="Text">
<Val><![CDATA['A label is not allowed here.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Aquí no se permite una etiqueta.]]></Val>
<Val><![CDATA[No se permite una etiqueta aquí.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -1189,7 +1189,7 @@
<Str Cat="Text">
<Val><![CDATA[Add 'export {}' to make this file into a module]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Agregar "export {}" para convertir este archivo en un módulo]]></Val>
<Val><![CDATA[Agregar "export {}" para transformar este archivo en un módulo]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -3205,7 +3205,7 @@
<Str Cat="Text">
<Val><![CDATA[Compiler reserves name '{0}' when emitting private identifier downlevel.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[El compilador reserva el nombre "{0}" al emitir un identificador privado en el nivel inferior.]]></Val>
<Val><![CDATA[El compilador reserva el nombre "{0}" al emitir un identificador privado válido para versiones anteriores.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -3654,6 +3654,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Declaration_augments_declaration_in_another_file_This_cannot_be_serialized_6232" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Declaration augments declaration in another file. This cannot be serialized.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[La declaración aumenta la declaración en otro archivo. Esto no se puede serializar.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_9005" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Declaration emit for this file requires using private name '{0}'. An explicit type annotation may unblock declaration emit.]]></Val>
@@ -5844,15 +5853,6 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it_2373" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Initializer of parameter '{0}' cannot reference identifier '{1}' declared after it.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[El inicializador del parámetro '{0}' no puede hacer referencia al identificador '{1}' declarado después.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value_2525" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Initializer provides no value for this binding element and the binding element has no default value.]]></Val>
@@ -7200,6 +7200,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Only_numeric_enums_can_have_computed_members_but_this_expression_has_type_0_If_you_do_not_need_exhau_18033" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Only numeric enums can have computed members, but this expression has type '{0}'. If you do not need exhaustiveness checks, consider using an object literal instead.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Solo las enumeraciones numéricas pueden tener miembros calculados, pero esta expresión tiene el tipo "{0}". Si no requiere comprobaciones de exhaustividad, considere la posibilidad de usar un literal de objeto en su lugar.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword_2340" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Only public and protected methods of the base class are accessible via the 'super' keyword.]]></Val>
@@ -7461,11 +7470,20 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Parameter_0_cannot_be_referenced_in_its_initializer_2372" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Parameter_0_cannot_reference_identifier_1_declared_after_it_2373" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Parameter '{0}' cannot be referenced in its initializer.]]></Val>
<Val><![CDATA[Parameter '{0}' cannot reference identifier '{1}' declared after it.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[No se puede hacer referencia al parámetro '{0}' en su inicializador.]]></Val>
<Val><![CDATA[El parámetro "{0}" no puede hacer referencia al identificador "{1}" declarado después de este.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Parameter_0_cannot_reference_itself_2372" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Parameter '{0}' cannot reference itself.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[El parámetro "{0}" no puede hacer referencia a sí mismo.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -10200,6 +10218,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";The_operand_of_a_delete_operator_must_be_optional_2790" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[The operand of a 'delete' operator must be optional.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[El operando de un operador "delete" debe ser opcional.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";The_operand_of_an_increment_or_decrement_operator_may_not_be_an_optional_property_access_2777" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[The operand of an increment or decrement operator may not be an optional property access.]]></Val>
@@ -10324,7 +10351,7 @@
<Str Cat="Text">
<Val><![CDATA[The shadowing declaration of '{0}' is defined here]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[La declaración de reemplazo de "{0}" se define aquí.]]></Val>
<Val><![CDATA[La declaración que ensombrece a "{0}" se define aquí.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -10548,6 +10575,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";This_is_the_declaration_being_augmented_Consider_moving_the_augmenting_declaration_into_the_same_fil_6233" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[This is the declaration being augmented. Consider moving the augmenting declaration into the same file.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Esta es la declaración que se está aumentando. Considere la posibilidad de mover la declaración en aumento al mismo archivo.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";This_may_be_converted_to_an_async_function_80006" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[This may be converted to an async function.]]></Val>
@@ -11119,7 +11155,7 @@
<Str Cat="Text">
<Val><![CDATA[Type originates at this import. A namespace-style import cannot be called or constructed, and will cause a failure at runtime. Consider using a default import or import require here instead.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[El tipo se origina en esta importación. No se puede construir ni llamar a una importación de estilo de espacio de nombres y provocará un error en tiempo de ejecución. Considere la posibilidad de usar una importación predeterminada o requerir la importación aquí.]]></Val>
<Val><![CDATA[El tipo se origina en esta importación. No se puede construir ni llamar a una importación de estilo de espacio de nombres y provocará un error en tiempo de ejecución. Considere la posibilidad de usar una importación predeterminada o require aquí en su lugar.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -11680,7 +11716,7 @@
<Str Cat="Text">
<Val><![CDATA[Using compiler options of project reference redirect '{0}'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[El uso de las opciones del compilador de la referencia del proyecto redirige "{0}".]]></Val>
<Val><![CDATA[Uso de las opciones del compilador de redireccionamiento de la referencia del proyecto "{0}".]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -445,7 +445,7 @@
<Str Cat="Text">
<Val><![CDATA['A label is not allowed here.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA['Étiquette non autorisée ici.]]></Val>
<Val><![CDATA[Étiquette non autorisée ici.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -3205,7 +3205,7 @@
<Str Cat="Text">
<Val><![CDATA[Compiler reserves name '{0}' when emitting private identifier downlevel.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Le compilateur réserve le nom '{0}' quand il émet un identificateur privé de niveau inférieur.]]></Val>
<Val><![CDATA[Le compilateur réserve le nom '{0}' quand il émet un identificateur privé pour une version antérieure.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -3654,6 +3654,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Declaration_augments_declaration_in_another_file_This_cannot_be_serialized_6232" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Declaration augments declaration in another file. This cannot be serialized.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[La déclaration augmente la déclaration dans un autre fichier. Cela ne peut pas être sérialisé.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_9005" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Declaration emit for this file requires using private name '{0}'. An explicit type annotation may unblock declaration emit.]]></Val>
@@ -5844,15 +5853,6 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it_2373" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Initializer of parameter '{0}' cannot reference identifier '{1}' declared after it.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[L'initialiseur du paramètre '{0}' ne peut pas référencer l'identificateur '{1}' déclaré après lui.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value_2525" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Initializer provides no value for this binding element and the binding element has no default value.]]></Val>
@@ -7200,6 +7200,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Only_numeric_enums_can_have_computed_members_but_this_expression_has_type_0_If_you_do_not_need_exhau_18033" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Only numeric enums can have computed members, but this expression has type '{0}'. If you do not need exhaustiveness checks, consider using an object literal instead.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Seules les enums numériques peuvent avoir des membres calculés, mais cette expression a le type '{0}'. Si vous n'avez pas besoin de contrôles d'exhaustivité, utilisez un littéral d'objet à la place.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword_2340" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Only public and protected methods of the base class are accessible via the 'super' keyword.]]></Val>
@@ -7411,7 +7420,7 @@
<Str Cat="Text">
<Val><![CDATA[Overload {0} of {1}, '{2}', gave the following error.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[La surcharge {0} de {1}, '{2}', a généré l'erreur suivante.]]></Val>
<Val><![CDATA[La surcharge {0} sur {1}, '{2}', a généré l'erreur suivante.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -7461,11 +7470,20 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Parameter_0_cannot_be_referenced_in_its_initializer_2372" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Parameter_0_cannot_reference_identifier_1_declared_after_it_2373" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Parameter '{0}' cannot be referenced in its initializer.]]></Val>
<Val><![CDATA[Parameter '{0}' cannot reference identifier '{1}' declared after it.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Le paramètre '{0}' ne peut pas être référencé dans son initialiseur.]]></Val>
<Val><![CDATA[Le paramètre '{0}' ne peut pas référencer l'identificateur '{1}' déclaré après lui.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Parameter_0_cannot_reference_itself_2372" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Parameter '{0}' cannot reference itself.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Le paramètre '{0}' ne peut pas se référencer lui-même.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -10200,6 +10218,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";The_operand_of_a_delete_operator_must_be_optional_2790" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[The operand of a 'delete' operator must be optional.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[L'opérande d'un opérateur 'delete' doit être facultatif.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";The_operand_of_an_increment_or_decrement_operator_may_not_be_an_optional_property_access_2777" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[The operand of an increment or decrement operator may not be an optional property access.]]></Val>
@@ -10548,6 +10575,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";This_is_the_declaration_being_augmented_Consider_moving_the_augmenting_declaration_into_the_same_fil_6233" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[This is the declaration being augmented. Consider moving the augmenting declaration into the same file.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Ceci est la déclaration augmentée. Pensez à déplacer la déclaration d'augmentation dans le même fichier.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";This_may_be_converted_to_an_async_function_80006" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[This may be converted to an async function.]]></Val>
@@ -11119,7 +11155,7 @@
<Str Cat="Text">
<Val><![CDATA[Type originates at this import. A namespace-style import cannot be called or constructed, and will cause a failure at runtime. Consider using a default import or import require here instead.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Le type provient de cette importation. Impossible d'appeler ou de construire une importation de style d'espace de noms, ce qui va entraîner un échec au moment de l'exécution. À la place, utilisez une importation par défaut ou une obligation d'importation ici.]]></Val>
<Val><![CDATA[Le type provient de cette importation. Impossible d'appeler ou de construire une importation de style d'espace de noms, ce qui va entraîner un échec au moment de l'exécution. À la place, utilisez ici une importation par défaut ou une importation avec require.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -1180,7 +1180,7 @@
<Str Cat="Text">
<Val><![CDATA[Add 'export {}' to make this file into a module]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Aggiungere 'export {}' per creare questo file in un modulo]]></Val>
<Val><![CDATA[Aggiungere 'export {}' per trasformare questo file in un modulo]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -3193,7 +3193,7 @@
<Str Cat="Text">
<Val><![CDATA[Compiler reserves name '{0}' when emitting private identifier downlevel.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Il compilatore riserva il nome '{0}' quando si crea l'identificatore provato di livello inferiore.]]></Val>
<Val><![CDATA[Il compilatore riserva il nome '{0}' quando si crea l'identificatore privato per browser meno recenti.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -3642,6 +3642,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Declaration_augments_declaration_in_another_file_This_cannot_be_serialized_6232" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Declaration augments declaration in another file. This cannot be serialized.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[La dichiarazione causa un aumento della dichiarazione in un altro file. Questa condizione non è serializzabile.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_9005" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Declaration emit for this file requires using private name '{0}'. An explicit type annotation may unblock declaration emit.]]></Val>
@@ -5832,15 +5841,6 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it_2373" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Initializer of parameter '{0}' cannot reference identifier '{1}' declared after it.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[L'inizializzatore del parametro '{0}' non può fare riferimento all'identificatore '{1}' dichiarato dopo di esso.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value_2525" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Initializer provides no value for this binding element and the binding element has no default value.]]></Val>
@@ -7188,6 +7188,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Only_numeric_enums_can_have_computed_members_but_this_expression_has_type_0_If_you_do_not_need_exhau_18033" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Only numeric enums can have computed members, but this expression has type '{0}'. If you do not need exhaustiveness checks, consider using an object literal instead.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Solo le enumerazioni numeriche possono includere membri calcolati, ma il tipo di questa espressione è '{0}'. Se non sono necessari controlli di esaustività, provare a usare un valore letterale di oggetto.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword_2340" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Only public and protected methods of the base class are accessible via the 'super' keyword.]]></Val>
@@ -7449,11 +7458,20 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Parameter_0_cannot_be_referenced_in_its_initializer_2372" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Parameter_0_cannot_reference_identifier_1_declared_after_it_2373" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Parameter '{0}' cannot be referenced in its initializer.]]></Val>
<Val><![CDATA[Parameter '{0}' cannot reference identifier '{1}' declared after it.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Non è possibile fare riferimento al parametro '{0}' nel relativo inizializzatore.]]></Val>
<Val><![CDATA[Il parametro '{0}' non può fare riferimento all'identificatore '{1}' dichiarato dopo di esso.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Parameter_0_cannot_reference_itself_2372" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Parameter '{0}' cannot reference itself.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Il parametro '{0}' non può fare riferimento a se stesso.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -7822,7 +7840,7 @@
<Str Cat="Text">
<Val><![CDATA[Prefix with 'declare']]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Aggiungere 'declare' come prefisso]]></Val>
<Val><![CDATA[Aggiungere il prefisso 'declare']]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -10188,6 +10206,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";The_operand_of_a_delete_operator_must_be_optional_2790" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[The operand of a 'delete' operator must be optional.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[L'operando di un operatore 'delete' deve essere facoltativo.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";The_operand_of_an_increment_or_decrement_operator_may_not_be_an_optional_property_access_2777" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[The operand of an increment or decrement operator may not be an optional property access.]]></Val>
@@ -10312,7 +10339,7 @@
<Str Cat="Text">
<Val><![CDATA[The shadowing declaration of '{0}' is defined here]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[La dichiarazione di shadowing di '{0}' viene definita in questo punto]]></Val>
<Val><![CDATA[La dichiarazione di oscuramento di '{0}' viene definita in questo punto]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -10536,6 +10563,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";This_is_the_declaration_being_augmented_Consider_moving_the_augmenting_declaration_into_the_same_fil_6233" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[This is the declaration being augmented. Consider moving the augmenting declaration into the same file.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Questa è la dichiarazione che verrà aumentata. Provare a spostare la dichiarazione che causa l'aumento nello stesso file.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";This_may_be_converted_to_an_async_function_80006" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[This may be converted to an async function.]]></Val>
@@ -11107,7 +11143,7 @@
<Str Cat="Text">
<Val><![CDATA[Type originates at this import. A namespace-style import cannot be called or constructed, and will cause a failure at runtime. Consider using a default import or import require here instead.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Il tipo è originato in corrispondenza di questa importazione. Non è possibile chiamare o costruire un'importazione di tipo spazio dei nomi e verrà restituito un errore in fase di esecuzione. Provare a usare un'importazione o un'importazione predefinita in questo punto.]]></Val>
<Val><![CDATA[Il tipo è originato in corrispondenza di questa importazione. Non è possibile chiamare o costruire un'importazione di tipo spazio dei nomi e verrà restituito un errore in fase di esecuzione. Provare a usare un'importazione predefinita o un'importazione di require in questo punto.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -11668,7 +11704,7 @@
<Str Cat="Text">
<Val><![CDATA[Using compiler options of project reference redirect '{0}'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Verranno usate le opzione del compilatore del progetto per fare riferimento al reindirizzamento '{0}'.]]></Val>
<Val><![CDATA[Using compiler options of project reference redirect '{0}'.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -436,7 +436,7 @@
<Str Cat="Text">
<Val><![CDATA['A label is not allowed here.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA['A ラベルはここでは使用できません。]]></Val>
<Val><![CDATA[A ラベルはここでは使用できません。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -1180,7 +1180,7 @@
<Str Cat="Text">
<Val><![CDATA[Add 'export {}' to make this file into a module]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA['export {}' を追加して、このファイルをモジュールに含める]]></Val>
<Val><![CDATA['export {}' を追加して、このファイルをモジュールにる]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -3193,7 +3193,7 @@
<Str Cat="Text">
<Val><![CDATA[Compiler reserves name '{0}' when emitting private identifier downlevel.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[private 識別子を下位レベルで出力するときに、コンパイラは名前 '{0}' を予約します。]]></Val>
<Val><![CDATA[private 識別子を下位レベルに生成するときに、コンパイラは名前 '{0}' を予約します。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -3642,6 +3642,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Declaration_augments_declaration_in_another_file_This_cannot_be_serialized_6232" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Declaration augments declaration in another file. This cannot be serialized.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[宣言は別のファイル内の宣言を拡張します。これをシリアル化できません。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_9005" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Declaration emit for this file requires using private name '{0}'. An explicit type annotation may unblock declaration emit.]]></Val>
@@ -5832,15 +5841,6 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it_2373" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Initializer of parameter '{0}' cannot reference identifier '{1}' declared after it.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[パラメーター '{0}' の初期化子はその後で宣言された識別子 '{1}' を参照できません。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value_2525" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Initializer provides no value for this binding element and the binding element has no default value.]]></Val>
@@ -7188,6 +7188,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Only_numeric_enums_can_have_computed_members_but_this_expression_has_type_0_If_you_do_not_need_exhau_18033" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Only numeric enums can have computed members, but this expression has type '{0}'. If you do not need exhaustiveness checks, consider using an object literal instead.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[計算されたメンバーを使用できるのは数値列挙型のみですが、この式には '{0}' 型があります。網羅性チェックが不要な場合は、代わりにオブジェクト リテラルを使用することをご検討ください。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword_2340" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Only public and protected methods of the base class are accessible via the 'super' keyword.]]></Val>
@@ -7399,7 +7408,7 @@
<Str Cat="Text">
<Val><![CDATA[Overload {0} of {1}, '{2}', gave the following error.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[{1}、'{2}' の {0} のオーバーロードにより、次のエラーが発生しました。]]></Val>
<Val><![CDATA[{1} {0} のオーバーロード, '{2}' により、次のエラーが発生しました。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -7449,11 +7458,20 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Parameter_0_cannot_be_referenced_in_its_initializer_2372" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Parameter_0_cannot_reference_identifier_1_declared_after_it_2373" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Parameter '{0}' cannot be referenced in its initializer.]]></Val>
<Val><![CDATA[Parameter '{0}' cannot reference identifier '{1}' declared after it.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[パラメーター '{0}' はその初期化子内では参照できません。]]></Val>
<Val><![CDATA[パラメーター '{0}' はその後で宣言された識別子 '{1}' を参照できません。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Parameter_0_cannot_reference_itself_2372" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Parameter '{0}' cannot reference itself.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[パラメーター '{0}' は、それ自体を参照できません。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -10188,6 +10206,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";The_operand_of_a_delete_operator_must_be_optional_2790" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[The operand of a 'delete' operator must be optional.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA['delete' 演算子のオペランドはオプションである必要があります。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";The_operand_of_an_increment_or_decrement_operator_may_not_be_an_optional_property_access_2777" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[The operand of an increment or decrement operator may not be an optional property access.]]></Val>
@@ -10536,6 +10563,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";This_is_the_declaration_being_augmented_Consider_moving_the_augmenting_declaration_into_the_same_fil_6233" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[This is the declaration being augmented. Consider moving the augmenting declaration into the same file.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[これは拡張される宣言です。拡張する側の宣言を同じファイルに移動することを検討してください。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";This_may_be_converted_to_an_async_function_80006" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[This may be converted to an async function.]]></Val>
@@ -11107,7 +11143,7 @@
<Str Cat="Text">
<Val><![CDATA[Type originates at this import. A namespace-style import cannot be called or constructed, and will cause a failure at runtime. Consider using a default import or import require here instead.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[型はこのインポートで生成されます。名前空間スタイルのインポートは、呼び出すこともコンストラクトすることもできず、実行時にエラーが発生します。代わりに、ここで既定のインポートまたはインポートの要求を使用することを検討してください。]]></Val>
<Val><![CDATA[型はこのインポートで生成されます。名前空間スタイルのインポートは、呼び出すこともコンストラクトすることもできず、実行時にエラーが発生します。代わりに、ここで既定のインポートまたはインポートの require を使用することを検討してください。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -11668,7 +11704,7 @@
<Str Cat="Text">
<Val><![CDATA[Using compiler options of project reference redirect '{0}'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[プロジェクト参照リダイレクト '{0}' のコンパイラ オプションを使用します。]]></Val>
<Val><![CDATA[Using compiler options of project reference redirect '{0}'.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -436,7 +436,7 @@
<Str Cat="Text">
<Val><![CDATA['A label is not allowed here.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA['여기서는 레이블을 사용할 수 없습니다.]]></Val>
<Val><![CDATA[여기서는 레이블을 사용할 수 없습니다.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -3642,6 +3642,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Declaration_augments_declaration_in_another_file_This_cannot_be_serialized_6232" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Declaration augments declaration in another file. This cannot be serialized.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[선언이 다른 파일의 선언을 확대합니다. 직렬화할 수 없습니다.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_9005" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Declaration emit for this file requires using private name '{0}'. An explicit type annotation may unblock declaration emit.]]></Val>
@@ -5832,15 +5841,6 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it_2373" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Initializer of parameter '{0}' cannot reference identifier '{1}' declared after it.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[매개 변수 '{0}'의 이니셜라이저는 그 다음에 선언된 식별자 '{1}'을(를) 참조할 수 없습니다.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value_2525" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Initializer provides no value for this binding element and the binding element has no default value.]]></Val>
@@ -7188,6 +7188,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Only_numeric_enums_can_have_computed_members_but_this_expression_has_type_0_If_you_do_not_need_exhau_18033" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Only numeric enums can have computed members, but this expression has type '{0}'. If you do not need exhaustiveness checks, consider using an object literal instead.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[숫자 열거형에는 컴퓨팅된 구성원만 사용할 수 있는데 이 식에는 '{0}' 형식이 있습니다. 전체 검사가 필요하지 않은 경우에는 개체 리터럴을 대신 사용해 보세요.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword_2340" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Only public and protected methods of the base class are accessible via the 'super' keyword.]]></Val>
@@ -7399,7 +7408,7 @@
<Str Cat="Text">
<Val><![CDATA[Overload {0} of {1}, '{2}', gave the following error.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[{1}, '{2}'의 오버로드 {0}에서 다음 오류가 발생했습니다.]]></Val>
<Val><![CDATA[오버로드 {0}/{1}('{2}')에서 다음 오류가 발생했습니다.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -7449,11 +7458,20 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Parameter_0_cannot_be_referenced_in_its_initializer_2372" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Parameter_0_cannot_reference_identifier_1_declared_after_it_2373" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Parameter '{0}' cannot be referenced in its initializer.]]></Val>
<Val><![CDATA[Parameter '{0}' cannot reference identifier '{1}' declared after it.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[매개 변수 '{0}'은(는) 해당 이니셜라이저에서 참조할 수 없습니다.]]></Val>
<Val><![CDATA[매개 변수 '{0}'은(는) 이 매개 변수 뒤에 선언된 식별자 '{1}'을(를) 참조할 수 없습니다.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Parameter_0_cannot_reference_itself_2372" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Parameter '{0}' cannot reference itself.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[매개 변수 '{0}'은(는) 자신을 참조할 수 없습니다.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -10188,6 +10206,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";The_operand_of_a_delete_operator_must_be_optional_2790" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[The operand of a 'delete' operator must be optional.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA['delete' 연산자의 피연산자는 선택 사항이어야 합니다.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";The_operand_of_an_increment_or_decrement_operator_may_not_be_an_optional_property_access_2777" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[The operand of an increment or decrement operator may not be an optional property access.]]></Val>
@@ -10536,6 +10563,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";This_is_the_declaration_being_augmented_Consider_moving_the_augmenting_declaration_into_the_same_fil_6233" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[This is the declaration being augmented. Consider moving the augmenting declaration into the same file.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[확대되는 선언입니다. 확대하는 선언을 같은 파일로 이동하는 것이 좋습니다.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";This_may_be_converted_to_an_async_function_80006" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[This may be converted to an async function.]]></Val>
@@ -10768,7 +10804,7 @@
<Str Cat="Text">
<Val><![CDATA[Type '{0}' is missing the following properties from type '{1}': {2}, and {3} more.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA['{0}' 형식에 '{1}' 형식의 {2}, {3} 속성이 없습니다.]]></Val>
<Val><![CDATA['{0}' 형식에 '{1}' 형식의 {2} {3} 속성이 없습니다.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -11107,7 +11143,7 @@
<Str Cat="Text">
<Val><![CDATA[Type originates at this import. A namespace-style import cannot be called or constructed, and will cause a failure at runtime. Consider using a default import or import require here instead.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[형식이 이 가져오기에서 시작됩니다. 네임스페이스 스타일 가져오기는 호출하거나 생성할 수 없으며, 런타임에 오류를 초래합니다. 여기서는 대신 기본 가져오기 또는 가져오기 필요를 사용하는 것이 좋습니다.]]></Val>
<Val><![CDATA[형식이 이 가져오기에서 시작됩니다. 네임스페이스 스타일 가져오기는 호출하거나 생성할 수 없으며, 런타임에 오류를 초래합니다. 여기서는 대신 기본 가져오기 또는 가져오기 require를 사용하는 것이 좋습니다.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -429,7 +429,7 @@
<Str Cat="Text">
<Val><![CDATA['A label is not allowed here.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Etykieta nie jest dozwolona w tym miejscu.]]></Val>
<Val><![CDATA[Etykieta nie jest dozwolona w tym miejscu.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -3183,7 +3183,7 @@
<Str Cat="Text">
<Val><![CDATA[Compiler reserves name '{0}' when emitting private identifier downlevel.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Kompilator rezerwuje nazwę „{0}” podczas emitowania niższego poziomu identyfikatora prywatnego.]]></Val>
<Val><![CDATA[Kompilator rezerwuje nazwę „{0}” podczas emitowania identyfikatora prywatnego na niższy poziom.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -3632,6 +3632,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Declaration_augments_declaration_in_another_file_This_cannot_be_serialized_6232" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Declaration augments declaration in another file. This cannot be serialized.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Deklaracja rozszerza deklarację w innym pliku. Nie można przeprowadzić serializacji.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_9005" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Declaration emit for this file requires using private name '{0}'. An explicit type annotation may unblock declaration emit.]]></Val>
@@ -5822,15 +5831,6 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it_2373" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Initializer of parameter '{0}' cannot reference identifier '{1}' declared after it.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Inicjator parametru „{0}” nie może przywoływać identyfikatora „{1}” zadeklarowanego po nim.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value_2525" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Initializer provides no value for this binding element and the binding element has no default value.]]></Val>
@@ -7178,6 +7178,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Only_numeric_enums_can_have_computed_members_but_this_expression_has_type_0_If_you_do_not_need_exhau_18033" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Only numeric enums can have computed members, but this expression has type '{0}'. If you do not need exhaustiveness checks, consider using an object literal instead.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Tylko wyliczenia numeryczne mogą mieć składowe obliczane, ale to wyrażenie ma typ „{0}”. Jeśli nie potrzebujesz sprawdzeń kompletności, rozważ użycie literału obiektu.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword_2340" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Only public and protected methods of the base class are accessible via the 'super' keyword.]]></Val>
@@ -7389,7 +7398,7 @@
<Str Cat="Text">
<Val><![CDATA[Overload {0} of {1}, '{2}', gave the following error.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Przeciążenie {0} {1}, „{2}”, dało następujący błąd.]]></Val>
<Val><![CDATA[Przeciążenie {0} z {1}, „{2}”, zwróciło następujący błąd.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -7439,11 +7448,20 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Parameter_0_cannot_be_referenced_in_its_initializer_2372" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Parameter_0_cannot_reference_identifier_1_declared_after_it_2373" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Parameter '{0}' cannot be referenced in its initializer.]]></Val>
<Val><![CDATA[Parameter '{0}' cannot reference identifier '{1}' declared after it.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Parametr „{0}” nie może być przywoływany w swoim inicjatorze.]]></Val>
<Val><![CDATA[Parametr „{0}” nie może przywoływać identyfikatora „{1}” zadeklarowanego po nim.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Parameter_0_cannot_reference_itself_2372" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Parameter '{0}' cannot reference itself.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Parametr „{0}” nie może odwoływać się do siebie samego.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -10175,6 +10193,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";The_operand_of_a_delete_operator_must_be_optional_2790" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[The operand of a 'delete' operator must be optional.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Operand operatora „delete” musi być opcjonalny.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";The_operand_of_an_increment_or_decrement_operator_may_not_be_an_optional_property_access_2777" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[The operand of an increment or decrement operator may not be an optional property access.]]></Val>
@@ -10523,6 +10550,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";This_is_the_declaration_being_augmented_Consider_moving_the_augmenting_declaration_into_the_same_fil_6233" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[This is the declaration being augmented. Consider moving the augmenting declaration into the same file.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[To jest rozszerzana deklaracja. Rozważ przeniesienie deklaracji rozszerzenia do tego samego pliku.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";This_may_be_converted_to_an_async_function_80006" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[This may be converted to an async function.]]></Val>
@@ -10755,7 +10791,7 @@
<Str Cat="Text">
<Val><![CDATA[Type '{0}' is missing the following properties from type '{1}': {2}, and {3} more.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[W typie „{0}” brakuje następujących właściwości typu „{1}”: {2} i {3} więcej.]]></Val>
<Val><![CDATA[W typie „{0}” brakuje następujących właściwości z typu „{1}”: {2} i jeszcze {3}.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -11655,7 +11691,7 @@
<Str Cat="Text">
<Val><![CDATA[Using compiler options of project reference redirect '{0}'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Używanie opcji kompilatora przekierowania odwołania do projektu „{0}.]]></Val>
<Val><![CDATA[Using compiler options of project reference redirect '{0}'.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -3186,7 +3186,7 @@
<Str Cat="Text">
<Val><![CDATA[Compiler reserves name '{0}' when emitting private identifier downlevel.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[O compilador reserva o nome '{0}' ao emitir um nível inferior de identificador privado.]]></Val>
<Val><![CDATA[O compilador reserva o nome '{0}' ao emitir um identificador privado para versões anteriores.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -3635,6 +3635,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Declaration_augments_declaration_in_another_file_This_cannot_be_serialized_6232" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Declaration augments declaration in another file. This cannot be serialized.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[A declaração aumenta a declaração em outro arquivo. Isso não pode ser serializado.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_9005" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Declaration emit for this file requires using private name '{0}'. An explicit type annotation may unblock declaration emit.]]></Val>
@@ -5825,15 +5834,6 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it_2373" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Initializer of parameter '{0}' cannot reference identifier '{1}' declared after it.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[O inicializador do parâmetro '{0}' não pode referenciar o identificador '{1}' declarado depois dele.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value_2525" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Initializer provides no value for this binding element and the binding element has no default value.]]></Val>
@@ -7181,6 +7181,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Only_numeric_enums_can_have_computed_members_but_this_expression_has_type_0_If_you_do_not_need_exhau_18033" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Only numeric enums can have computed members, but this expression has type '{0}'. If you do not need exhaustiveness checks, consider using an object literal instead.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Somente enumerações numéricas podem ter membros computados, mas esta expressão tem o tipo '{0}'. Se você não precisar de verificações de exaustão, considere o uso de um literal de objeto.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword_2340" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Only public and protected methods of the base class are accessible via the 'super' keyword.]]></Val>
@@ -7442,11 +7451,20 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Parameter_0_cannot_be_referenced_in_its_initializer_2372" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Parameter_0_cannot_reference_identifier_1_declared_after_it_2373" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Parameter '{0}' cannot be referenced in its initializer.]]></Val>
<Val><![CDATA[Parameter '{0}' cannot reference identifier '{1}' declared after it.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[O parâmetro '{0}' não pode ser referenciado em seu inicializador.]]></Val>
<Val><![CDATA[O parâmetro '{0}' não pode referenciar o identificador '{1}' declarado depois dele.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Parameter_0_cannot_reference_itself_2372" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Parameter '{0}' cannot reference itself.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[O parâmetro '{0}' não pode referenciar a si mesmo.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -7812,7 +7830,7 @@
<Str Cat="Text">
<Val><![CDATA[Prefix with 'declare']]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Prefixo com 'declare']]></Val>
<Val><![CDATA[Prefixar com 'declare']]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -10178,6 +10196,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";The_operand_of_a_delete_operator_must_be_optional_2790" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[The operand of a 'delete' operator must be optional.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[O operando de um operador 'delete' precisa ser opcional.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";The_operand_of_an_increment_or_decrement_operator_may_not_be_an_optional_property_access_2777" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[The operand of an increment or decrement operator may not be an optional property access.]]></Val>
@@ -10526,6 +10553,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";This_is_the_declaration_being_augmented_Consider_moving_the_augmenting_declaration_into_the_same_fil_6233" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[This is the declaration being augmented. Consider moving the augmenting declaration into the same file.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Esta é a declaração que está sendo aumentada. Considere mover a declaração em aumento para o mesmo arquivo.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";This_may_be_converted_to_an_async_function_80006" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[This may be converted to an async function.]]></Val>
@@ -11097,7 +11133,7 @@
<Str Cat="Text">
<Val><![CDATA[Type originates at this import. A namespace-style import cannot be called or constructed, and will cause a failure at runtime. Consider using a default import or import require here instead.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[O tipo se origina nessa importação. Uma importação de estilo de namespace não pode ser chamada nem construída e causará uma falha no runtime. Considere usar uma importação padrão ou solicite uma importação aqui.]]></Val>
<Val><![CDATA[O tipo se origina nessa importação. Uma importação de estilo de namespace não pode ser chamada nem construída e causará uma falha no runtime. Considere usar uma importação padrão ou importe require aqui.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -11658,7 +11694,7 @@
<Str Cat="Text">
<Val><![CDATA[Using compiler options of project reference redirect '{0}'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Usando opções de compilador de redirecionamento de referência de projeto '{0}'.]]></Val>
<Val><![CDATA[Using compiler options of project reference redirect '{0}'.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -1179,7 +1179,7 @@
<Str Cat="Text">
<Val><![CDATA[Add 'export {}' to make this file into a module]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Добавить "export {}", чтобы сделать этот файл модулем]]></Val>
<Val><![CDATA[Добавить "export {}", чтобы превратить этот файл в модуль]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -3641,6 +3641,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Declaration_augments_declaration_in_another_file_This_cannot_be_serialized_6232" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Declaration augments declaration in another file. This cannot be serialized.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Объявление дополняет объявление в другом файле. Сериализация невозможна.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_9005" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Declaration emit for this file requires using private name '{0}'. An explicit type annotation may unblock declaration emit.]]></Val>
@@ -5640,7 +5649,7 @@
<Str Cat="Text">
<Val><![CDATA[Import default '{0}' from module "{1}"]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Импорт "{0}" по умолчанию из модуля "{1}"]]></Val>
<Val><![CDATA[Импортировать "{0}" по умолчанию из модуля "{1}"]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -5831,15 +5840,6 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it_2373" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Initializer of parameter '{0}' cannot reference identifier '{1}' declared after it.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Инициализатор параметра "{0}" не может ссылаться на идентификатор "{1}", объявленный после него.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value_2525" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Initializer provides no value for this binding element and the binding element has no default value.]]></Val>
@@ -7187,6 +7187,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Only_numeric_enums_can_have_computed_members_but_this_expression_has_type_0_If_you_do_not_need_exhau_18033" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Only numeric enums can have computed members, but this expression has type '{0}'. If you do not need exhaustiveness checks, consider using an object literal instead.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Только числовые перечисления могут иметь вычисляемые элементы, но это выражение имеет тип "{0}". Если вы не хотите проверять полноту, рекомендуется использовать вместо этого объектный литерал.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword_2340" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Only public and protected methods of the base class are accessible via the 'super' keyword.]]></Val>
@@ -7448,11 +7457,20 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Parameter_0_cannot_be_referenced_in_its_initializer_2372" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Parameter_0_cannot_reference_identifier_1_declared_after_it_2373" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Parameter '{0}' cannot be referenced in its initializer.]]></Val>
<Val><![CDATA[Parameter '{0}' cannot reference identifier '{1}' declared after it.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[На параметр "{0}" невозможно ссылаться в его инициализаторе.]]></Val>
<Val><![CDATA[Параметр "{0}" не может ссылаться на идентификатор "{1}", объявленный после него.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Parameter_0_cannot_reference_itself_2372" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Parameter '{0}' cannot reference itself.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Параметр "{0}" не может ссылаться сам на себя.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -10187,6 +10205,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";The_operand_of_a_delete_operator_must_be_optional_2790" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[The operand of a 'delete' operator must be optional.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Операнд оператора "delete" должен быть необязательным.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";The_operand_of_an_increment_or_decrement_operator_may_not_be_an_optional_property_access_2777" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[The operand of an increment or decrement operator may not be an optional property access.]]></Val>
@@ -10535,6 +10562,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";This_is_the_declaration_being_augmented_Consider_moving_the_augmenting_declaration_into_the_same_fil_6233" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[This is the declaration being augmented. Consider moving the augmenting declaration into the same file.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Это объявление дополняется другим объявлением. Попробуйте переместить дополняющее объявление в тот же файл.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";This_may_be_converted_to_an_async_function_80006" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[This may be converted to an async function.]]></Val>
@@ -10758,7 +10794,7 @@
<Str Cat="Text">
<Val><![CDATA[Type '{0}' is missing the following properties from type '{1}': {2}]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[В типе "{0}" отсутствуют следующие свойства из типа "{1}": {2}.]]></Val>
<Val><![CDATA[В типе "{0}" отсутствуют следующие свойства из типа "{1}": {2}]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -11106,7 +11142,7 @@
<Str Cat="Text">
<Val><![CDATA[Type originates at this import. A namespace-style import cannot be called or constructed, and will cause a failure at runtime. Consider using a default import or import require here instead.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Тип происходит от этого импорта. Импорт стиля пространства имен не может быть вызван или создан и приведет к сбою во время выполнения. Вместо этого рекомендуется использовать импорт по умолчанию или импорт, указанный здесь.]]></Val>
<Val><![CDATA[Тип происходит от этого импорта. Импорт стиля пространства имен не может быть вызван или создан и приведет к сбою во время выполнения. Вместо этого рекомендуется использовать импорт по умолчанию или импортировать сюда "require".]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -11667,7 +11703,7 @@
<Str Cat="Text">
<Val><![CDATA[Using compiler options of project reference redirect '{0}'.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Использование параметров компилятора перенаправления ссылки на проект "{0}".]]></Val>
<Val><![CDATA[Использование параметров компилятора для перенаправления ссылки на проект "{0}".]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -3635,6 +3635,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Declaration_augments_declaration_in_another_file_This_cannot_be_serialized_6232" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Declaration augments declaration in another file. This cannot be serialized.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Bildirim başka bir dosyadaki bildirimi genişlettiğinden serileştirilemez.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_9005" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Declaration emit for this file requires using private name '{0}'. An explicit type annotation may unblock declaration emit.]]></Val>
@@ -5825,15 +5834,6 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it_2373" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Initializer of parameter '{0}' cannot reference identifier '{1}' declared after it.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA['{0}' parametresinin başlatıcısı, kendinden sonra bildirilen '{1}' tanımlayıcısına başvuramaz.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value_2525" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Initializer provides no value for this binding element and the binding element has no default value.]]></Val>
@@ -7181,6 +7181,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Only_numeric_enums_can_have_computed_members_but_this_expression_has_type_0_If_you_do_not_need_exhau_18033" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Only numeric enums can have computed members, but this expression has type '{0}'. If you do not need exhaustiveness checks, consider using an object literal instead.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Yalnızca sayısal sabit listelerinde hesaplanmış üyeler olabilir ancak bu ifadede '{0}' türü var. Kapsamlılık denetimleri gerekmiyorsa bunun yerine bir nesne sabit değeri kullanmayı düşünebilirsiniz.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword_2340" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Only public and protected methods of the base class are accessible via the 'super' keyword.]]></Val>
@@ -7392,7 +7401,7 @@
<Str Cat="Text">
<Val><![CDATA[Overload {0} of {1}, '{2}', gave the following error.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[{1} metodunun {0} aşırı yüklemesi ('{2}'), aşağıdaki hatayı verdi.]]></Val>
<Val><![CDATA[{0}/{1} aşırı yükleme '{2}' imzası, aşağıdaki hatayı verdi.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -7442,11 +7451,20 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Parameter_0_cannot_be_referenced_in_its_initializer_2372" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Parameter_0_cannot_reference_identifier_1_declared_after_it_2373" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Parameter '{0}' cannot be referenced in its initializer.]]></Val>
<Val><![CDATA[Parameter '{0}' cannot reference identifier '{1}' declared after it.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA['{0}' parametresine başlatıcısında başvurulamaz.]]></Val>
<Val><![CDATA['{0}' parametresi, kendisinden sonra bildirilen '{1}' tanımlayıcısına başvuramaz.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Parameter_0_cannot_reference_itself_2372" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Parameter '{0}' cannot reference itself.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA['{0}' parametresi kendisine başvuramaz.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -10181,6 +10199,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";The_operand_of_a_delete_operator_must_be_optional_2790" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[The operand of a 'delete' operator must be optional.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA['delete' operatörünün işleneni isteğe bağlı olmalıdır.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";The_operand_of_an_increment_or_decrement_operator_may_not_be_an_optional_property_access_2777" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[The operand of an increment or decrement operator may not be an optional property access.]]></Val>
@@ -10529,6 +10556,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";This_is_the_declaration_being_augmented_Consider_moving_the_augmenting_declaration_into_the_same_fil_6233" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[This is the declaration being augmented. Consider moving the augmenting declaration into the same file.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Bu, genişletilmekte olan bildirimdir. Genişleten bildirimi aynı dosyaya taşımayı düşünün.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";This_may_be_converted_to_an_async_function_80006" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[This may be converted to an async function.]]></Val>
@@ -11100,7 +11136,7 @@
<Str Cat="Text">
<Val><![CDATA[Type originates at this import. A namespace-style import cannot be called or constructed, and will cause a failure at runtime. Consider using a default import or import require here instead.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Tür bu içeri aktarmadan kaynaklanıyor. Bir ad alanı stili içeri aktarma işlemi çağrılamaz ya da oluşturulamaz ve çalışma zamanında hataya neden olur. Bunun yerine varsayılan içeri aktarmayı kullanmayı veya içeri aktarmayı burada gerektirmeyi deneyin.]]></Val>
<Val><![CDATA[Tür bu içeri aktarmadan kaynaklanıyor. Ad alanı stili içeri aktarma işlemi çağrılamaz ya da oluşturulamaz ve çalışma zamanında hataya neden olur. Bunun yerine varsayılan içeri aktarmayı kullanabilir veya burada içeri aktarma gerektirebilirsiniz.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
+6 -2
View File
@@ -2784,7 +2784,7 @@ namespace ts.server.protocol {
/**
* Arguments for navto request message.
*/
export interface NavtoRequestArgs extends FileRequestArgs {
export interface NavtoRequestArgs {
/**
* Search term to navigate to from current location; term can
* be '.*' or an identifier prefix.
@@ -2794,6 +2794,10 @@ namespace ts.server.protocol {
* Optional limit on the number of items to return.
*/
maxResultCount?: number;
/**
* The file for the request (absolute pathname required).
*/
file?: string;
/**
* Optional flag to indicate we want results for just the current file
* or the entire project.
@@ -2809,7 +2813,7 @@ namespace ts.server.protocol {
* match the search term given in argument 'searchTerm'. The
* context for the search is given by the named file.
*/
export interface NavtoRequest extends FileRequest {
export interface NavtoRequest extends Request {
command: CommandTypes.Navto;
arguments: NavtoRequestArgs;
}
+40 -27
View File
@@ -304,7 +304,7 @@ namespace ts.server {
projects,
defaultProject,
/*initialLocation*/ undefined,
({ project }, tryAddToTodo) => {
(project, _, tryAddToTodo) => {
for (const output of action(project)) {
if (!contains(outputs, output, resultsEqual) && !tryAddToTodo(project, getLocation(output))) {
outputs.push(output);
@@ -329,7 +329,7 @@ namespace ts.server {
projects,
defaultProject,
initialLocation,
({ project, location }, tryAddToTodo) => {
(project, location, tryAddToTodo) => {
for (const output of project.getLanguageService().findRenameLocations(location.fileName, location.pos, findInStrings, findInComments, hostPreferences.providePrefixAndSuffixTextForRename) || emptyArray) {
if (!contains(outputs, output, documentSpansEqual) && !tryAddToTodo(project, documentSpanLocation(output))) {
outputs.push(output);
@@ -358,7 +358,7 @@ namespace ts.server {
projects,
defaultProject,
initialLocation,
({ project, location }, getMappedLocation) => {
(project, location, getMappedLocation) => {
for (const outputReferencedSymbol of project.getLanguageService().findReferences(location.fileName, location.pos) || emptyArray) {
const mappedDefinitionFile = getMappedLocation(project, documentSpanLocation(outputReferencedSymbol.definition));
const definition: ReferencedSymbolDefinitionInfo = mappedDefinitionFile === undefined ?
@@ -408,7 +408,8 @@ namespace ts.server {
}
type CombineProjectOutputCallback<TLocation extends DocumentPosition | undefined> = (
where: ProjectAndLocation<TLocation>,
project: Project,
location: TLocation,
getMappedLocation: (project: Project, location: DocumentPosition) => DocumentPosition | undefined,
) => void;
@@ -422,9 +423,9 @@ namespace ts.server {
let toDo: ProjectAndLocation<TLocation>[] | undefined;
const seenProjects = createMap<true>();
forEachProjectInProjects(projects, initialLocation && initialLocation.fileName, (project, path) => {
// TLocation shoud be either `DocumentPosition` or `undefined`. Since `initialLocation` is `TLocation` this cast should be valid.
// TLocation should be either `DocumentPosition` or `undefined`. Since `initialLocation` is `TLocation` this cast should be valid.
const location = (initialLocation ? { fileName: path, pos: initialLocation.pos } : undefined) as TLocation;
toDo = callbackProjectAndLocation({ project, location }, projectService, toDo, seenProjects, cb);
toDo = callbackProjectAndLocation(project, location, projectService, toDo, seenProjects, cb);
});
// After initial references are collected, go over every other project and see if it has a reference for the symbol definition.
@@ -442,14 +443,16 @@ namespace ts.server {
if (!addToSeen(seenProjects, project)) return;
const definition = mapDefinitionInProject(defaultDefinition, project, getGeneratedDefinition, getSourceDefinition);
if (definition) {
toDo = callbackProjectAndLocation<TLocation>({ project, location: definition as TLocation }, projectService, toDo, seenProjects, cb);
toDo = callbackProjectAndLocation<TLocation>(project, definition as TLocation, projectService, toDo, seenProjects, cb);
}
});
}
}
while (toDo && toDo.length) {
toDo = callbackProjectAndLocation(Debug.checkDefined(toDo.pop()), projectService, toDo, seenProjects, cb);
const next = toDo.pop();
Debug.assertIsDefined(next);
toDo = callbackProjectAndLocation(next.project, next.location, projectService, toDo, seenProjects, cb);
}
}
@@ -487,31 +490,33 @@ namespace ts.server {
}
function callbackProjectAndLocation<TLocation extends DocumentPosition | undefined>(
projectAndLocation: ProjectAndLocation<TLocation>,
project: Project,
location: TLocation,
projectService: ProjectService,
toDo: ProjectAndLocation<TLocation>[] | undefined,
seenProjects: Map<true>,
cb: CombineProjectOutputCallback<TLocation>,
): ProjectAndLocation<TLocation>[] | undefined {
const { project, location } = projectAndLocation;
if (project.getCancellationToken().isCancellationRequested()) return undefined; // Skip rest of toDo if cancelled
// If this is not the file we were actually looking, return rest of the toDo
if (isLocationProjectReferenceRedirect(project, location)) return toDo;
cb(projectAndLocation, (project, location) => {
addToSeen(seenProjects, projectAndLocation.project);
const originalLocation = projectService.getOriginalLocationEnsuringConfiguredProject(project, location);
cb(project, location, (innerProject, location) => {
addToSeen(seenProjects, project);
const originalLocation = projectService.getOriginalLocationEnsuringConfiguredProject(innerProject, location);
if (!originalLocation) return undefined;
const originalScriptInfo = projectService.getScriptInfo(originalLocation.fileName)!;
toDo = toDo || [];
for (const project of originalScriptInfo.containingProjects) {
addToTodo({ project, location: originalLocation as TLocation }, toDo, seenProjects);
addToTodo(project, originalLocation as TLocation, toDo, seenProjects);
}
const symlinkedProjectsMap = projectService.getSymlinkedProjects(originalScriptInfo);
if (symlinkedProjectsMap) {
symlinkedProjectsMap.forEach((symlinkedProjects, symlinkedPath) => {
for (const symlinkedProject of symlinkedProjects) addToTodo({ project: symlinkedProject, location: { fileName: symlinkedPath, pos: originalLocation.pos } as TLocation }, toDo!, seenProjects);
for (const symlinkedProject of symlinkedProjects) {
addToTodo(symlinkedProject, { fileName: symlinkedPath, pos: originalLocation.pos } as TLocation, toDo!, seenProjects);
}
});
}
return originalLocation === location ? undefined : originalLocation;
@@ -519,8 +524,8 @@ namespace ts.server {
return toDo;
}
function addToTodo<TLocation extends DocumentPosition | undefined>(projectAndLocation: ProjectAndLocation<TLocation>, toDo: Push<ProjectAndLocation<TLocation>>, seenProjects: Map<true>): void {
if (addToSeen(seenProjects, projectAndLocation.project)) toDo.push(projectAndLocation);
function addToTodo<TLocation extends DocumentPosition | undefined>(project: Project, location: TLocation, toDo: Push<ProjectAndLocation<TLocation>>, seenProjects: Map<true>): void {
if (addToSeen(seenProjects, project)) toDo.push({ project, location });
}
function addToSeen(seenProjects: Map<true>, project: Project) {
@@ -1323,7 +1328,7 @@ namespace ts.server {
// filter handles case when 'projects' is undefined
projects = filter(projects, p => p.languageServiceEnabled && !p.isOrphan());
if (!ignoreNoProjectError && (!projects || !projects.length) && !symLinkedProjects) {
this.projectService.logErrorForScriptInfoNotFound(args.file);
this.projectService.logErrorForScriptInfoNotFound(args.file ?? args.projectFileName);
return Errors.ThrowNoProject();
}
return symLinkedProjects ? { projects: projects!, symLinkedProjects } : projects!; // TODO: GH#18217
@@ -1335,6 +1340,9 @@ namespace ts.server {
if (project) {
return project;
}
if (!args.file) {
return Errors.ThrowNoProject();
}
}
const info = this.projectService.getScriptInfo(args.file)!;
return info.getDefaultProject();
@@ -1894,20 +1902,25 @@ namespace ts.server {
}
private getFullNavigateToItems(args: protocol.NavtoRequestArgs): readonly NavigateToItem[] {
const { currentFileOnly, searchValue, maxResultCount } = args;
const { currentFileOnly, searchValue, maxResultCount, projectFileName } = args;
if (currentFileOnly) {
const { file, project } = this.getFileAndProject(args);
Debug.assertDefined(args.file);
const { file, project } = this.getFileAndProject(args as protocol.FileRequestArgs);
return project.getLanguageService().getNavigateToItems(searchValue, maxResultCount, file);
}
else {
return combineProjectOutputWhileOpeningReferencedProjects<NavigateToItem>(
this.getProjects(args),
this.getDefaultProject(args),
project =>
project.getLanguageService().getNavigateToItems(searchValue, maxResultCount, /*fileName*/ undefined, /*excludeDts*/ project.isNonTsProject()),
documentSpanLocation,
else if (!args.file && !projectFileName) {
return combineProjectOutputFromEveryProject(
this.projectService,
project => project.getLanguageService().getNavigateToItems(searchValue, maxResultCount, /*filename*/ undefined, /*excludeDts*/ project.isNonTsProject()),
navigateToItemIsEqualTo);
}
const fileArgs = args as protocol.FileRequestArgs;
return combineProjectOutputWhileOpeningReferencedProjects<NavigateToItem>(
this.getProjects(fileArgs),
this.getDefaultProject(fileArgs),
project => project.getLanguageService().getNavigateToItems(searchValue, maxResultCount, /*fileName*/ undefined, /*excludeDts*/ project.isNonTsProject()),
documentSpanLocation,
navigateToItemIsEqualTo);
function navigateToItemIsEqualTo(a: NavigateToItem, b: NavigateToItem): boolean {
if (a === b) {
@@ -60,10 +60,15 @@ namespace ts.codefix {
const memberElements: ClassElement[] = [];
// all instance members are stored in the "member" array of symbol
if (symbol.members) {
symbol.members.forEach(member => {
symbol.members.forEach((member, key) => {
if (key === "constructor") {
// fn.prototype.constructor = fn
changes.delete(sourceFile, member.valueDeclaration.parent);
return;
}
const memberElement = createClassElement(member, /*modifiers*/ undefined);
if (memberElement) {
memberElements.push(memberElement);
memberElements.push(...memberElement);
}
});
}
@@ -71,32 +76,68 @@ namespace ts.codefix {
// all static members are stored in the "exports" array of symbol
if (symbol.exports) {
symbol.exports.forEach(member => {
const memberElement = createClassElement(member, [createToken(SyntaxKind.StaticKeyword)]);
if (memberElement) {
memberElements.push(memberElement);
if (member.name === "prototype") {
const firstDeclaration = member.declarations[0];
// only one "x.prototype = { ... }" will pass
if (member.declarations.length === 1 &&
isPropertyAccessExpression(firstDeclaration) &&
isBinaryExpression(firstDeclaration.parent) &&
firstDeclaration.parent.operatorToken.kind === SyntaxKind.EqualsToken &&
isObjectLiteralExpression(firstDeclaration.parent.right)
) {
const prototypes = firstDeclaration.parent.right;
const memberElement = createClassElement(prototypes.symbol, /** modifiers */ undefined);
if (memberElement) {
memberElements.push(...memberElement);
}
}
}
else {
const memberElement = createClassElement(member, [createToken(SyntaxKind.StaticKeyword)]);
if (memberElement) {
memberElements.push(...memberElement);
}
}
});
}
return memberElements;
function shouldConvertDeclaration(_target: PropertyAccessExpression, source: Expression) {
// Right now the only thing we can convert are function expressions - other values shouldn't get
// transformed. We can update this once ES public class properties are available.
return isFunctionLike(source);
function shouldConvertDeclaration(_target: PropertyAccessExpression | ObjectLiteralExpression, source: Expression) {
// Right now the only thing we can convert are function expressions, get/set accessors and methods
// other values like normal value fields ({a: 1}) shouldn't get transformed.
// We can update this once ES public class properties are available.
if (isPropertyAccessExpression(_target)) {
if (isConstructorAssignment(_target)) return true;
return isFunctionLike(source);
}
else {
return every(_target.properties, property => {
// a() {}
if (isMethodDeclaration(property) || isGetOrSetAccessorDeclaration(property)) return true;
// a: function() {}
if (isPropertyAssignment(property) && isFunctionExpression(property.initializer) && !!property.name) return true;
// x.prototype.constructor = fn
if (isConstructorAssignment(property)) return true;
return false;
});
}
}
function createClassElement(symbol: Symbol, modifiers: Modifier[] | undefined): ClassElement | undefined {
function createClassElement(symbol: Symbol, modifiers: Modifier[] | undefined): readonly ClassElement[] {
// Right now the only thing we can convert are function expressions, which are marked as methods
if (!(symbol.flags & SymbolFlags.Method)) {
return;
// or { x: y } type prototype assignments, which are marked as ObjectLiteral
const members: ClassElement[] = [];
if (!(symbol.flags & SymbolFlags.Method) && !(symbol.flags & SymbolFlags.ObjectLiteral)) {
return members;
}
const memberDeclaration = symbol.valueDeclaration as PropertyAccessExpression;
const memberDeclaration = symbol.valueDeclaration as PropertyAccessExpression | ObjectLiteralExpression;
const assignmentBinaryExpression = memberDeclaration.parent as BinaryExpression;
const assignmentExpr = assignmentBinaryExpression.right;
if (!shouldConvertDeclaration(memberDeclaration, assignmentBinaryExpression.right)) {
return;
if (!shouldConvertDeclaration(memberDeclaration, assignmentExpr)) {
return members;
}
// delete the entire statement if this expression is the sole expression to take care of the semicolon at the end
@@ -104,51 +145,76 @@ namespace ts.codefix {
? assignmentBinaryExpression.parent : assignmentBinaryExpression;
changes.delete(sourceFile, nodeToDelete);
if (!assignmentBinaryExpression.right) {
return createProperty([], modifiers, symbol.name, /*questionToken*/ undefined,
/*type*/ undefined, /*initializer*/ undefined);
if (!assignmentExpr) {
members.push(createProperty([], modifiers, symbol.name, /*questionToken*/ undefined,
/*type*/ undefined, /*initializer*/ undefined));
return members;
}
switch (assignmentBinaryExpression.right.kind) {
case SyntaxKind.FunctionExpression: {
const functionExpression = assignmentBinaryExpression.right as FunctionExpression;
const fullModifiers = concatenate(modifiers, getModifierKindFromSource(functionExpression, SyntaxKind.AsyncKeyword));
const method = createMethod(/*decorators*/ undefined, fullModifiers, /*asteriskToken*/ undefined, memberDeclaration.name, /*questionToken*/ undefined,
/*typeParameters*/ undefined, functionExpression.parameters, /*type*/ undefined, functionExpression.body);
copyLeadingComments(assignmentBinaryExpression, method, sourceFile);
return method;
}
case SyntaxKind.ArrowFunction: {
const arrowFunction = assignmentBinaryExpression.right as ArrowFunction;
const arrowFunctionBody = arrowFunction.body;
let bodyBlock: Block;
// case 1: () => { return [1,2,3] }
if (arrowFunctionBody.kind === SyntaxKind.Block) {
bodyBlock = arrowFunctionBody as Block;
// f.x = expr
if (isPropertyAccessExpression(memberDeclaration) && (isFunctionExpression(assignmentExpr) || isArrowFunction(assignmentExpr))) {
return createFunctionLikeExpressionMember(members, assignmentExpr, memberDeclaration.name);
}
// f.prototype = { ... }
else if (isObjectLiteralExpression(assignmentExpr)) {
return flatMap(
assignmentExpr.properties,
property => {
if (isMethodDeclaration(property) || isGetOrSetAccessorDeclaration(property)) {
// MethodDeclaration and AccessorDeclaration can appear in a class directly
return members.concat(property);
}
if (isPropertyAssignment(property) && isFunctionExpression(property.initializer)) {
return createFunctionLikeExpressionMember(members, property.initializer, property.name);
}
// Drop constructor assignments
if (isConstructorAssignment(property)) return members;
return [];
}
// case 2: () => [1,2,3]
else {
bodyBlock = createBlock([createReturn(arrowFunctionBody)]);
}
const fullModifiers = concatenate(modifiers, getModifierKindFromSource(arrowFunction, SyntaxKind.AsyncKeyword));
const method = createMethod(/*decorators*/ undefined, fullModifiers, /*asteriskToken*/ undefined, memberDeclaration.name, /*questionToken*/ undefined,
/*typeParameters*/ undefined, arrowFunction.parameters, /*type*/ undefined, bodyBlock);
copyLeadingComments(assignmentBinaryExpression, method, sourceFile);
return method;
}
);
}
else {
// Don't try to declare members in JavaScript files
if (isSourceFileJS(sourceFile)) return members;
if (!isPropertyAccessExpression(memberDeclaration)) return members;
const prop = createProperty(/*decorators*/ undefined, modifiers, memberDeclaration.name, /*questionToken*/ undefined, /*type*/ undefined, assignmentExpr);
copyLeadingComments(assignmentBinaryExpression.parent, prop, sourceFile);
members.push(prop);
return members;
}
default: {
// Don't try to declare members in JavaScript files
if (isSourceFileJS(sourceFile)) {
return;
}
const prop = createProperty(/*decorators*/ undefined, modifiers, memberDeclaration.name, /*questionToken*/ undefined,
/*type*/ undefined, assignmentBinaryExpression.right);
copyLeadingComments(assignmentBinaryExpression.parent, prop, sourceFile);
return prop;
type MethodName = Parameters<typeof createMethod>[3];
function createFunctionLikeExpressionMember(members: readonly ClassElement[], expression: FunctionExpression | ArrowFunction, name: MethodName) {
if (isFunctionExpression(expression)) return createFunctionExpressionMember(members, expression, name);
else return createArrowFunctionExpressionMember(members, expression, name);
}
function createFunctionExpressionMember(members: readonly ClassElement[], functionExpression: FunctionExpression, name: MethodName) {
const fullModifiers = concatenate(modifiers, getModifierKindFromSource(functionExpression, SyntaxKind.AsyncKeyword));
const method = createMethod(/*decorators*/ undefined, fullModifiers, /*asteriskToken*/ undefined, name, /*questionToken*/ undefined,
/*typeParameters*/ undefined, functionExpression.parameters, /*type*/ undefined, functionExpression.body);
copyLeadingComments(assignmentBinaryExpression, method, sourceFile);
return members.concat(method);
}
function createArrowFunctionExpressionMember(members: readonly ClassElement[], arrowFunction: ArrowFunction, name: MethodName) {
const arrowFunctionBody = arrowFunction.body;
let bodyBlock: Block;
// case 1: () => { return [1,2,3] }
if (arrowFunctionBody.kind === SyntaxKind.Block) {
bodyBlock = arrowFunctionBody as Block;
}
// case 2: () => [1,2,3]
else {
bodyBlock = createBlock([createReturn(arrowFunctionBody)]);
}
const fullModifiers = concatenate(modifiers, getModifierKindFromSource(arrowFunction, SyntaxKind.AsyncKeyword));
const method = createMethod(/*decorators*/ undefined, fullModifiers, /*asteriskToken*/ undefined, name, /*questionToken*/ undefined,
/*typeParameters*/ undefined, arrowFunction.parameters, /*type*/ undefined, bodyBlock);
copyLeadingComments(assignmentBinaryExpression, method, sourceFile);
return members.concat(method);
}
}
}
@@ -192,4 +258,10 @@ namespace ts.codefix {
function getModifierKindFromSource(source: Node, kind: SyntaxKind): readonly Modifier[] | undefined {
return filter(source.modifiers, modifier => modifier.kind === kind);
}
function isConstructorAssignment(x: ObjectLiteralElementLike | PropertyAccessExpression) {
if (!x.name) return false;
if (isIdentifier(x.name) && x.name.text === "constructor") return true;
return false;
}
}
@@ -282,7 +282,7 @@ namespace ts.codefix {
varDeclIdentifier = getSynthesizedDeepClone(possibleNameForVarDecl.identifier);
const typeArray: Type[] = possibleNameForVarDecl.types;
const unionType = transformer.checker.getUnionType(typeArray, UnionReduction.Subtype);
const unionTypeNode = transformer.isInJSFile ? undefined : transformer.checker.typeToTypeNode(unionType);
const unionTypeNode = transformer.isInJSFile ? undefined : transformer.checker.typeToTypeNode(unionType, /*enclosingDeclaration*/ undefined, /*flags*/ undefined);
const varDecl = [createVariableDeclaration(varDeclIdentifier, unionTypeNode)];
varDeclList = createVariableStatement(/*modifiers*/ undefined, createVariableDeclarationList(varDecl, NodeFlags.Let));
}
@@ -16,6 +16,7 @@ namespace ts.codefix {
return undefined;
}
const newLineCharacter = sourceFile.checkJsDirective ? "" : getNewLineOrDefaultFromHost(host, formatContext.options);
const fixes: CodeFixAction[] = [
// fixId unnecessary because adding `// @ts-nocheck` even once will ignore every error in the file.
createCodeFixActionWithoutFixAll(
@@ -23,7 +24,7 @@ namespace ts.codefix {
[createFileTextChanges(sourceFile.fileName, [
createTextChange(sourceFile.checkJsDirective
? createTextSpanFromBounds(sourceFile.checkJsDirective.pos, sourceFile.checkJsDirective.end)
: createTextSpan(0, 0), `// @ts-nocheck${getNewLineOrDefaultFromHost(host, formatContext.options)}`),
: createTextSpan(0, 0), `// @ts-nocheck${newLineCharacter}`),
])],
Diagnostics.Disable_checking_for_this_file),
];
@@ -230,11 +230,11 @@ namespace ts.codefix {
const binaryExpression = token.parent.parent as BinaryExpression;
const otherExpression = token.parent === binaryExpression.left ? binaryExpression.right : binaryExpression.left;
const widenedType = checker.getWidenedType(checker.getBaseTypeOfLiteralType(checker.getTypeAtLocation(otherExpression)));
typeNode = checker.typeToTypeNode(widenedType, classDeclaration);
typeNode = checker.typeToTypeNode(widenedType, classDeclaration, /*flags*/ undefined);
}
else {
const contextualType = checker.getContextualType(token.parent as Expression);
typeNode = contextualType ? checker.typeToTypeNode(contextualType) : undefined;
typeNode = contextualType ? checker.typeToTypeNode(contextualType, /*enclosingDeclaration*/ undefined, /*flags*/ undefined) : undefined;
}
return typeNode || createKeywordTypeNode(SyntaxKind.AnyKeyword);
}
+1 -1
View File
@@ -40,7 +40,7 @@ namespace ts.codefix {
});
function doChange(changes: textChanges.ChangeTracker, sourceFile: SourceFile, oldTypeNode: TypeNode, newType: Type, checker: TypeChecker): void {
changes.replaceNode(sourceFile, oldTypeNode, checker.typeToTypeNode(newType, /*enclosingDeclaration*/ oldTypeNode)!); // TODO: GH#18217
changes.replaceNode(sourceFile, oldTypeNode, checker.typeToTypeNode(newType, /*enclosingDeclaration*/ oldTypeNode, /*flags*/ undefined)!); // TODO: GH#18217
}
function getInfo(sourceFile: SourceFile, pos: number, checker: TypeChecker): { readonly typeNode: TypeNode, readonly type: Type } | undefined {
@@ -0,0 +1,70 @@
/* @internal */
namespace ts.codefix {
const fixId = "fixReturnTypeInAsyncFunction";
const errorCodes = [
Diagnostics.The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_Did_you_mean_to_write_Promise_0.code,
];
interface Info {
readonly returnTypeNode: TypeNode;
readonly returnType: Type;
readonly promisedTypeNode: TypeNode;
readonly promisedType: Type;
}
registerCodeFix({
errorCodes,
fixIds: [fixId],
getCodeActions: context => {
const { sourceFile, program, span } = context;
const checker = program.getTypeChecker();
const info = getInfo(sourceFile, program.getTypeChecker(), span.start);
if (!info) {
return undefined;
}
const { returnTypeNode, returnType, promisedTypeNode, promisedType } = info;
const changes = textChanges.ChangeTracker.with(context, t => doChange(t, sourceFile, returnTypeNode, promisedTypeNode));
return [createCodeFixAction(
fixId, changes,
[Diagnostics.Replace_0_with_Promise_1,
checker.typeToString(returnType), checker.typeToString(promisedType)],
fixId, Diagnostics.Fix_all_incorrect_return_type_of_an_async_functions)];
},
getAllCodeActions: context => codeFixAll(context, errorCodes, (changes, diag) => {
const info = getInfo(diag.file, context.program.getTypeChecker(), diag.start);
if (info) {
doChange(changes, diag.file, info.returnTypeNode, info.promisedTypeNode);
}
})
});
function getInfo(sourceFile: SourceFile, checker: TypeChecker, pos: number): Info | undefined {
const returnTypeNode = getReturnTypeNode(sourceFile, pos);
if (!returnTypeNode) {
return undefined;
}
const returnType = checker.getTypeFromTypeNode(returnTypeNode);
const promisedType = checker.getAwaitedType(returnType) || checker.getVoidType();
const promisedTypeNode = checker.typeToTypeNode(promisedType);
if (promisedTypeNode) {
return { returnTypeNode, returnType, promisedTypeNode, promisedType };
}
}
function doChange(changes: textChanges.ChangeTracker, sourceFile: SourceFile, returnTypeNode: TypeNode, promisedTypeNode: TypeNode): void {
changes.replaceNode(sourceFile, returnTypeNode, createTypeReferenceNode("Promise", [promisedTypeNode]));
}
function getReturnTypeNode(sourceFile: SourceFile, pos: number): TypeNode | undefined {
if (isInJSFile(sourceFile)) {
return undefined;
}
const token = getTokenAtPosition(sourceFile, pos);
const parent = findAncestor(token, isFunctionLikeDeclaration);
if (parent?.type) {
return parent.type;
}
}
}
+15 -13
View File
@@ -226,18 +226,8 @@ namespace ts.codefix {
const scriptTarget = getEmitScriptTarget(context.program.getCompilerOptions());
const checker = context.program.getTypeChecker();
const tracker = getNoopSymbolTrackerWithResolver(context);
const types = map(args, arg => {
const type = checker.getBaseTypeOfLiteralType(checker.getTypeAtLocation(arg));
const typeNode = checker.typeToTypeNode(type, contextNode, /*flags*/ undefined, tracker);
if (typeNode?.kind === SyntaxKind.ImportType) {
const importableReference = tryGetAutoImportableReferenceFromImportTypeNode(typeNode, type, scriptTarget);
if (importableReference) {
importSymbols(importAdder, importableReference.symbols);
return importableReference.typeReference;
}
}
return typeNode;
});
const types = map(args, arg =>
typeToAutoImportableTypeNode(checker, importAdder, checker.getBaseTypeOfLiteralType(checker.getTypeAtLocation(arg)), contextNode, scriptTarget, /*flags*/ undefined, tracker));
const names = map(args, arg =>
isIdentifier(arg) ? arg.text : isPropertyAccessExpression(arg) && isIdentifier(arg.name) ? arg.name.text : undefined);
const contextualType = checker.getContextualType(call);
@@ -255,6 +245,18 @@ namespace ts.codefix {
body ? createStubbedMethodBody(context.preferences) : undefined);
}
export function typeToAutoImportableTypeNode(checker: TypeChecker, importAdder: ImportAdder, type: Type, contextNode: Node, scriptTarget: ScriptTarget, flags?: NodeBuilderFlags, tracker?: SymbolTracker): TypeNode | undefined {
const typeNode = checker.typeToTypeNode(type, contextNode, flags, tracker);
if (typeNode && isImportTypeNode(typeNode)) {
const importableReference = tryGetAutoImportableReferenceFromImportTypeNode(typeNode, type, scriptTarget);
if (importableReference) {
importSymbols(importAdder, importableReference.symbols);
return importableReference.typeReference;
}
}
return typeNode;
}
function createDummyParameters(argCount: number, names: (string | undefined)[] | undefined, types: (TypeNode | undefined)[] | undefined, minArgumentCount: number | undefined, inJs: boolean): ParameterDeclaration[] {
const parameters: ParameterDeclaration[] = [];
for (let i = 0; i < argCount; i++) {
@@ -456,7 +458,7 @@ namespace ts.codefix {
return createQualifiedName(replaceFirstIdentifierOfEntityName(name.left, newIdentifier), name.right);
}
function importSymbols(importAdder: ImportAdder, symbols: readonly Symbol[]) {
export function importSymbols(importAdder: ImportAdder, symbols: readonly Symbol[]) {
symbols.forEach(s => importAdder.addImportFromExportedSymbol(s, /*usageIsTypeOnly*/ true));
}
}
+21 -15
View File
@@ -45,7 +45,6 @@ namespace ts.codefix {
// Keys are import clause node IDs.
const addToExisting = createMap<{ readonly importClauseOrBindingPattern: ImportClause | ObjectBindingPattern, defaultImport: string | undefined; readonly namedImports: string[], canUseTypeOnlyImport: boolean }>();
const newImports = createMap<Mutable<ImportsCollection & { useRequire: boolean }>>();
let lastModuleSpecifier: string | undefined;
return { addImportFromDiagnostic, addImportFromExportedSymbol, writeFixes };
function addImportFromDiagnostic(diagnostic: DiagnosticWithLocation, context: CodeFixContextBase) {
@@ -97,7 +96,6 @@ namespace ts.codefix {
let entry = newImports.get(moduleSpecifier);
if (!entry) {
newImports.set(moduleSpecifier, entry = { namedImports: [], namespaceLikeImport: undefined, typeOnly, useRequire });
lastModuleSpecifier = moduleSpecifier;
}
else {
// An import clause can only be type-only if every import fix contributing to it can be type-only.
@@ -135,10 +133,15 @@ namespace ts.codefix {
addToExisting.forEach(({ importClauseOrBindingPattern, defaultImport, namedImports, canUseTypeOnlyImport }) => {
doAddExistingFix(changeTracker, sourceFile, importClauseOrBindingPattern, defaultImport, namedImports, canUseTypeOnlyImport);
});
let newDeclarations: Statement | readonly Statement[] | undefined;
newImports.forEach(({ useRequire, ...imports }, moduleSpecifier) => {
const addDeclarations = useRequire ? addNewRequires : addNewImports;
addDeclarations(changeTracker, sourceFile, moduleSpecifier, quotePreference, imports, /*blankLineBetween*/ lastModuleSpecifier === moduleSpecifier);
const getDeclarations = useRequire ? getNewRequires : getNewImports;
newDeclarations = combine(newDeclarations, getDeclarations(moduleSpecifier, quotePreference, imports));
});
if (newDeclarations) {
insertImports(changeTracker, sourceFile, newDeclarations, /*blankLineBetween*/ true);
}
}
}
@@ -631,11 +634,11 @@ namespace ts.codefix {
}
case ImportFixKind.AddNew: {
const { importKind, moduleSpecifier, typeOnly, useRequire } = fix;
const addDeclarations = useRequire ? addNewRequires : addNewImports;
const getDeclarations = useRequire ? getNewRequires : getNewImports;
const importsCollection = importKind === ImportKind.Default ? { defaultImport: symbolName, typeOnly } :
importKind === ImportKind.Named ? { namedImports: [symbolName], typeOnly } :
{ namespaceLikeImport: { importKind, name: symbolName }, typeOnly };
addDeclarations(changes, sourceFile, moduleSpecifier, quotePreference, importsCollection, /*blankLineBetween*/ true);
insertImports(changes, sourceFile, getDeclarations(moduleSpecifier, quotePreference, importsCollection), /*blankLineBetween*/ true);
return [importKind === ImportKind.Default ? Diagnostics.Import_default_0_from_module_1 : Diagnostics.Import_0_from_module_1, symbolName, moduleSpecifier];
}
default:
@@ -717,13 +720,13 @@ namespace ts.codefix {
readonly name: string;
};
}
function addNewImports(changes: textChanges.ChangeTracker, sourceFile: SourceFile, moduleSpecifier: string, quotePreference: QuotePreference, imports: ImportsCollection, blankLineBetween: boolean): void {
function getNewImports(moduleSpecifier: string, quotePreference: QuotePreference, imports: ImportsCollection): Statement | readonly Statement[] {
const quotedModuleSpecifier = makeStringLiteral(moduleSpecifier, quotePreference);
let statements: Statement | readonly Statement[] | undefined;
if (imports.defaultImport !== undefined || imports.namedImports?.length) {
insertImport(changes, sourceFile,
makeImport(
imports.defaultImport === undefined ? undefined : createIdentifier(imports.defaultImport),
imports.namedImports?.map(n => createImportSpecifier(/*propertyName*/ undefined, createIdentifier(n))), moduleSpecifier, quotePreference, imports.typeOnly), /*blankLineBetween*/ blankLineBetween);
statements = combine(statements, makeImport(
imports.defaultImport === undefined ? undefined : createIdentifier(imports.defaultImport),
imports.namedImports?.map(n => createImportSpecifier(/*propertyName*/ undefined, createIdentifier(n))), moduleSpecifier, quotePreference, imports.typeOnly));
}
const { namespaceLikeImport, typeOnly } = imports;
if (namespaceLikeImport) {
@@ -741,12 +744,14 @@ namespace ts.codefix {
createNamespaceImport(createIdentifier(namespaceLikeImport.name)),
typeOnly),
quotedModuleSpecifier);
insertImport(changes, sourceFile, declaration, /*blankLineBetween*/ blankLineBetween);
statements = combine(statements, declaration);
}
return Debug.checkDefined(statements);
}
function addNewRequires(changes: textChanges.ChangeTracker, sourceFile: SourceFile, moduleSpecifier: string, quotePreference: QuotePreference, imports: ImportsCollection, blankLineBetween: boolean) {
function getNewRequires(moduleSpecifier: string, quotePreference: QuotePreference, imports: ImportsCollection): Statement | readonly Statement[] {
const quotedModuleSpecifier = makeStringLiteral(moduleSpecifier, quotePreference);
let statements: Statement | readonly Statement[] | undefined;
// const { default: foo, bar, etc } = require('./mod');
if (imports.defaultImport || imports.namedImports?.length) {
const bindingElements = imports.namedImports?.map(name => createBindingElement(/*dotDotDotToken*/ undefined, /*propertyName*/ undefined, name)) || [];
@@ -754,13 +759,14 @@ namespace ts.codefix {
bindingElements.unshift(createBindingElement(/*dotDotDotToken*/ undefined, "default", imports.defaultImport));
}
const declaration = createConstEqualsRequireDeclaration(createObjectBindingPattern(bindingElements), quotedModuleSpecifier);
insertImport(changes, sourceFile, declaration, blankLineBetween);
statements = combine(statements, declaration);
}
// const foo = require('./mod');
if (imports.namespaceLikeImport) {
const declaration = createConstEqualsRequireDeclaration(imports.namespaceLikeImport.name, quotedModuleSpecifier);
insertImport(changes, sourceFile, declaration, blankLineBetween);
statements = combine(statements, declaration);
}
return Debug.checkDefined(statements);
}
function createConstEqualsRequireDeclaration(name: string | ObjectBindingPattern, quotedModuleSpecifier: StringLiteral): VariableStatement {
+6 -5
View File
@@ -603,7 +603,7 @@ namespace ts.codefix {
switch (node.parent.kind) {
case SyntaxKind.ExpressionStatement:
addCandidateType(usage, checker.getVoidType());
inferTypeFromExpressionStatement(node, usage);
break;
case SyntaxKind.PostfixUnaryExpression:
usage.isNumber = true;
@@ -661,6 +661,10 @@ namespace ts.codefix {
}
}
function inferTypeFromExpressionStatement(node: Expression, usage: Usage): void {
addCandidateType(usage, isCallExpression(node) ? checker.getVoidType() : checker.getAnyType());
}
function inferTypeFromPrefixUnaryExpression(node: PrefixUnaryExpression, usage: Usage): void {
switch (node.operator) {
case SyntaxKind.PlusPlusToken:
@@ -960,10 +964,7 @@ namespace ts.codefix {
if (usage.numberIndex) {
types.push(checker.createArrayType(combineFromUsage(usage.numberIndex)));
}
if (usage.properties && usage.properties.size
|| usage.calls && usage.calls.length
|| usage.constructs && usage.constructs.length
|| usage.stringIndex) {
if (usage.properties?.size || usage.calls?.length || usage.constructs?.length || usage.stringIndex) {
types.push(inferStructuralType(usage));
}
+9 -2
View File
@@ -2427,7 +2427,8 @@ namespace ts.Completions {
return baseSymbols.filter(propertySymbol =>
!existingMemberNames.has(propertySymbol.escapedName) &&
!!propertySymbol.declarations &&
!(getDeclarationModifierFlagsFromSymbol(propertySymbol) & ModifierFlags.Private));
!(getDeclarationModifierFlagsFromSymbol(propertySymbol) & ModifierFlags.Private) &&
!isPrivateIdentifierPropertyDeclaration(propertySymbol.valueDeclaration));
}
/**
@@ -2684,10 +2685,16 @@ namespace ts.Completions {
return cls;
}
break;
case SyntaxKind.Identifier: // class c extends React.Component { a: () => 1\n compon| }
case SyntaxKind.Identifier: {
// class c { public prop = c| }
if (isPropertyDeclaration(location.parent) && location.parent.initializer === location) {
return undefined;
}
// class c extends React.Component { a: () => 1\n compon| }
if (isFromObjectTypeDeclaration(location)) {
return findAncestor(location, isObjectTypeDeclaration);
}
}
}
if (!contextToken) return undefined;
+2
View File
@@ -363,6 +363,8 @@ namespace ts.JsDoc {
// want to give back a JSDoc template for the 'b' or 'c' in 'namespace a.b.c { }'.
return commentOwner.parent.kind === SyntaxKind.ModuleDeclaration ? undefined : { commentOwner };
case SyntaxKind.ExpressionStatement:
return getCommentOwnerInfoWorker((commentOwner as ExpressionStatement).expression);
case SyntaxKind.BinaryExpression: {
const be = commentOwner as BinaryExpression;
if (getAssignmentDeclarationKind(be) === AssignmentDeclarationKind.None) {
@@ -199,6 +199,7 @@ namespace ts.OutliningElementsCollector {
case SyntaxKind.InterfaceDeclaration:
case SyntaxKind.EnumDeclaration:
case SyntaxKind.CaseBlock:
case SyntaxKind.TypeLiteral:
return spanForNode(n);
case SyntaxKind.CaseClause:
case SyntaxKind.DefaultClause:
+4 -1
View File
@@ -719,6 +719,8 @@ namespace ts.refactor.extractSymbol {
context: RefactorContext): RefactorEditInfo {
const checker = context.program.getTypeChecker();
const scriptTarget = getEmitScriptTarget(context.program.getCompilerOptions());
const importAdder = codefix.createImportAdder(context.file, context.program, context.preferences, context.host);
// Make a unique name for the extracted function
const file = scope.getSourceFile();
@@ -737,7 +739,7 @@ namespace ts.refactor.extractSymbol {
let type = checker.getTypeOfSymbolAtLocation(usage.symbol, usage.node);
// Widen the type so we don't emit nonsense annotations like "function fn(x: 3) {"
type = checker.getBaseTypeOfLiteralType(type);
typeNode = checker.typeToTypeNode(type, scope, NodeBuilderFlags.NoTruncation);
typeNode = codefix.typeToAutoImportableTypeNode(checker, importAdder, type, scope, scriptTarget, NodeBuilderFlags.NoTruncation);
}
const paramDecl = createParameter(
@@ -823,6 +825,7 @@ namespace ts.refactor.extractSymbol {
else {
changeTracker.insertNodeAtEndOfScope(context.file, scope, newFunction);
}
importAdder.writeFixes(changeTracker);
const newNodes: Node[] = [];
// replace range with function call
+1 -1
View File
@@ -121,7 +121,7 @@ namespace ts.refactor {
const quotePreference = getQuotePreference(oldFile, preferences);
const importsFromNewFile = createOldFileImportsFromNewFile(usage.oldFileImportsFromNewFile, newModuleName, useEs6ModuleSyntax, quotePreference);
if (importsFromNewFile) {
insertImport(changes, oldFile, importsFromNewFile, /*blankLineBetween*/ true);
insertImports(changes, oldFile, importsFromNewFile, /*blankLineBetween*/ true);
}
deleteUnusedOldImports(oldFile, toMove.all, changes, usage.unusedImportsFromOldFile, checker);
+2 -2
View File
@@ -580,7 +580,7 @@ namespace ts.SignatureHelp {
const printer = createPrinter({ removeComments: true });
const typeParameterParts = mapToDisplayParts(writer => {
if (candidateSignature.typeParameters && candidateSignature.typeParameters.length) {
const args = createNodeArray(candidateSignature.typeParameters.map(p => checker.typeParameterToDeclaration(p, enclosingDeclaration)!));
const args = createNodeArray(candidateSignature.typeParameters.map(p => checker.typeParameterToDeclaration(p, enclosingDeclaration, signatureHelpNodeBuilderFlags)!));
printer.writeList(ListFormat.TypeParameters, args, sourceFile, writer);
}
});
@@ -599,7 +599,7 @@ namespace ts.SignatureHelp {
function createSignatureHelpParameterForTypeParameter(typeParameter: TypeParameter, checker: TypeChecker, enclosingDeclaration: Node, sourceFile: SourceFile, printer: Printer): SignatureHelpParameter {
const displayParts = mapToDisplayParts(writer => {
const param = checker.typeParameterToDeclaration(typeParameter, enclosingDeclaration)!;
const param = checker.typeParameterToDeclaration(typeParameter, enclosingDeclaration, signatureHelpNodeBuilderFlags)!;
printer.writeNode(EmitHint.Unspecified, param, sourceFile, writer);
});
return { name: typeParameter.symbol.name, documentation: typeParameter.symbol.getDocumentationComment(checker), displayParts, isOptional: false };
+12 -1
View File
@@ -156,7 +156,18 @@ namespace ts {
}
function isPromiseHandler(node: Node): node is CallExpression {
return isCallExpression(node) && (hasPropertyAccessExpressionWithName(node, "then") || hasPropertyAccessExpressionWithName(node, "catch"));
return isCallExpression(node) && (
hasPropertyAccessExpressionWithName(node, "then") && hasSupportedNumberOfArguments(node) ||
hasPropertyAccessExpressionWithName(node, "catch"));
}
function hasSupportedNumberOfArguments(node: CallExpression) {
if (node.arguments.length > 2) return false;
if (node.arguments.length < 2) return true;
return some(node.arguments, arg => {
return arg.kind === SyntaxKind.NullKeyword ||
isIdentifier(arg) && arg.text === "undefined";
});
}
// should be kept up to date with getTransformationBody in convertToAsyncFunction.ts
+4 -2
View File
@@ -1,5 +1,7 @@
/* @internal */
namespace ts.SymbolDisplay {
const symbolDisplayNodeBuilderFlags = NodeBuilderFlags.OmitParameterModifiers | NodeBuilderFlags.IgnoreErrors | NodeBuilderFlags.UseAliasDefinedOutsideCurrentScope;
// TODO(drosen): use contextual SemanticMeaning.
export function getSymbolKind(typeChecker: TypeChecker, symbol: Symbol, location: Node): ScriptElementKind {
const result = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, location);
@@ -471,7 +473,7 @@ namespace ts.SymbolDisplay {
// If the type is type parameter, format it specially
if (type.symbol && type.symbol.flags & SymbolFlags.TypeParameter) {
const typeParameterParts = mapToDisplayParts(writer => {
const param = typeChecker.typeParameterToDeclaration(type as TypeParameter, enclosingDeclaration)!;
const param = typeChecker.typeParameterToDeclaration(type as TypeParameter, enclosingDeclaration, symbolDisplayNodeBuilderFlags)!;
getPrinter().writeNode(EmitHint.Unspecified, param, getSourceFileOfNode(getParseTreeNode(enclosingDeclaration)), writer);
});
addRange(displayParts, typeParameterParts);
@@ -631,7 +633,7 @@ namespace ts.SymbolDisplay {
function writeTypeParametersOfSymbol(symbol: Symbol, enclosingDeclaration: Node | undefined) {
const typeParameterParts = mapToDisplayParts(writer => {
const params = typeChecker.symbolToTypeParameterDeclarations(symbol, enclosingDeclaration);
const params = typeChecker.symbolToTypeParameterDeclarations(symbol, enclosingDeclaration, symbolDisplayNodeBuilderFlags);
getPrinter().writeList(ListFormat.TypeParameters, params, getSourceFileOfNode(getParseTreeNode(enclosingDeclaration)), writer);
});
addRange(displayParts, typeParameterParts);
+32 -7
View File
@@ -349,11 +349,25 @@ namespace ts.textChanges {
}
public insertNodeAtTopOfFile(sourceFile: SourceFile, newNode: Statement, blankLineBetween: boolean): void {
this.insertAtTopOfFile(sourceFile, newNode, blankLineBetween);
}
public insertNodesAtTopOfFile(sourceFile: SourceFile, newNodes: readonly Statement[], blankLineBetween: boolean): void {
this.insertAtTopOfFile(sourceFile, newNodes, blankLineBetween);
}
private insertAtTopOfFile(sourceFile: SourceFile, insert: Statement | readonly Statement[], blankLineBetween: boolean): void {
const pos = getInsertionPositionAtSourceFileTop(sourceFile);
this.insertNodeAt(sourceFile, pos, newNode, {
const options = {
prefix: pos === 0 ? undefined : this.newLineCharacter,
suffix: (isLineBreak(sourceFile.text.charCodeAt(pos)) ? "" : this.newLineCharacter) + (blankLineBetween ? this.newLineCharacter : ""),
});
};
if (isArray(insert)) {
this.insertNodesAt(sourceFile, pos, insert, options);
}
else {
this.insertNodeAt(sourceFile, pos, insert, options);
}
}
public insertFirstParameter(sourceFile: SourceFile, parameters: NodeArray<ParameterDeclaration>, newParam: ParameterDeclaration): void {
@@ -434,7 +448,7 @@ namespace ts.textChanges {
}
}
else {
endNode = node.kind !== SyntaxKind.VariableDeclaration && node.questionToken ? node.questionToken : node.name;
endNode = (node.kind === SyntaxKind.VariableDeclaration ? node.exclamationToken : node.questionToken) ?? node.name;
}
this.insertNodeAt(sourceFile, endNode.end, type, { prefix: ": " });
@@ -873,7 +887,7 @@ namespace ts.textChanges {
namespace changesToText {
export function getTextChangesFromChanges(changes: readonly Change[], newLineCharacter: string, formatContext: formatting.FormatContext, validate: ValidateNonFormattedText | undefined): FileTextChanges[] {
return group(changes, c => c.sourceFile.path).map(changesInFile => {
return mapDefined(group(changes, c => c.sourceFile.path), changesInFile => {
const sourceFile = changesInFile[0].sourceFile;
// order changes by start position
// If the start position is the same, put the shorter range first, since an empty range (x, x) may precede (x, y) but not vice-versa.
@@ -883,9 +897,20 @@ namespace ts.textChanges {
Debug.assert(normalized[i].range.end <= normalized[i + 1].range.pos, "Changes overlap", () =>
`${JSON.stringify(normalized[i].range)} and ${JSON.stringify(normalized[i + 1].range)}`);
}
const textChanges = normalized.map(c =>
createTextChange(createTextSpanFromRange(c.range), computeNewText(c, sourceFile, newLineCharacter, formatContext, validate)));
return { fileName: sourceFile.fileName, textChanges };
const textChanges = mapDefined(normalized, c => {
const span = createTextSpanFromRange(c.range);
const newText = computeNewText(c, sourceFile, newLineCharacter, formatContext, validate);
// Filter out redundant changes.
if (span.length === newText.length && stringContainsAt(sourceFile.text, newText, span.start)) {
return undefined;
}
return createTextChange(span, newText);
});
return textChanges.length > 0 ? { fileName: sourceFile.fileName, textChanges } : undefined;
});
}
+1
View File
@@ -85,6 +85,7 @@
"codefixes/fixMissingCallParentheses.ts",
"codefixes/fixAwaitInSyncFunction.ts",
"codefixes/inferFromUsage.ts",
"codefixes/fixReturnTypeInAsyncFunction.ts",
"codefixes/disableJsDiagnostics.ts",
"codefixes/helpers.ts",
"codefixes/fixInvalidImportSyntax.ts",
+42 -4
View File
@@ -1871,14 +1871,23 @@ namespace ts {
return node.modifiers && find(node.modifiers, m => m.kind === kind);
}
export function insertImport(changes: textChanges.ChangeTracker, sourceFile: SourceFile, importDecl: Statement, blankLineBetween: boolean): void {
const importKindPredicate = importDecl.kind === SyntaxKind.VariableStatement ? isRequireVariableDeclarationStatement : isAnyImportSyntax;
export function insertImports(changes: textChanges.ChangeTracker, sourceFile: SourceFile, imports: Statement | readonly Statement[], blankLineBetween: boolean): void {
const decl = isArray(imports) ? imports[0] : imports;
const importKindPredicate = decl.kind === SyntaxKind.VariableStatement ? isRequireVariableDeclarationStatement : isAnyImportSyntax;
const lastImportDeclaration = findLast(sourceFile.statements, statement => importKindPredicate(statement));
if (lastImportDeclaration) {
changes.insertNodeAfter(sourceFile, lastImportDeclaration, importDecl);
if (isArray(imports)) {
changes.insertNodesAfter(sourceFile, lastImportDeclaration, imports);
}
else {
changes.insertNodeAfter(sourceFile, lastImportDeclaration, imports);
}
}
else if (isArray(imports)) {
changes.insertNodesAtTopOfFile(sourceFile, imports, blankLineBetween);
}
else {
changes.insertNodeAtTopOfFile(sourceFile, importDecl, blankLineBetween);
changes.insertNodeAtTopOfFile(sourceFile, imports, blankLineBetween);
}
}
@@ -2818,6 +2827,35 @@ namespace ts {
return symbol.name;
}
/**
* Useful to check whether a string contains another string at a specific index
* without allocating another string or traversing the entire contents of the outer string.
*
* This function is useful in place of either of the following:
*
* ```ts
* // Allocates
* haystack.substr(startIndex, needle.length) === needle
*
* // Full traversal
* haystack.indexOf(needle, startIndex) === startIndex
* ```
*
* @param haystack The string that potentially contains `needle`.
* @param needle The string whose content might sit within `haystack`.
* @param startIndex The index within `haystack` to start searching for `needle`.
*/
export function stringContainsAt(haystack: string, needle: string, startIndex: number) {
const needleLength = needle.length;
if (needleLength + startIndex > haystack.length) {
return false;
}
for (let i = 0; i < needleLength; i++) {
if (needle.charCodeAt(i) !== haystack.charCodeAt(i + startIndex)) return false;
}
return true;
}
export function startsWithUnderscore(name: string): boolean {
return name.charCodeAt(0) === CharacterCodes._;
}
@@ -558,13 +558,13 @@ function [#|f|]():void{
}
`
);
_testConvertToAsyncFunction("convertToAsyncFunction_Rej", `
_testConvertToAsyncFunctionFailed("convertToAsyncFunction_Rej", `
function [#|f|]():Promise<void> {
return fetch('https://typescriptlang.org').then(result => { console.log(result); }, rejection => { console.log("rejected:", rejection); });
}
`
);
_testConvertToAsyncFunction("convertToAsyncFunction_RejRef", `
_testConvertToAsyncFunctionFailed("convertToAsyncFunction_RejRef", `
function [#|f|]():Promise<void> {
return fetch('https://typescriptlang.org').then(res, rej);
}
@@ -576,7 +576,7 @@ function rej(err){
}
`
);
_testConvertToAsyncFunction("convertToAsyncFunction_RejNoBrackets", `
_testConvertToAsyncFunctionFailed("convertToAsyncFunction_RejNoBrackets", `
function [#|f|]():Promise<void> {
return fetch('https://typescriptlang.org').then(result => console.log(result), rejection => console.log("rejected:", rejection));
}
@@ -1238,7 +1238,7 @@ function [#|f|]() {
}
`);
_testConvertToAsyncFunction("convertToAsyncFunction_ResRejNoArgsArrow", `
_testConvertToAsyncFunctionFailed("convertToAsyncFunction_ResRejNoArgsArrow", `
function [#|f|]() {
return Promise.resolve().then(() => 1, () => "a");
}
@@ -1436,5 +1436,10 @@ function [#|get|]() {
.catch<APIResponse<{ email: string }>>(() => ({ success: false }));
}
`);
_testConvertToAsyncFunctionFailed("convertToAsyncFunction_threeArguments", `
function [#|f|]() {
return Promise.resolve().then(undefined, undefined, () => 1);
}`);
});
}
@@ -285,6 +285,7 @@ namespace ts {
});
});
describe("Baselines", () => {
const libFile = {
@@ -327,6 +328,16 @@ export const Other = 1;
assert.isEmpty(changes);
});
it("doesn't return any changes when the text would be identical", () => {
const testFile = {
path: "/a.ts",
content: `import { f } from 'foo';\nf();`
};
const languageService = makeLanguageService(testFile);
const changes = languageService.organizeImports({ type: "file", fileName: testFile.path }, testFormatSettings, emptyOptions);
assert.isEmpty(changes);
});
testOrganizeImports("Renamed_used",
{
path: "/test.ts",
@@ -366,6 +377,16 @@ D();
},
libFile);
it("doesn't return any changes when the text would be identical", () => {
const testFile = {
path: "/a.ts",
content: `import { f } from 'foo';\nf();`
};
const languageService = makeLanguageService(testFile);
const changes = languageService.organizeImports({ type: "file", fileName: testFile.path }, testFormatSettings, emptyOptions);
assert.isEmpty(changes);
});
testOrganizeImports("Unused_All",
{
path: "/test.ts",
@@ -377,14 +398,17 @@ import D from "lib";
},
libFile);
testOrganizeImports("Unused_Empty",
{
it("Unused_Empty", () => {
const testFile = {
path: "/test.ts",
content: `
import { } from "lib";
`,
},
libFile);
};
const languageService = makeLanguageService(testFile);
const changes = languageService.organizeImports({ type: "file", fileName: testFile.path }, testFormatSettings, emptyOptions);
assert.isEmpty(changes);
});
testOrganizeImports("Unused_false_positive_module_augmentation",
{
@@ -414,25 +438,33 @@ declare module 'caseless' {
test(name: KeyType): boolean;
}
}`
});
});
testOrganizeImports("Unused_false_positive_shorthand_assignment",
{
it("Unused_false_positive_shorthand_assignment", () => {
const testFile = {
path: "/test.ts",
content: `
import { x } from "a";
const o = { x };
`
});
};
const languageService = makeLanguageService(testFile);
const changes = languageService.organizeImports({ type: "file", fileName: testFile.path }, testFormatSettings, emptyOptions);
assert.isEmpty(changes);
});
testOrganizeImports("Unused_false_positive_export_shorthand",
{
it("Unused_false_positive_export_shorthand", () => {
const testFile = {
path: "/test.ts",
content: `
import { x } from "a";
export { x };
`
});
};
const languageService = makeLanguageService(testFile);
const changes = languageService.organizeImports({ type: "file", fileName: testFile.path }, testFormatSettings, emptyOptions);
assert.isEmpty(changes);
});
testOrganizeImports("MoveToTop",
{
@@ -63,7 +63,7 @@ namespace ts.projectSystem {
};
const aDts: File = {
path: "/a/bin/a.d.ts",
// Need to mangle the sourceMappingURL part or it breaks the build
// ${""} is needed to mangle the sourceMappingURL part or it breaks the build
content: `export declare function fnA(): void;\nexport interface IfaceA {\n}\nexport declare const instanceA: IfaceA;\n//# source${""}MappingURL=a.d.ts.map`,
};
@@ -86,7 +86,7 @@ namespace ts.projectSystem {
content: JSON.stringify(bDtsMapContent),
};
const bDts: File = {
// Need to mangle the sourceMappingURL part or it breaks the build
// ${""} is need to mangle the sourceMappingURL part so it doesn't break the build
path: "/b/bin/b.d.ts",
content: `export declare function fnB(): void;\n//# source${""}MappingURL=b.d.ts.map`,
};
@@ -114,7 +114,7 @@ namespace ts.projectSystem {
})
};
function makeSampleProjects(addUserTsConfig?: boolean) {
function makeSampleProjects(addUserTsConfig?: boolean, keepAllFiles?: boolean) {
const host = createServerHost([aTs, aTsconfig, aDtsMap, aDts, bTsconfig, bTs, bDtsMap, bDts, ...(addUserTsConfig ? [userTsForConfigProject, userTsconfig] : [userTs]), dummyFile]);
const session = createSession(host);
@@ -122,7 +122,9 @@ namespace ts.projectSystem {
checkDeclarationFiles(bTs, session, [bDtsMap, bDts]);
// Testing what happens if we delete the original sources.
host.deleteFile(bTs.path);
if (!keepAllFiles) {
host.deleteFile(bTs.path);
}
openFilesForSession([userTs], session);
const service = session.getProjectService();
@@ -322,6 +324,64 @@ namespace ts.projectSystem {
verifyATsConfigOriginalProject(session);
});
it("navigateToAll -- when neither file nor project is specified", () => {
const session = makeSampleProjects(/*addUserTsConfig*/ true, /*keepAllFiles*/ true);
const response = executeSessionRequest<protocol.NavtoRequest, protocol.NavtoResponse>(session, CommandNames.Navto, { file: undefined, searchValue: "fn" });
assert.deepEqual<readonly protocol.NavtoItem[] | undefined>(response, [
{
...protocolFileSpanFromSubstring({
file: bTs,
text: "export function fnB() {}"
}),
name: "fnB",
matchKind: "prefix",
isCaseSensitive: true,
kind: ScriptElementKind.functionElement,
kindModifiers: "export",
},
{
...protocolFileSpanFromSubstring({
file: aTs,
text: "export function fnA() {}"
}),
name: "fnA",
matchKind: "prefix",
isCaseSensitive: true,
kind: ScriptElementKind.functionElement,
kindModifiers: "export",
},
{
...protocolFileSpanFromSubstring({
file: userTs,
text: "export function fnUser() { a.fnA(); b.fnB(); a.instanceA; }"
}),
name: "fnUser",
matchKind: "prefix",
isCaseSensitive: true,
kind: ScriptElementKind.functionElement,
kindModifiers: "export",
}
]);
});
it("navigateToAll -- when file is not specified but project is", () => {
const session = makeSampleProjects(/*addUserTsConfig*/ true, /*keepAllFiles*/ true);
const response = executeSessionRequest<protocol.NavtoRequest, protocol.NavtoResponse>(session, CommandNames.Navto, { projectFileName: bTsconfig.path, file: undefined, searchValue: "fn" });
assert.deepEqual<readonly protocol.NavtoItem[] | undefined>(response, [
{
...protocolFileSpanFromSubstring({
file: bTs,
text: "export function fnB() {}"
}),
name: "fnB",
matchKind: "prefix",
isCaseSensitive: true,
kind: ScriptElementKind.functionElement,
kindModifiers: "export",
}
]);
});
const referenceATs = (aTs: File): protocol.ReferencesResponseItem => makeReferenceItem({
file: aTs,
isDefinition: true,
+6 -3
View File
@@ -122,7 +122,8 @@ namespace ts.server.typingsInstaller {
// store error info to report it later when it is known that server is already listening to events from typings installer
this.delayedInitializationError = {
kind: "event::initializationFailed",
message: (<Error>e).message
message: (<Error>e).message,
stack: (<Error>e).stack,
};
}
@@ -246,7 +247,9 @@ namespace ts.server.typingsInstaller {
const installer = new NodeTypingsInstaller(globalTypingsCacheLocation!, typingSafeListLocation!, typesMapLocation!, npmLocation, validateDefaultNpmLocation, /*throttleLimit*/5, log); // TODO: GH#18217
installer.listen();
function indent(newline: string, str: string): string {
return `${newline} ` + str.replace(/\r?\n/, `${newline} `);
function indent(newline: string, str: string | undefined): string {
return str && str.length
? `${newline} ` + str.replace(/\r?\n/, `${newline} `)
: "";
}
}
@@ -1,8 +1,8 @@
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration3_es6.ts(1,20): error TS2372: Parameter 'yield' cannot be referenced in its initializer.
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration3_es6.ts(1,20): error TS2372: Parameter 'yield' cannot reference itself.
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration3_es6.ts (1 errors) ====
function f(yield = yield) {
~~~~~
!!! error TS2372: Parameter 'yield' cannot be referenced in its initializer.
!!! error TS2372: Parameter 'yield' cannot reference itself.
}
@@ -2,10 +2,11 @@ tests/cases/compiler/abstractPropertyInConstructor.ts(4,24): error TS2715: Abstr
tests/cases/compiler/abstractPropertyInConstructor.ts(7,18): error TS2715: Abstract property 'prop' in class 'AbstractClass' cannot be accessed in the constructor.
tests/cases/compiler/abstractPropertyInConstructor.ts(9,14): error TS2715: Abstract property 'cb' in class 'AbstractClass' cannot be accessed in the constructor.
tests/cases/compiler/abstractPropertyInConstructor.ts(25,18): error TS2715: Abstract property 'prop' in class 'AbstractClass' cannot be accessed in the constructor.
tests/cases/compiler/abstractPropertyInConstructor.ts(25,18): error TS2729: Property 'prop' is used before its initialization.
tests/cases/compiler/abstractPropertyInConstructor.ts(39,22): error TS2715: Abstract property 'prop' in class 'AbstractClass' cannot be accessed in the constructor.
==== tests/cases/compiler/abstractPropertyInConstructor.ts (5 errors) ====
==== tests/cases/compiler/abstractPropertyInConstructor.ts (6 errors) ====
abstract class AbstractClass {
constructor(str: string, other: AbstractClass) {
this.method(parseInt(str));
@@ -39,6 +40,9 @@ tests/cases/compiler/abstractPropertyInConstructor.ts(39,22): error TS2715: Abst
other = this.prop;
~~~~
!!! error TS2715: Abstract property 'prop' in class 'AbstractClass' cannot be accessed in the constructor.
~~~~
!!! error TS2729: Property 'prop' is used before its initialization.
!!! related TS2728 tests/cases/compiler/abstractPropertyInConstructor.ts:20:14: 'prop' is declared here.
fn = () => this.prop;
method2() {
+18 -12
View File
@@ -14,7 +14,7 @@ and limitations under the License.
***************************************************************************** */
declare namespace ts {
const versionMajorMinor = "3.9";
const versionMajorMinor = "4.0";
/** The version of the TypeScript compiler release */
const version: string;
/**
@@ -2040,23 +2040,23 @@ declare namespace ts {
getNonNullableType(type: Type): Type;
getTypeArguments(type: TypeReference): readonly Type[];
/** Note that the resulting nodes cannot be checked. */
typeToTypeNode(type: Type, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): TypeNode | undefined;
typeToTypeNode(type: Type, enclosingDeclaration: Node | undefined, flags: NodeBuilderFlags | undefined): TypeNode | undefined;
/** Note that the resulting nodes cannot be checked. */
signatureToSignatureDeclaration(signature: Signature, kind: SyntaxKind, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): (SignatureDeclaration & {
signatureToSignatureDeclaration(signature: Signature, kind: SyntaxKind, enclosingDeclaration: Node | undefined, flags: NodeBuilderFlags | undefined): (SignatureDeclaration & {
typeArguments?: NodeArray<TypeNode>;
}) | undefined;
/** Note that the resulting nodes cannot be checked. */
indexInfoToIndexSignatureDeclaration(indexInfo: IndexInfo, kind: IndexKind, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): IndexSignatureDeclaration | undefined;
indexInfoToIndexSignatureDeclaration(indexInfo: IndexInfo, kind: IndexKind, enclosingDeclaration: Node | undefined, flags: NodeBuilderFlags | undefined): IndexSignatureDeclaration | undefined;
/** Note that the resulting nodes cannot be checked. */
symbolToEntityName(symbol: Symbol, meaning: SymbolFlags, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): EntityName | undefined;
symbolToEntityName(symbol: Symbol, meaning: SymbolFlags, enclosingDeclaration: Node | undefined, flags: NodeBuilderFlags | undefined): EntityName | undefined;
/** Note that the resulting nodes cannot be checked. */
symbolToExpression(symbol: Symbol, meaning: SymbolFlags, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): Expression | undefined;
symbolToExpression(symbol: Symbol, meaning: SymbolFlags, enclosingDeclaration: Node | undefined, flags: NodeBuilderFlags | undefined): Expression | undefined;
/** Note that the resulting nodes cannot be checked. */
symbolToTypeParameterDeclarations(symbol: Symbol, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): NodeArray<TypeParameterDeclaration> | undefined;
symbolToTypeParameterDeclarations(symbol: Symbol, enclosingDeclaration: Node | undefined, flags: NodeBuilderFlags | undefined): NodeArray<TypeParameterDeclaration> | undefined;
/** Note that the resulting nodes cannot be checked. */
symbolToParameterDeclaration(symbol: Symbol, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): ParameterDeclaration | undefined;
symbolToParameterDeclaration(symbol: Symbol, enclosingDeclaration: Node | undefined, flags: NodeBuilderFlags | undefined): ParameterDeclaration | undefined;
/** Note that the resulting nodes cannot be checked. */
typeParameterToDeclaration(parameter: TypeParameter, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): TypeParameterDeclaration | undefined;
typeParameterToDeclaration(parameter: TypeParameter, enclosingDeclaration: Node | undefined, flags: NodeBuilderFlags | undefined): TypeParameterDeclaration | undefined;
getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[];
getSymbolAtLocation(node: Node): Symbol | undefined;
getSymbolsOfParameterPropertyDeclaration(parameter: ParameterDeclaration, parameterName: string): Symbol[];
@@ -4460,7 +4460,8 @@ declare namespace ts {
* Starts a new lexical environment and visits a parameter list, suspending the lexical
* environment upon completion.
*/
function visitParameterList(nodes: NodeArray<ParameterDeclaration> | undefined, visitor: Visitor, context: TransformationContext, nodesVisitor?: typeof visitNodes): NodeArray<ParameterDeclaration>;
function visitParameterList(nodes: NodeArray<ParameterDeclaration>, visitor: Visitor, context: TransformationContext, nodesVisitor?: <T extends Node>(nodes: NodeArray<T>, visitor: Visitor, test?: (node: Node) => boolean, start?: number, count?: number) => NodeArray<T>): NodeArray<ParameterDeclaration>;
function visitParameterList(nodes: NodeArray<ParameterDeclaration> | undefined, visitor: Visitor, context: TransformationContext, nodesVisitor?: <T extends Node>(nodes: NodeArray<T> | undefined, visitor: Visitor, test?: (node: Node) => boolean, start?: number, count?: number) => NodeArray<T> | undefined): NodeArray<ParameterDeclaration> | undefined;
/**
* Resumes a suspended lexical environment and visits a function body, ending the lexical
* environment and merging hoisted declarations upon completion.
@@ -4959,6 +4960,7 @@ declare namespace ts.server {
interface InitializationFailedResponse extends TypingInstallerResponse {
readonly kind: EventInitializationFailed;
readonly message: string;
readonly stack?: string;
}
interface ProjectResponse extends TypingInstallerResponse {
readonly projectName: string;
@@ -8319,7 +8321,7 @@ declare namespace ts.server.protocol {
/**
* Arguments for navto request message.
*/
interface NavtoRequestArgs extends FileRequestArgs {
interface NavtoRequestArgs {
/**
* Search term to navigate to from current location; term can
* be '.*' or an identifier prefix.
@@ -8329,6 +8331,10 @@ declare namespace ts.server.protocol {
* Optional limit on the number of items to return.
*/
maxResultCount?: number;
/**
* The file for the request (absolute pathname required).
*/
file?: string;
/**
* Optional flag to indicate we want results for just the current file
* or the entire project.
@@ -8342,7 +8348,7 @@ declare namespace ts.server.protocol {
* match the search term given in argument 'searchTerm'. The
* context for the search is given by the named file.
*/
interface NavtoRequest extends FileRequest {
interface NavtoRequest extends Request {
command: CommandTypes.Navto;
arguments: NavtoRequestArgs;
}
+12 -10
View File
@@ -14,7 +14,7 @@ and limitations under the License.
***************************************************************************** */
declare namespace ts {
const versionMajorMinor = "3.9";
const versionMajorMinor = "4.0";
/** The version of the TypeScript compiler release */
const version: string;
/**
@@ -2040,23 +2040,23 @@ declare namespace ts {
getNonNullableType(type: Type): Type;
getTypeArguments(type: TypeReference): readonly Type[];
/** Note that the resulting nodes cannot be checked. */
typeToTypeNode(type: Type, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): TypeNode | undefined;
typeToTypeNode(type: Type, enclosingDeclaration: Node | undefined, flags: NodeBuilderFlags | undefined): TypeNode | undefined;
/** Note that the resulting nodes cannot be checked. */
signatureToSignatureDeclaration(signature: Signature, kind: SyntaxKind, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): (SignatureDeclaration & {
signatureToSignatureDeclaration(signature: Signature, kind: SyntaxKind, enclosingDeclaration: Node | undefined, flags: NodeBuilderFlags | undefined): (SignatureDeclaration & {
typeArguments?: NodeArray<TypeNode>;
}) | undefined;
/** Note that the resulting nodes cannot be checked. */
indexInfoToIndexSignatureDeclaration(indexInfo: IndexInfo, kind: IndexKind, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): IndexSignatureDeclaration | undefined;
indexInfoToIndexSignatureDeclaration(indexInfo: IndexInfo, kind: IndexKind, enclosingDeclaration: Node | undefined, flags: NodeBuilderFlags | undefined): IndexSignatureDeclaration | undefined;
/** Note that the resulting nodes cannot be checked. */
symbolToEntityName(symbol: Symbol, meaning: SymbolFlags, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): EntityName | undefined;
symbolToEntityName(symbol: Symbol, meaning: SymbolFlags, enclosingDeclaration: Node | undefined, flags: NodeBuilderFlags | undefined): EntityName | undefined;
/** Note that the resulting nodes cannot be checked. */
symbolToExpression(symbol: Symbol, meaning: SymbolFlags, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): Expression | undefined;
symbolToExpression(symbol: Symbol, meaning: SymbolFlags, enclosingDeclaration: Node | undefined, flags: NodeBuilderFlags | undefined): Expression | undefined;
/** Note that the resulting nodes cannot be checked. */
symbolToTypeParameterDeclarations(symbol: Symbol, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): NodeArray<TypeParameterDeclaration> | undefined;
symbolToTypeParameterDeclarations(symbol: Symbol, enclosingDeclaration: Node | undefined, flags: NodeBuilderFlags | undefined): NodeArray<TypeParameterDeclaration> | undefined;
/** Note that the resulting nodes cannot be checked. */
symbolToParameterDeclaration(symbol: Symbol, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): ParameterDeclaration | undefined;
symbolToParameterDeclaration(symbol: Symbol, enclosingDeclaration: Node | undefined, flags: NodeBuilderFlags | undefined): ParameterDeclaration | undefined;
/** Note that the resulting nodes cannot be checked. */
typeParameterToDeclaration(parameter: TypeParameter, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): TypeParameterDeclaration | undefined;
typeParameterToDeclaration(parameter: TypeParameter, enclosingDeclaration: Node | undefined, flags: NodeBuilderFlags | undefined): TypeParameterDeclaration | undefined;
getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[];
getSymbolAtLocation(node: Node): Symbol | undefined;
getSymbolsOfParameterPropertyDeclaration(parameter: ParameterDeclaration, parameterName: string): Symbol[];
@@ -4460,7 +4460,8 @@ declare namespace ts {
* Starts a new lexical environment and visits a parameter list, suspending the lexical
* environment upon completion.
*/
function visitParameterList(nodes: NodeArray<ParameterDeclaration> | undefined, visitor: Visitor, context: TransformationContext, nodesVisitor?: typeof visitNodes): NodeArray<ParameterDeclaration>;
function visitParameterList(nodes: NodeArray<ParameterDeclaration>, visitor: Visitor, context: TransformationContext, nodesVisitor?: <T extends Node>(nodes: NodeArray<T>, visitor: Visitor, test?: (node: Node) => boolean, start?: number, count?: number) => NodeArray<T>): NodeArray<ParameterDeclaration>;
function visitParameterList(nodes: NodeArray<ParameterDeclaration> | undefined, visitor: Visitor, context: TransformationContext, nodesVisitor?: <T extends Node>(nodes: NodeArray<T> | undefined, visitor: Visitor, test?: (node: Node) => boolean, start?: number, count?: number) => NodeArray<T> | undefined): NodeArray<ParameterDeclaration> | undefined;
/**
* Resumes a suspended lexical environment and visits a function body, ending the lexical
* environment and merging hoisted declarations upon completion.
@@ -4959,6 +4960,7 @@ declare namespace ts.server {
interface InitializationFailedResponse extends TypingInstallerResponse {
readonly kind: EventInitializationFailed;
readonly message: string;
readonly stack?: string;
}
interface ProjectResponse extends TypingInstallerResponse {
readonly projectName: string;
+2 -2
View File
@@ -4,9 +4,9 @@ var arr: string[] | number[];
arr.splice(1, 1);
>arr.splice(1, 1) : string[] | number[]
>arr.splice : { (start: number, deleteCount: number): string[]; (start: number, deleteCount: number, ...items: string[]): string[]; } | { (start: number, deleteCount: number): number[]; (start: number, deleteCount: number, ...items: number[]): number[]; }
>arr.splice : { (start: number, deleteCount?: number): string[]; (start: number, deleteCount: number, ...items: string[]): string[]; } | { (start: number, deleteCount?: number): number[]; (start: number, deleteCount: number, ...items: number[]): number[]; }
>arr : string[] | number[]
>splice : { (start: number, deleteCount: number): string[]; (start: number, deleteCount: number, ...items: string[]): string[]; } | { (start: number, deleteCount: number): number[]; (start: number, deleteCount: number, ...items: number[]): number[]; }
>splice : { (start: number, deleteCount?: number): string[]; (start: number, deleteCount: number, ...items: string[]): string[]; } | { (start: number, deleteCount?: number): number[]; (start: number, deleteCount: number, ...items: number[]): number[]; }
>1 : 1
>1 : 1
@@ -1,10 +1,11 @@
tests/cases/conformance/classes/propertyMemberDeclarations/assignParameterPropertyToPropertyDeclarationESNext.ts(2,16): error TS2729: Property 'bar' is used before its initialization.
tests/cases/conformance/classes/propertyMemberDeclarations/assignParameterPropertyToPropertyDeclarationESNext.ts(3,16): error TS2729: Property 'foo' is used before its initialization.
tests/cases/conformance/classes/propertyMemberDeclarations/assignParameterPropertyToPropertyDeclarationESNext.ts(9,17): error TS2729: Property 'baz' is used before its initialization.
tests/cases/conformance/classes/propertyMemberDeclarations/assignParameterPropertyToPropertyDeclarationESNext.ts(10,16): error TS2729: Property 'foo' is used before its initialization.
tests/cases/conformance/classes/propertyMemberDeclarations/assignParameterPropertyToPropertyDeclarationESNext.ts(6,19): error TS2729: Property 'm3' is used before its initialization.
tests/cases/conformance/classes/propertyMemberDeclarations/assignParameterPropertyToPropertyDeclarationESNext.ts(12,17): error TS2729: Property 'baz' is used before its initialization.
tests/cases/conformance/classes/propertyMemberDeclarations/assignParameterPropertyToPropertyDeclarationESNext.ts(13,16): error TS2729: Property 'foo' is used before its initialization.
==== tests/cases/conformance/classes/propertyMemberDeclarations/assignParameterPropertyToPropertyDeclarationESNext.ts (4 errors) ====
==== tests/cases/conformance/classes/propertyMemberDeclarations/assignParameterPropertyToPropertyDeclarationESNext.ts (5 errors) ====
class C {
qux = this.bar // should error
~~~
@@ -13,20 +14,26 @@ tests/cases/conformance/classes/propertyMemberDeclarations/assignParameterProper
bar = this.foo // should error
~~~
!!! error TS2729: Property 'foo' is used before its initialization.
!!! related TS2728 tests/cases/conformance/classes/propertyMemberDeclarations/assignParameterPropertyToPropertyDeclarationESNext.ts:8:17: 'foo' is declared here.
!!! related TS2728 tests/cases/conformance/classes/propertyMemberDeclarations/assignParameterPropertyToPropertyDeclarationESNext.ts:11:17: 'foo' is declared here.
quiz = this.bar // ok
quench = this.m1() // ok
quanch = this.m3() // should error
~~
!!! error TS2729: Property 'm3' is used before its initialization.
!!! related TS2728 tests/cases/conformance/classes/propertyMemberDeclarations/assignParameterPropertyToPropertyDeclarationESNext.ts:10:5: 'm3' is declared here.
m1() {
this.foo // ok
}
m3 = function() { }
constructor(public foo: string) {}
quim = this.baz // should error
~~~
!!! error TS2729: Property 'baz' is used before its initialization.
!!! related TS2728 tests/cases/conformance/classes/propertyMemberDeclarations/assignParameterPropertyToPropertyDeclarationESNext.ts:10:5: 'baz' is declared here.
!!! related TS2728 tests/cases/conformance/classes/propertyMemberDeclarations/assignParameterPropertyToPropertyDeclarationESNext.ts:13:5: 'baz' is declared here.
baz = this.foo; // should error
~~~
!!! error TS2729: Property 'foo' is used before its initialization.
!!! related TS2728 tests/cases/conformance/classes/propertyMemberDeclarations/assignParameterPropertyToPropertyDeclarationESNext.ts:8:17: 'foo' is declared here.
!!! related TS2728 tests/cases/conformance/classes/propertyMemberDeclarations/assignParameterPropertyToPropertyDeclarationESNext.ts:11:17: 'foo' is declared here.
quid = this.baz // ok
m2() {
this.foo // ok
@@ -3,9 +3,12 @@ class C {
qux = this.bar // should error
bar = this.foo // should error
quiz = this.bar // ok
quench = this.m1() // ok
quanch = this.m3() // should error
m1() {
this.foo // ok
}
m3 = function() { }
constructor(public foo: string) {}
quim = this.baz // should error
baz = this.foo; // should error
@@ -45,9 +48,12 @@ class C {
qux = this.bar; // should error
bar = this.foo; // should error
quiz = this.bar; // ok
quench = this.m1(); // ok
quanch = this.m3(); // should error
m1() {
this.foo; // ok
}
m3 = function () { };
constructor(foo) {
this.foo = foo;
}
@@ -10,9 +10,9 @@ class C {
bar = this.foo // should error
>bar : Symbol(C.bar, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 1, 18))
>this.foo : Symbol(C.foo, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 7, 16))
>this.foo : Symbol(C.foo, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 10, 16))
>this : Symbol(C, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 0, 0))
>foo : Symbol(C.foo, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 7, 16))
>foo : Symbol(C.foo, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 10, 16))
quiz = this.bar // ok
>quiz : Symbol(C.quiz, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 2, 18))
@@ -20,105 +20,120 @@ class C {
>this : Symbol(C, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 0, 0))
>bar : Symbol(C.bar, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 1, 18))
quench = this.m1() // ok
>quench : Symbol(C.quench, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 3, 19))
>this.m1 : Symbol(C.m1, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 5, 22))
>this : Symbol(C, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 0, 0))
>m1 : Symbol(C.m1, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 5, 22))
quanch = this.m3() // should error
>quanch : Symbol(C.quanch, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 4, 22))
>this.m3 : Symbol(C.m3, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 8, 5))
>this : Symbol(C, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 0, 0))
>m3 : Symbol(C.m3, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 8, 5))
m1() {
>m1 : Symbol(C.m1, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 3, 19))
>m1 : Symbol(C.m1, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 5, 22))
this.foo // ok
>this.foo : Symbol(C.foo, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 7, 16))
>this.foo : Symbol(C.foo, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 10, 16))
>this : Symbol(C, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 0, 0))
>foo : Symbol(C.foo, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 7, 16))
>foo : Symbol(C.foo, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 10, 16))
}
m3 = function() { }
>m3 : Symbol(C.m3, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 8, 5))
constructor(public foo: string) {}
>foo : Symbol(C.foo, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 7, 16))
>foo : Symbol(C.foo, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 10, 16))
quim = this.baz // should error
>quim : Symbol(C.quim, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 7, 38))
>this.baz : Symbol(C.baz, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 8, 19))
>quim : Symbol(C.quim, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 10, 38))
>this.baz : Symbol(C.baz, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 11, 19))
>this : Symbol(C, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 0, 0))
>baz : Symbol(C.baz, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 8, 19))
>baz : Symbol(C.baz, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 11, 19))
baz = this.foo; // should error
>baz : Symbol(C.baz, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 8, 19))
>this.foo : Symbol(C.foo, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 7, 16))
>baz : Symbol(C.baz, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 11, 19))
>this.foo : Symbol(C.foo, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 10, 16))
>this : Symbol(C, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 0, 0))
>foo : Symbol(C.foo, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 7, 16))
>foo : Symbol(C.foo, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 10, 16))
quid = this.baz // ok
>quid : Symbol(C.quid, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 9, 19))
>this.baz : Symbol(C.baz, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 8, 19))
>quid : Symbol(C.quid, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 12, 19))
>this.baz : Symbol(C.baz, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 11, 19))
>this : Symbol(C, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 0, 0))
>baz : Symbol(C.baz, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 8, 19))
>baz : Symbol(C.baz, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 11, 19))
m2() {
>m2 : Symbol(C.m2, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 10, 19))
>m2 : Symbol(C.m2, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 13, 19))
this.foo // ok
>this.foo : Symbol(C.foo, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 7, 16))
>this.foo : Symbol(C.foo, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 10, 16))
>this : Symbol(C, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 0, 0))
>foo : Symbol(C.foo, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 7, 16))
>foo : Symbol(C.foo, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 10, 16))
}
}
class D extends C {
>D : Symbol(D, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 14, 1))
>D : Symbol(D, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 17, 1))
>C : Symbol(C, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 0, 0))
quill = this.foo // ok
>quill : Symbol(D.quill, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 16, 19))
>this.foo : Symbol(C.foo, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 7, 16))
>this : Symbol(D, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 14, 1))
>foo : Symbol(C.foo, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 7, 16))
>quill : Symbol(D.quill, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 19, 19))
>this.foo : Symbol(C.foo, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 10, 16))
>this : Symbol(D, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 17, 1))
>foo : Symbol(C.foo, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 10, 16))
}
class E {
>E : Symbol(E, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 18, 1))
>E : Symbol(E, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 21, 1))
bar = () => this.foo1 + this.foo2; // both ok
>bar : Symbol(E.bar, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 20, 9))
>this.foo1 : Symbol(E.foo1, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 21, 38))
>this : Symbol(E, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 18, 1))
>foo1 : Symbol(E.foo1, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 21, 38))
>this.foo2 : Symbol(E.foo2, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 23, 16))
>this : Symbol(E, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 18, 1))
>foo2 : Symbol(E.foo2, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 23, 16))
>bar : Symbol(E.bar, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 23, 9))
>this.foo1 : Symbol(E.foo1, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 24, 38))
>this : Symbol(E, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 21, 1))
>foo1 : Symbol(E.foo1, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 24, 38))
>this.foo2 : Symbol(E.foo2, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 26, 16))
>this : Symbol(E, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 21, 1))
>foo2 : Symbol(E.foo2, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 26, 16))
foo1 = '';
>foo1 : Symbol(E.foo1, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 21, 38))
>foo1 : Symbol(E.foo1, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 24, 38))
constructor(public foo2: string) {}
>foo2 : Symbol(E.foo2, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 23, 16))
>foo2 : Symbol(E.foo2, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 26, 16))
}
class F {
>F : Symbol(F, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 24, 1))
>F : Symbol(F, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 27, 1))
Inner = class extends F {
>Inner : Symbol(F.Inner, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 26, 9))
>F : Symbol(F, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 24, 1))
>Inner : Symbol(F.Inner, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 29, 9))
>F : Symbol(F, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 27, 1))
p2 = this.p1
>p2 : Symbol((Anonymous class).p2, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 27, 29))
>this.p1 : Symbol(F.p1, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 29, 5))
>this : Symbol((Anonymous class), Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 27, 11))
>p1 : Symbol(F.p1, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 29, 5))
>p2 : Symbol((Anonymous class).p2, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 30, 29))
>this.p1 : Symbol(F.p1, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 32, 5))
>this : Symbol((Anonymous class), Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 30, 11))
>p1 : Symbol(F.p1, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 32, 5))
}
p1 = 0
>p1 : Symbol(F.p1, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 29, 5))
>p1 : Symbol(F.p1, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 32, 5))
}
class G {
>G : Symbol(G, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 31, 1))
>G : Symbol(G, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 34, 1))
Inner = class extends G {
>Inner : Symbol(G.Inner, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 32, 9))
>G : Symbol(G, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 31, 1))
>Inner : Symbol(G.Inner, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 35, 9))
>G : Symbol(G, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 34, 1))
p2 = this.p1
>p2 : Symbol((Anonymous class).p2, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 33, 29))
>this.p1 : Symbol(G.p1, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 36, 16))
>this : Symbol((Anonymous class), Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 33, 11))
>p1 : Symbol(G.p1, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 36, 16))
>p2 : Symbol((Anonymous class).p2, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 36, 29))
>this.p1 : Symbol(G.p1, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 39, 16))
>this : Symbol((Anonymous class), Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 36, 11))
>p1 : Symbol(G.p1, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 39, 16))
}
constructor(public p1: number) {}
>p1 : Symbol(G.p1, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 36, 16))
>p1 : Symbol(G.p1, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 39, 16))
}
@@ -20,6 +20,20 @@ class C {
>this : this
>bar : string
quench = this.m1() // ok
>quench : void
>this.m1() : void
>this.m1 : () => void
>this : this
>m1 : () => void
quanch = this.m3() // should error
>quanch : void
>this.m3() : void
>this.m3 : () => void
>this : this
>m3 : () => void
m1() {
>m1 : () => void
@@ -28,6 +42,10 @@ class C {
>this : this
>foo : string
}
m3 = function() { }
>m3 : () => void
>function() { } : () => void
constructor(public foo: string) {}
>foo : string
@@ -1,8 +1,8 @@
tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction3_es2017.ts(1,20): error TS2372: Parameter 'await' cannot be referenced in its initializer.
tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction3_es2017.ts(1,20): error TS2372: Parameter 'await' cannot reference itself.
==== tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction3_es2017.ts (1 errors) ====
function f(await = await) {
~~~~~
!!! error TS2372: Parameter 'await' cannot be referenced in its initializer.
!!! error TS2372: Parameter 'await' cannot reference itself.
}
@@ -1,8 +1,8 @@
tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction3_es5.ts(1,20): error TS2372: Parameter 'await' cannot be referenced in its initializer.
tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction3_es5.ts(1,20): error TS2372: Parameter 'await' cannot reference itself.
==== tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction3_es5.ts (1 errors) ====
function f(await = await) {
~~~~~
!!! error TS2372: Parameter 'await' cannot be referenced in its initializer.
!!! error TS2372: Parameter 'await' cannot reference itself.
}
@@ -1,8 +1,8 @@
tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction3_es6.ts(1,20): error TS2372: Parameter 'await' cannot be referenced in its initializer.
tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction3_es6.ts(1,20): error TS2372: Parameter 'await' cannot reference itself.
==== tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction3_es6.ts (1 errors) ====
function f(await = await) {
~~~~~
!!! error TS2372: Parameter 'await' cannot be referenced in its initializer.
!!! error TS2372: Parameter 'await' cannot reference itself.
}
@@ -1,11 +1,13 @@
tests/cases/conformance/async/es2017/asyncArrowFunction/file.js(3,17): error TS2322: Type '0' is not assignable to type 'string'.
tests/cases/conformance/async/es2017/asyncArrowFunction/file.js(6,24): error TS1064: The return type of an async function or method must be the global Promise<T> type. Did you mean to write 'Promise<string>'?
tests/cases/conformance/async/es2017/asyncArrowFunction/file.js(7,23): error TS2322: Type '0' is not assignable to type 'string'.
tests/cases/conformance/async/es2017/asyncArrowFunction/file.js(10,24): error TS1064: The return type of an async function or method must be the global Promise<T> type. Did you mean to write 'Promise<string>'?
tests/cases/conformance/async/es2017/asyncArrowFunction/file.js(12,2): error TS2322: Type '0' is not assignable to type 'string'.
tests/cases/conformance/async/es2017/asyncArrowFunction/file.js(19,3): error TS2345: Argument of type '() => Promise<number>' is not assignable to parameter of type '() => string'.
Type 'Promise<number>' is not assignable to type 'string'.
==== tests/cases/conformance/async/es2017/asyncArrowFunction/file.js (4 errors) ====
==== tests/cases/conformance/async/es2017/asyncArrowFunction/file.js (6 errors) ====
// Error (good)
/** @type {function(): string} */
const a = () => 0
@@ -14,12 +16,16 @@ tests/cases/conformance/async/es2017/asyncArrowFunction/file.js(19,3): error TS2
// Error (good)
/** @type {function(): string} */
~~~~~~
!!! error TS1064: The return type of an async function or method must be the global Promise<T> type. Did you mean to write 'Promise<string>'?
const b = async () => 0
~
!!! error TS2322: Type '0' is not assignable to type 'string'.
// No error (bad)
/** @type {function(): string} */
~~~~~~
!!! error TS1064: The return type of an async function or method must be the global Promise<T> type. Did you mean to write 'Promise<string>'?
const c = async () => {
return 0
~~~~~~~~
@@ -1,10 +1,10 @@
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration15_es6.ts(6,23): error TS1064: The return type of an async function or method must be the global Promise<T> type.
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration15_es6.ts(6,23): error TS1064: The return type of an async function or method must be the global Promise<T> type. Did you mean to write 'Promise<{}>'?
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration15_es6.ts(6,23): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value.
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration15_es6.ts(7,23): error TS1064: The return type of an async function or method must be the global Promise<T> type.
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration15_es6.ts(8,23): error TS1064: The return type of an async function or method must be the global Promise<T> type.
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration15_es6.ts(7,23): error TS1064: The return type of an async function or method must be the global Promise<T> type. Did you mean to write 'Promise<any>'?
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration15_es6.ts(8,23): error TS1064: The return type of an async function or method must be the global Promise<T> type. Did you mean to write 'Promise<number>'?
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration15_es6.ts(8,23): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value.
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration15_es6.ts(9,23): error TS1064: The return type of an async function or method must be the global Promise<T> type.
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration15_es6.ts(10,23): error TS1064: The return type of an async function or method must be the global Promise<T> type.
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration15_es6.ts(9,23): error TS1064: The return type of an async function or method must be the global Promise<T> type. Did you mean to write 'Promise<void>'?
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration15_es6.ts(10,23): error TS1064: The return type of an async function or method must be the global Promise<T> type. Did you mean to write 'Promise<void>'?
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration15_es6.ts(17,16): error TS1058: The return type of an async function must either be a valid promise or must not contain a callable 'then' member.
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration15_es6.ts(23,25): error TS1320: Type of 'await' operand must either be a valid promise or must not contain a callable 'then' member.
@@ -17,23 +17,23 @@ tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration1
async function fn1() { } // valid: Promise<void>
async function fn2(): { } { } // error
~~~
!!! error TS1064: The return type of an async function or method must be the global Promise<T> type.
!!! error TS1064: The return type of an async function or method must be the global Promise<T> type. Did you mean to write 'Promise<{}>'?
~~~
!!! error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value.
async function fn3(): any { } // error
~~~
!!! error TS1064: The return type of an async function or method must be the global Promise<T> type.
!!! error TS1064: The return type of an async function or method must be the global Promise<T> type. Did you mean to write 'Promise<any>'?
async function fn4(): number { } // error
~~~~~~
!!! error TS1064: The return type of an async function or method must be the global Promise<T> type.
!!! error TS1064: The return type of an async function or method must be the global Promise<T> type. Did you mean to write 'Promise<number>'?
~~~~~~
!!! error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value.
async function fn5(): PromiseLike<void> { } // error
~~~~~~~~~~~~~~~~~
!!! error TS1064: The return type of an async function or method must be the global Promise<T> type.
!!! error TS1064: The return type of an async function or method must be the global Promise<T> type. Did you mean to write 'Promise<void>'?
async function fn6(): Thenable { } // error
~~~~~~~~
!!! error TS1064: The return type of an async function or method must be the global Promise<T> type.
!!! error TS1064: The return type of an async function or method must be the global Promise<T> type. Did you mean to write 'Promise<void>'?
async function fn7() { return; } // valid: Promise<void>
async function fn8() { return 1; } // valid: Promise<number>
async function fn9() { return null; } // valid: Promise<any>
@@ -1,8 +1,8 @@
tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration3_es2017.ts(1,20): error TS2372: Parameter 'await' cannot be referenced in its initializer.
tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration3_es2017.ts(1,20): error TS2372: Parameter 'await' cannot reference itself.
==== tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration3_es2017.ts (1 errors) ====
function f(await = await) {
~~~~~
!!! error TS2372: Parameter 'await' cannot be referenced in its initializer.
!!! error TS2372: Parameter 'await' cannot reference itself.
}
@@ -1,8 +1,8 @@
tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration3_es5.ts(1,20): error TS2372: Parameter 'await' cannot be referenced in its initializer.
tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration3_es5.ts(1,20): error TS2372: Parameter 'await' cannot reference itself.
==== tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration3_es5.ts (1 errors) ====
function f(await = await) {
~~~~~
!!! error TS2372: Parameter 'await' cannot be referenced in its initializer.
!!! error TS2372: Parameter 'await' cannot reference itself.
}
@@ -1,8 +1,8 @@
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration3_es6.ts(1,20): error TS2372: Parameter 'await' cannot be referenced in its initializer.
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration3_es6.ts(1,20): error TS2372: Parameter 'await' cannot reference itself.
==== tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration3_es6.ts (1 errors) ====
function f(await = await) {
~~~~~
!!! error TS2372: Parameter 'await' cannot be referenced in its initializer.
!!! error TS2372: Parameter 'await' cannot reference itself.
}
@@ -1,4 +1,4 @@
tests/cases/conformance/async/es6/test.ts(3,25): error TS1064: The return type of an async function or method must be the global Promise<T> type.
tests/cases/conformance/async/es6/test.ts(3,25): error TS1064: The return type of an async function or method must be the global Promise<T> type. Did you mean to write 'Promise<T>'?
==== tests/cases/conformance/async/es6/task.ts (0 errors) ====
@@ -9,5 +9,5 @@ tests/cases/conformance/async/es6/test.ts(3,25): error TS1064: The return type o
class Test {
async example<T>(): Task<T> { return; }
~~~~~~~
!!! error TS1064: The return type of an async function or method must be the global Promise<T> type.
!!! error TS1064: The return type of an async function or method must be the global Promise<T> type. Did you mean to write 'Promise<T>'?
}
@@ -1,4 +1,4 @@
tests/cases/conformance/async/es6/asyncQualifiedReturnType_es6.ts(6,21): error TS1064: The return type of an async function or method must be the global Promise<T> type.
tests/cases/conformance/async/es6/asyncQualifiedReturnType_es6.ts(6,21): error TS1064: The return type of an async function or method must be the global Promise<T> type. Did you mean to write 'Promise<void>'?
==== tests/cases/conformance/async/es6/asyncQualifiedReturnType_es6.ts (1 errors) ====
@@ -9,5 +9,5 @@ tests/cases/conformance/async/es6/asyncQualifiedReturnType_es6.ts(6,21): error T
async function f(): X.MyPromise<void> {
~~~~~~~~~~~~~~~~~
!!! error TS1064: The return type of an async function or method must be the global Promise<T> type.
!!! error TS1064: The return type of an async function or method must be the global Promise<T> type. Did you mean to write 'Promise<void>'?
}
@@ -0,0 +1,11 @@
//// [bigIntWithTargetES2016.ts]
BigInt(1) ** BigInt(1); // should not error
let num = BigInt(2);
num **= BigInt(2); // should not error
//// [bigIntWithTargetES2016.js]
BigInt(1) ** BigInt(1); // should not error
let num = BigInt(2);
num **= BigInt(2); // should not error
@@ -0,0 +1,13 @@
=== tests/cases/compiler/bigIntWithTargetES2016.ts ===
BigInt(1) ** BigInt(1); // should not error
>BigInt : Symbol(BigInt, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --))
>BigInt : Symbol(BigInt, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --))
let num = BigInt(2);
>num : Symbol(num, Decl(bigIntWithTargetES2016.ts, 2, 3))
>BigInt : Symbol(BigInt, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --))
num **= BigInt(2); // should not error
>num : Symbol(num, Decl(bigIntWithTargetES2016.ts, 2, 3))
>BigInt : Symbol(BigInt, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --))
@@ -0,0 +1,23 @@
=== tests/cases/compiler/bigIntWithTargetES2016.ts ===
BigInt(1) ** BigInt(1); // should not error
>BigInt(1) ** BigInt(1) : bigint
>BigInt(1) : bigint
>BigInt : BigIntConstructor
>1 : 1
>BigInt(1) : bigint
>BigInt : BigIntConstructor
>1 : 1
let num = BigInt(2);
>num : bigint
>BigInt(2) : bigint
>BigInt : BigIntConstructor
>2 : 2
num **= BigInt(2); // should not error
>num **= BigInt(2) : bigint
>num : bigint
>BigInt(2) : bigint
>BigInt : BigIntConstructor
>2 : 2
@@ -0,0 +1,14 @@
tests/cases/compiler/bigIntWithTargetLessThanES2016.ts(1,1): error TS2791: Exponentiation cannot be performed on 'bigint' values unless the 'target' option is set to 'es2016' or later.
tests/cases/compiler/bigIntWithTargetLessThanES2016.ts(4,1): error TS2791: Exponentiation cannot be performed on 'bigint' values unless the 'target' option is set to 'es2016' or later.
==== tests/cases/compiler/bigIntWithTargetLessThanES2016.ts (2 errors) ====
BigInt(1) ** BigInt(1); // should error
~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2791: Exponentiation cannot be performed on 'bigint' values unless the 'target' option is set to 'es2016' or later.
let foo = BigInt(2);
foo **= BigInt(2); // should error
~~~~~~~~~~~~~~~~~
!!! error TS2791: Exponentiation cannot be performed on 'bigint' values unless the 'target' option is set to 'es2016' or later.
@@ -0,0 +1,11 @@
//// [bigIntWithTargetLessThanES2016.ts]
BigInt(1) ** BigInt(1); // should error
let foo = BigInt(2);
foo **= BigInt(2); // should error
//// [bigIntWithTargetLessThanES2016.js]
Math.pow(BigInt(1), BigInt(1)); // should error
let foo = BigInt(2);
foo = Math.pow(foo, BigInt(2)); // should error
@@ -0,0 +1,13 @@
=== tests/cases/compiler/bigIntWithTargetLessThanES2016.ts ===
BigInt(1) ** BigInt(1); // should error
>BigInt : Symbol(BigInt, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --))
>BigInt : Symbol(BigInt, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --))
let foo = BigInt(2);
>foo : Symbol(foo, Decl(bigIntWithTargetLessThanES2016.ts, 2, 3))
>BigInt : Symbol(BigInt, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --))
foo **= BigInt(2); // should error
>foo : Symbol(foo, Decl(bigIntWithTargetLessThanES2016.ts, 2, 3))
>BigInt : Symbol(BigInt, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --))
@@ -0,0 +1,23 @@
=== tests/cases/compiler/bigIntWithTargetLessThanES2016.ts ===
BigInt(1) ** BigInt(1); // should error
>BigInt(1) ** BigInt(1) : bigint
>BigInt(1) : bigint
>BigInt : BigIntConstructor
>1 : 1
>BigInt(1) : bigint
>BigInt : BigIntConstructor
>1 : 1
let foo = BigInt(2);
>foo : bigint
>BigInt(2) : bigint
>BigInt : BigIntConstructor
>2 : 2
foo **= BigInt(2); // should error
>foo **= BigInt(2) : bigint
>foo : bigint
>BigInt(2) : bigint
>BigInt : BigIntConstructor
>2 : 2
@@ -1,6 +1,6 @@
tests/cases/compiler/capturedParametersInInitializers1.ts(18,20): error TS2373: Initializer of parameter 'y' cannot reference identifier 'z' declared after it.
tests/cases/compiler/capturedParametersInInitializers1.ts(22,26): error TS2373: Initializer of parameter 'y' cannot reference identifier 'z' declared after it.
tests/cases/compiler/capturedParametersInInitializers1.ts(38,21): error TS2373: Initializer of parameter 'y' cannot reference identifier 'z' declared after it.
tests/cases/compiler/capturedParametersInInitializers1.ts(18,20): error TS2373: Parameter 'y' cannot reference identifier 'z' declared after it.
tests/cases/compiler/capturedParametersInInitializers1.ts(22,26): error TS2373: Parameter 'y' cannot reference identifier 'z' declared after it.
tests/cases/compiler/capturedParametersInInitializers1.ts(38,21): error TS2373: Parameter 'y' cannot reference identifier 'z' declared after it.
==== tests/cases/compiler/capturedParametersInInitializers1.ts (3 errors) ====
@@ -23,13 +23,13 @@ tests/cases/compiler/capturedParametersInInitializers1.ts(38,21): error TS2373:
// error - used before declaration
function foo4(y = {z}, z = 1) {
~
!!! error TS2373: Initializer of parameter 'y' cannot reference identifier 'z' declared after it.
!!! error TS2373: Parameter 'y' cannot reference identifier 'z' declared after it.
}
// error - used before declaration, IIFEs are inlined
function foo5(y = (() => z)(), z = 1) {
~
!!! error TS2373: Initializer of parameter 'y' cannot reference identifier 'z' declared after it.
!!! error TS2373: Parameter 'y' cannot reference identifier 'z' declared after it.
}
// ok - IIFE inside another function
@@ -47,6 +47,6 @@ tests/cases/compiler/capturedParametersInInitializers1.ts(38,21): error TS2373:
// error - used as computed name of method
function foo9(y = {[z]() { return z; }}, z = 1) {
~
!!! error TS2373: Initializer of parameter 'y' cannot reference identifier 'z' declared after it.
!!! error TS2373: Parameter 'y' cannot reference identifier 'z' declared after it.
}
@@ -1,8 +1,8 @@
tests/cases/compiler/capturedParametersInInitializers2.ts(3,20): error TS2373: Initializer of parameter 'y' cannot reference identifier 'x' declared after it.
tests/cases/compiler/capturedParametersInInitializers2.ts(4,14): error TS2373: Initializer of parameter 'y' cannot reference identifier 'x' declared after it.
tests/cases/compiler/capturedParametersInInitializers2.ts(6,10): error TS2373: Initializer of parameter 'y' cannot reference identifier 'z' declared after it.
tests/cases/compiler/capturedParametersInInitializers2.ts(3,20): error TS2373: Parameter 'y' cannot reference identifier 'x' declared after it.
tests/cases/compiler/capturedParametersInInitializers2.ts(4,14): error TS2373: Parameter 'y' cannot reference identifier 'x' declared after it.
tests/cases/compiler/capturedParametersInInitializers2.ts(6,10): error TS2373: Parameter 'y' cannot reference identifier 'z' declared after it.
tests/cases/compiler/capturedParametersInInitializers2.ts(13,26): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type.
tests/cases/compiler/capturedParametersInInitializers2.ts(13,27): error TS2373: Initializer of parameter 'y' cannot reference identifier 'x' declared after it.
tests/cases/compiler/capturedParametersInInitializers2.ts(13,27): error TS2373: Parameter 'y' cannot reference identifier 'x' declared after it.
==== tests/cases/compiler/capturedParametersInInitializers2.ts (5 errors) ====
@@ -10,14 +10,14 @@ tests/cases/compiler/capturedParametersInInitializers2.ts(13,27): error TS2373:
y = class {
static c = x;
~
!!! error TS2373: Initializer of parameter 'y' cannot reference identifier 'x' declared after it.
!!! error TS2373: Parameter 'y' cannot reference identifier 'x' declared after it.
get [x]() {return x;}
~
!!! error TS2373: Initializer of parameter 'y' cannot reference identifier 'x' declared after it.
!!! error TS2373: Parameter 'y' cannot reference identifier 'x' declared after it.
constructor() { x; }
[z]() { return z; }
~
!!! error TS2373: Initializer of parameter 'y' cannot reference identifier 'z' declared after it.
!!! error TS2373: Parameter 'y' cannot reference identifier 'z' declared after it.
},
x = 1,
z = 2
@@ -28,5 +28,5 @@ tests/cases/compiler/capturedParametersInInitializers2.ts(13,27): error TS2373:
~~~
!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type.
~
!!! error TS2373: Initializer of parameter 'y' cannot reference identifier 'x' declared after it.
!!! error TS2373: Parameter 'y' cannot reference identifier 'x' declared after it.
}
@@ -16,6 +16,7 @@ function foo2(y = class {[x] = x}, x = 1) {
//// [capturedParametersInInitializers2.js]
function foo(y, x, z) {
var _a;
if (y === void 0) { y = (_a = /** @class */ (function () {
function class_1() {
x;
@@ -32,10 +33,10 @@ function foo(y, x, z) {
_a); }
if (x === void 0) { x = 1; }
if (z === void 0) { z = 2; }
var _a;
y.c;
}
function foo2(y, x) {
var _a, _b;
if (y === void 0) { y = (_b = /** @class */ (function () {
function class_2() {
this[_a] = x;
@@ -45,5 +46,4 @@ function foo2(y, x) {
_a = x,
_b); }
if (x === void 0) { x = 1; }
var _a, _b;
}
@@ -105,9 +105,9 @@ function Person(name) {
this.name = name;
>this.name = name : string
>this.name : string
>this.name : any
>this : this
>name : string
>name : any
>name : string
}
Person.prototype.describe = function () {
@@ -23,9 +23,9 @@ someFunction(function(BaseClass) {
this.foo = "bar";
>this.foo = "bar" : "bar"
>this.foo : string
>this.foo : any
>this : this
>foo : string
>foo : any
>"bar" : "bar"
}
_render(error) {
@@ -25,9 +25,9 @@ class B extends A {
this.foo = () => 3;
>this.foo = () => 3 : () => number
>this.foo : () => number
>this.foo : any
>this : this
>foo : () => number
>foo : any
>() => 3 : () => number
>3 : 3
}
@@ -12,9 +12,9 @@ class Derived {
this.x = 10;
>this.x = 10 : 10
>this.x : number
>this.x : any
>this : this
>x : number
>x : any
>10 : 10
var that = this;
@@ -1,11 +1,11 @@
tests/cases/compiler/circularOptionalityRemoval.ts(2,14): error TS2502: 'x' is referenced directly or indirectly in its own type annotation.
tests/cases/compiler/circularOptionalityRemoval.ts(2,38): error TS2372: Parameter 'x' cannot be referenced in its initializer.
tests/cases/compiler/circularOptionalityRemoval.ts(2,38): error TS2372: Parameter 'x' cannot reference itself.
tests/cases/compiler/circularOptionalityRemoval.ts(2,38): error TS2532: Object is possibly 'undefined'.
tests/cases/compiler/circularOptionalityRemoval.ts(2,46): error TS2372: Parameter 'x' cannot be referenced in its initializer.
tests/cases/compiler/circularOptionalityRemoval.ts(2,46): error TS2372: Parameter 'x' cannot reference itself.
tests/cases/compiler/circularOptionalityRemoval.ts(5,14): error TS1015: Parameter cannot have question mark and initializer.
tests/cases/compiler/circularOptionalityRemoval.ts(5,14): error TS2502: 'x' is referenced directly or indirectly in its own type annotation.
tests/cases/compiler/circularOptionalityRemoval.ts(5,27): error TS2304: Cannot find name 'someCondition'.
tests/cases/compiler/circularOptionalityRemoval.ts(5,54): error TS2372: Parameter 'x' cannot be referenced in its initializer.
tests/cases/compiler/circularOptionalityRemoval.ts(5,54): error TS2372: Parameter 'x' cannot reference itself.
==== tests/cases/compiler/circularOptionalityRemoval.ts (8 errors) ====
@@ -14,11 +14,11 @@ tests/cases/compiler/circularOptionalityRemoval.ts(5,54): error TS2372: Paramete
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2502: 'x' is referenced directly or indirectly in its own type annotation.
~
!!! error TS2372: Parameter 'x' cannot be referenced in its initializer.
!!! error TS2372: Parameter 'x' cannot reference itself.
~
!!! error TS2532: Object is possibly 'undefined'.
~
!!! error TS2372: Parameter 'x' cannot be referenced in its initializer.
!!! error TS2372: Parameter 'x' cannot reference itself.
// Report from user
function fn2(x?: string = someCondition ? 'value1' : x) { }
@@ -29,4 +29,4 @@ tests/cases/compiler/circularOptionalityRemoval.ts(5,54): error TS2372: Paramete
~~~~~~~~~~~~~
!!! error TS2304: Cannot find name 'someCondition'.
~
!!! error TS2372: Parameter 'x' cannot be referenced in its initializer.
!!! error TS2372: Parameter 'x' cannot reference itself.
@@ -9,9 +9,9 @@ function Wagon(numberOxen) {
this.numberOxen = numberOxen
>this.numberOxen = numberOxen : number
>this.numberOxen : number
>this.numberOxen : any
>this : this
>numberOxen : number
>numberOxen : any
>numberOxen : number
}
/** @param {Wagon[]=} wagons */
@@ -91,9 +91,9 @@ class Sql extends Wagon {
this.foonly = 12
>this.foonly = 12 : 12
>this.foonly : number
>this.foonly : any
>this : this
>foonly : number
>foonly : any
>12 : 12
}
/**
@@ -67,9 +67,9 @@ class B extends Err {
this.wat = 12
>this.wat = 12 : 12
>this.wat : number
>this.wat : any
>this : this
>wat : number
>wat : any
>12 : 12
}
f() {

Some files were not shown because too many files have changed in this diff Show More