mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge branch 'master' into vfs
This commit is contained in:
@@ -516,8 +516,9 @@ namespace ts {
|
||||
const saveReturnTarget = currentReturnTarget;
|
||||
const saveActiveLabels = activeLabels;
|
||||
const saveHasExplicitReturn = hasExplicitReturn;
|
||||
const isIIFE = containerFlags & ContainerFlags.IsFunctionExpression && !hasModifier(node, ModifierFlags.Async) && !!getImmediatelyInvokedFunctionExpression(node);
|
||||
// A non-async IIFE is considered part of the containing control flow. Return statements behave
|
||||
const isIIFE = containerFlags & ContainerFlags.IsFunctionExpression && !hasModifier(node, ModifierFlags.Async) &&
|
||||
!(<FunctionLikeDeclaration>node).asteriskToken && !!getImmediatelyInvokedFunctionExpression(node);
|
||||
// A non-async, non-generator IIFE is considered part of the containing control flow. Return statements behave
|
||||
// similarly to break statements that exit to a label just past the statement body.
|
||||
if (!isIIFE) {
|
||||
currentFlow = { flags: FlowFlags.Start };
|
||||
@@ -2219,14 +2220,14 @@ namespace ts {
|
||||
bindAnonymousDeclaration(file, SymbolFlags.ValueModule, `"${removeFileExtension(file.fileName)}"` as __String);
|
||||
}
|
||||
|
||||
function bindExportAssignment(node: ExportAssignment | BinaryExpression) {
|
||||
function bindExportAssignment(node: ExportAssignment) {
|
||||
if (!container.symbol || !container.symbol.exports) {
|
||||
// Export assignment in some sort of block construct
|
||||
bindAnonymousDeclaration(node, SymbolFlags.Alias, getDeclarationName(node));
|
||||
}
|
||||
else {
|
||||
const flags = node.kind === SyntaxKind.ExportAssignment && exportAssignmentIsAlias(node)
|
||||
// An export default clause with an EntityNameExpression exports all meanings of that identifier
|
||||
// An export default clause with an EntityNameExpression or a class expression exports all meanings of that identifier or expression;
|
||||
? SymbolFlags.Alias
|
||||
// An export default clause with any other expression exports a value
|
||||
: SymbolFlags.Property;
|
||||
@@ -2321,7 +2322,10 @@ namespace ts {
|
||||
|
||||
// 'module.exports = expr' assignment
|
||||
setCommonJsModuleIndicator(node);
|
||||
declareSymbol(file.symbol.exports, file.symbol, node, SymbolFlags.Property | SymbolFlags.ExportValue | SymbolFlags.ValueModule, SymbolFlags.None);
|
||||
const flags = exportAssignmentIsAlias(node)
|
||||
? SymbolFlags.Alias // An export= with an EntityNameExpression or a ClassExpression exports all meanings of that identifier or class
|
||||
: SymbolFlags.Property | SymbolFlags.ExportValue | SymbolFlags.ValueModule;
|
||||
declareSymbol(file.symbol.exports, file.symbol, node, flags, SymbolFlags.None);
|
||||
}
|
||||
|
||||
function bindThisPropertyAssignment(node: BinaryExpression | PropertyAccessExpression) {
|
||||
|
||||
+268
-208
@@ -67,6 +67,7 @@ namespace ts {
|
||||
const strictPropertyInitialization = getStrictOptionValue(compilerOptions, "strictPropertyInitialization");
|
||||
const noImplicitAny = getStrictOptionValue(compilerOptions, "noImplicitAny");
|
||||
const noImplicitThis = getStrictOptionValue(compilerOptions, "noImplicitThis");
|
||||
const keyofStringsOnly = !!compilerOptions.keyofStringsOnly;
|
||||
|
||||
const emitResolver = createResolver();
|
||||
const nodeBuilder = createNodeBuilder();
|
||||
@@ -356,6 +357,8 @@ namespace ts {
|
||||
const silentNeverType = createIntrinsicType(TypeFlags.Never, "never");
|
||||
const implicitNeverType = createIntrinsicType(TypeFlags.Never, "never");
|
||||
const nonPrimitiveType = createIntrinsicType(TypeFlags.NonPrimitive, "object");
|
||||
const stringNumberSymbolType = getUnionType([stringType, numberType, esSymbolType]);
|
||||
const keyofConstraintType = keyofStringsOnly ? stringType : stringNumberSymbolType;
|
||||
|
||||
const emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
|
||||
|
||||
@@ -430,6 +433,7 @@ namespace ts {
|
||||
let deferredGlobalAsyncIteratorType: GenericType;
|
||||
let deferredGlobalAsyncIterableIteratorType: GenericType;
|
||||
let deferredGlobalTemplateStringsArrayType: ObjectType;
|
||||
let deferredGlobalExtractSymbol: Symbol;
|
||||
|
||||
let deferredNodes: Node[];
|
||||
const allPotentiallyUnusedIdentifiers = createMap<ReadonlyArray<PotentiallyUnusedIdentifier>>(); // key is file name
|
||||
@@ -1568,7 +1572,7 @@ namespace ts {
|
||||
return false;
|
||||
}
|
||||
|
||||
const container = getThisContainer(errorLocation, /*includeArrowFunctions*/ true);
|
||||
const container = getThisContainer(errorLocation, /*includeArrowFunctions*/ false);
|
||||
let location = container;
|
||||
while (location) {
|
||||
if (isClassLike(location.parent)) {
|
||||
@@ -1841,7 +1845,7 @@ namespace ts {
|
||||
return valueSymbol;
|
||||
}
|
||||
const result = createSymbol(valueSymbol.flags | typeSymbol.flags, valueSymbol.escapedName);
|
||||
result.declarations = concatenate(valueSymbol.declarations, typeSymbol.declarations);
|
||||
result.declarations = deduplicate(concatenate(valueSymbol.declarations, typeSymbol.declarations), equateValues);
|
||||
result.parent = valueSymbol.parent || typeSymbol.parent;
|
||||
if (valueSymbol.valueDeclaration) result.valueDeclaration = valueSymbol.valueDeclaration;
|
||||
if (typeSymbol.members) result.members = typeSymbol.members;
|
||||
@@ -1876,7 +1880,7 @@ namespace ts {
|
||||
|
||||
let symbolFromVariable: Symbol;
|
||||
// First check if module was specified with "export=". If so, get the member from the resolved type
|
||||
if (moduleSymbol && moduleSymbol.exports && moduleSymbol.exports.get("export=" as __String)) {
|
||||
if (moduleSymbol && moduleSymbol.exports && moduleSymbol.exports.get(InternalSymbolName.ExportEquals)) {
|
||||
symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name.escapedText);
|
||||
}
|
||||
else {
|
||||
@@ -1889,7 +1893,7 @@ namespace ts {
|
||||
if (!symbolFromModule && allowSyntheticDefaultImports && name.escapedText === InternalSymbolName.Default) {
|
||||
symbolFromModule = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias);
|
||||
}
|
||||
const symbol = symbolFromModule && symbolFromVariable ?
|
||||
const symbol = symbolFromModule && symbolFromVariable && symbolFromModule !== symbolFromVariable ?
|
||||
combineValueAndTypeSymbols(symbolFromVariable, symbolFromModule) :
|
||||
symbolFromModule || symbolFromVariable;
|
||||
if (!symbol) {
|
||||
@@ -1922,13 +1926,17 @@ namespace ts {
|
||||
resolveEntityName(node.propertyName || node.name, meaning, /*ignoreErrors*/ false, dontResolveAlias);
|
||||
}
|
||||
|
||||
function getTargetOfExportAssignment(node: ExportAssignment, dontResolveAlias: boolean): Symbol | undefined {
|
||||
const aliasLike = resolveEntityName(<EntityNameExpression>node.expression, SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace, /*ignoreErrors*/ true, dontResolveAlias);
|
||||
function getTargetOfExportAssignment(node: ExportAssignment | BinaryExpression, dontResolveAlias: boolean): Symbol | undefined {
|
||||
const expression = (isExportAssignment(node) ? node.expression : node.right) as EntityNameExpression | ClassExpression;
|
||||
if (isClassExpression(expression)) {
|
||||
return checkExpression(expression).symbol;
|
||||
}
|
||||
const aliasLike = resolveEntityName(expression, SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace, /*ignoreErrors*/ true, dontResolveAlias);
|
||||
if (aliasLike) {
|
||||
return aliasLike;
|
||||
}
|
||||
checkExpression(node.expression);
|
||||
return getNodeLinks(node.expression).resolvedSymbol;
|
||||
checkExpression(expression);
|
||||
return getNodeLinks(expression).resolvedSymbol;
|
||||
}
|
||||
|
||||
function getTargetOfAliasDeclaration(node: Declaration, dontRecursivelyResolve?: boolean): Symbol | undefined {
|
||||
@@ -1944,7 +1952,8 @@ namespace ts {
|
||||
case SyntaxKind.ExportSpecifier:
|
||||
return getTargetOfExportSpecifier(<ExportSpecifier>node, SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace, dontRecursivelyResolve);
|
||||
case SyntaxKind.ExportAssignment:
|
||||
return getTargetOfExportAssignment(<ExportAssignment>node, dontRecursivelyResolve);
|
||||
case SyntaxKind.BinaryExpression:
|
||||
return getTargetOfExportAssignment((<ExportAssignment | BinaryExpression>node), dontRecursivelyResolve);
|
||||
case SyntaxKind.NamespaceExportDeclaration:
|
||||
return getTargetOfNamespaceExportDeclaration(<NamespaceExportDeclaration>node, dontRecursivelyResolve);
|
||||
}
|
||||
@@ -2061,7 +2070,7 @@ namespace ts {
|
||||
let symbol: Symbol;
|
||||
if (name.kind === SyntaxKind.Identifier) {
|
||||
const message = meaning === namespaceMeaning ? Diagnostics.Cannot_find_namespace_0 : Diagnostics.Cannot_find_name_0;
|
||||
const symbolFromJSPrototype = isInJavaScriptFile(name) && resolveEntityNameFromJSPrototype(name, meaning);
|
||||
const symbolFromJSPrototype = isInJavaScriptFile(name) ? resolveEntityNameFromJSPrototype(name, meaning) : undefined;
|
||||
symbol = resolveName(location || name, name.escapedText, meaning, ignoreErrors || symbolFromJSPrototype ? undefined : message, name, /*isUse*/ true);
|
||||
if (!symbol) {
|
||||
return symbolFromJSPrototype;
|
||||
@@ -2225,20 +2234,28 @@ namespace ts {
|
||||
// An external module with an 'export =' declaration resolves to the target of the 'export =' declaration,
|
||||
// and an external module with no 'export =' declaration resolves to the module itself.
|
||||
function resolveExternalModuleSymbol(moduleSymbol: Symbol, dontResolveAlias?: boolean): Symbol {
|
||||
return moduleSymbol && getMergedSymbol(resolveSymbol(getCommonJsExportEquals(moduleSymbol), dontResolveAlias)) || moduleSymbol;
|
||||
return moduleSymbol && getMergedSymbol(getCommonJsExportEquals(resolveSymbol(moduleSymbol.exports.get(InternalSymbolName.ExportEquals), dontResolveAlias), moduleSymbol)) || moduleSymbol;
|
||||
}
|
||||
|
||||
function getCommonJsExportEquals(moduleSymbol: Symbol): Symbol {
|
||||
const exported = moduleSymbol.exports.get(InternalSymbolName.ExportEquals);
|
||||
if (!exported || !exported.exports || moduleSymbol.exports.size === 1) {
|
||||
function getCommonJsExportEquals(exported: Symbol, moduleSymbol: Symbol): Symbol {
|
||||
if (!exported || moduleSymbol.exports.size === 1) {
|
||||
return exported;
|
||||
}
|
||||
const merged = cloneSymbol(exported);
|
||||
if (merged.exports === undefined) {
|
||||
merged.flags = merged.flags | SymbolFlags.ValueModule;
|
||||
merged.exports = createSymbolTable();
|
||||
}
|
||||
moduleSymbol.exports.forEach((s, name) => {
|
||||
if (name === InternalSymbolName.ExportEquals) return;
|
||||
if (!merged.exports.has(name)) {
|
||||
merged.exports.set(name, s);
|
||||
}
|
||||
else {
|
||||
const ms = cloneSymbol(merged.exports.get(name));
|
||||
mergeSymbol(ms, s);
|
||||
merged.exports.set(name, ms);
|
||||
}
|
||||
});
|
||||
return merged;
|
||||
}
|
||||
@@ -3859,10 +3876,13 @@ namespace ts {
|
||||
return "(Anonymous function)";
|
||||
}
|
||||
}
|
||||
if ((symbol as TransientSymbol).nameType && (symbol as TransientSymbol).nameType.flags & TypeFlags.StringLiteral) {
|
||||
const stringValue = ((symbol as TransientSymbol).nameType as StringLiteralType).value;
|
||||
if (!isIdentifierText(stringValue, compilerOptions.target)) {
|
||||
return `"${escapeString(stringValue, CharacterCodes.doubleQuote)}"`;
|
||||
const nameType = symbol.nameType;
|
||||
if (nameType) {
|
||||
if (nameType.flags & TypeFlags.StringLiteral && !isIdentifierText((<StringLiteralType>nameType).value, compilerOptions.target)) {
|
||||
return `"${escapeString((<StringLiteralType>nameType).value, CharacterCodes.doubleQuote)}"`;
|
||||
}
|
||||
if (nameType && nameType.flags & TypeFlags.UniqueESSymbol) {
|
||||
return `[${getNameOfSymbolAsWritten((<UniqueESSymbolType>nameType).symbol, context)}]`;
|
||||
}
|
||||
}
|
||||
return symbolName(symbol);
|
||||
@@ -4273,7 +4293,7 @@ namespace ts {
|
||||
// right hand expression is of a type parameter type.
|
||||
if (isVariableDeclaration(declaration) && declaration.parent.parent.kind === SyntaxKind.ForInStatement) {
|
||||
const indexType = getIndexType(checkNonNullExpression(declaration.parent.parent.expression));
|
||||
return indexType.flags & (TypeFlags.TypeParameter | TypeFlags.Index) ? indexType : stringType;
|
||||
return indexType.flags & (TypeFlags.TypeParameter | TypeFlags.Index) ? getExtractStringType(indexType) : stringType;
|
||||
}
|
||||
|
||||
if (isVariableDeclaration(declaration) && declaration.parent.parent.kind === SyntaxKind.ForOfStatement) {
|
||||
@@ -5290,6 +5310,16 @@ namespace ts {
|
||||
return links.declaredType;
|
||||
}
|
||||
|
||||
function isStringConcatExpression(expr: Node): boolean {
|
||||
if (expr.kind === SyntaxKind.StringLiteral) {
|
||||
return true;
|
||||
}
|
||||
else if (expr.kind === SyntaxKind.BinaryExpression) {
|
||||
return isStringConcatExpression((<BinaryExpression>expr).left) && isStringConcatExpression((<BinaryExpression>expr).right);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function isLiteralEnumMember(member: EnumMember) {
|
||||
const expr = member.initializer;
|
||||
if (!expr) {
|
||||
@@ -5304,6 +5334,8 @@ namespace ts {
|
||||
(<PrefixUnaryExpression>expr).operand.kind === SyntaxKind.NumericLiteral;
|
||||
case SyntaxKind.Identifier:
|
||||
return nodeIsMissing(expr) || !!getSymbolOfNode(member.parent).exports.get((<Identifier>expr).escapedText);
|
||||
case SyntaxKind.BinaryExpression:
|
||||
return isStringConcatExpression(expr);
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
@@ -5665,13 +5697,7 @@ namespace ts {
|
||||
error(decl.name || decl, Diagnostics.Duplicate_declaration_0, name);
|
||||
lateSymbol = createSymbol(SymbolFlags.None, memberName, CheckFlags.Late);
|
||||
}
|
||||
|
||||
const symbolLinks = getSymbolLinks(lateSymbol);
|
||||
if (!symbolLinks.nameType) {
|
||||
// Retain link to name type so that it can be reused later
|
||||
symbolLinks.nameType = type;
|
||||
}
|
||||
|
||||
lateSymbol.nameType = type;
|
||||
addDeclarationToLateBoundSymbol(lateSymbol, decl, symbolFlags);
|
||||
if (lateSymbol.parent) {
|
||||
Debug.assert(lateSymbol.parent === parent, "Existing symbol parent should match new one");
|
||||
@@ -6103,6 +6129,7 @@ namespace ts {
|
||||
const checkFlags = CheckFlags.ReverseMapped | (readonlyMask && isReadonlySymbol(prop) ? CheckFlags.Readonly : 0);
|
||||
const inferredProp = createSymbol(SymbolFlags.Property | prop.flags & optionalMask, prop.escapedName, checkFlags) as ReverseMappedSymbol;
|
||||
inferredProp.declarations = prop.declarations;
|
||||
inferredProp.nameType = prop.nameType;
|
||||
inferredProp.propertyType = getTypeOfSymbol(prop);
|
||||
inferredProp.mappedType = type.mappedType;
|
||||
members.set(prop.escapedName, inferredProp);
|
||||
@@ -6114,6 +6141,7 @@ namespace ts {
|
||||
function resolveMappedTypeMembers(type: MappedType) {
|
||||
const members: SymbolTable = createSymbolTable();
|
||||
let stringIndexInfo: IndexInfo;
|
||||
let numberIndexInfo: IndexInfo;
|
||||
// Resolve upfront such that recursive references see an empty object type.
|
||||
setStructuredTypeMembers(type, emptySymbols, emptyArray, emptyArray, undefined, undefined);
|
||||
// In { [P in K]: T }, we refer to P as the type parameter type, K as the constraint type,
|
||||
@@ -6124,15 +6152,19 @@ namespace ts {
|
||||
const modifiersType = getApparentType(getModifiersTypeFromMappedType(type)); // The 'T' in 'keyof T'
|
||||
const templateModifiers = getMappedTypeModifiers(type);
|
||||
const constraintDeclaration = type.declaration.typeParameter.constraint;
|
||||
const include = keyofStringsOnly ? TypeFlags.StringLiteral : TypeFlags.StringOrNumberLiteralOrUnique;
|
||||
if (constraintDeclaration.kind === SyntaxKind.TypeOperator &&
|
||||
(<TypeOperatorNode>constraintDeclaration).operator === SyntaxKind.KeyOfKeyword) {
|
||||
// We have a { [P in keyof T]: X }
|
||||
for (const propertySymbol of getPropertiesOfType(modifiersType)) {
|
||||
addMemberForKeyType(getLiteralTypeFromPropertyName(propertySymbol), propertySymbol);
|
||||
for (const prop of getPropertiesOfType(modifiersType)) {
|
||||
addMemberForKeyType(getLiteralTypeFromPropertyName(prop, include), /*_index*/ undefined, prop);
|
||||
}
|
||||
if (modifiersType.flags & TypeFlags.Any || getIndexInfoOfType(modifiersType, IndexKind.String)) {
|
||||
addMemberForKeyType(stringType);
|
||||
}
|
||||
if (!keyofStringsOnly && getIndexInfoOfType(modifiersType, IndexKind.Number)) {
|
||||
addMemberForKeyType(numberType);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// First, if the constraint type is a type parameter, obtain the base constraint. Then,
|
||||
@@ -6142,16 +6174,9 @@ namespace ts {
|
||||
const iterationType = keyType.flags & TypeFlags.Index ? getIndexType(getApparentType((<IndexType>keyType).type)) : keyType;
|
||||
forEachType(iterationType, addMemberForKeyType);
|
||||
}
|
||||
setStructuredTypeMembers(type, members, emptyArray, emptyArray, stringIndexInfo, undefined);
|
||||
setStructuredTypeMembers(type, members, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo);
|
||||
|
||||
function addMemberForKeyType(t: Type, propertySymbolOrIndex?: Symbol | number) {
|
||||
let propertySymbol: Symbol;
|
||||
// forEachType delegates to forEach, which calls with a numeric second argument
|
||||
// the type system currently doesn't catch this incompatibility, so we annotate
|
||||
// the function ourselves to indicate the runtime behavior and deal with it here
|
||||
if (typeof propertySymbolOrIndex === "object") {
|
||||
propertySymbol = propertySymbolOrIndex;
|
||||
}
|
||||
function addMemberForKeyType(t: Type, _index?: number, origin?: Symbol) {
|
||||
// Create a mapper from T to the current iteration type constituent. Then, if the
|
||||
// mapped type is itself an instantiated type, combine the iteration mapper with the
|
||||
// instantiation mapper.
|
||||
@@ -6159,8 +6184,8 @@ namespace ts {
|
||||
const propType = instantiateType(templateType, templateMapper);
|
||||
// If the current iteration type constituent is a string literal type, create a property.
|
||||
// Otherwise, for type string create a string index signature.
|
||||
if (t.flags & TypeFlags.StringLiteral) {
|
||||
const propName = getLateBoundNameFromType(t as LiteralType | UniqueESSymbolType);
|
||||
if (t.flags & TypeFlags.StringOrNumberLiteralOrUnique) {
|
||||
const propName = getLateBoundNameFromType(t as LiteralType);
|
||||
const modifiersProp = getPropertyOfType(modifiersType, propName);
|
||||
const isOptional = !!(templateModifiers & MappedTypeModifiers.IncludeOptional ||
|
||||
!(templateModifiers & MappedTypeModifiers.ExcludeOptional) && modifiersProp && modifiersProp.flags & SymbolFlags.Optional);
|
||||
@@ -6173,9 +6198,9 @@ namespace ts {
|
||||
prop.type = strictNullChecks && isOptional && !isTypeAssignableTo(undefinedType, propType) ? getOptionalType(propType) :
|
||||
strictNullChecks && !isOptional && modifiersProp && modifiersProp.flags & SymbolFlags.Optional ? getTypeWithFacts(propType, TypeFacts.NEUndefined) :
|
||||
propType;
|
||||
if (propertySymbol) {
|
||||
prop.syntheticOrigin = propertySymbol;
|
||||
prop.declarations = propertySymbol.declarations;
|
||||
if (origin) {
|
||||
prop.syntheticOrigin = origin;
|
||||
prop.declarations = origin.declarations;
|
||||
}
|
||||
prop.nameType = t;
|
||||
members.set(propName, prop);
|
||||
@@ -6183,6 +6208,9 @@ namespace ts {
|
||||
else if (t.flags & (TypeFlags.Any | TypeFlags.String)) {
|
||||
stringIndexInfo = createIndexInfo(propType, !!(templateModifiers & MappedTypeModifiers.IncludeReadonly));
|
||||
}
|
||||
else if (t.flags & TypeFlags.Number) {
|
||||
numberIndexInfo = createIndexInfo(propType, !!(templateModifiers & MappedTypeModifiers.IncludeReadonly));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6362,18 +6390,10 @@ namespace ts {
|
||||
}
|
||||
|
||||
function getConstraintOfIndexedAccess(type: IndexedAccessType) {
|
||||
const transformed = getSimplifiedIndexedAccessType(type);
|
||||
if (transformed) {
|
||||
return transformed;
|
||||
}
|
||||
const baseObjectType = getBaseConstraintOfType(type.objectType);
|
||||
const baseIndexType = getBaseConstraintOfType(type.indexType);
|
||||
if (baseIndexType === stringType && !getIndexInfoOfType(baseObjectType || type.objectType, IndexKind.String)) {
|
||||
// getIndexedAccessType returns `any` for X[string] where X doesn't have an index signature.
|
||||
// to avoid this, return `undefined`.
|
||||
return undefined;
|
||||
}
|
||||
return baseObjectType || baseIndexType ? getIndexedAccessType(baseObjectType || type.objectType, baseIndexType || type.indexType) : undefined;
|
||||
const objectType = getBaseConstraintOfType(type.objectType) || type.objectType;
|
||||
const indexType = getBaseConstraintOfType(type.indexType) || type.indexType;
|
||||
const constraint = !isGenericObjectType(objectType) && !isGenericIndexType(indexType) ? getIndexedAccessType(objectType, indexType) : undefined;
|
||||
return constraint && constraint !== unknownType ? constraint : undefined;
|
||||
}
|
||||
|
||||
function getDefaultConstraintOfConditionalType(type: ConditionalType) {
|
||||
@@ -6420,7 +6440,7 @@ namespace ts {
|
||||
function getBaseConstraintOfType(type: Type): Type {
|
||||
const constraint = getBaseConstraintOfInstantiableNonPrimitiveUnionOrIntersection(type);
|
||||
if (!constraint && type.flags & TypeFlags.Index) {
|
||||
return stringType;
|
||||
return keyofConstraintType;
|
||||
}
|
||||
return constraint;
|
||||
}
|
||||
@@ -6455,7 +6475,7 @@ namespace ts {
|
||||
circular = true;
|
||||
return undefined;
|
||||
}
|
||||
const result = computeBaseConstraint(t);
|
||||
const result = computeBaseConstraint(getSimplifiedType(t));
|
||||
if (!popTypeResolution()) {
|
||||
circular = true;
|
||||
return undefined;
|
||||
@@ -6484,13 +6504,9 @@ namespace ts {
|
||||
undefined;
|
||||
}
|
||||
if (t.flags & TypeFlags.Index) {
|
||||
return stringType;
|
||||
return keyofConstraintType;
|
||||
}
|
||||
if (t.flags & TypeFlags.IndexedAccess) {
|
||||
const transformed = getSimplifiedIndexedAccessType(<IndexedAccessType>t);
|
||||
if (transformed) {
|
||||
return getBaseConstraint(transformed);
|
||||
}
|
||||
const baseObjectType = getBaseConstraint((<IndexedAccessType>t).objectType);
|
||||
const baseIndexType = getBaseConstraint((<IndexedAccessType>t).indexType);
|
||||
const baseIndexedAccess = baseObjectType && baseIndexType ? getIndexedAccessType(baseObjectType, baseIndexType) : undefined;
|
||||
@@ -6574,6 +6590,7 @@ namespace ts {
|
||||
t.flags & TypeFlags.BooleanLike ? globalBooleanType :
|
||||
t.flags & TypeFlags.ESSymbolLike ? getGlobalESSymbolType(/*reportErrors*/ languageVersion >= ScriptTarget.ES2015) :
|
||||
t.flags & TypeFlags.NonPrimitive ? emptyObjectType :
|
||||
t.flags & TypeFlags.Index ? keyofConstraintType :
|
||||
t;
|
||||
}
|
||||
|
||||
@@ -6613,25 +6630,30 @@ namespace ts {
|
||||
if (props.length === 1 && !(checkFlags & CheckFlags.Partial)) {
|
||||
return props[0];
|
||||
}
|
||||
const propTypes: Type[] = [];
|
||||
const declarations: Declaration[] = [];
|
||||
let declarations: Declaration[];
|
||||
let commonType: Type;
|
||||
let nameType: Type;
|
||||
const propTypes: Type[] = [];
|
||||
let first = true;
|
||||
for (const prop of props) {
|
||||
if (prop.declarations) {
|
||||
addRange(declarations, prop.declarations);
|
||||
}
|
||||
declarations = addRange(declarations, prop.declarations);
|
||||
const type = getTypeOfSymbol(prop);
|
||||
if (!commonType) {
|
||||
if (first) {
|
||||
commonType = type;
|
||||
nameType = prop.nameType;
|
||||
first = false;
|
||||
}
|
||||
else if (type !== commonType) {
|
||||
checkFlags |= CheckFlags.HasNonUniformType;
|
||||
else {
|
||||
if (type !== commonType) {
|
||||
checkFlags |= CheckFlags.HasNonUniformType;
|
||||
}
|
||||
}
|
||||
propTypes.push(type);
|
||||
}
|
||||
const result = createSymbol(SymbolFlags.Property | commonFlags, name, syntheticFlag | checkFlags);
|
||||
result.containingType = containingType;
|
||||
result.declarations = declarations;
|
||||
result.nameType = nameType;
|
||||
result.type = isUnion ? getUnionType(propTypes) : getIntersectionType(propTypes);
|
||||
return result;
|
||||
}
|
||||
@@ -7769,6 +7791,10 @@ namespace ts {
|
||||
return symbol && <GenericType>getTypeOfGlobalSymbol(symbol, arity);
|
||||
}
|
||||
|
||||
function getGlobalExtractSymbol(): Symbol {
|
||||
return deferredGlobalExtractSymbol || (deferredGlobalExtractSymbol = getGlobalSymbol("Extract" as __String, SymbolFlags.TypeAlias, Diagnostics.Cannot_find_global_type_0));
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a global type that is generic with some element type, and returns that instantiation.
|
||||
*/
|
||||
@@ -8203,53 +8229,66 @@ namespace ts {
|
||||
return links.resolvedType;
|
||||
}
|
||||
|
||||
function getIndexTypeForGenericType(type: InstantiableType | UnionOrIntersectionType, includeDeclaredTypes?: boolean) {
|
||||
const cacheLocation = includeDeclaredTypes ? "resolvedDeclaredIndexType" : "resolvedIndexType";
|
||||
if (!type[cacheLocation]) {
|
||||
type[cacheLocation] = <IndexType>createType(TypeFlags.Index);
|
||||
type[cacheLocation].type = type;
|
||||
if (includeDeclaredTypes) {
|
||||
type[cacheLocation].isDeclaredType = true;
|
||||
}
|
||||
}
|
||||
return type[cacheLocation];
|
||||
function createIndexType(type: InstantiableType | UnionOrIntersectionType, stringsOnly: boolean) {
|
||||
const result = <IndexType>createType(TypeFlags.Index);
|
||||
result.type = type;
|
||||
result.stringsOnly = stringsOnly;
|
||||
return result;
|
||||
}
|
||||
|
||||
function getLiteralTypeFromPropertyName(prop: Symbol) {
|
||||
const links = getSymbolLinks(getLateBoundSymbol(prop));
|
||||
if (!links.nameType) {
|
||||
if (links.target && links.target !== unknownSymbol && links.target !== resolvingSymbol && links.target.escapedName === prop.escapedName) {
|
||||
links.nameType = getLiteralTypeFromPropertyName(links.target);
|
||||
}
|
||||
else {
|
||||
links.nameType = getDeclarationModifierFlagsFromSymbol(prop) & ModifierFlags.NonPublicAccessibilityModifier || isKnownSymbol(prop) ?
|
||||
neverType :
|
||||
function getIndexTypeForGenericType(type: InstantiableType | UnionOrIntersectionType, stringsOnly: boolean) {
|
||||
return stringsOnly ?
|
||||
type.resolvedStringIndexType || (type.resolvedStringIndexType = createIndexType(type, /*stringsOnly*/ true)) :
|
||||
type.resolvedIndexType || (type.resolvedIndexType = createIndexType(type, /*stringsOnly*/ false));
|
||||
}
|
||||
|
||||
function getLiteralTypeFromPropertyName(prop: Symbol, include: TypeFlags) {
|
||||
if (!(getDeclarationModifierFlagsFromSymbol(prop) & ModifierFlags.NonPublicAccessibilityModifier)) {
|
||||
let type = getLateBoundSymbol(prop).nameType;
|
||||
if (!type && !isKnownSymbol(prop)) {
|
||||
const name = getNameOfDeclaration(prop.valueDeclaration);
|
||||
type = name && isNumericLiteral(name) ? getLiteralType(+name.text) :
|
||||
name && name.kind === SyntaxKind.ComputedPropertyName && isNumericLiteral(name.expression) ? getLiteralType(+name.expression.text) :
|
||||
getLiteralType(symbolName(prop));
|
||||
}
|
||||
if (type && type.flags & include) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
return links.nameType;
|
||||
return neverType;
|
||||
}
|
||||
|
||||
function isTypeString(type: Type) {
|
||||
return isTypeAssignableToKind(type, TypeFlags.StringLike);
|
||||
function getLiteralTypeFromPropertyNames(type: Type, include: TypeFlags) {
|
||||
return getUnionType(map(getPropertiesOfType(type), t => getLiteralTypeFromPropertyName(t, include)));
|
||||
}
|
||||
|
||||
function getLiteralTypeFromPropertyNames(type: Type, includeDeclaredTypes?: boolean) {
|
||||
const originalKeys = map(getPropertiesOfType(type), getLiteralTypeFromPropertyName);
|
||||
return getUnionType(includeDeclaredTypes ? originalKeys : filter(originalKeys, isTypeString));
|
||||
function getNonEnumNumberIndexInfo(type: Type) {
|
||||
const numberIndexInfo = getIndexInfoOfType(type, IndexKind.Number);
|
||||
return numberIndexInfo !== enumNumberIndexInfo ? numberIndexInfo : undefined;
|
||||
}
|
||||
|
||||
function getIndexType(type: Type, includeDeclaredTypes?: boolean): Type {
|
||||
return type.flags & TypeFlags.Intersection ? getUnionType(map((<IntersectionType>type).types, t => getIndexType(t, includeDeclaredTypes))) :
|
||||
maybeTypeOfKind(type, TypeFlags.InstantiableNonPrimitive) ? getIndexTypeForGenericType(<InstantiableType | UnionOrIntersectionType>type, includeDeclaredTypes) :
|
||||
function getIndexType(type: Type, stringsOnly = keyofStringsOnly): Type {
|
||||
return type.flags & TypeFlags.Intersection ? getUnionType(map((<IntersectionType>type).types, t => getIndexType(t, stringsOnly))) :
|
||||
maybeTypeOfKind(type, TypeFlags.InstantiableNonPrimitive) ? getIndexTypeForGenericType(<InstantiableType | UnionOrIntersectionType>type, stringsOnly) :
|
||||
getObjectFlags(type) & ObjectFlags.Mapped ? getConstraintTypeFromMappedType(<MappedType>type) :
|
||||
type === wildcardType ? wildcardType :
|
||||
type.flags & TypeFlags.Any || getIndexInfoOfType(type, IndexKind.String) ? stringType :
|
||||
getLiteralTypeFromPropertyNames(type, includeDeclaredTypes);
|
||||
type.flags & TypeFlags.Any ? keyofConstraintType :
|
||||
stringsOnly ? getIndexInfoOfType(type, IndexKind.String) ? stringType : getLiteralTypeFromPropertyNames(type, TypeFlags.StringLiteral) :
|
||||
getIndexInfoOfType(type, IndexKind.String) ? getUnionType([stringType, numberType, getLiteralTypeFromPropertyNames(type, TypeFlags.UniqueESSymbol)]) :
|
||||
getNonEnumNumberIndexInfo(type) ? getUnionType([numberType, getLiteralTypeFromPropertyNames(type, TypeFlags.StringLiteral | TypeFlags.UniqueESSymbol)]) :
|
||||
getLiteralTypeFromPropertyNames(type, TypeFlags.StringOrNumberLiteralOrUnique);
|
||||
}
|
||||
|
||||
function getExtractStringType(type: Type) {
|
||||
if (keyofStringsOnly) {
|
||||
return type;
|
||||
}
|
||||
const extractTypeAlias = getGlobalExtractSymbol();
|
||||
return extractTypeAlias ? getTypeAliasInstantiation(extractTypeAlias, [type, stringType]) : stringType;
|
||||
}
|
||||
|
||||
function getIndexTypeOrString(type: Type): Type {
|
||||
const indexType = getIndexType(type);
|
||||
const indexType = getExtractStringType(getIndexType(type));
|
||||
return indexType.flags & TypeFlags.Never ? stringType : indexType;
|
||||
}
|
||||
|
||||
@@ -8307,7 +8346,11 @@ namespace ts {
|
||||
getIndexInfoOfType(objectType, IndexKind.String) ||
|
||||
undefined;
|
||||
if (indexInfo) {
|
||||
if (accessExpression && indexInfo.isReadonly && (isAssignmentTarget(accessExpression) || isDeleteTarget(accessExpression))) {
|
||||
if (accessNode && !isTypeAssignableToKind(indexType, TypeFlags.String | TypeFlags.Number)) {
|
||||
const indexNode = accessNode.kind === SyntaxKind.ElementAccessExpression ? accessNode.argumentExpression : accessNode.indexType;
|
||||
error(indexNode, Diagnostics.Type_0_cannot_be_used_as_an_index_type, typeToString(indexType));
|
||||
}
|
||||
else if (accessExpression && indexInfo.isReadonly && (isAssignmentTarget(accessExpression) || isDeleteTarget(accessExpression))) {
|
||||
error(accessExpression, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType));
|
||||
}
|
||||
return indexInfo.type;
|
||||
@@ -8338,9 +8381,8 @@ namespace ts {
|
||||
else {
|
||||
error(indexNode, Diagnostics.Type_0_cannot_be_used_as_an_index_type, typeToString(indexType));
|
||||
}
|
||||
return unknownType;
|
||||
}
|
||||
return anyType;
|
||||
return unknownType;
|
||||
}
|
||||
|
||||
function isGenericObjectType(type: Type): boolean {
|
||||
@@ -8367,8 +8409,12 @@ namespace ts {
|
||||
return getObjectFlags(type) & ObjectFlags.Mapped && getTemplateTypeFromMappedType(type as MappedType) === neverType;
|
||||
}
|
||||
|
||||
function getSimplifiedType(type: Type): Type {
|
||||
return type.flags & TypeFlags.IndexedAccess ? getSimplifiedIndexedAccessType(<IndexedAccessType>type) : type;
|
||||
}
|
||||
|
||||
// Transform an indexed access to a simpler form, if possible. Return the simpler form, or return
|
||||
// undefined if no transformation is possible.
|
||||
// the type itself if no transformation is possible.
|
||||
function getSimplifiedIndexedAccessType(type: IndexedAccessType): Type {
|
||||
const objectType = type.objectType;
|
||||
if (objectType.flags & TypeFlags.Intersection && isGenericObjectType(objectType)) {
|
||||
@@ -8388,7 +8434,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
return getUnionType([
|
||||
getIndexedAccessType(getIntersectionType(regularTypes), type.indexType),
|
||||
getSimplifiedType(getIndexedAccessType(getIntersectionType(regularTypes), type.indexType)),
|
||||
getIntersectionType(stringIndexTypes)
|
||||
]);
|
||||
}
|
||||
@@ -8398,13 +8444,13 @@ namespace ts {
|
||||
// eventually anyway, but it easier to reason about.
|
||||
if (some((<IntersectionType>objectType).types, isMappedTypeToNever)) {
|
||||
const nonNeverTypes = filter((<IntersectionType>objectType).types, t => !isMappedTypeToNever(t));
|
||||
return getIndexedAccessType(getIntersectionType(nonNeverTypes), type.indexType);
|
||||
return getSimplifiedType(getIndexedAccessType(getIntersectionType(nonNeverTypes), type.indexType));
|
||||
}
|
||||
}
|
||||
|
||||
// If the object type is a mapped type { [P in K]: E }, where K is generic, instantiate E using a mapper
|
||||
// that substitutes the index type for P. For example, for an index access { [P in K]: Box<T[P]> }[X], we
|
||||
// construct the type Box<T[X]>.
|
||||
// construct the type Box<T[X]>. We do not further simplify the result because mapped types can be recursive
|
||||
// and we might never terminate.
|
||||
if (isGenericMappedType(objectType)) {
|
||||
return substituteIndexedMappedType(objectType, type);
|
||||
}
|
||||
@@ -8414,7 +8460,7 @@ namespace ts {
|
||||
return substituteIndexedMappedType(constraint, type);
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
return type;
|
||||
}
|
||||
|
||||
function substituteIndexedMappedType(objectType: MappedType, type: IndexedAccessType) {
|
||||
@@ -8747,7 +8793,7 @@ namespace ts {
|
||||
if (right.flags & TypeFlags.Union) {
|
||||
return mapType(right, t => getSpreadType(left, t, symbol, typeFlags, objectFlags));
|
||||
}
|
||||
if (right.flags & (TypeFlags.BooleanLike | TypeFlags.NumberLike | TypeFlags.StringLike | TypeFlags.EnumLike | TypeFlags.NonPrimitive)) {
|
||||
if (right.flags & (TypeFlags.BooleanLike | TypeFlags.NumberLike | TypeFlags.StringLike | TypeFlags.EnumLike | TypeFlags.NonPrimitive | TypeFlags.Index)) {
|
||||
return left;
|
||||
}
|
||||
|
||||
@@ -8793,6 +8839,7 @@ namespace ts {
|
||||
result.leftSpread = leftProp;
|
||||
result.rightSpread = rightProp;
|
||||
result.declarations = declarations;
|
||||
result.nameType = leftProp.nameType;
|
||||
members.set(leftProp.escapedName, result);
|
||||
}
|
||||
}
|
||||
@@ -8821,6 +8868,7 @@ namespace ts {
|
||||
const result = createSymbol(flags, prop.escapedName);
|
||||
result.type = getTypeOfSymbol(prop);
|
||||
result.declarations = prop.declarations;
|
||||
result.nameType = prop.nameType;
|
||||
result.syntheticOrigin = prop;
|
||||
return result;
|
||||
}
|
||||
@@ -9166,8 +9214,13 @@ namespace ts {
|
||||
if (symbol.valueDeclaration) {
|
||||
result.valueDeclaration = symbol.valueDeclaration;
|
||||
}
|
||||
if ((symbol as TransientSymbol).isRestParameter) {
|
||||
result.isRestParameter = (symbol as TransientSymbol).isRestParameter;
|
||||
if (symbol.nameType) {
|
||||
result.nameType = symbol.nameType;
|
||||
}
|
||||
if (isTransientSymbol(symbol)) {
|
||||
if (symbol.isRestParameter) {
|
||||
result.isRestParameter = symbol.isRestParameter;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -9973,6 +10026,12 @@ namespace ts {
|
||||
if (target.flags & TypeFlags.Substitution) {
|
||||
target = (<SubstitutionType>target).typeVariable;
|
||||
}
|
||||
if (source.flags & TypeFlags.IndexedAccess) {
|
||||
source = getSimplifiedType(source);
|
||||
}
|
||||
if (target.flags & TypeFlags.IndexedAccess) {
|
||||
target = getSimplifiedType(target);
|
||||
}
|
||||
|
||||
// both types are the same - covers 'they are the same primitive type or both are Any' or the same type parameter cases
|
||||
if (source === target) return Ternary.True;
|
||||
@@ -10426,15 +10485,15 @@ namespace ts {
|
||||
// constraint of T.
|
||||
const constraint = getConstraintForRelation((<IndexType>target).type);
|
||||
if (constraint) {
|
||||
if (result = isRelatedTo(source, getIndexType(constraint, (target as IndexType).isDeclaredType), reportErrors)) {
|
||||
if (result = isRelatedTo(source, getIndexType(constraint, (target as IndexType).stringsOnly), reportErrors)) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (target.flags & TypeFlags.IndexedAccess) {
|
||||
// A type S is related to a type T[K] if S is related to A[K], where K is string-like and
|
||||
// A is the apparent type of T.
|
||||
const constraint = getConstraintForRelation(<IndexedAccessType>target);
|
||||
// A type S is related to a type T[K] if S is related to C, where C is the
|
||||
// constraint of T[K]
|
||||
const constraint = getConstraintForRelation(target);
|
||||
if (constraint) {
|
||||
if (result = isRelatedTo(source, constraint, reportErrors)) {
|
||||
errorInfo = saveErrorInfo;
|
||||
@@ -10447,21 +10506,21 @@ namespace ts {
|
||||
const template = getTemplateTypeFromMappedType(target);
|
||||
const modifiers = getMappedTypeModifiers(target);
|
||||
if (!(modifiers & MappedTypeModifiers.ExcludeOptional)) {
|
||||
if (template.flags & TypeFlags.IndexedAccess && (<IndexedAccessType>template).objectType === source &&
|
||||
(<IndexedAccessType>template).indexType === getTypeParameterFromMappedType(target)) {
|
||||
return Ternary.True;
|
||||
}
|
||||
// A source type T is related to a target type { [P in keyof T]: X } if T[P] is related to X.
|
||||
if (!isGenericMappedType(source) && getConstraintTypeFromMappedType(target) === getIndexType(source)) {
|
||||
const indexedAccessType = getIndexedAccessType(source, getTypeParameterFromMappedType(target));
|
||||
const templateType = getTemplateTypeFromMappedType(target);
|
||||
if (result = isRelatedTo(indexedAccessType, templateType, reportErrors)) {
|
||||
errorInfo = saveErrorInfo;
|
||||
return result;
|
||||
if (template.flags & TypeFlags.IndexedAccess && (<IndexedAccessType>template).objectType === source &&
|
||||
(<IndexedAccessType>template).indexType === getTypeParameterFromMappedType(target)) {
|
||||
return Ternary.True;
|
||||
}
|
||||
// A source type T is related to a target type { [P in keyof T]: X } if T[P] is related to X.
|
||||
if (!isGenericMappedType(source) && getConstraintTypeFromMappedType(target) === getIndexType(source)) {
|
||||
const indexedAccessType = getIndexedAccessType(source, getTypeParameterFromMappedType(target));
|
||||
const templateType = getTemplateTypeFromMappedType(target);
|
||||
if (result = isRelatedTo(indexedAccessType, templateType, reportErrors)) {
|
||||
errorInfo = saveErrorInfo;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (source.flags & TypeFlags.TypeParameter) {
|
||||
let constraint = getConstraintForRelation(<TypeParameter>source);
|
||||
@@ -10479,16 +10538,8 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
else if (source.flags & TypeFlags.IndexedAccess) {
|
||||
// A type S[K] is related to a type T if A[K] is related to T, where K is string-like and
|
||||
// A is the apparent type of S.
|
||||
const constraint = getConstraintForRelation(<IndexedAccessType>source);
|
||||
if (constraint) {
|
||||
if (result = isRelatedTo(constraint, target, reportErrors)) {
|
||||
errorInfo = saveErrorInfo;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
else if (target.flags & TypeFlags.IndexedAccess) {
|
||||
if (target.flags & TypeFlags.IndexedAccess) {
|
||||
// A type S[K] is related to a type T[J] if S is related to T and K is related to J.
|
||||
if (result = isRelatedTo((<IndexedAccessType>source).objectType, (<IndexedAccessType>target).objectType, reportErrors)) {
|
||||
result &= isRelatedTo((<IndexedAccessType>source).indexType, (<IndexedAccessType>target).indexType, reportErrors);
|
||||
}
|
||||
@@ -10497,6 +10548,21 @@ namespace ts {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
// A type S[K] is related to a type T if C is related to T, where C is the
|
||||
// constraint of S[K].
|
||||
const constraint = getConstraintForRelation(<IndexedAccessType>source);
|
||||
if (constraint) {
|
||||
if (result = isRelatedTo(constraint, target, reportErrors)) {
|
||||
errorInfo = saveErrorInfo;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (source.flags & TypeFlags.Index) {
|
||||
if (result = isRelatedTo(keyofConstraintType, target, reportErrors)) {
|
||||
errorInfo = saveErrorInfo;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
else if (source.flags & TypeFlags.Conditional) {
|
||||
if (target.flags & TypeFlags.Conditional) {
|
||||
@@ -10889,8 +10955,7 @@ namespace ts {
|
||||
continue;
|
||||
}
|
||||
// Skip over symbol-named members
|
||||
const nameType = getLiteralTypeFromPropertyName(prop);
|
||||
if (nameType !== undefined && !(isRelatedTo(nameType, stringType) || isRelatedTo(nameType, numberType))) {
|
||||
if (prop.nameType && prop.nameType.flags & TypeFlags.UniqueESSymbol) {
|
||||
continue;
|
||||
}
|
||||
if (kind === IndexKind.String || isNumericLiteralName(prop.escapedName)) {
|
||||
@@ -11493,6 +11558,9 @@ namespace ts {
|
||||
if (source.valueDeclaration) {
|
||||
symbol.valueDeclaration = source.valueDeclaration;
|
||||
}
|
||||
if (source.nameType) {
|
||||
symbol.nameType = source.nameType;
|
||||
}
|
||||
return symbol;
|
||||
}
|
||||
|
||||
@@ -11535,7 +11603,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
function createWideningContext(parent: WideningContext, propertyName: __String, siblings: Type[]): WideningContext {
|
||||
return { parent, propertyName, siblings, resolvedPropertyNames: undefined };
|
||||
return { parent, propertyName, siblings, resolvedProperties: undefined };
|
||||
}
|
||||
|
||||
function getSiblingsOfContext(context: WideningContext): Type[] {
|
||||
@@ -11556,19 +11624,19 @@ namespace ts {
|
||||
return context.siblings;
|
||||
}
|
||||
|
||||
function getPropertyNamesOfContext(context: WideningContext): __String[] {
|
||||
if (!context.resolvedPropertyNames) {
|
||||
const names = createMap<boolean>() as UnderscoreEscapedMap<boolean>;
|
||||
function getPropertiesOfContext(context: WideningContext): Symbol[] {
|
||||
if (!context.resolvedProperties) {
|
||||
const names = createMap<Symbol>() as UnderscoreEscapedMap<Symbol>;
|
||||
for (const t of getSiblingsOfContext(context)) {
|
||||
if (isObjectLiteralType(t) && !(getObjectFlags(t) & ObjectFlags.ContainsSpread)) {
|
||||
for (const prop of getPropertiesOfType(t)) {
|
||||
names.set(prop.escapedName, true);
|
||||
names.set(prop.escapedName, prop);
|
||||
}
|
||||
}
|
||||
}
|
||||
context.resolvedPropertyNames = arrayFrom(names.keys());
|
||||
context.resolvedProperties = arrayFrom(names.values());
|
||||
}
|
||||
return context.resolvedPropertyNames;
|
||||
return context.resolvedProperties;
|
||||
}
|
||||
|
||||
function getWidenedProperty(prop: Symbol, context: WideningContext): Symbol {
|
||||
@@ -11578,18 +11646,14 @@ namespace ts {
|
||||
return widened === original ? prop : createSymbolWithType(prop, widened);
|
||||
}
|
||||
|
||||
function getUndefinedProperty(name: __String) {
|
||||
const cached = undefinedProperties.get(name);
|
||||
function getUndefinedProperty(prop: Symbol) {
|
||||
const cached = undefinedProperties.get(prop.escapedName);
|
||||
if (cached) {
|
||||
return cached;
|
||||
}
|
||||
const result = createSymbol(SymbolFlags.Property | SymbolFlags.Optional, name);
|
||||
result.type = undefinedType;
|
||||
const associatedKeyType = getLiteralType(unescapeLeadingUnderscores(name));
|
||||
if (associatedKeyType.flags & TypeFlags.StringLiteral) {
|
||||
result.nameType = associatedKeyType;
|
||||
}
|
||||
undefinedProperties.set(name, result);
|
||||
const result = createSymbolWithType(prop, undefinedType);
|
||||
result.flags |= SymbolFlags.Optional;
|
||||
undefinedProperties.set(prop.escapedName, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -11601,9 +11665,9 @@ namespace ts {
|
||||
members.set(prop.escapedName, prop.flags & SymbolFlags.Property ? getWidenedProperty(prop, context) : prop);
|
||||
}
|
||||
if (context) {
|
||||
for (const name of getPropertyNamesOfContext(context)) {
|
||||
if (!members.has(name)) {
|
||||
members.set(name, getUndefinedProperty(name));
|
||||
for (const prop of getPropertiesOfContext(context)) {
|
||||
if (!members.has(prop.escapedName)) {
|
||||
members.set(prop.escapedName, getUndefinedProperty(prop));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12360,14 +12424,13 @@ namespace ts {
|
||||
inferredType = getTypeFromInference(inference);
|
||||
}
|
||||
|
||||
inferredType = getWidenedUniqueESSymbolType(inferredType);
|
||||
inference.inferredType = inferredType;
|
||||
|
||||
const constraint = getConstraintOfTypeParameter(inference.typeParameter);
|
||||
if (constraint) {
|
||||
const instantiatedConstraint = instantiateType(constraint, context);
|
||||
if (!context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
|
||||
inference.inferredType = inferredType = getWidenedUniqueESSymbolType(instantiatedConstraint);
|
||||
inference.inferredType = inferredType = instantiatedConstraint;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15311,7 +15374,7 @@ namespace ts {
|
||||
// type, and any union of these types (like string | number).
|
||||
if (links.resolvedType.flags & TypeFlags.Nullable ||
|
||||
!isTypeAssignableToKind(links.resolvedType, TypeFlags.StringLike | TypeFlags.NumberLike | TypeFlags.ESSymbolLike) &&
|
||||
!isTypeAssignableTo(links.resolvedType, getUnionType([stringType, numberType, esSymbolType]))) {
|
||||
!isTypeAssignableTo(links.resolvedType, stringNumberSymbolType)) {
|
||||
error(node, Diagnostics.A_computed_property_name_must_be_of_type_string_number_symbol_or_any);
|
||||
}
|
||||
else {
|
||||
@@ -15352,6 +15415,7 @@ namespace ts {
|
||||
let patternWithComputedProperties = false;
|
||||
let hasComputedStringProperty = false;
|
||||
let hasComputedNumberProperty = false;
|
||||
|
||||
if (isInJSFile && node.properties.length === 0) {
|
||||
// an empty JS object literal that nonetheless has members is a JS namespace
|
||||
const symbol = getSymbolOfNode(node);
|
||||
@@ -15367,47 +15431,28 @@ namespace ts {
|
||||
for (let i = 0; i < node.properties.length; i++) {
|
||||
const memberDecl = node.properties[i];
|
||||
let member = getSymbolOfNode(memberDecl);
|
||||
let literalName: __String | undefined;
|
||||
const computedNameType = memberDecl.name && memberDecl.name.kind === SyntaxKind.ComputedPropertyName && !isWellKnownSymbolSyntactically(memberDecl.name.expression) ?
|
||||
checkComputedPropertyName(memberDecl.name) : undefined;
|
||||
if (memberDecl.kind === SyntaxKind.PropertyAssignment ||
|
||||
memberDecl.kind === SyntaxKind.ShorthandPropertyAssignment ||
|
||||
isObjectLiteralMethod(memberDecl)) {
|
||||
let jsdocType: Type;
|
||||
let type = memberDecl.kind === SyntaxKind.PropertyAssignment ? checkPropertyAssignment(memberDecl, checkMode) :
|
||||
memberDecl.kind === SyntaxKind.ShorthandPropertyAssignment ? checkExpressionForMutableLocation(memberDecl.name, checkMode) :
|
||||
checkObjectLiteralMethod(memberDecl, checkMode);
|
||||
if (isInJSFile) {
|
||||
jsdocType = getTypeForDeclarationFromJSDocComment(memberDecl);
|
||||
}
|
||||
|
||||
let type: Type;
|
||||
if (memberDecl.kind === SyntaxKind.PropertyAssignment) {
|
||||
if (memberDecl.name.kind === SyntaxKind.ComputedPropertyName) {
|
||||
const t = checkComputedPropertyName(memberDecl.name);
|
||||
if (t.flags & TypeFlags.Literal) {
|
||||
literalName = escapeLeadingUnderscores("" + (t as LiteralType).value);
|
||||
}
|
||||
const jsDocType = getTypeForDeclarationFromJSDocComment(memberDecl);
|
||||
if (jsDocType) {
|
||||
checkTypeAssignableTo(type, jsDocType, memberDecl);
|
||||
type = jsDocType;
|
||||
}
|
||||
type = checkPropertyAssignment(memberDecl, checkMode);
|
||||
}
|
||||
else if (memberDecl.kind === SyntaxKind.MethodDeclaration) {
|
||||
type = checkObjectLiteralMethod(memberDecl, checkMode);
|
||||
}
|
||||
else {
|
||||
Debug.assert(memberDecl.kind === SyntaxKind.ShorthandPropertyAssignment);
|
||||
type = checkExpressionForMutableLocation(memberDecl.name, checkMode);
|
||||
}
|
||||
|
||||
if (jsdocType) {
|
||||
checkTypeAssignableTo(type, jsdocType, memberDecl);
|
||||
type = jsdocType;
|
||||
}
|
||||
|
||||
typeFlags |= type.flags;
|
||||
|
||||
const nameType = hasLateBindableName(memberDecl) ? checkComputedPropertyName(memberDecl.name) : undefined;
|
||||
const hasLateBoundName = nameType && isTypeUsableAsLateBoundName(nameType);
|
||||
const prop = hasLateBoundName
|
||||
? createSymbol(SymbolFlags.Property | member.flags, getLateBoundNameFromType(nameType as LiteralType | UniqueESSymbolType), CheckFlags.Late)
|
||||
: createSymbol(SymbolFlags.Property | member.flags, literalName || member.escapedName);
|
||||
|
||||
if (hasLateBoundName) {
|
||||
const nameType = computedNameType && computedNameType.flags & TypeFlags.StringOrNumberLiteralOrUnique ?
|
||||
<LiteralType | UniqueESSymbolType>computedNameType : undefined;
|
||||
const prop = nameType ?
|
||||
createSymbol(SymbolFlags.Property | member.flags, getLateBoundNameFromType(nameType), CheckFlags.Late) :
|
||||
createSymbol(SymbolFlags.Property | member.flags, member.escapedName);
|
||||
if (nameType) {
|
||||
prop.nameType = nameType;
|
||||
}
|
||||
|
||||
@@ -15420,9 +15465,6 @@ namespace ts {
|
||||
if (isOptional) {
|
||||
prop.flags |= SymbolFlags.Optional;
|
||||
}
|
||||
if (!literalName && hasDynamicName(memberDecl)) {
|
||||
patternWithComputedProperties = true;
|
||||
}
|
||||
}
|
||||
else if (contextualTypeHasPattern && !(getObjectFlags(contextualType) & ObjectFlags.ObjectLiteralPatternWithComputedProperties)) {
|
||||
// If object literal is contextually typed by the implied type of a binding pattern, and if the
|
||||
@@ -15478,12 +15520,17 @@ namespace ts {
|
||||
checkNodeDeferred(memberDecl);
|
||||
}
|
||||
|
||||
if (!literalName && hasNonBindableDynamicName(memberDecl)) {
|
||||
if (isNumericName(memberDecl.name)) {
|
||||
hasComputedNumberProperty = true;
|
||||
}
|
||||
else {
|
||||
hasComputedStringProperty = true;
|
||||
if (computedNameType && !(computedNameType.flags & TypeFlags.StringOrNumberLiteralOrUnique)) {
|
||||
if (isTypeAssignableTo(computedNameType, stringNumberSymbolType)) {
|
||||
if (isTypeAssignableTo(computedNameType, numberType)) {
|
||||
hasComputedNumberProperty = true;
|
||||
}
|
||||
else {
|
||||
hasComputedStringProperty = true;
|
||||
}
|
||||
if (inDestructuringPattern) {
|
||||
patternWithComputedProperties = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -20045,6 +20092,15 @@ namespace ts {
|
||||
return widened;
|
||||
}
|
||||
|
||||
function isTypeParameterWithKeyofConstraint(type: Type) {
|
||||
if (type.flags & TypeFlags.TypeParameter) {
|
||||
const constraintDeclaration = getConstraintDeclaration(<TypeParameter>type);
|
||||
return constraintDeclaration && constraintDeclaration.kind === SyntaxKind.TypeOperator &&
|
||||
(<TypeOperatorNode>constraintDeclaration).operator === SyntaxKind.KeyOfKeyword;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function isLiteralOfContextualType(candidateType: Type, contextualType: Type): boolean {
|
||||
if (contextualType) {
|
||||
if (contextualType.flags & TypeFlags.UnionOrIntersection) {
|
||||
@@ -20056,7 +20112,8 @@ namespace ts {
|
||||
// this a literal context for literals of that primitive type. For example, given a
|
||||
// type parameter 'T extends string', infer string literal types for T.
|
||||
const constraint = getBaseConstraintOfType(contextualType) || emptyObjectType;
|
||||
return constraint.flags & TypeFlags.String && maybeTypeOfKind(candidateType, TypeFlags.StringLiteral) ||
|
||||
return isTypeParameterWithKeyofConstraint(contextualType) && maybeTypeOfKind(candidateType, TypeFlags.StringLiteral | TypeFlags.NumberLiteral | TypeFlags.UniqueESSymbol) ||
|
||||
constraint.flags & TypeFlags.String && maybeTypeOfKind(candidateType, TypeFlags.StringLiteral) ||
|
||||
constraint.flags & TypeFlags.Number && maybeTypeOfKind(candidateType, TypeFlags.NumberLiteral) ||
|
||||
constraint.flags & TypeFlags.Boolean && maybeTypeOfKind(candidateType, TypeFlags.BooleanLiteral) ||
|
||||
constraint.flags & TypeFlags.ESSymbol && maybeTypeOfKind(candidateType, TypeFlags.UniqueESSymbol) ||
|
||||
@@ -20985,7 +21042,7 @@ namespace ts {
|
||||
// Check if the index type is assignable to 'keyof T' for the object type.
|
||||
const objectType = (<IndexedAccessType>type).objectType;
|
||||
const indexType = (<IndexedAccessType>type).indexType;
|
||||
if (isTypeAssignableTo(indexType, getIndexType(objectType, /*includeDeclaredTypes*/ true))) {
|
||||
if (isTypeAssignableTo(indexType, getIndexType(objectType, /*stringsOnly*/ false))) {
|
||||
if (accessNode.kind === SyntaxKind.ElementAccessExpression && isAssignmentTarget(accessNode) &&
|
||||
getObjectFlags(objectType) & ObjectFlags.Mapped && getMappedTypeModifiers(<MappedType>objectType) & MappedTypeModifiers.IncludeReadonly) {
|
||||
error(accessNode, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType));
|
||||
@@ -21017,7 +21074,7 @@ namespace ts {
|
||||
|
||||
const type = <MappedType>getTypeFromMappedTypeNode(node);
|
||||
const constraintType = getConstraintTypeFromMappedType(type);
|
||||
checkTypeAssignableTo(constraintType, stringType, node.typeParameter.constraint);
|
||||
checkTypeAssignableTo(constraintType, keyofConstraintType, node.typeParameter.constraint);
|
||||
}
|
||||
|
||||
function checkTypeOperator(node: TypeOperatorNode) {
|
||||
@@ -24090,6 +24147,9 @@ namespace ts {
|
||||
case SyntaxKind.AsteriskAsteriskToken: return left ** right;
|
||||
}
|
||||
}
|
||||
else if (typeof left === "string" && typeof right === "string" && (<BinaryExpression>expr).operatorToken.kind === SyntaxKind.PlusToken) {
|
||||
return left + right;
|
||||
}
|
||||
break;
|
||||
case SyntaxKind.StringLiteral:
|
||||
return (<StringLiteral>expr).text;
|
||||
|
||||
@@ -672,6 +672,12 @@ namespace ts {
|
||||
category: Diagnostics.Advanced_Options,
|
||||
description: Diagnostics.Disable_strict_checking_of_generic_signatures_in_function_types,
|
||||
},
|
||||
{
|
||||
name: "keyofStringsOnly",
|
||||
type: "boolean",
|
||||
category: Diagnostics.Advanced_Options,
|
||||
description: Diagnostics.Resolve_keyof_to_string_valued_property_names_only_no_numbers_or_symbols,
|
||||
},
|
||||
{
|
||||
// A list of plugins to load in the language service
|
||||
name: "plugins",
|
||||
|
||||
@@ -2212,6 +2212,15 @@ namespace ts {
|
||||
return absolutePath;
|
||||
}
|
||||
|
||||
export function getRelativePath(path: string, directoryPath: string, getCanonicalFileName: GetCanonicalFileName) {
|
||||
const relativePath = getRelativePathToDirectoryOrUrl(directoryPath, path, directoryPath, getCanonicalFileName, /*isAbsolutePathAnUrl*/ false);
|
||||
return ensurePathIsRelative(relativePath);
|
||||
}
|
||||
|
||||
export function ensurePathIsRelative(path: string): string {
|
||||
return !pathIsRelative(path) ? "./" + path : path;
|
||||
}
|
||||
|
||||
export function getBaseFileName(path: string) {
|
||||
if (path === undefined) {
|
||||
return undefined;
|
||||
|
||||
@@ -3526,6 +3526,10 @@
|
||||
"category": "Message",
|
||||
"code": 6194
|
||||
},
|
||||
"Resolve 'keyof' to string valued property names only (no numbers or symbols).": {
|
||||
"category": "Message",
|
||||
"code": 6195
|
||||
},
|
||||
"Variable '{0}' implicitly has an '{1}' type.": {
|
||||
"category": "Error",
|
||||
"code": 7005
|
||||
|
||||
@@ -444,6 +444,12 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
export function resolveModuleNameFromCache(moduleName: string, containingFile: string, cache: ModuleResolutionCache): ResolvedModuleWithFailedLookupLocations | undefined {
|
||||
const containingDirectory = getDirectoryPath(containingFile);
|
||||
const perFolderCache = cache && cache.getOrCreateCacheForDirectory(containingDirectory);
|
||||
return perFolderCache && perFolderCache.get(moduleName);
|
||||
}
|
||||
|
||||
export function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache): ResolvedModuleWithFailedLookupLocations {
|
||||
const traceEnabled = isTraceEnabled(compilerOptions, host);
|
||||
if (traceEnabled) {
|
||||
|
||||
@@ -622,9 +622,6 @@ namespace ts {
|
||||
|
||||
Debug.assert(!!missingFilePaths);
|
||||
|
||||
// unconditionally set moduleResolutionCache to undefined to avoid unnecessary leaks
|
||||
moduleResolutionCache = undefined;
|
||||
|
||||
// Release any files we have acquired in the old program but are
|
||||
// not part of the new program.
|
||||
if (oldProgram && host.onReleaseOldSourceFile) {
|
||||
@@ -670,7 +667,8 @@ namespace ts {
|
||||
sourceFileToPackageName,
|
||||
redirectTargetsSet,
|
||||
isEmittedFile,
|
||||
getConfigFileParsingDiagnostics
|
||||
getConfigFileParsingDiagnostics,
|
||||
getResolvedModuleWithFailedLookupLocationsFromCache,
|
||||
};
|
||||
|
||||
verifyCompilerOptions();
|
||||
@@ -679,6 +677,10 @@ namespace ts {
|
||||
|
||||
return program;
|
||||
|
||||
function getResolvedModuleWithFailedLookupLocationsFromCache(moduleName: string, containingFile: string): ResolvedModuleWithFailedLookupLocations {
|
||||
return moduleResolutionCache && resolveModuleNameFromCache(moduleName, containingFile, moduleResolutionCache);
|
||||
}
|
||||
|
||||
function toPath(fileName: string): Path {
|
||||
return ts.toPath(fileName, currentDirectory, getCanonicalFileName);
|
||||
}
|
||||
|
||||
+14
-11
@@ -2332,7 +2332,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
export interface JSDocTag extends Node {
|
||||
parent: JSDoc;
|
||||
parent: JSDoc | JSDocTypeLiteral;
|
||||
atToken: AtToken;
|
||||
tagName: Identifier;
|
||||
comment: string | undefined;
|
||||
@@ -2725,6 +2725,8 @@ namespace ts {
|
||||
/* @internal */ redirectTargetsSet: Map<true>;
|
||||
/** Is the file emitted file */
|
||||
/* @internal */ isEmittedFile(file: string): boolean;
|
||||
|
||||
/* @internal */ getResolvedModuleWithFailedLookupLocationsFromCache(moduleName: string, containingFile: string): ResolvedModuleWithFailedLookupLocations | undefined;
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
@@ -3375,6 +3377,7 @@ namespace ts {
|
||||
/* @internal */ mergeId?: number; // Merge id (used to look up merged symbol)
|
||||
/* @internal */ parent?: Symbol; // Parent symbol
|
||||
/* @internal */ exportSymbol?: Symbol; // Exported symbol associated with this symbol
|
||||
/* @internal */ nameType?: Type; // Type associated with a late-bound symbol
|
||||
/* @internal */ constEnumOnlyModule?: boolean; // True if module contains only const enums or other modules with only const enums
|
||||
/* @internal */ isReferenced?: SymbolFlags; // True if the symbol is referenced elsewhere. Keeps track of the meaning of a reference in case a symbol is both a type parameter and parameter.
|
||||
/* @internal */ isReplaceableByMethod?: boolean; // Can this Javascript class property be replaced by a method symbol?
|
||||
@@ -3409,7 +3412,6 @@ namespace ts {
|
||||
enumKind?: EnumKind; // Enum declaration classification
|
||||
originatingImport?: ImportDeclaration | ImportCall; // Import declaration which produced the symbol, present if the symbol is marked as uncallable but had call signatures in `resolveESModuleSymbol`
|
||||
lateSymbol?: Symbol; // Late-bound symbol for a computed property
|
||||
nameType?: Type; // Type associate with a late-bound or mapped type property symbol's name
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
@@ -3606,7 +3608,7 @@ namespace ts {
|
||||
Intrinsic = Any | String | Number | Boolean | BooleanLiteral | ESSymbol | Void | Undefined | Null | Never | NonPrimitive,
|
||||
/* @internal */
|
||||
Primitive = String | Number | Boolean | Enum | EnumLiteral | ESSymbol | Void | Undefined | Null | Literal | UniqueESSymbol,
|
||||
StringLike = String | StringLiteral | Index,
|
||||
StringLike = String | StringLiteral,
|
||||
NumberLike = Number | NumberLiteral | Enum,
|
||||
BooleanLike = Boolean | BooleanLiteral,
|
||||
EnumLike = Enum | EnumLiteral,
|
||||
@@ -3763,7 +3765,7 @@ namespace ts {
|
||||
/* @internal */
|
||||
resolvedIndexType: IndexType;
|
||||
/* @internal */
|
||||
resolvedDeclaredIndexType: IndexType;
|
||||
resolvedStringIndexType: IndexType;
|
||||
/* @internal */
|
||||
resolvedBaseConstraint: Type;
|
||||
/* @internal */
|
||||
@@ -3852,7 +3854,7 @@ namespace ts {
|
||||
/* @internal */
|
||||
resolvedIndexType?: IndexType;
|
||||
/* @internal */
|
||||
resolvedDeclaredIndexType?: IndexType;
|
||||
resolvedStringIndexType?: IndexType;
|
||||
}
|
||||
|
||||
// Type parameters (TypeFlags.TypeParameter)
|
||||
@@ -3884,9 +3886,9 @@ namespace ts {
|
||||
|
||||
// keyof T types (TypeFlags.Index)
|
||||
export interface IndexType extends InstantiableType {
|
||||
/* @internal */
|
||||
isDeclaredType?: boolean;
|
||||
type: InstantiableType | UnionOrIntersectionType;
|
||||
/* @internal */
|
||||
stringsOnly: boolean;
|
||||
}
|
||||
|
||||
export interface ConditionalRoot {
|
||||
@@ -4045,10 +4047,10 @@ namespace ts {
|
||||
|
||||
/* @internal */
|
||||
export interface WideningContext {
|
||||
parent?: WideningContext; // Parent context
|
||||
propertyName?: __String; // Name of property in parent
|
||||
siblings?: Type[]; // Types of siblings
|
||||
resolvedPropertyNames?: __String[]; // Property names occurring in sibling object literals
|
||||
parent?: WideningContext; // Parent context
|
||||
propertyName?: __String; // Name of property in parent
|
||||
siblings?: Type[]; // Types of siblings
|
||||
resolvedProperties?: Symbol[]; // Properties occurring in sibling object literals
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
@@ -4163,6 +4165,7 @@ namespace ts {
|
||||
inlineSources?: boolean;
|
||||
isolatedModules?: boolean;
|
||||
jsx?: JsxEmit;
|
||||
keyofStringsOnly?: boolean;
|
||||
lib?: string[];
|
||||
/*@internal*/listEmittedFiles?: boolean;
|
||||
/*@internal*/listFiles?: boolean;
|
||||
|
||||
+17
-16
@@ -1818,10 +1818,8 @@ namespace ts {
|
||||
|
||||
function getJSDocCommentsAndTagsWorker(node: Node): void {
|
||||
const parent = node.parent;
|
||||
if (parent &&
|
||||
(parent.kind === SyntaxKind.PropertyAssignment ||
|
||||
parent.kind === SyntaxKind.PropertyDeclaration ||
|
||||
getNestedModuleDeclaration(parent))) {
|
||||
if (!parent) return;
|
||||
if (parent.kind === SyntaxKind.PropertyAssignment || parent.kind === SyntaxKind.PropertyDeclaration || getNestedModuleDeclaration(parent)) {
|
||||
getJSDocCommentsAndTagsWorker(parent);
|
||||
}
|
||||
// Try to recognize this pattern when node is initializer of variable declaration and JSDoc comments are on containing variable statement.
|
||||
@@ -1830,16 +1828,18 @@ namespace ts {
|
||||
// * @returns {number}
|
||||
// */
|
||||
// var x = function(name) { return name.length; }
|
||||
if (parent && parent.parent &&
|
||||
if (parent.parent &&
|
||||
(getSingleVariableOfVariableStatement(parent.parent) === node || getSourceOfAssignment(parent.parent))) {
|
||||
getJSDocCommentsAndTagsWorker(parent.parent);
|
||||
}
|
||||
if (parent && parent.parent && parent.parent.parent &&
|
||||
(getSingleInitializerOfVariableStatementOrPropertyDeclaration(parent.parent.parent) === node || getSourceOfDefaultedAssignment(parent.parent.parent))) {
|
||||
if (parent.parent && parent.parent.parent &&
|
||||
(getSingleVariableOfVariableStatement(parent.parent.parent) ||
|
||||
getSingleInitializerOfVariableStatementOrPropertyDeclaration(parent.parent.parent) === node ||
|
||||
getSourceOfDefaultedAssignment(parent.parent.parent))) {
|
||||
getJSDocCommentsAndTagsWorker(parent.parent.parent);
|
||||
}
|
||||
if (isBinaryExpression(node) && getSpecialPropertyAssignmentKind(node) !== SpecialPropertyAssignmentKind.None ||
|
||||
parent && isBinaryExpression(parent) && getSpecialPropertyAssignmentKind(parent) !== SpecialPropertyAssignmentKind.None ||
|
||||
isBinaryExpression(parent) && getSpecialPropertyAssignmentKind(parent) !== SpecialPropertyAssignmentKind.None ||
|
||||
node.kind === SyntaxKind.PropertyAccessExpression && node.parent && node.parent.kind === SyntaxKind.ExpressionStatement) {
|
||||
getJSDocCommentsAndTagsWorker(parent);
|
||||
}
|
||||
@@ -1888,6 +1888,9 @@ namespace ts {
|
||||
}
|
||||
|
||||
export function getJSDocHost(node: JSDocTag): HasJSDoc {
|
||||
while (node.parent.kind === SyntaxKind.JSDocTypeLiteral) {
|
||||
node = node.parent.parent.parent as JSDocParameterTag;
|
||||
}
|
||||
Debug.assert(node.parent!.kind === SyntaxKind.JSDocComment);
|
||||
return node.parent!.parent!;
|
||||
}
|
||||
@@ -2137,11 +2140,13 @@ namespace ts {
|
||||
node.kind === SyntaxKind.NamespaceImport ||
|
||||
node.kind === SyntaxKind.ImportSpecifier ||
|
||||
node.kind === SyntaxKind.ExportSpecifier ||
|
||||
node.kind === SyntaxKind.ExportAssignment && exportAssignmentIsAlias(<ExportAssignment>node);
|
||||
node.kind === SyntaxKind.ExportAssignment && exportAssignmentIsAlias(<ExportAssignment>node) ||
|
||||
isBinaryExpression(node) && getSpecialPropertyAssignmentKind(node) === SpecialPropertyAssignmentKind.ModuleExports;
|
||||
}
|
||||
|
||||
export function exportAssignmentIsAlias(node: ExportAssignment): boolean {
|
||||
return isEntityNameExpression(node.expression);
|
||||
export function exportAssignmentIsAlias(node: ExportAssignment | BinaryExpression): boolean {
|
||||
const e = isExportAssignment(node) ? node.expression : node.right;
|
||||
return isEntityNameExpression(e) || isClassExpression(e);
|
||||
}
|
||||
|
||||
export function getClassExtendsHeritageClauseElement(node: ClassLikeDeclaration | InterfaceDeclaration) {
|
||||
@@ -2933,11 +2938,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
export function getFirstConstructorWithBody(node: ClassLikeDeclaration): ConstructorDeclaration {
|
||||
return forEach(node.members, member => {
|
||||
if (member.kind === SyntaxKind.Constructor && nodeIsPresent((<ConstructorDeclaration>member).body)) {
|
||||
return <ConstructorDeclaration>member;
|
||||
}
|
||||
});
|
||||
return find(node.members, (member): member is ConstructorDeclaration => isConstructorDeclaration(member) && nodeIsPresent(member.body));
|
||||
}
|
||||
|
||||
function getSetAccessorValueParameter(accessor: SetAccessorDeclaration): ParameterDeclaration | undefined {
|
||||
|
||||
+29
-5
@@ -33,14 +33,32 @@ namespace ts {
|
||||
Diagnostics.Found_0_errors_Watching_for_file_changes.code
|
||||
];
|
||||
|
||||
function clearScreenIfNotWatchingForFileChanges(system: System, diagnostic: Diagnostic, options: CompilerOptions) {
|
||||
/**
|
||||
* @returns Whether the screen was cleared.
|
||||
*/
|
||||
function clearScreenIfNotWatchingForFileChanges(system: System, diagnostic: Diagnostic, options: CompilerOptions): boolean {
|
||||
if (system.clearScreen &&
|
||||
!options.preserveWatchOutput &&
|
||||
!options.extendedDiagnostics &&
|
||||
!options.diagnostics &&
|
||||
!contains(nonClearingMessageCodes, diagnostic.code)) {
|
||||
system.clearScreen();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
export const screenStartingMessageCodes: number[] = [
|
||||
Diagnostics.Starting_compilation_in_watch_mode.code,
|
||||
Diagnostics.File_change_detected_Starting_incremental_compilation.code,
|
||||
];
|
||||
|
||||
function getPlainDiagnosticFollowingNewLines(diagnostic: Diagnostic, newLine: string): string {
|
||||
return contains(screenStartingMessageCodes, diagnostic.code)
|
||||
? newLine + newLine
|
||||
: newLine;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -51,13 +69,19 @@ namespace ts {
|
||||
(diagnostic, newLine, options) => {
|
||||
clearScreenIfNotWatchingForFileChanges(system, diagnostic, options);
|
||||
let output = `[${formatColorAndReset(new Date().toLocaleTimeString(), ForegroundColorEscapeSequences.Grey)}] `;
|
||||
output += `${flattenDiagnosticMessageText(diagnostic.messageText, system.newLine)}${newLine + newLine + newLine}`;
|
||||
output += `${flattenDiagnosticMessageText(diagnostic.messageText, system.newLine)}${newLine + newLine}`;
|
||||
system.write(output);
|
||||
} :
|
||||
(diagnostic, newLine, options) => {
|
||||
clearScreenIfNotWatchingForFileChanges(system, diagnostic, options);
|
||||
let output = new Date().toLocaleTimeString() + " - ";
|
||||
output += `${flattenDiagnosticMessageText(diagnostic.messageText, system.newLine)}${newLine + newLine + newLine}`;
|
||||
let output = "";
|
||||
|
||||
if (!clearScreenIfNotWatchingForFileChanges(system, diagnostic, options)) {
|
||||
output += newLine;
|
||||
}
|
||||
|
||||
output += `${new Date().toLocaleTimeString()} - `;
|
||||
output += `${flattenDiagnosticMessageText(diagnostic.messageText, system.newLine)}${getPlainDiagnosticFollowingNewLines(diagnostic, newLine)}`;
|
||||
|
||||
system.write(output);
|
||||
};
|
||||
}
|
||||
|
||||
+25
-14
@@ -283,14 +283,10 @@ namespace FourSlash {
|
||||
});
|
||||
const fs = new vfs.FileSystem(/*ignoreCase*/ true, { cwd: baseDir, files });
|
||||
const host = new fakes.ParseConfigHost(fs);
|
||||
|
||||
const configJsonObj = ts.parseConfigFileTextToJson(configFileName, this.inputFiles.get(configFileName));
|
||||
assert.isTrue(configJsonObj.config !== undefined);
|
||||
|
||||
compilationOptions = ts.parseJsonConfigFileContent(configJsonObj.config, host, baseDir, compilationOptions, configFileName).options;
|
||||
const jsonSourceFile = ts.parseJsonText(configFileName, this.inputFiles.get(configFileName));
|
||||
compilationOptions = ts.parseJsonSourceFileConfigFileContent(jsonSourceFile, host, baseDir, compilationOptions, configFileName).options;
|
||||
}
|
||||
|
||||
|
||||
if (compilationOptions.typeRoots) {
|
||||
compilationOptions.typeRoots = compilationOptions.typeRoots.map(p => ts.getNormalizedAbsolutePath(p, this.basePath));
|
||||
}
|
||||
@@ -852,6 +848,7 @@ namespace FourSlash {
|
||||
|
||||
const actualCompletions = this.getCompletionListAtCaret(options);
|
||||
if (!actualCompletions) {
|
||||
if (expected === undefined) return;
|
||||
this.raiseError(`No completions at position '${this.currentCaretPosition}'.`);
|
||||
}
|
||||
|
||||
@@ -2432,14 +2429,7 @@ Actual: ${stringify(fullActual)}`);
|
||||
public applyCodeActionFromCompletion(markerName: string, options: FourSlashInterface.VerifyCompletionActionOptions) {
|
||||
this.goToMarker(markerName);
|
||||
|
||||
const actualCompletion = this.getCompletionListAtCaret({ ...ts.defaultPreferences, includeCompletionsForModuleExports: true }).entries.find(e =>
|
||||
e.name === options.name && e.source === options.source);
|
||||
|
||||
if (!actualCompletion.hasAction) {
|
||||
this.raiseError(`Completion for ${options.name} does not have an associated action.`);
|
||||
}
|
||||
|
||||
const details = this.getCompletionEntryDetails(options.name, actualCompletion.source, options.preferences);
|
||||
const details = this.getCompletionEntryDetails(options.name, options.source, options.preferences);
|
||||
if (details.codeActions.length !== 1) {
|
||||
this.raiseError(`Expected one code action, got ${details.codeActions.length}`);
|
||||
}
|
||||
@@ -3289,6 +3279,15 @@ Actual: ${stringify(fullActual)}`);
|
||||
private static textSpansEqual(a: ts.TextSpan, b: ts.TextSpan) {
|
||||
return a && b && a.start === b.start && a.length === b.length;
|
||||
}
|
||||
|
||||
public getEditsForFileRename(options: FourSlashInterface.GetEditsForFileRenameOptions): void {
|
||||
const changes = this.languageService.getEditsForFileRename(options.oldPath, options.newPath, this.formatCodeSettings);
|
||||
this.applyChanges(changes);
|
||||
for (const fileName in options.newFileContents) {
|
||||
this.openFile(fileName);
|
||||
this.verifyCurrentFileContent(options.newFileContents[fileName]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function runFourSlashTest(basePath: string, testType: FourSlashTestType, fileName: string) {
|
||||
@@ -4380,6 +4379,10 @@ namespace FourSlashInterface {
|
||||
public allRangesAppearInImplementationList(markerName: string) {
|
||||
this.state.verifyRangesInImplementationList(markerName);
|
||||
}
|
||||
|
||||
public getEditsForFileRename(options: GetEditsForFileRenameOptions) {
|
||||
this.state.getEditsForFileRename(options);
|
||||
}
|
||||
}
|
||||
|
||||
export class Edit {
|
||||
@@ -4663,10 +4666,12 @@ namespace FourSlashInterface {
|
||||
|
||||
export type ExpectedCompletionEntry = string | { name: string, insertText?: string, replacementSpan?: FourSlash.Range };
|
||||
export interface CompletionsAtOptions extends Partial<ts.UserPreferences> {
|
||||
triggerCharacter?: string;
|
||||
isNewIdentifierLocation?: boolean;
|
||||
}
|
||||
|
||||
export interface VerifyCompletionListContainsOptions extends ts.UserPreferences {
|
||||
triggerCharacter?: string;
|
||||
sourceDisplay: string;
|
||||
isRecommended?: true;
|
||||
insertText?: string;
|
||||
@@ -4720,4 +4725,10 @@ namespace FourSlashInterface {
|
||||
range?: FourSlash.Range;
|
||||
code: number;
|
||||
}
|
||||
|
||||
export interface GetEditsForFileRenameOptions {
|
||||
readonly oldPath: string;
|
||||
readonly newPath: string;
|
||||
readonly newFileContents: { readonly [fileName: string]: string };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -530,6 +530,9 @@ namespace Harness.LanguageService {
|
||||
organizeImports(_scope: ts.OrganizeImportsScope, _formatOptions: ts.FormatCodeSettings): ReadonlyArray<ts.FileTextChanges> {
|
||||
throw new Error("Not supported on the shim.");
|
||||
}
|
||||
getEditsForFileRename(): ReadonlyArray<ts.FileTextChanges> {
|
||||
throw new Error("Not supported on the shim.");
|
||||
}
|
||||
getEmitOutput(fileName: string): ts.EmitOutput {
|
||||
return unwrapJSONCallResult(this.shim.getEmitOutput(fileName));
|
||||
}
|
||||
|
||||
@@ -70,6 +70,7 @@
|
||||
"../services/navigateTo.ts",
|
||||
"../services/navigationBar.ts",
|
||||
"../services/organizeImports.ts",
|
||||
"../services/getEditsForFileRename.ts",
|
||||
"../services/outliningElementsCollector.ts",
|
||||
"../services/patternMatcher.ts",
|
||||
"../services/preProcess.ts",
|
||||
|
||||
@@ -263,6 +263,8 @@ namespace ts.server {
|
||||
CommandNames.GetEditsForRefactorFull,
|
||||
CommandNames.OrganizeImports,
|
||||
CommandNames.OrganizeImportsFull,
|
||||
CommandNames.GetEditsForFileRename,
|
||||
CommandNames.GetEditsForFileRenameFull,
|
||||
];
|
||||
|
||||
it("should not throw when commands are executed with invalid arguments", () => {
|
||||
|
||||
@@ -124,7 +124,10 @@ namespace ts.tscWatch {
|
||||
}
|
||||
|
||||
function getWatchDiagnosticWithoutDate(diagnostic: Diagnostic) {
|
||||
return ` - ${flattenDiagnosticMessageText(diagnostic.messageText, host.newLine)}${host.newLine + host.newLine + host.newLine}`;
|
||||
const newLines = contains(screenStartingMessageCodes, diagnostic.code)
|
||||
? `${host.newLine}${host.newLine}`
|
||||
: host.newLine;
|
||||
return ` - ${flattenDiagnosticMessageText(diagnostic.messageText, host.newLine)}${newLines}`;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
-35
@@ -1,5 +1,3 @@
|
||||
declare type PropertyKey = string | number | symbol;
|
||||
|
||||
interface Array<T> {
|
||||
/**
|
||||
* Returns the value of the first element in the array where predicate is true, and undefined
|
||||
@@ -258,20 +256,6 @@ interface NumberConstructor {
|
||||
parseInt(string: string, radix?: number): number;
|
||||
}
|
||||
|
||||
interface Object {
|
||||
/**
|
||||
* Determines whether an object has a property with the specified name.
|
||||
* @param v A property name.
|
||||
*/
|
||||
hasOwnProperty(v: PropertyKey): boolean;
|
||||
|
||||
/**
|
||||
* Determines whether a specified property is enumerable.
|
||||
* @param v A property name.
|
||||
*/
|
||||
propertyIsEnumerable(v: PropertyKey): boolean;
|
||||
}
|
||||
|
||||
interface ObjectConstructor {
|
||||
/**
|
||||
* Copy the values of all of the enumerable own properties from one or more source objects to a
|
||||
@@ -327,25 +311,6 @@ interface ObjectConstructor {
|
||||
* @param proto The value of the new prototype or null.
|
||||
*/
|
||||
setPrototypeOf(o: any, proto: object | null): any;
|
||||
|
||||
/**
|
||||
* Gets the own property descriptor of the specified object.
|
||||
* An own property descriptor is one that is defined directly on the object and is not
|
||||
* inherited from the object's prototype.
|
||||
* @param o Object that contains the property.
|
||||
* @param p Name of the property.
|
||||
*/
|
||||
getOwnPropertyDescriptor(o: any, propertyKey: PropertyKey): PropertyDescriptor | undefined;
|
||||
|
||||
/**
|
||||
* Adds a property to an object, or modifies attributes of an existing property.
|
||||
* @param o Object on which to add or modify the property. This can be a native JavaScript
|
||||
* object (that is, a user-defined object or a built in object) or a DOM object.
|
||||
* @param p The property name.
|
||||
* @param attributes Descriptor for the property. It can be for a data property or an accessor
|
||||
* property.
|
||||
*/
|
||||
defineProperty(o: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): any;
|
||||
}
|
||||
|
||||
interface ReadonlyArray<T> {
|
||||
|
||||
Vendored
+7
-5
@@ -74,6 +74,8 @@ declare function escape(string: string): string;
|
||||
*/
|
||||
declare function unescape(string: string): string;
|
||||
|
||||
declare type PropertyKey = string | number | symbol;
|
||||
|
||||
interface PropertyDescriptor {
|
||||
configurable?: boolean;
|
||||
enumerable?: boolean;
|
||||
@@ -104,7 +106,7 @@ interface Object {
|
||||
* Determines whether an object has a property with the specified name.
|
||||
* @param v A property name.
|
||||
*/
|
||||
hasOwnProperty(v: string): boolean;
|
||||
hasOwnProperty(v: PropertyKey): boolean;
|
||||
|
||||
/**
|
||||
* Determines whether an object exists in another object's prototype chain.
|
||||
@@ -116,7 +118,7 @@ interface Object {
|
||||
* Determines whether a specified property is enumerable.
|
||||
* @param v A property name.
|
||||
*/
|
||||
propertyIsEnumerable(v: string): boolean;
|
||||
propertyIsEnumerable(v: PropertyKey): boolean;
|
||||
}
|
||||
|
||||
interface ObjectConstructor {
|
||||
@@ -139,7 +141,7 @@ interface ObjectConstructor {
|
||||
* @param o Object that contains the property.
|
||||
* @param p Name of the property.
|
||||
*/
|
||||
getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor | undefined;
|
||||
getOwnPropertyDescriptor(o: any, p: PropertyKey): PropertyDescriptor | undefined;
|
||||
|
||||
/**
|
||||
* Returns the names of the own properties of an object. The own properties of an object are those that are defined directly
|
||||
@@ -167,7 +169,7 @@ interface ObjectConstructor {
|
||||
* @param p The property name.
|
||||
* @param attributes Descriptor for the property. It can be for a data property or an accessor property.
|
||||
*/
|
||||
defineProperty(o: any, p: string, attributes: PropertyDescriptor & ThisType<any>): any;
|
||||
defineProperty(o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType<any>): any;
|
||||
|
||||
/**
|
||||
* Adds one or more properties to an object, and/or modifies attributes of existing properties.
|
||||
@@ -1340,7 +1342,7 @@ type Pick<T, K extends keyof T> = {
|
||||
/**
|
||||
* Construct a type with a set of properties K of type T
|
||||
*/
|
||||
type Record<K extends string, T> = {
|
||||
type Record<K extends keyof any, T> = {
|
||||
[P in K]: T;
|
||||
};
|
||||
|
||||
|
||||
@@ -903,6 +903,12 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Add_0_to_unresolved_variable_90008" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Add '{0}.' to unresolved variable]]></Val>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Add_all_missing_async_modifiers_95041" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Add all missing 'async' modifiers]]></Val>
|
||||
@@ -999,24 +1005,9 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Add_this_to_all_unresolved_variables_matching_a_member_name_95037" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Item ItemId=";Add_qualifier_to_all_unresolved_variables_matching_a_member_name_95037" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Add 'this.' to all unresolved variables matching a member name]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[為所有用以比對成員名稱未解析的變數新增 'this.']]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Add_this_to_unresolved_variable_90008" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Add 'this.' to unresolved variable]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[將 'this' 新增至未解析的變數]]></Val>
|
||||
</Tgt>
|
||||
<Prev Cat="Text">
|
||||
<Val><![CDATA[Add 'this.' to unresolved variable.]]></Val>
|
||||
</Prev>
|
||||
<Val><![CDATA[Add qualifier to all unresolved variables matching a member name]]></Val>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
@@ -2388,15 +2379,6 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Compilation_complete_Watching_for_file_changes_6042" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Compilation complete. Watching for file changes.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[編譯完成。正在等候檔案變更。]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json_6020" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Compile the project given the path to its configuration file, or to a folder with a 'tsconfig.json'.]]></Val>
|
||||
@@ -3771,20 +3753,20 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Found_0_errors_6194" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Item ItemId=";Found_0_errors_Watching_for_file_changes_6194" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Found {0} errors.]]></Val>
|
||||
<Val><![CDATA[Found {0} errors. Watching for file changes.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[找到 {0} 個錯誤。]]></Val>
|
||||
<Val><![CDATA[找到 {0} 個錯誤。正在監看檔案變更。]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Found_1_error_6193" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Item ItemId=";Found_1_error_Watching_for_file_changes_6193" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Found 1 error.]]></Val>
|
||||
<Val><![CDATA[Found 1 error. Watching for file changes.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[找到 1 個錯誤。]]></Val>
|
||||
<Val><![CDATA[找到 1 個錯誤。正在監看檔案變更。]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
|
||||
@@ -912,6 +912,15 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Add_0_to_unresolved_variable_90008" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Add '{0}.' to unresolved variable]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Přidat {0}. k nerozpoznané proměnné]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Add_all_missing_async_modifiers_95041" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Add all missing 'async' modifiers]]></Val>
|
||||
@@ -1008,27 +1017,15 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Add_this_to_all_unresolved_variables_matching_a_member_name_95037" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Item ItemId=";Add_qualifier_to_all_unresolved_variables_matching_a_member_name_95037" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Add 'this.' to all unresolved variables matching a member name]]></Val>
|
||||
<Val><![CDATA[Add qualifier to all unresolved variables matching a member name]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Přidat this. do všech nerozpoznaných proměnných odpovídajících názvu členu]]></Val>
|
||||
<Val><![CDATA[Přidat kvalifikátor do všech nerozpoznaných proměnných odpovídajících názvu členu]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Add_this_to_unresolved_variable_90008" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Add 'this.' to unresolved variable]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Přidat k nerozpoznané proměnné this.]]></Val>
|
||||
</Tgt>
|
||||
<Prev Cat="Text">
|
||||
<Val><![CDATA[Add 'this.' to unresolved variable.]]></Val>
|
||||
</Prev>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Add_to_all_uncalled_decorators_95044" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Add '()' to all uncalled decorators]]></Val>
|
||||
@@ -2397,15 +2394,6 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Compilation_complete_Watching_for_file_changes_6042" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Compilation complete. Watching for file changes.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Kompilace je hotová. Sledují se změny souborů.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json_6020" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Compile the project given the path to its configuration file, or to a folder with a 'tsconfig.json'.]]></Val>
|
||||
@@ -3780,20 +3768,20 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Found_0_errors_6194" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Item ItemId=";Found_0_errors_Watching_for_file_changes_6194" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Found {0} errors.]]></Val>
|
||||
<Val><![CDATA[Found {0} errors. Watching for file changes.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Našel se tento počet chyb: {0}.]]></Val>
|
||||
<Val><![CDATA[Byl nalezen tento počet chyb: {0}. Sledují se změny souborů.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Found_1_error_6193" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Item ItemId=";Found_1_error_Watching_for_file_changes_6193" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Found 1 error.]]></Val>
|
||||
<Val><![CDATA[Found 1 error. Watching for file changes.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Našla se 1 chyba.]]></Val>
|
||||
<Val><![CDATA[Byla nalezena 1 chyba. Sledují se změny souborů.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
|
||||
@@ -900,6 +900,12 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Add_0_to_unresolved_variable_90008" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Add '{0}.' to unresolved variable]]></Val>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Add_all_missing_async_modifiers_95041" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Add all missing 'async' modifiers]]></Val>
|
||||
@@ -996,24 +1002,9 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Add_this_to_all_unresolved_variables_matching_a_member_name_95037" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Item ItemId=";Add_qualifier_to_all_unresolved_variables_matching_a_member_name_95037" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Add 'this.' to all unresolved variables matching a member name]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Allen nicht aufgelösten Variablen, die einem Membernamen entsprechen, "this." hinzufügen]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Add_this_to_unresolved_variable_90008" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Add 'this.' to unresolved variable]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Der nicht aufgelösten Variablen "this." hinzufügen]]></Val>
|
||||
</Tgt>
|
||||
<Prev Cat="Text">
|
||||
<Val><![CDATA[Add 'this.' to unresolved variable.]]></Val>
|
||||
</Prev>
|
||||
<Val><![CDATA[Add qualifier to all unresolved variables matching a member name]]></Val>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
@@ -2385,15 +2376,6 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Compilation_complete_Watching_for_file_changes_6042" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Compilation complete. Watching for file changes.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Die Kompilierung wurde abgeschlossen. Dateiänderungen werden überprüft.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json_6020" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Compile the project given the path to its configuration file, or to a folder with a 'tsconfig.json'.]]></Val>
|
||||
@@ -3768,20 +3750,20 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Found_0_errors_6194" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Item ItemId=";Found_0_errors_Watching_for_file_changes_6194" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Found {0} errors.]]></Val>
|
||||
<Val><![CDATA[Found {0} errors. Watching for file changes.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[{0} Fehler gefunden.]]></Val>
|
||||
<Val><![CDATA[{0} Fehler gefunden. Es wird auf Dateiänderungen überwacht.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Found_1_error_6193" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Item ItemId=";Found_1_error_Watching_for_file_changes_6193" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Found 1 error.]]></Val>
|
||||
<Val><![CDATA[Found 1 error. Watching for file changes.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[1 Fehler gefunden.]]></Val>
|
||||
<Val><![CDATA[1 Fehler gefunden. Es wird auf Dateiänderungen überwacht.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
|
||||
@@ -912,6 +912,12 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Add_0_to_unresolved_variable_90008" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Add '{0}.' to unresolved variable]]></Val>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Add_all_missing_async_modifiers_95041" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Add all missing 'async' modifiers]]></Val>
|
||||
@@ -1008,24 +1014,9 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Add_this_to_all_unresolved_variables_matching_a_member_name_95037" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Item ItemId=";Add_qualifier_to_all_unresolved_variables_matching_a_member_name_95037" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Add 'this.' to all unresolved variables matching a member name]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Agregar "this." a todas las variables no resueltas que coincidan con un nombre de miembro]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Add_this_to_unresolved_variable_90008" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Add 'this.' to unresolved variable]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Agregar "this." a una variable no resuelta]]></Val>
|
||||
</Tgt>
|
||||
<Prev Cat="Text">
|
||||
<Val><![CDATA[Add 'this.' to unresolved variable.]]></Val>
|
||||
</Prev>
|
||||
<Val><![CDATA[Add qualifier to all unresolved variables matching a member name]]></Val>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
@@ -2397,15 +2388,6 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Compilation_complete_Watching_for_file_changes_6042" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Compilation complete. Watching for file changes.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Compilación completada. Supervisando los cambios del archivo.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json_6020" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Compile the project given the path to its configuration file, or to a folder with a 'tsconfig.json'.]]></Val>
|
||||
@@ -3780,20 +3762,20 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Found_0_errors_6194" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Item ItemId=";Found_0_errors_Watching_for_file_changes_6194" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Found {0} errors.]]></Val>
|
||||
<Val><![CDATA[Found {0} errors. Watching for file changes.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Se encontró {0} errores.]]></Val>
|
||||
<Val><![CDATA[Se encontraron {0} errores. Supervisando los cambios del archivo.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Found_1_error_6193" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Item ItemId=";Found_1_error_Watching_for_file_changes_6193" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Found 1 error.]]></Val>
|
||||
<Val><![CDATA[Found 1 error. Watching for file changes.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Se encontró 1 error.]]></Val>
|
||||
<Val><![CDATA[Se encontró un error. Supervisando los cambios del archivo.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
|
||||
@@ -2397,15 +2397,6 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Compilation_complete_Watching_for_file_changes_6042" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Compilation complete. Watching for file changes.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Fin de la compilation. Détection des changements apportés au fichier.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json_6020" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Compile the project given the path to its configuration file, or to a folder with a 'tsconfig.json'.]]></Val>
|
||||
@@ -3780,20 +3771,20 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Found_0_errors_6194" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Item ItemId=";Found_0_errors_Watching_for_file_changes_6194" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Found {0} errors.]]></Val>
|
||||
<Val><![CDATA[Found {0} errors. Watching for file changes.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[{0} erreurs trouvées.]]></Val>
|
||||
<Val><![CDATA[{0} erreurs trouvées. Changements de fichier sous surveillance.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Found_1_error_6193" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Item ItemId=";Found_1_error_Watching_for_file_changes_6193" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Found 1 error.]]></Val>
|
||||
<Val><![CDATA[Found 1 error. Watching for file changes.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[1 erreur trouvée.]]></Val>
|
||||
<Val><![CDATA[1 erreur trouvée. Changements de fichier sous surveillance.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
|
||||
@@ -903,6 +903,15 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Add_0_to_unresolved_variable_90008" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Add '{0}.' to unresolved variable]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Aggiungere '{0}.' alla variabile non risolta]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Add_all_missing_async_modifiers_95041" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Add all missing 'async' modifiers]]></Val>
|
||||
@@ -999,27 +1008,15 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Add_this_to_all_unresolved_variables_matching_a_member_name_95037" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Item ItemId=";Add_qualifier_to_all_unresolved_variables_matching_a_member_name_95037" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Add 'this.' to all unresolved variables matching a member name]]></Val>
|
||||
<Val><![CDATA[Add qualifier to all unresolved variables matching a member name]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Aggiungere 'this.' a tutte le variabili non risolte corrispondenti a un nome di membro]]></Val>
|
||||
<Val><![CDATA[Aggiungere il qualificatore a tutte le variabili non risolte corrispondenti a un nome di membro]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Add_this_to_unresolved_variable_90008" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Add 'this.' to unresolved variable]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Aggiungere 'this.' alla variabile non risolta]]></Val>
|
||||
</Tgt>
|
||||
<Prev Cat="Text">
|
||||
<Val><![CDATA[Add 'this.' to unresolved variable.]]></Val>
|
||||
</Prev>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Add_to_all_uncalled_decorators_95044" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Add '()' to all uncalled decorators]]></Val>
|
||||
|
||||
@@ -903,6 +903,12 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Add_0_to_unresolved_variable_90008" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Add '{0}.' to unresolved variable]]></Val>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Add_all_missing_async_modifiers_95041" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Add all missing 'async' modifiers]]></Val>
|
||||
@@ -999,24 +1005,9 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Add_this_to_all_unresolved_variables_matching_a_member_name_95037" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Item ItemId=";Add_qualifier_to_all_unresolved_variables_matching_a_member_name_95037" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Add 'this.' to all unresolved variables matching a member name]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[メンバー名と一致するすべての未解決の変数に 'this.' を追加します]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Add_this_to_unresolved_variable_90008" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Add 'this.' to unresolved variable]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA['this.' を未解決の変数に追加する]]></Val>
|
||||
</Tgt>
|
||||
<Prev Cat="Text">
|
||||
<Val><![CDATA[Add 'this.' to unresolved variable.]]></Val>
|
||||
</Prev>
|
||||
<Val><![CDATA[Add qualifier to all unresolved variables matching a member name]]></Val>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
@@ -2388,15 +2379,6 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Compilation_complete_Watching_for_file_changes_6042" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Compilation complete. Watching for file changes.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[コンパイルが完了しました。ファイルの変更を監視しています。]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json_6020" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Compile the project given the path to its configuration file, or to a folder with a 'tsconfig.json'.]]></Val>
|
||||
@@ -3771,20 +3753,20 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Found_0_errors_6194" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Item ItemId=";Found_0_errors_Watching_for_file_changes_6194" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Found {0} errors.]]></Val>
|
||||
<Val><![CDATA[Found {0} errors. Watching for file changes.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[{0} 件のエラーが見つかりました。]]></Val>
|
||||
<Val><![CDATA[{0} 件のエラーが見つかりました。ファイルの変更をモニタリングしています。]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Found_1_error_6193" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Item ItemId=";Found_1_error_Watching_for_file_changes_6193" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Found 1 error.]]></Val>
|
||||
<Val><![CDATA[Found 1 error. Watching for file changes.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[1 件のエラーが見つかりました。]]></Val>
|
||||
<Val><![CDATA[1 件のエラーが見つかりました。ファイルの変更をモニタリングしています。]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
|
||||
@@ -903,6 +903,12 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Add_0_to_unresolved_variable_90008" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Add '{0}.' to unresolved variable]]></Val>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Add_all_missing_async_modifiers_95041" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Add all missing 'async' modifiers]]></Val>
|
||||
@@ -999,24 +1005,9 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Add_this_to_all_unresolved_variables_matching_a_member_name_95037" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Item ItemId=";Add_qualifier_to_all_unresolved_variables_matching_a_member_name_95037" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Add 'this.' to all unresolved variables matching a member name]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[멤버 이름과 일치하는 모든 확인되지 않은 변수에 'this.' 추가]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Add_this_to_unresolved_variable_90008" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Add 'this.' to unresolved variable]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[확인되지 않은 변수에 'this.' 추가]]></Val>
|
||||
</Tgt>
|
||||
<Prev Cat="Text">
|
||||
<Val><![CDATA[Add 'this.' to unresolved variable.]]></Val>
|
||||
</Prev>
|
||||
<Val><![CDATA[Add qualifier to all unresolved variables matching a member name]]></Val>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
@@ -2388,15 +2379,6 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Compilation_complete_Watching_for_file_changes_6042" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Compilation complete. Watching for file changes.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[컴파일이 완료되었습니다. 파일이 변경되었는지 확인하는 중입니다.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json_6020" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Compile the project given the path to its configuration file, or to a folder with a 'tsconfig.json'.]]></Val>
|
||||
@@ -3771,20 +3753,20 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Found_0_errors_6194" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Item ItemId=";Found_0_errors_Watching_for_file_changes_6194" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Found {0} errors.]]></Val>
|
||||
<Val><![CDATA[Found {0} errors. Watching for file changes.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[{0}개 오류가 발견되었습니다.]]></Val>
|
||||
<Val><![CDATA[{0}개 오류가 발견되었습니다. 파일이 변경되었는지 확인하는 중입니다.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Found_1_error_6193" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Item ItemId=";Found_1_error_Watching_for_file_changes_6193" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Found 1 error.]]></Val>
|
||||
<Val><![CDATA[Found 1 error. Watching for file changes.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[1개 오류가 발견되었습니다.]]></Val>
|
||||
<Val><![CDATA[1개 오류가 발견되었습니다. 파일이 변경되었는지 확인하는 중입니다.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
|
||||
@@ -893,6 +893,12 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Add_0_to_unresolved_variable_90008" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Add '{0}.' to unresolved variable]]></Val>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Add_all_missing_async_modifiers_95041" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Add all missing 'async' modifiers]]></Val>
|
||||
@@ -989,24 +995,9 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Add_this_to_all_unresolved_variables_matching_a_member_name_95037" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Item ItemId=";Add_qualifier_to_all_unresolved_variables_matching_a_member_name_95037" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Add 'this.' to all unresolved variables matching a member name]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Dodaj element „this.” do wszystkich nierozpoznanych zmiennych pasujących do nazwy elementu członkowskiego]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Add_this_to_unresolved_variable_90008" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Add 'this.' to unresolved variable]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Dodaj „this.” do nierozpoznanej zmiennej]]></Val>
|
||||
</Tgt>
|
||||
<Prev Cat="Text">
|
||||
<Val><![CDATA[Add 'this.' to unresolved variable.]]></Val>
|
||||
</Prev>
|
||||
<Val><![CDATA[Add qualifier to all unresolved variables matching a member name]]></Val>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
@@ -2378,15 +2369,6 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Compilation_complete_Watching_for_file_changes_6042" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Compilation complete. Watching for file changes.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Ukończono kompilację. Wyszukiwanie zmian plików.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json_6020" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Compile the project given the path to its configuration file, or to a folder with a 'tsconfig.json'.]]></Val>
|
||||
@@ -3761,20 +3743,20 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Found_0_errors_6194" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Item ItemId=";Found_0_errors_Watching_for_file_changes_6194" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Found {0} errors.]]></Val>
|
||||
<Val><![CDATA[Found {0} errors. Watching for file changes.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Znaleziono błędy: {0}.]]></Val>
|
||||
<Val><![CDATA[Znalezione błędy: {0}. Obserwowanie zmian plików.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Found_1_error_6193" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Item ItemId=";Found_1_error_Watching_for_file_changes_6193" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Found 1 error.]]></Val>
|
||||
<Val><![CDATA[Found 1 error. Watching for file changes.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Znaleziono 1 błąd.]]></Val>
|
||||
<Val><![CDATA[Znaleziono 1 błąd. Obserwowanie zmian plików.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
|
||||
@@ -893,6 +893,12 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Add_0_to_unresolved_variable_90008" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Add '{0}.' to unresolved variable]]></Val>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Add_all_missing_async_modifiers_95041" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Add all missing 'async' modifiers]]></Val>
|
||||
@@ -989,24 +995,9 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Add_this_to_all_unresolved_variables_matching_a_member_name_95037" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Item ItemId=";Add_qualifier_to_all_unresolved_variables_matching_a_member_name_95037" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Add 'this.' to all unresolved variables matching a member name]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Adicionar 'this.' a todas as variáveis não resolvidas correspondentes a um nome de membro]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Add_this_to_unresolved_variable_90008" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Add 'this.' to unresolved variable]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Adicionar 'this.' a uma variável não resolvida]]></Val>
|
||||
</Tgt>
|
||||
<Prev Cat="Text">
|
||||
<Val><![CDATA[Add 'this.' to unresolved variable.]]></Val>
|
||||
</Prev>
|
||||
<Val><![CDATA[Add qualifier to all unresolved variables matching a member name]]></Val>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
@@ -2378,15 +2369,6 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Compilation_complete_Watching_for_file_changes_6042" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Compilation complete. Watching for file changes.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Compilação concluída. Monitorando alterações de arquivo.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json_6020" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Compile the project given the path to its configuration file, or to a folder with a 'tsconfig.json'.]]></Val>
|
||||
@@ -3761,20 +3743,20 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Found_0_errors_6194" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Item ItemId=";Found_0_errors_Watching_for_file_changes_6194" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Found {0} errors.]]></Val>
|
||||
<Val><![CDATA[Found {0} errors. Watching for file changes.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Encontrados {0} erros.]]></Val>
|
||||
<Val><![CDATA[{0} erros encontrados. Monitorando alterações de arquivo.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Found_1_error_6193" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Item ItemId=";Found_1_error_Watching_for_file_changes_6193" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Found 1 error.]]></Val>
|
||||
<Val><![CDATA[Found 1 error. Watching for file changes.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Encontrado 1 erro.]]></Val>
|
||||
<Val><![CDATA[Um erro encontrado. Monitorando alterações de arquivo.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
|
||||
@@ -902,6 +902,12 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Add_0_to_unresolved_variable_90008" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Add '{0}.' to unresolved variable]]></Val>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Add_all_missing_async_modifiers_95041" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Add all missing 'async' modifiers]]></Val>
|
||||
@@ -998,24 +1004,9 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Add_this_to_all_unresolved_variables_matching_a_member_name_95037" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Item ItemId=";Add_qualifier_to_all_unresolved_variables_matching_a_member_name_95037" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Add 'this.' to all unresolved variables matching a member name]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Добавить "this." ко всем неразрешенным переменным, соответствующим имени элемента]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Add_this_to_unresolved_variable_90008" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Add 'this.' to unresolved variable]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Добавьте "this." к неразрешенной переменной]]></Val>
|
||||
</Tgt>
|
||||
<Prev Cat="Text">
|
||||
<Val><![CDATA[Add 'this.' to unresolved variable.]]></Val>
|
||||
</Prev>
|
||||
<Val><![CDATA[Add qualifier to all unresolved variables matching a member name]]></Val>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
@@ -2387,15 +2378,6 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Compilation_complete_Watching_for_file_changes_6042" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Compilation complete. Watching for file changes.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Компиляция завершена. Отслеживание изменений в файлах.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json_6020" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Compile the project given the path to its configuration file, or to a folder with a 'tsconfig.json'.]]></Val>
|
||||
@@ -3770,20 +3752,20 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Found_0_errors_6194" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Item ItemId=";Found_0_errors_Watching_for_file_changes_6194" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Found {0} errors.]]></Val>
|
||||
<Val><![CDATA[Found {0} errors. Watching for file changes.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Найдено ошибок: {0}.]]></Val>
|
||||
<Val><![CDATA[Найдено ошибок: {0}. Отслеживаются изменения в файлах.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Found_1_error_6193" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Item ItemId=";Found_1_error_Watching_for_file_changes_6193" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Found 1 error.]]></Val>
|
||||
<Val><![CDATA[Found 1 error. Watching for file changes.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Найдено ошибок: 1.]]></Val>
|
||||
<Val><![CDATA[Найдена одна ошибка. Отслеживаются изменения в файлах.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
|
||||
@@ -896,6 +896,12 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Add_0_to_unresolved_variable_90008" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Add '{0}.' to unresolved variable]]></Val>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Add_all_missing_async_modifiers_95041" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Add all missing 'async' modifiers]]></Val>
|
||||
@@ -992,24 +998,9 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Add_this_to_all_unresolved_variables_matching_a_member_name_95037" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Item ItemId=";Add_qualifier_to_all_unresolved_variables_matching_a_member_name_95037" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Add 'this.' to all unresolved variables matching a member name]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Bir üye adıyla eşleşen tüm çözülmemiş değişkenlere 'this.' ekle]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Add_this_to_unresolved_variable_90008" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Add 'this.' to unresolved variable]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Çözümlenmemiş değişkene 'this.' ekle]]></Val>
|
||||
</Tgt>
|
||||
<Prev Cat="Text">
|
||||
<Val><![CDATA[Add 'this.' to unresolved variable.]]></Val>
|
||||
</Prev>
|
||||
<Val><![CDATA[Add qualifier to all unresolved variables matching a member name]]></Val>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
@@ -2381,15 +2372,6 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Compilation_complete_Watching_for_file_changes_6042" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Compilation complete. Watching for file changes.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Derleme tamamlandı. Dosya değişiklikleri izleniyor.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json_6020" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Compile the project given the path to its configuration file, or to a folder with a 'tsconfig.json'.]]></Val>
|
||||
@@ -3764,20 +3746,20 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Found_0_errors_6194" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Item ItemId=";Found_0_errors_Watching_for_file_changes_6194" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Found {0} errors.]]></Val>
|
||||
<Val><![CDATA[Found {0} errors. Watching for file changes.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[{0} hata bulundu.]]></Val>
|
||||
<Val><![CDATA[{0} hata bulundu. Dosya değişiklikleri izleniyor.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";Found_1_error_6193" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Item ItemId=";Found_1_error_Watching_for_file_changes_6193" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Found 1 error.]]></Val>
|
||||
<Val><![CDATA[Found 1 error. Watching for file changes.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[1 hata bulundu.]]></Val>
|
||||
<Val><![CDATA[1 hata bulundu. Dosya değişiklikleri izleniyor.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
|
||||
@@ -632,6 +632,10 @@ namespace ts.server {
|
||||
return notImplemented();
|
||||
}
|
||||
|
||||
getEditsForFileRename() {
|
||||
return notImplemented();
|
||||
}
|
||||
|
||||
private convertCodeEditsToTextChanges(edits: protocol.FileCodeEdits[]): FileTextChanges[] {
|
||||
return edits.map(edit => {
|
||||
const fileName = edit.fileName;
|
||||
|
||||
@@ -121,6 +121,9 @@ namespace ts.server.protocol {
|
||||
OrganizeImports = "organizeImports",
|
||||
/* @internal */
|
||||
OrganizeImportsFull = "organizeImports-full",
|
||||
GetEditsForFileRename = "getEditsForFileRename",
|
||||
/* @internal */
|
||||
GetEditsForFileRenameFull = "getEditsForFileRename-full",
|
||||
|
||||
// NOTE: If updating this, be sure to also update `allCommandNames` in `harness/unittests/session.ts`.
|
||||
}
|
||||
@@ -610,6 +613,22 @@ namespace ts.server.protocol {
|
||||
edits: ReadonlyArray<FileCodeEdits>;
|
||||
}
|
||||
|
||||
export interface GetEditsForFileRenameRequest extends Request {
|
||||
command: CommandTypes.GetEditsForFileRename;
|
||||
arguments: GetEditsForFileRenameRequestArgs;
|
||||
}
|
||||
|
||||
// Note: The file from FileRequestArgs is just any file in the project.
|
||||
// We will generate code changes for every file in that project, so the choice is arbitrary.
|
||||
export interface GetEditsForFileRenameRequestArgs extends FileRequestArgs {
|
||||
readonly oldFilePath: string;
|
||||
readonly newFilePath: string;
|
||||
}
|
||||
|
||||
export interface GetEditsForFileRenameResponse extends Response {
|
||||
edits: ReadonlyArray<FileCodeEdits>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Request for the available codefixes at a specific position.
|
||||
*/
|
||||
@@ -1749,6 +1768,7 @@ namespace ts.server.protocol {
|
||||
* Optional prefix to apply to possible completions.
|
||||
*/
|
||||
prefix?: string;
|
||||
triggerCharacter?: string;
|
||||
/**
|
||||
* @deprecated Use UserPreferences.includeCompletionsForModuleExports
|
||||
*/
|
||||
|
||||
+14
-1
@@ -1287,6 +1287,7 @@ namespace ts.server {
|
||||
|
||||
const completions = project.getLanguageService().getCompletionsAtPosition(file, position, {
|
||||
...this.getPreferences(file),
|
||||
triggerCharacter: args.triggerCharacter,
|
||||
includeExternalModuleExports: args.includeExternalModuleExports,
|
||||
includeInsertTextCompletions: args.includeInsertTextCompletions
|
||||
});
|
||||
@@ -1664,6 +1665,12 @@ namespace ts.server {
|
||||
}
|
||||
}
|
||||
|
||||
private getEditsForFileRename(args: protocol.GetEditsForFileRenameRequestArgs, simplifiedResult: boolean): ReadonlyArray<protocol.FileCodeEdits> | ReadonlyArray<FileTextChanges> {
|
||||
const { file, project } = this.getFileAndProject(args);
|
||||
const changes = project.getLanguageService().getEditsForFileRename(args.oldFilePath, args.newFilePath, this.getFormatOptions(file));
|
||||
return simplifiedResult ? this.mapTextChangesToCodeEdits(project, changes) : changes;
|
||||
}
|
||||
|
||||
private getCodeFixes(args: protocol.CodeFixRequestArgs, simplifiedResult: boolean): ReadonlyArray<protocol.CodeFixAction> | ReadonlyArray<CodeFixAction> {
|
||||
if (args.errorCodes.length === 0) {
|
||||
return undefined;
|
||||
@@ -2117,7 +2124,13 @@ namespace ts.server {
|
||||
},
|
||||
[CommandNames.OrganizeImportsFull]: (request: protocol.OrganizeImportsRequest) => {
|
||||
return this.requiredResponse(this.organizeImports(request.arguments, /*simplifiedResult*/ false));
|
||||
}
|
||||
},
|
||||
[CommandNames.GetEditsForFileRename]: (request: protocol.GetEditsForFileRenameRequest) => {
|
||||
return this.requiredResponse(this.getEditsForFileRename(request.arguments, /*simplifiedResult*/ true));
|
||||
},
|
||||
[CommandNames.GetEditsForFileRenameFull]: (request: protocol.GetEditsForFileRenameRequest) => {
|
||||
return this.requiredResponse(this.getEditsForFileRename(request.arguments, /*simplifiedResult*/ false));
|
||||
},
|
||||
});
|
||||
|
||||
public addProtocolHandler(command: string, handler: (request: protocol.Request) => HandlerResponse) {
|
||||
|
||||
@@ -66,6 +66,7 @@
|
||||
"../services/navigateTo.ts",
|
||||
"../services/navigationBar.ts",
|
||||
"../services/organizeImports.ts",
|
||||
"../services/getEditsForFileRename.ts",
|
||||
"../services/outliningElementsCollector.ts",
|
||||
"../services/patternMatcher.ts",
|
||||
"../services/preProcess.ts",
|
||||
|
||||
@@ -72,6 +72,7 @@
|
||||
"../services/navigateTo.ts",
|
||||
"../services/navigationBar.ts",
|
||||
"../services/organizeImports.ts",
|
||||
"../services/getEditsForFileRename.ts",
|
||||
"../services/outliningElementsCollector.ts",
|
||||
"../services/patternMatcher.ts",
|
||||
"../services/preProcess.ts",
|
||||
|
||||
@@ -127,7 +127,7 @@ namespace ts.codefix {
|
||||
const classDeclaration = getClassLikeDeclarationOfSymbol(type.symbol);
|
||||
if (!classDeclaration || hasModifier(classDeclaration, ModifierFlags.Abstract)) return undefined;
|
||||
|
||||
const constructorDeclaration = find<ClassElement, ConstructorDeclaration>(classDeclaration.members, (m): m is ConstructorDeclaration => isConstructorDeclaration(m) && !!m.body)!;
|
||||
const constructorDeclaration = getFirstConstructorWithBody(classDeclaration);
|
||||
if (constructorDeclaration && constructorDeclaration.parameters.length) return undefined;
|
||||
|
||||
return createNew(createIdentifier(type.symbol.name), /*typeArguments*/ undefined, /*argumentsArray*/ undefined);
|
||||
|
||||
@@ -39,7 +39,6 @@ namespace ts.codefix {
|
||||
}
|
||||
|
||||
function convertToImportCodeFixContext(context: CodeFixContext, symbolToken: Node, symbolName: string): ImportCodeFixContext {
|
||||
const useCaseSensitiveFileNames = context.host.useCaseSensitiveFileNames ? context.host.useCaseSensitiveFileNames() : false;
|
||||
const { program } = context;
|
||||
const checker = program.getTypeChecker();
|
||||
|
||||
@@ -51,7 +50,7 @@ namespace ts.codefix {
|
||||
checker,
|
||||
compilerOptions: program.getCompilerOptions(),
|
||||
cachedImportDeclarations: [],
|
||||
getCanonicalFileName: createGetCanonicalFileName(useCaseSensitiveFileNames),
|
||||
getCanonicalFileName: createGetCanonicalFileName(hostUsesCaseSensitiveFileNames(context.host)),
|
||||
symbolName,
|
||||
symbolToken,
|
||||
preferences: context.preferences,
|
||||
@@ -547,11 +546,6 @@ namespace ts.codefix {
|
||||
return startsWith(path, "..");
|
||||
}
|
||||
|
||||
function getRelativePath(path: string, directoryPath: string, getCanonicalFileName: GetCanonicalFileName) {
|
||||
const relativePath = getRelativePathToDirectoryOrUrl(directoryPath, path, directoryPath, getCanonicalFileName, /*isAbsolutePathAnUrl*/ false);
|
||||
return !pathIsRelative(relativePath) ? "./" + relativePath : relativePath;
|
||||
}
|
||||
|
||||
function getCodeActionsForAddImport(
|
||||
exportInfos: ReadonlyArray<SymbolExportInfo>,
|
||||
ctx: ImportCodeFixContext,
|
||||
|
||||
+44
-11
@@ -25,7 +25,7 @@ namespace ts.Completions {
|
||||
|
||||
const enum GlobalsSearch { Continue, Success, Fail }
|
||||
|
||||
export function getCompletionsAtPosition(host: LanguageServiceHost, program: Program, log: Log, sourceFile: SourceFile, position: number, preferences: UserPreferences): CompletionInfo | undefined {
|
||||
export function getCompletionsAtPosition(host: LanguageServiceHost, program: Program, log: Log, sourceFile: SourceFile, position: number, preferences: UserPreferences, triggerCharacter: string | undefined): CompletionInfo | undefined {
|
||||
const typeChecker = program.getTypeChecker();
|
||||
const compilerOptions = program.getCompilerOptions();
|
||||
if (isInReferenceComment(sourceFile, position)) {
|
||||
@@ -34,6 +34,7 @@ namespace ts.Completions {
|
||||
}
|
||||
|
||||
const contextToken = findPrecedingToken(position, sourceFile);
|
||||
if (triggerCharacter && !isValidTrigger(sourceFile, triggerCharacter, contextToken, position)) return undefined;
|
||||
|
||||
if (isInString(sourceFile, position, contextToken)) {
|
||||
return !contextToken || !isStringLiteralLike(contextToken)
|
||||
@@ -46,7 +47,7 @@ namespace ts.Completions {
|
||||
return getLabelCompletionAtPosition(contextToken.parent);
|
||||
}
|
||||
|
||||
const completionData = getCompletionData(program, log, sourceFile, position, preferences);
|
||||
const completionData = getCompletionData(program, log, sourceFile, position, preferences, /*detailsEntryId*/ undefined);
|
||||
if (!completionData) {
|
||||
return undefined;
|
||||
}
|
||||
@@ -485,9 +486,9 @@ namespace ts.Completions {
|
||||
previousToken: Node;
|
||||
readonly isJsxInitializer: IsJsxInitializer;
|
||||
}
|
||||
function getSymbolCompletionFromEntryId(program: Program, log: Log, sourceFile: SourceFile, position: number, { name, source }: CompletionEntryIdentifier,
|
||||
function getSymbolCompletionFromEntryId(program: Program, log: Log, sourceFile: SourceFile, position: number, entryId: CompletionEntryIdentifier,
|
||||
): SymbolCompletion | { type: "request", request: Request } | { type: "none" } {
|
||||
const completionData = getCompletionData(program, log, sourceFile, position, { includeCompletionsForModuleExports: true, includeCompletionsWithInsertText: true });
|
||||
const completionData = getCompletionData(program, log, sourceFile, position, { includeCompletionsForModuleExports: true, includeCompletionsWithInsertText: true }, entryId);
|
||||
if (!completionData) {
|
||||
return { type: "none" };
|
||||
}
|
||||
@@ -504,7 +505,9 @@ namespace ts.Completions {
|
||||
return firstDefined<Symbol, SymbolCompletion>(symbols, (symbol): SymbolCompletion => { // TODO: Shouldn't need return type annotation (GH#12632)
|
||||
const origin = symbolToOriginInfoMap[getSymbolId(symbol)];
|
||||
const info = getCompletionEntryDisplayNameForSymbol(symbol, program.getCompilerOptions().target, origin, completionKind);
|
||||
return info && info.name === name && getSourceFromOrigin(origin) === source ? { type: "symbol" as "symbol", symbol, location, symbolToOriginInfoMap, previousToken, isJsxInitializer } : undefined;
|
||||
return info && info.name === entryId.name && getSourceFromOrigin(origin) === entryId.source
|
||||
? { type: "symbol" as "symbol", symbol, location, symbolToOriginInfoMap, previousToken, isJsxInitializer }
|
||||
: undefined;
|
||||
}) || { type: "none" };
|
||||
}
|
||||
|
||||
@@ -754,6 +757,7 @@ namespace ts.Completions {
|
||||
sourceFile: SourceFile,
|
||||
position: number,
|
||||
preferences: Pick<UserPreferences, "includeCompletionsForModuleExports" | "includeCompletionsWithInsertText">,
|
||||
detailsEntryId: CompletionEntryIdentifier | undefined,
|
||||
): CompletionData | Request | undefined {
|
||||
const typeChecker = program.getTypeChecker();
|
||||
|
||||
@@ -1197,14 +1201,11 @@ namespace ts.Completions {
|
||||
// If already using commonjs, don't introduce ES6.
|
||||
if (sourceFile.commonJsModuleIndicator) return false;
|
||||
// If some file is using ES6 modules, assume that it's OK to add more.
|
||||
if (program.getSourceFiles().some(s => !s.isDeclarationFile && !program.isSourceFileFromExternalLibrary(s) && !!s.externalModuleIndicator)) {
|
||||
return true;
|
||||
}
|
||||
if (programContainsEs6Modules(program)) return true;
|
||||
// For JS, stay on the safe side.
|
||||
if (isSourceFileJavaScript(sourceFile)) return false;
|
||||
// If module transpilation is enabled or we're targeting es6 or above, or not emitting, OK.
|
||||
const compilerOptions = program.getCompilerOptions();
|
||||
return !!compilerOptions.module || compilerOptions.target >= ScriptTarget.ES2015 || !!compilerOptions.noEmit;
|
||||
return compilerOptionsIndicateEs6Modules(program.getCompilerOptions());
|
||||
}
|
||||
|
||||
function isSnippetScope(scopeNode: Node): boolean {
|
||||
@@ -1301,6 +1302,11 @@ namespace ts.Completions {
|
||||
const tokenTextLowerCase = tokenText.toLowerCase();
|
||||
|
||||
codefix.forEachExternalModuleToImportFrom(typeChecker, sourceFile, program.getSourceFiles(), moduleSymbol => {
|
||||
// Perf -- ignore other modules if this is a request for details
|
||||
if (detailsEntryId && detailsEntryId.source && stripQuotes(moduleSymbol.name) !== detailsEntryId.source) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (let symbol of typeChecker.getExportsOfModule(moduleSymbol)) {
|
||||
// Don't add a completion for a re-export, only for the original.
|
||||
// The actual import fix might end up coming from a re-export -- we don't compute that until getting completion details.
|
||||
@@ -1319,7 +1325,7 @@ namespace ts.Completions {
|
||||
}
|
||||
|
||||
const origin: SymbolOriginInfo = { type: "export", moduleSymbol, isDefaultExport };
|
||||
if (stringContainsCharactersInOrder(getSymbolName(symbol, origin, target).toLowerCase(), tokenTextLowerCase)) {
|
||||
if (detailsEntryId || stringContainsCharactersInOrder(getSymbolName(symbol, origin, target).toLowerCase(), tokenTextLowerCase)) {
|
||||
symbols.push(symbol);
|
||||
symbolToOriginInfoMap[getSymbolId(symbol)] = origin;
|
||||
}
|
||||
@@ -2197,4 +2203,31 @@ namespace ts.Completions {
|
||||
function hasIndexSignature(type: Type): boolean {
|
||||
return !!type.getStringIndexType() || !!type.getNumberIndexType();
|
||||
}
|
||||
|
||||
function isValidTrigger(sourceFile: SourceFile, triggerCharacter: string, contextToken: Node, position: number): boolean {
|
||||
switch (triggerCharacter) {
|
||||
case '"':
|
||||
case "'":
|
||||
case "`":
|
||||
// Only automatically bring up completions if this is an opening quote.
|
||||
return isStringLiteralOrTemplate(contextToken) && position === contextToken.getStart(sourceFile) + 1;
|
||||
case "<":
|
||||
// Opening JSX tag
|
||||
return contextToken.kind === SyntaxKind.LessThanToken && contextToken.parent.kind !== SyntaxKind.BinaryExpression;
|
||||
default:
|
||||
return Debug.fail(triggerCharacter);
|
||||
}
|
||||
}
|
||||
|
||||
function isStringLiteralOrTemplate(node: Node): node is StringLiteralLike | TemplateExpression | TaggedTemplateExpression {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.StringLiteral:
|
||||
case SyntaxKind.NoSubstitutionTemplateLiteral:
|
||||
case SyntaxKind.TemplateExpression:
|
||||
case SyntaxKind.TaggedTemplateExpression:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1014,21 +1014,17 @@ namespace ts.FindAllReferences.Core {
|
||||
|
||||
function addClassStaticThisReferences(referenceLocation: Node, search: Search, state: State): void {
|
||||
addReference(referenceLocation, search.symbol, state);
|
||||
if (!state.options.isForRename && isClassLike(referenceLocation.parent)) {
|
||||
Debug.assert(referenceLocation.parent.name === referenceLocation);
|
||||
// This is the class declaration.
|
||||
addStaticThisReferences(referenceLocation.parent, state.referenceAdder(search.symbol));
|
||||
}
|
||||
}
|
||||
|
||||
function addStaticThisReferences(classLike: ClassLikeDeclaration, pusher: (node: Node) => void): void {
|
||||
const classLike = referenceLocation.parent;
|
||||
if (state.options.isForRename || !isClassLike(classLike)) return;
|
||||
Debug.assert(classLike.name === referenceLocation);
|
||||
const addRef = state.referenceAdder(search.symbol);
|
||||
for (const member of classLike.members) {
|
||||
if (!(isMethodOrAccessor(member) && hasModifier(member, ModifierFlags.Static))) {
|
||||
continue;
|
||||
}
|
||||
member.body.forEachChild(function cb(node) {
|
||||
if (node.kind === SyntaxKind.ThisKeyword) {
|
||||
pusher(node);
|
||||
addRef(node);
|
||||
}
|
||||
else if (!isFunctionLike(node)) {
|
||||
node.forEachChild(cb);
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
/* @internal */
|
||||
namespace ts {
|
||||
export function getEditsForFileRename(program: Program, oldFilePath: string, newFilePath: string, host: LanguageServiceHost, formatContext: formatting.FormatContext): ReadonlyArray<FileTextChanges> {
|
||||
const pathUpdater = getPathUpdater(oldFilePath, newFilePath, host);
|
||||
return textChanges.ChangeTracker.with({ host, formatContext }, changeTracker => {
|
||||
updateTsconfigFiles(program, changeTracker, oldFilePath, newFilePath);
|
||||
for (const { sourceFile, toUpdate } of getImportsToUpdate(program, oldFilePath)) {
|
||||
const newPath = pathUpdater(isRef(toUpdate) ? toUpdate.fileName : toUpdate.text);
|
||||
if (newPath !== undefined) {
|
||||
const range = isRef(toUpdate) ? toUpdate : createStringRange(toUpdate, sourceFile);
|
||||
changeTracker.replaceRangeWithText(sourceFile, range, isRef(toUpdate) ? newPath : removeFileExtension(newPath));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function updateTsconfigFiles(program: Program, changeTracker: textChanges.ChangeTracker, oldFilePath: string, newFilePath: string): void {
|
||||
const cfg = program.getCompilerOptions().configFile;
|
||||
if (!cfg) return;
|
||||
const oldFile = cfg.jsonObject && getFilesEntry(cfg.jsonObject, oldFilePath);
|
||||
if (oldFile) {
|
||||
changeTracker.replaceRangeWithText(cfg, createStringRange(oldFile, cfg), newFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
function getFilesEntry(cfg: ObjectLiteralExpression, fileName: string): StringLiteral | undefined {
|
||||
const filesProp = find(cfg.properties, (prop): prop is PropertyAssignment =>
|
||||
isPropertyAssignment(prop) && isStringLiteral(prop.name) && prop.name.text === "files");
|
||||
const files = filesProp && filesProp.initializer;
|
||||
return files && isArrayLiteralExpression(files) ? find(files.elements, (e): e is StringLiteral => isStringLiteral(e) && e.text === fileName) : undefined;
|
||||
}
|
||||
|
||||
interface ToUpdate {
|
||||
readonly sourceFile: SourceFile;
|
||||
readonly toUpdate: StringLiteralLike | FileReference;
|
||||
}
|
||||
function isRef(toUpdate: StringLiteralLike | FileReference): toUpdate is FileReference {
|
||||
return "fileName" in toUpdate;
|
||||
}
|
||||
|
||||
function getImportsToUpdate(program: Program, oldFilePath: string): ReadonlyArray<ToUpdate> {
|
||||
const checker = program.getTypeChecker();
|
||||
const result: ToUpdate[] = [];
|
||||
for (const sourceFile of program.getSourceFiles()) {
|
||||
for (const ref of sourceFile.referencedFiles) {
|
||||
if (!program.getSourceFileFromReference(sourceFile, ref) && resolveTripleslashReference(ref.fileName, sourceFile.fileName) === oldFilePath) {
|
||||
result.push({ sourceFile, toUpdate: ref });
|
||||
}
|
||||
}
|
||||
|
||||
for (const importStringLiteral of sourceFile.imports) {
|
||||
// If it resolved to something already, ignore.
|
||||
if (checker.getSymbolAtLocation(importStringLiteral)) continue;
|
||||
|
||||
const resolved = program.getResolvedModuleWithFailedLookupLocationsFromCache(importStringLiteral.text, sourceFile.fileName);
|
||||
if (contains(resolved.failedLookupLocations, oldFilePath)) {
|
||||
result.push({ sourceFile, toUpdate: importStringLiteral });
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
function getPathUpdater(oldFilePath: string, newFilePath: string, host: LanguageServiceHost): (oldPath: string) => string | undefined {
|
||||
// Get the relative path from old to new location, and append it on to the end of imports and normalize.
|
||||
const rel = getRelativePath(newFilePath, getDirectoryPath(oldFilePath), createGetCanonicalFileName(hostUsesCaseSensitiveFileNames(host)));
|
||||
return oldPath => {
|
||||
if (!pathIsRelative(oldPath)) return;
|
||||
return ensurePathIsRelative(normalizePath(combinePaths(getDirectoryPath(oldPath), rel)));
|
||||
};
|
||||
}
|
||||
|
||||
function createStringRange(node: StringLiteralLike, sourceFile: SourceFileLike): TextRange {
|
||||
return createTextRange(node.getStart(sourceFile) + 1, node.end - 1);
|
||||
}
|
||||
}
|
||||
@@ -365,13 +365,10 @@ namespace ts.JsDoc {
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.ArrowFunction:
|
||||
return (<FunctionExpression>rightHandSide).parameters;
|
||||
case SyntaxKind.ClassExpression:
|
||||
for (const member of (<ClassExpression>rightHandSide).members) {
|
||||
if (member.kind === SyntaxKind.Constructor) {
|
||||
return (<ConstructorDeclaration>member).parameters;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SyntaxKind.ClassExpression: {
|
||||
const ctr = find((rightHandSide as ClassExpression).members, isConstructorDeclaration);
|
||||
return ctr && ctr.parameters;
|
||||
}
|
||||
}
|
||||
|
||||
return emptyArray;
|
||||
|
||||
@@ -1128,7 +1128,6 @@ namespace ts {
|
||||
let lastProjectVersion: string;
|
||||
let lastTypesRootVersion = 0;
|
||||
|
||||
const useCaseSensitivefileNames = host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames();
|
||||
const cancellationToken = new CancellationTokenObject(host.getCancellationToken && host.getCancellationToken());
|
||||
|
||||
const currentDirectory = host.getCurrentDirectory();
|
||||
@@ -1145,7 +1144,8 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
const getCanonicalFileName = createGetCanonicalFileName(useCaseSensitivefileNames);
|
||||
const useCaseSensitiveFileNames = hostUsesCaseSensitiveFileNames(host);
|
||||
const getCanonicalFileName = createGetCanonicalFileName(useCaseSensitiveFileNames);
|
||||
|
||||
function getValidSourceFile(fileName: string): SourceFile {
|
||||
const sourceFile = program.getSourceFile(fileName);
|
||||
@@ -1202,7 +1202,7 @@ namespace ts {
|
||||
getSourceFileByPath: getOrCreateSourceFileByPath,
|
||||
getCancellationToken: () => cancellationToken,
|
||||
getCanonicalFileName,
|
||||
useCaseSensitiveFileNames: () => useCaseSensitivefileNames,
|
||||
useCaseSensitiveFileNames: () => useCaseSensitiveFileNames,
|
||||
getNewLine: () => getNewLineCharacter(newSettings, () => getNewLineOrDefaultFromHost(host)),
|
||||
getDefaultLibFileName: (options) => host.getDefaultLibFileName(options),
|
||||
writeFile: noop,
|
||||
@@ -1409,7 +1409,8 @@ namespace ts {
|
||||
log,
|
||||
getValidSourceFile(fileName),
|
||||
position,
|
||||
fullPreferences);
|
||||
fullPreferences,
|
||||
options.triggerCharacter);
|
||||
}
|
||||
|
||||
function getCompletionEntryDetails(fileName: string, position: number, name: string, formattingOptions: FormatCodeSettings | undefined, source: string | undefined, preferences: UserPreferences = defaultPreferences): CompletionEntryDetails {
|
||||
@@ -1950,6 +1951,10 @@ namespace ts {
|
||||
return OrganizeImports.organizeImports(sourceFile, formatContext, host, program, preferences);
|
||||
}
|
||||
|
||||
function getEditsForFileRename(oldFilePath: string, newFilePath: string, formatOptions: FormatCodeSettings): ReadonlyArray<FileTextChanges> {
|
||||
return ts.getEditsForFileRename(getProgram(), oldFilePath, newFilePath, host, formatting.getFormatContext(formatOptions));
|
||||
}
|
||||
|
||||
function applyCodeActionCommand(action: CodeActionCommand): Promise<ApplyCodeActionCommandResult>;
|
||||
function applyCodeActionCommand(action: CodeActionCommand[]): Promise<ApplyCodeActionCommandResult[]>;
|
||||
function applyCodeActionCommand(action: CodeActionCommand | CodeActionCommand[]): Promise<ApplyCodeActionCommandResult | ApplyCodeActionCommandResult[]>;
|
||||
@@ -2250,6 +2255,7 @@ namespace ts {
|
||||
getCombinedCodeFix,
|
||||
applyCodeActionCommand,
|
||||
organizeImports,
|
||||
getEditsForFileRename,
|
||||
getEmitOutput,
|
||||
getNonBoundSourceFile,
|
||||
getSourceFile,
|
||||
|
||||
@@ -912,7 +912,7 @@ namespace ts {
|
||||
* to provide at the given source position and providing a member completion
|
||||
* list if requested.
|
||||
*/
|
||||
public getCompletionsAtPosition(fileName: string, position: number, preferences: UserPreferences | undefined) {
|
||||
public getCompletionsAtPosition(fileName: string, position: number, preferences: GetCompletionsAtPositionOptions | undefined) {
|
||||
return this.forwardJSONCall(
|
||||
`getCompletionsAtPosition('${fileName}', ${position}, ${preferences})`,
|
||||
() => this.languageService.getCompletionsAtPosition(fileName, position, preferences)
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace ts {
|
||||
const checker = program.getDiagnosticsProducingTypeChecker();
|
||||
const diags: Diagnostic[] = [];
|
||||
|
||||
if (sourceFile.commonJsModuleIndicator) {
|
||||
if (sourceFile.commonJsModuleIndicator && (programContainsEs6Modules(program) || compilerOptionsIndicateEs6Modules(program.getCompilerOptions()))) {
|
||||
diags.push(createDiagnosticForNode(getErrorNodeFromCommonJsIndicator(sourceFile.commonJsModuleIndicator), Diagnostics.File_is_a_CommonJS_module_it_may_be_converted_to_an_ES6_module));
|
||||
}
|
||||
|
||||
|
||||
@@ -413,6 +413,9 @@ namespace ts.SymbolDisplay {
|
||||
displayParts.push(spacePart());
|
||||
displayParts.push(keywordPart((symbol.declarations[0] as ExportAssignment).isExportEquals ? SyntaxKind.EqualsToken : SyntaxKind.DefaultKeyword));
|
||||
break;
|
||||
case SyntaxKind.ExportSpecifier:
|
||||
displayParts.push(keywordPart(SyntaxKind.ExportKeyword));
|
||||
break;
|
||||
default:
|
||||
displayParts.push(keywordPart(SyntaxKind.ImportKeyword));
|
||||
}
|
||||
|
||||
@@ -365,8 +365,12 @@ namespace ts.textChanges {
|
||||
this.insertText(sourceFile, token.getStart(sourceFile), text);
|
||||
}
|
||||
|
||||
public replaceRangeWithText(sourceFile: SourceFile, range: TextRange, text: string) {
|
||||
this.changes.push({ kind: ChangeKind.Text, sourceFile, range, text });
|
||||
}
|
||||
|
||||
private insertText(sourceFile: SourceFile, pos: number, text: string): void {
|
||||
this.changes.push({ kind: ChangeKind.Text, sourceFile, range: { pos, end: pos }, text });
|
||||
this.replaceRangeWithText(sourceFile, createTextRange(pos), text);
|
||||
}
|
||||
|
||||
/** Prefer this over replacing a node with another that has a type annotation, as it avoids reformatting the other parts of the node. */
|
||||
|
||||
@@ -63,6 +63,7 @@
|
||||
"navigateTo.ts",
|
||||
"navigationBar.ts",
|
||||
"organizeImports.ts",
|
||||
"getEditsForFileRename.ts",
|
||||
"outliningElementsCollector.ts",
|
||||
"patternMatcher.ts",
|
||||
"preProcess.ts",
|
||||
|
||||
@@ -334,6 +334,7 @@ namespace ts {
|
||||
getApplicableRefactors(fileName: string, positionOrRaneg: number | TextRange, preferences: UserPreferences | undefined): ApplicableRefactorInfo[];
|
||||
getEditsForRefactor(fileName: string, formatOptions: FormatCodeSettings, positionOrRange: number | TextRange, refactorName: string, actionName: string, preferences: UserPreferences | undefined): RefactorEditInfo | undefined;
|
||||
organizeImports(scope: OrganizeImportsScope, formatOptions: FormatCodeSettings, preferences: UserPreferences | undefined): ReadonlyArray<FileTextChanges>;
|
||||
getEditsForFileRename(oldFilePath: string, newFilePath: string, formatOptions: FormatCodeSettings): ReadonlyArray<FileTextChanges>;
|
||||
|
||||
getEmitOutput(fileName: string, emitOnlyDtsFiles?: boolean): EmitOutput;
|
||||
|
||||
@@ -354,8 +355,9 @@ namespace ts {
|
||||
|
||||
export type OrganizeImportsScope = CombinedCodeFixScope;
|
||||
|
||||
/** @deprecated Use UserPreferences */
|
||||
export interface GetCompletionsAtPositionOptions extends UserPreferences {
|
||||
/** If the editor is asking for completions because a certain character was typed, and not because the user explicitly requested them, this should be set. */
|
||||
triggerCharacter?: string;
|
||||
/** @deprecated Use includeCompletionsForModuleExports */
|
||||
includeExternalModuleExports?: boolean;
|
||||
/** @deprecated Use includeCompletionsWithInsertText */
|
||||
|
||||
@@ -1213,6 +1213,21 @@ namespace ts {
|
||||
? isStringOrNumericLiteral(name.expression) ? name.expression.text : undefined
|
||||
: getTextOfIdentifierOrLiteral(name);
|
||||
}
|
||||
|
||||
export function programContainsEs6Modules(program: Program): boolean {
|
||||
return program.getSourceFiles().some(s => !s.isDeclarationFile && !program.isSourceFileFromExternalLibrary(s) && !!s.externalModuleIndicator);
|
||||
}
|
||||
export function compilerOptionsIndicateEs6Modules(compilerOptions: CompilerOptions): boolean {
|
||||
return !!compilerOptions.module || compilerOptions.target >= ScriptTarget.ES2015 || !!compilerOptions.noEmit;
|
||||
}
|
||||
|
||||
export function hostUsesCaseSensitiveFileNames(host: LanguageServiceHost): boolean {
|
||||
return host.useCaseSensitiveFileNames ? host.useCaseSensitiveFileNames() : false;
|
||||
}
|
||||
|
||||
export function hostGetCanonicalFileName(host: LanguageServiceHost): GetCanonicalFileName {
|
||||
return createGetCanonicalFileName(hostUsesCaseSensitiveFileNames(host));
|
||||
}
|
||||
}
|
||||
|
||||
// Display-part writer helpers
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
tests/cases/compiler/user.ts(3,5): error TS2322: Type '() => void' is not assignable to type 'string'.
|
||||
tests/cases/compiler/user.ts(4,5): error TS2322: Type '() => void' is not assignable to type 'string'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/demo.d.ts (0 errors) ====
|
||||
declare namespace demoNS {
|
||||
function f(): void;
|
||||
}
|
||||
declare module 'demoModule' {
|
||||
import alias = demoNS;
|
||||
export = alias;
|
||||
}
|
||||
==== tests/cases/compiler/user.ts (2 errors) ====
|
||||
import { f } from 'demoModule';
|
||||
// Assign an incorrect type here to see the type of 'f'.
|
||||
let x1: string = demoNS.f;
|
||||
~~
|
||||
!!! error TS2322: Type '() => void' is not assignable to type 'string'.
|
||||
let x2: string = f;
|
||||
~~
|
||||
!!! error TS2322: Type '() => void' is not assignable to type 'string'.
|
||||
@@ -0,0 +1,23 @@
|
||||
//// [tests/cases/compiler/aliasDoesNotDuplicateSignatures.ts] ////
|
||||
|
||||
//// [demo.d.ts]
|
||||
declare namespace demoNS {
|
||||
function f(): void;
|
||||
}
|
||||
declare module 'demoModule' {
|
||||
import alias = demoNS;
|
||||
export = alias;
|
||||
}
|
||||
//// [user.ts]
|
||||
import { f } from 'demoModule';
|
||||
// Assign an incorrect type here to see the type of 'f'.
|
||||
let x1: string = demoNS.f;
|
||||
let x2: string = f;
|
||||
|
||||
//// [user.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
var demoModule_1 = require("demoModule");
|
||||
// Assign an incorrect type here to see the type of 'f'.
|
||||
var x1 = demoNS.f;
|
||||
var x2 = demoModule_1.f;
|
||||
@@ -0,0 +1,32 @@
|
||||
=== tests/cases/compiler/demo.d.ts ===
|
||||
declare namespace demoNS {
|
||||
>demoNS : Symbol(demoNS, Decl(demo.d.ts, 0, 0))
|
||||
|
||||
function f(): void;
|
||||
>f : Symbol(f, Decl(demo.d.ts, 0, 26))
|
||||
}
|
||||
declare module 'demoModule' {
|
||||
>'demoModule' : Symbol('demoModule', Decl(demo.d.ts, 2, 1))
|
||||
|
||||
import alias = demoNS;
|
||||
>alias : Symbol(alias, Decl(demo.d.ts, 3, 29))
|
||||
>demoNS : Symbol(alias, Decl(demo.d.ts, 0, 0))
|
||||
|
||||
export = alias;
|
||||
>alias : Symbol(alias, Decl(demo.d.ts, 3, 29))
|
||||
}
|
||||
=== tests/cases/compiler/user.ts ===
|
||||
import { f } from 'demoModule';
|
||||
>f : Symbol(f, Decl(user.ts, 0, 8))
|
||||
|
||||
// Assign an incorrect type here to see the type of 'f'.
|
||||
let x1: string = demoNS.f;
|
||||
>x1 : Symbol(x1, Decl(user.ts, 2, 3))
|
||||
>demoNS.f : Symbol(f, Decl(demo.d.ts, 0, 26))
|
||||
>demoNS : Symbol(demoNS, Decl(demo.d.ts, 0, 0))
|
||||
>f : Symbol(f, Decl(demo.d.ts, 0, 26))
|
||||
|
||||
let x2: string = f;
|
||||
>x2 : Symbol(x2, Decl(user.ts, 3, 3))
|
||||
>f : Symbol(f, Decl(user.ts, 0, 8))
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
=== tests/cases/compiler/demo.d.ts ===
|
||||
declare namespace demoNS {
|
||||
>demoNS : typeof demoNS
|
||||
|
||||
function f(): void;
|
||||
>f : () => void
|
||||
}
|
||||
declare module 'demoModule' {
|
||||
>'demoModule' : typeof 'demoModule'
|
||||
|
||||
import alias = demoNS;
|
||||
>alias : typeof alias
|
||||
>demoNS : typeof alias
|
||||
|
||||
export = alias;
|
||||
>alias : typeof alias
|
||||
}
|
||||
=== tests/cases/compiler/user.ts ===
|
||||
import { f } from 'demoModule';
|
||||
>f : () => void
|
||||
|
||||
// Assign an incorrect type here to see the type of 'f'.
|
||||
let x1: string = demoNS.f;
|
||||
>x1 : string
|
||||
>demoNS.f : () => void
|
||||
>demoNS : typeof demoNS
|
||||
>f : () => void
|
||||
|
||||
let x2: string = f;
|
||||
>x2 : string
|
||||
>f : () => void
|
||||
|
||||
+22
-4
@@ -1494,7 +1494,7 @@ declare namespace ts {
|
||||
comment: string | undefined;
|
||||
}
|
||||
interface JSDocTag extends Node {
|
||||
parent: JSDoc;
|
||||
parent: JSDoc | JSDocTypeLiteral;
|
||||
atToken: AtToken;
|
||||
tagName: Identifier;
|
||||
comment: string | undefined;
|
||||
@@ -2100,7 +2100,7 @@ declare namespace ts {
|
||||
Unit = 13536,
|
||||
StringOrNumberLiteral = 96,
|
||||
PossiblyFalsy = 14574,
|
||||
StringLike = 524322,
|
||||
StringLike = 34,
|
||||
NumberLike = 84,
|
||||
BooleanLike = 136,
|
||||
EnumLike = 272,
|
||||
@@ -2340,6 +2340,7 @@ declare namespace ts {
|
||||
inlineSources?: boolean;
|
||||
isolatedModules?: boolean;
|
||||
jsx?: JsxEmit;
|
||||
keyofStringsOnly?: boolean;
|
||||
lib?: string[];
|
||||
locale?: string;
|
||||
mapRoot?: string;
|
||||
@@ -3402,6 +3403,7 @@ declare namespace ts {
|
||||
set(directory: string, result: ResolvedModuleWithFailedLookupLocations): void;
|
||||
}
|
||||
function createModuleResolutionCache(currentDirectory: string, getCanonicalFileName: (s: string) => string): ModuleResolutionCache;
|
||||
function resolveModuleNameFromCache(moduleName: string, containingFile: string, cache: ModuleResolutionCache): ResolvedModuleWithFailedLookupLocations | undefined;
|
||||
function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache): ResolvedModuleWithFailedLookupLocations;
|
||||
function nodeModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache): ResolvedModuleWithFailedLookupLocations;
|
||||
function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: NonRelativeModuleNameResolutionCache): ResolvedModuleWithFailedLookupLocations;
|
||||
@@ -4446,6 +4448,7 @@ declare namespace ts {
|
||||
getApplicableRefactors(fileName: string, positionOrRaneg: number | TextRange, preferences: UserPreferences | undefined): ApplicableRefactorInfo[];
|
||||
getEditsForRefactor(fileName: string, formatOptions: FormatCodeSettings, positionOrRange: number | TextRange, refactorName: string, actionName: string, preferences: UserPreferences | undefined): RefactorEditInfo | undefined;
|
||||
organizeImports(scope: OrganizeImportsScope, formatOptions: FormatCodeSettings, preferences: UserPreferences | undefined): ReadonlyArray<FileTextChanges>;
|
||||
getEditsForFileRename(oldFilePath: string, newFilePath: string, formatOptions: FormatCodeSettings): ReadonlyArray<FileTextChanges>;
|
||||
getEmitOutput(fileName: string, emitOnlyDtsFiles?: boolean): EmitOutput;
|
||||
getProgram(): Program;
|
||||
dispose(): void;
|
||||
@@ -4455,8 +4458,9 @@ declare namespace ts {
|
||||
fileName: string;
|
||||
}
|
||||
type OrganizeImportsScope = CombinedCodeFixScope;
|
||||
/** @deprecated Use UserPreferences */
|
||||
interface GetCompletionsAtPositionOptions extends UserPreferences {
|
||||
/** If the editor is asking for completions because a certain character was typed, and not because the user explicitly requested them, this should be set. */
|
||||
triggerCharacter?: string;
|
||||
/** @deprecated Use includeCompletionsForModuleExports */
|
||||
includeExternalModuleExports?: boolean;
|
||||
/** @deprecated Use includeCompletionsWithInsertText */
|
||||
@@ -5409,7 +5413,8 @@ declare namespace ts.server.protocol {
|
||||
GetSupportedCodeFixes = "getSupportedCodeFixes",
|
||||
GetApplicableRefactors = "getApplicableRefactors",
|
||||
GetEditsForRefactor = "getEditsForRefactor",
|
||||
OrganizeImports = "organizeImports"
|
||||
OrganizeImports = "organizeImports",
|
||||
GetEditsForFileRename = "getEditsForFileRename"
|
||||
}
|
||||
/**
|
||||
* A TypeScript Server message
|
||||
@@ -5805,6 +5810,17 @@ declare namespace ts.server.protocol {
|
||||
interface OrganizeImportsResponse extends Response {
|
||||
edits: ReadonlyArray<FileCodeEdits>;
|
||||
}
|
||||
interface GetEditsForFileRenameRequest extends Request {
|
||||
command: CommandTypes.GetEditsForFileRename;
|
||||
arguments: GetEditsForFileRenameRequestArgs;
|
||||
}
|
||||
interface GetEditsForFileRenameRequestArgs extends FileRequestArgs {
|
||||
readonly oldFilePath: string;
|
||||
readonly newFilePath: string;
|
||||
}
|
||||
interface GetEditsForFileRenameResponse extends Response {
|
||||
edits: ReadonlyArray<FileCodeEdits>;
|
||||
}
|
||||
/**
|
||||
* Request for the available codefixes at a specific position.
|
||||
*/
|
||||
@@ -6667,6 +6683,7 @@ declare namespace ts.server.protocol {
|
||||
* Optional prefix to apply to possible completions.
|
||||
*/
|
||||
prefix?: string;
|
||||
triggerCharacter?: string;
|
||||
/**
|
||||
* @deprecated Use UserPreferences.includeCompletionsForModuleExports
|
||||
*/
|
||||
@@ -8320,6 +8337,7 @@ declare namespace ts.server {
|
||||
private getApplicableRefactors;
|
||||
private getEditsForRefactor;
|
||||
private organizeImports;
|
||||
private getEditsForFileRename;
|
||||
private getCodeFixes;
|
||||
private getCombinedCodeFix;
|
||||
private applyCodeActionCommand;
|
||||
|
||||
+7
-3
@@ -1494,7 +1494,7 @@ declare namespace ts {
|
||||
comment: string | undefined;
|
||||
}
|
||||
interface JSDocTag extends Node {
|
||||
parent: JSDoc;
|
||||
parent: JSDoc | JSDocTypeLiteral;
|
||||
atToken: AtToken;
|
||||
tagName: Identifier;
|
||||
comment: string | undefined;
|
||||
@@ -2100,7 +2100,7 @@ declare namespace ts {
|
||||
Unit = 13536,
|
||||
StringOrNumberLiteral = 96,
|
||||
PossiblyFalsy = 14574,
|
||||
StringLike = 524322,
|
||||
StringLike = 34,
|
||||
NumberLike = 84,
|
||||
BooleanLike = 136,
|
||||
EnumLike = 272,
|
||||
@@ -2340,6 +2340,7 @@ declare namespace ts {
|
||||
inlineSources?: boolean;
|
||||
isolatedModules?: boolean;
|
||||
jsx?: JsxEmit;
|
||||
keyofStringsOnly?: boolean;
|
||||
lib?: string[];
|
||||
locale?: string;
|
||||
mapRoot?: string;
|
||||
@@ -3402,6 +3403,7 @@ declare namespace ts {
|
||||
set(directory: string, result: ResolvedModuleWithFailedLookupLocations): void;
|
||||
}
|
||||
function createModuleResolutionCache(currentDirectory: string, getCanonicalFileName: (s: string) => string): ModuleResolutionCache;
|
||||
function resolveModuleNameFromCache(moduleName: string, containingFile: string, cache: ModuleResolutionCache): ResolvedModuleWithFailedLookupLocations | undefined;
|
||||
function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache): ResolvedModuleWithFailedLookupLocations;
|
||||
function nodeModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache): ResolvedModuleWithFailedLookupLocations;
|
||||
function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: NonRelativeModuleNameResolutionCache): ResolvedModuleWithFailedLookupLocations;
|
||||
@@ -4446,6 +4448,7 @@ declare namespace ts {
|
||||
getApplicableRefactors(fileName: string, positionOrRaneg: number | TextRange, preferences: UserPreferences | undefined): ApplicableRefactorInfo[];
|
||||
getEditsForRefactor(fileName: string, formatOptions: FormatCodeSettings, positionOrRange: number | TextRange, refactorName: string, actionName: string, preferences: UserPreferences | undefined): RefactorEditInfo | undefined;
|
||||
organizeImports(scope: OrganizeImportsScope, formatOptions: FormatCodeSettings, preferences: UserPreferences | undefined): ReadonlyArray<FileTextChanges>;
|
||||
getEditsForFileRename(oldFilePath: string, newFilePath: string, formatOptions: FormatCodeSettings): ReadonlyArray<FileTextChanges>;
|
||||
getEmitOutput(fileName: string, emitOnlyDtsFiles?: boolean): EmitOutput;
|
||||
getProgram(): Program;
|
||||
dispose(): void;
|
||||
@@ -4455,8 +4458,9 @@ declare namespace ts {
|
||||
fileName: string;
|
||||
}
|
||||
type OrganizeImportsScope = CombinedCodeFixScope;
|
||||
/** @deprecated Use UserPreferences */
|
||||
interface GetCompletionsAtPositionOptions extends UserPreferences {
|
||||
/** If the editor is asking for completions because a certain character was typed, and not because the user explicitly requested them, this should be set. */
|
||||
triggerCharacter?: string;
|
||||
/** @deprecated Use includeCompletionsForModuleExports */
|
||||
includeExternalModuleExports?: boolean;
|
||||
/** @deprecated Use includeCompletionsWithInsertText */
|
||||
|
||||
@@ -17,9 +17,9 @@ var r = c.toString();
|
||||
var r2 = c.hasOwnProperty('');
|
||||
>r2 : boolean
|
||||
>c.hasOwnProperty('') : boolean
|
||||
>c.hasOwnProperty : (v: string) => boolean
|
||||
>c.hasOwnProperty : (v: string | number | symbol) => boolean
|
||||
>c : C
|
||||
>hasOwnProperty : (v: string) => boolean
|
||||
>hasOwnProperty : (v: string | number | symbol) => boolean
|
||||
>'' : ""
|
||||
|
||||
var o: Object = c;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/compiler/classMemberInitializerWithLamdaScoping3_1.ts(8,21): error TS2304: Cannot find name 'field1'.
|
||||
tests/cases/compiler/classMemberInitializerWithLamdaScoping3_1.ts(8,21): error TS2663: Cannot find name 'field1'. Did you mean the instance member 'this.field1'?
|
||||
|
||||
|
||||
==== tests/cases/compiler/classMemberInitializerWithLamdaScoping3_0.ts (0 errors) ====
|
||||
@@ -14,6 +14,6 @@ tests/cases/compiler/classMemberInitializerWithLamdaScoping3_1.ts(8,21): error T
|
||||
messageHandler = () => {
|
||||
console.log(field1); // Should be error that couldnt find symbol field1
|
||||
~~~~~~
|
||||
!!! error TS2304: Cannot find name 'field1'.
|
||||
!!! error TS2663: Cannot find name 'field1'. Did you mean the instance member 'this.field1'?
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
//// [tests/cases/compiler/commonJsImportClassExpression.ts] ////
|
||||
|
||||
//// [mod1.ts]
|
||||
export = class {
|
||||
chunk = 1
|
||||
}
|
||||
|
||||
//// [use.ts]
|
||||
import Chunk = require('./mod1')
|
||||
declare var c: Chunk;
|
||||
c.chunk;
|
||||
|
||||
|
||||
//// [mod1.js]
|
||||
"use strict";
|
||||
module.exports = /** @class */ (function () {
|
||||
function class_1() {
|
||||
this.chunk = 1;
|
||||
}
|
||||
return class_1;
|
||||
}());
|
||||
//// [use.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
c.chunk;
|
||||
@@ -0,0 +1,19 @@
|
||||
=== tests/cases/compiler/use.ts ===
|
||||
import Chunk = require('./mod1')
|
||||
>Chunk : Symbol(Chunk, Decl(use.ts, 0, 0))
|
||||
|
||||
declare var c: Chunk;
|
||||
>c : Symbol(c, Decl(use.ts, 1, 11))
|
||||
>Chunk : Symbol(Chunk, Decl(use.ts, 0, 0))
|
||||
|
||||
c.chunk;
|
||||
>c.chunk : Symbol(Chunk.chunk, Decl(mod1.ts, 0, 16))
|
||||
>c : Symbol(c, Decl(use.ts, 1, 11))
|
||||
>chunk : Symbol(Chunk.chunk, Decl(mod1.ts, 0, 16))
|
||||
|
||||
=== tests/cases/compiler/mod1.ts ===
|
||||
export = class {
|
||||
chunk = 1
|
||||
>chunk : Symbol((Anonymous class).chunk, Decl(mod1.ts, 0, 16))
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
=== tests/cases/compiler/use.ts ===
|
||||
import Chunk = require('./mod1')
|
||||
>Chunk : typeof Chunk
|
||||
|
||||
declare var c: Chunk;
|
||||
>c : Chunk
|
||||
>Chunk : Chunk
|
||||
|
||||
c.chunk;
|
||||
>c.chunk : number
|
||||
>c : Chunk
|
||||
>chunk : number
|
||||
|
||||
=== tests/cases/compiler/mod1.ts ===
|
||||
export = class {
|
||||
>class { chunk = 1} : typeof (Anonymous class)
|
||||
|
||||
chunk = 1
|
||||
>chunk : number
|
||||
>1 : 1
|
||||
}
|
||||
|
||||
@@ -1689,7 +1689,7 @@ declare module Immutable {
|
||||
export interface Class<T extends Object> {
|
||||
>Class : Symbol(Class, Decl(immutable.ts, 214, 70))
|
||||
>T : Symbol(T, Decl(immutable.ts, 215, 27))
|
||||
>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --))
|
||||
>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||||
|
||||
(values?: Partial<T> | Iterable<[string, any]>): Instance<T> & Readonly<T>;
|
||||
>values : Symbol(values, Decl(immutable.ts, 216, 7))
|
||||
@@ -1714,7 +1714,7 @@ declare module Immutable {
|
||||
export interface Instance<T extends Object> {
|
||||
>Instance : Symbol(Instance, Decl(immutable.ts, 218, 5))
|
||||
>T : Symbol(T, Decl(immutable.ts, 219, 30))
|
||||
>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --))
|
||||
>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||||
|
||||
readonly size: number;
|
||||
>size : Symbol(Instance.size, Decl(immutable.ts, 219, 49))
|
||||
@@ -2005,7 +2005,7 @@ declare module Immutable {
|
||||
|
||||
toJS(): Object;
|
||||
>toJS : Symbol(Keyed.toJS, Decl(immutable.ts, 269, 76))
|
||||
>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --))
|
||||
>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||||
|
||||
toJSON(): { [key: string]: V };
|
||||
>toJSON : Symbol(Keyed.toJSON, Decl(immutable.ts, 270, 21))
|
||||
@@ -2594,7 +2594,7 @@ declare module Immutable {
|
||||
|
||||
toJS(): Object;
|
||||
>toJS : Symbol(Keyed.toJS, Decl(immutable.ts, 340, 59))
|
||||
>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --))
|
||||
>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||||
|
||||
toJSON(): { [key: string]: V };
|
||||
>toJSON : Symbol(Keyed.toJSON, Decl(immutable.ts, 341, 21))
|
||||
|
||||
@@ -9,8 +9,8 @@ var a: any;
|
||||
>a : any
|
||||
|
||||
var v = {
|
||||
>v : { [x: string]: () => void; [x: number]: () => void; [""](): void; [0](): void; }
|
||||
>{ [s]() { }, [n]() { }, [s + s]() { }, [s + n]() { }, [+s]() { }, [""]() { }, [0]() { }, [a]() { }, [<any>true]() { }, [`hello bye`]() { }, [`hello ${a} bye`]() { }} : { [x: string]: () => void; [x: number]: () => void; [""](): void; [0](): void; }
|
||||
>v : { [x: string]: () => void; [x: number]: () => void; [""](): void; [0](): void; [`hello bye`](): void; }
|
||||
>{ [s]() { }, [n]() { }, [s + s]() { }, [s + n]() { }, [+s]() { }, [""]() { }, [0]() { }, [a]() { }, [<any>true]() { }, [`hello bye`]() { }, [`hello ${a} bye`]() { }} : { [x: string]: () => void; [x: number]: () => void; [""](): void; [0](): void; [`hello bye`](): void; }
|
||||
|
||||
[s]() { },
|
||||
>[s] : () => void
|
||||
|
||||
@@ -9,8 +9,8 @@ var a: any;
|
||||
>a : any
|
||||
|
||||
var v = {
|
||||
>v : { [x: string]: () => void; [x: number]: () => void; [""](): void; [0](): void; }
|
||||
>{ [s]() { }, [n]() { }, [s + s]() { }, [s + n]() { }, [+s]() { }, [""]() { }, [0]() { }, [a]() { }, [<any>true]() { }, [`hello bye`]() { }, [`hello ${a} bye`]() { }} : { [x: string]: () => void; [x: number]: () => void; [""](): void; [0](): void; }
|
||||
>v : { [x: string]: () => void; [x: number]: () => void; [""](): void; [0](): void; [`hello bye`](): void; }
|
||||
>{ [s]() { }, [n]() { }, [s + s]() { }, [s + n]() { }, [+s]() { }, [""]() { }, [0]() { }, [a]() { }, [<any>true]() { }, [`hello bye`]() { }, [`hello ${a} bye`]() { }} : { [x: string]: () => void; [x: number]: () => void; [""](): void; [0](): void; [`hello bye`](): void; }
|
||||
|
||||
[s]() { },
|
||||
>[s] : () => void
|
||||
|
||||
@@ -12,8 +12,8 @@ class C extends Base {
|
||||
>super : typeof Base
|
||||
|
||||
var obj = {
|
||||
>obj : { [x: string]: () => void; }
|
||||
>{ [(super(), "prop")]() { } } : { [x: string]: () => void; }
|
||||
>obj : { [(super(), "prop")](): void; }
|
||||
>{ [(super(), "prop")]() { } } : { [(super(), "prop")](): void; }
|
||||
|
||||
[(super(), "prop")]() { }
|
||||
>[(super(), "prop")] : () => void
|
||||
|
||||
@@ -12,8 +12,8 @@ class C extends Base {
|
||||
>super : typeof Base
|
||||
|
||||
var obj = {
|
||||
>obj : { [x: string]: () => void; }
|
||||
>{ [(super(), "prop")]() { } } : { [x: string]: () => void; }
|
||||
>obj : { [(super(), "prop")](): void; }
|
||||
>{ [(super(), "prop")]() { } } : { [(super(), "prop")](): void; }
|
||||
|
||||
[(super(), "prop")]() { }
|
||||
>[(super(), "prop")] : () => void
|
||||
|
||||
@@ -15,8 +15,8 @@ class C extends Base {
|
||||
>() => { var obj = { // Ideally, we would capture this. But the reference is // illegal, and not capturing this is consistent with //treatment of other similar violations. [(super(), "prop")]() { } }; } : () => void
|
||||
|
||||
var obj = {
|
||||
>obj : { [x: string]: () => void; }
|
||||
>{ // Ideally, we would capture this. But the reference is // illegal, and not capturing this is consistent with //treatment of other similar violations. [(super(), "prop")]() { } } : { [x: string]: () => void; }
|
||||
>obj : { [(super(), "prop")](): void; }
|
||||
>{ // Ideally, we would capture this. But the reference is // illegal, and not capturing this is consistent with //treatment of other similar violations. [(super(), "prop")]() { } } : { [(super(), "prop")](): void; }
|
||||
|
||||
// Ideally, we would capture this. But the reference is
|
||||
// illegal, and not capturing this is consistent with
|
||||
|
||||
@@ -15,8 +15,8 @@ class C extends Base {
|
||||
>() => { var obj = { // Ideally, we would capture this. But the reference is // illegal, and not capturing this is consistent with //treatment of other similar violations. [(super(), "prop")]() { } }; } : () => void
|
||||
|
||||
var obj = {
|
||||
>obj : { [x: string]: () => void; }
|
||||
>{ // Ideally, we would capture this. But the reference is // illegal, and not capturing this is consistent with //treatment of other similar violations. [(super(), "prop")]() { } } : { [x: string]: () => void; }
|
||||
>obj : { [(super(), "prop")](): void; }
|
||||
>{ // Ideally, we would capture this. But the reference is // illegal, and not capturing this is consistent with //treatment of other similar violations. [(super(), "prop")]() { } } : { [(super(), "prop")](): void; }
|
||||
|
||||
// Ideally, we would capture this. But the reference is
|
||||
// illegal, and not capturing this is consistent with
|
||||
|
||||
@@ -3,8 +3,8 @@ var b: boolean;
|
||||
>b : boolean
|
||||
|
||||
var v = {
|
||||
>v : { [x: string]: number; [x: number]: any; [true]: number; }
|
||||
>{ [b]: 0, [true]: 1, [[]]: 0, [{}]: 0, [undefined]: undefined, [null]: null} : { [x: string]: number; [x: number]: null; [true]: number; }
|
||||
>v : { [x: number]: any; }
|
||||
>{ [b]: 0, [true]: 1, [[]]: 0, [{}]: 0, [undefined]: undefined, [null]: null} : { [x: number]: null; }
|
||||
|
||||
[b]: 0,
|
||||
>[b] : number
|
||||
|
||||
@@ -3,8 +3,8 @@ var b: boolean;
|
||||
>b : boolean
|
||||
|
||||
var v = {
|
||||
>v : { [x: string]: number; [x: number]: any; [true]: number; }
|
||||
>{ [b]: 0, [true]: 1, [[]]: 0, [{}]: 0, [undefined]: undefined, [null]: null} : { [x: string]: number; [x: number]: null; [true]: number; }
|
||||
>v : { [x: number]: any; }
|
||||
>{ [b]: 0, [true]: 1, [[]]: 0, [{}]: 0, [undefined]: undefined, [null]: null} : { [x: number]: null; }
|
||||
|
||||
[b]: 0,
|
||||
>[b] : number
|
||||
|
||||
@@ -19,8 +19,8 @@ function f(x): any { }
|
||||
>x : any
|
||||
|
||||
var v = {
|
||||
>v : { [x: string]: number; [x: number]: number; [f(true)]: number; }
|
||||
>{ [f("")]: 0, [f(0)]: 0, [f(true)]: 0} : { [x: string]: number; [x: number]: number; [f(true)]: number; }
|
||||
>v : { [x: string]: number; [x: number]: number; }
|
||||
>{ [f("")]: 0, [f(0)]: 0, [f(true)]: 0} : { [x: string]: number; [x: number]: number; }
|
||||
|
||||
[f("")]: 0,
|
||||
>[f("")] : number
|
||||
|
||||
@@ -19,8 +19,8 @@ function f(x): any { }
|
||||
>x : any
|
||||
|
||||
var v = {
|
||||
>v : { [x: string]: number; [x: number]: number; [f(true)]: number; }
|
||||
>{ [f("")]: 0, [f(0)]: 0, [f(true)]: 0} : { [x: string]: number; [x: number]: number; [f(true)]: number; }
|
||||
>v : { [x: string]: number; [x: number]: number; }
|
||||
>{ [f("")]: 0, [f(0)]: 0, [f(true)]: 0} : { [x: string]: number; [x: number]: number; }
|
||||
|
||||
[f("")]: 0,
|
||||
>[f("")] : number
|
||||
|
||||
@@ -5,9 +5,8 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(17,5): error TS23
|
||||
tests/cases/conformance/types/conditional/conditionalTypes1.ts(18,9): error TS2322: Type 'T' is not assignable to type 'string'.
|
||||
Type 'string | undefined' is not assignable to type 'string'.
|
||||
Type 'undefined' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/conditional/conditionalTypes1.ts(24,5): error TS2322: Type 'Partial<T>[keyof T]' is not assignable to type 'NonNullable<Partial<T>[keyof T]>'.
|
||||
Type 'T[keyof T] | undefined' is not assignable to type 'NonNullable<Partial<T>[keyof T]>'.
|
||||
Type 'undefined' is not assignable to type 'NonNullable<Partial<T>[keyof T]>'.
|
||||
tests/cases/conformance/types/conditional/conditionalTypes1.ts(24,5): error TS2322: Type 'T[keyof T] | undefined' is not assignable to type 'NonNullable<Partial<T>[keyof T]>'.
|
||||
Type 'undefined' is not assignable to type 'NonNullable<Partial<T>[keyof T]>'.
|
||||
tests/cases/conformance/types/conditional/conditionalTypes1.ts(29,5): error TS2322: Type 'T["x"]' is not assignable to type 'NonNullable<T["x"]>'.
|
||||
Type 'string | undefined' is not assignable to type 'NonNullable<T["x"]>'.
|
||||
Type 'undefined' is not assignable to type 'NonNullable<T["x"]>'.
|
||||
@@ -17,41 +16,25 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(30,9): error TS23
|
||||
tests/cases/conformance/types/conditional/conditionalTypes1.ts(103,5): error TS2322: Type 'Pick<T, { [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]>' is not assignable to type 'T'.
|
||||
tests/cases/conformance/types/conditional/conditionalTypes1.ts(104,5): error TS2322: Type 'Pick<T, { [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]>' is not assignable to type 'T'.
|
||||
tests/cases/conformance/types/conditional/conditionalTypes1.ts(106,5): error TS2322: Type 'Pick<T, { [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]>' is not assignable to type 'Pick<T, { [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]>'.
|
||||
Type '{ [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]' is not assignable to type '{ [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]'.
|
||||
Type 'T[keyof T] extends Function ? keyof T : never' is not assignable to type '{ [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]'.
|
||||
Type 'keyof T' is not assignable to type '{ [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]'.
|
||||
Type 'keyof T' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
|
||||
Type 'T[keyof T] extends Function ? keyof T : never' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
|
||||
Type '{ [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
|
||||
Type 'T[keyof T] extends Function ? keyof T : never' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
|
||||
Type 'keyof T' is not assignable to type 'never'.
|
||||
Type 'T[keyof T] extends Function ? keyof T : never' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
|
||||
Type 'keyof T' is not assignable to type 'never'.
|
||||
Type 'string | number | symbol' is not assignable to type 'never'.
|
||||
Type 'string' is not assignable to type 'never'.
|
||||
tests/cases/conformance/types/conditional/conditionalTypes1.ts(108,5): error TS2322: Type 'Pick<T, { [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]>' is not assignable to type 'Pick<T, { [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]>'.
|
||||
Type '{ [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]' is not assignable to type '{ [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]'.
|
||||
Type 'T[keyof T] extends Function ? never : keyof T' is not assignable to type '{ [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]'.
|
||||
Type 'keyof T' is not assignable to type '{ [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]'.
|
||||
Type 'keyof T' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'.
|
||||
Type 'T[keyof T] extends Function ? never : keyof T' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'.
|
||||
Type '{ [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'.
|
||||
Type 'T[keyof T] extends Function ? never : keyof T' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'.
|
||||
Type 'keyof T' is not assignable to type 'never'.
|
||||
tests/cases/conformance/types/conditional/conditionalTypes1.ts(114,5): error TS2322: Type 'keyof T' is not assignable to type '{ [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]'.
|
||||
Type 'keyof T' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'.
|
||||
tests/cases/conformance/types/conditional/conditionalTypes1.ts(115,5): error TS2322: Type '{ [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]' is not assignable to type '{ [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]'.
|
||||
Type 'T[keyof T] extends Function ? never : keyof T' is not assignable to type '{ [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]'.
|
||||
Type 'keyof T' is not assignable to type '{ [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]'.
|
||||
Type 'T[keyof T] extends Function ? never : keyof T' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'.
|
||||
Type '{ [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'.
|
||||
Type 'T[keyof T] extends Function ? never : keyof T' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'.
|
||||
Type 'keyof T' is not assignable to type 'never'.
|
||||
tests/cases/conformance/types/conditional/conditionalTypes1.ts(116,5): error TS2322: Type 'keyof T' is not assignable to type '{ [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]'.
|
||||
Type 'keyof T' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
|
||||
tests/cases/conformance/types/conditional/conditionalTypes1.ts(117,5): error TS2322: Type '{ [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]' is not assignable to type '{ [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]'.
|
||||
Type 'T[keyof T] extends Function ? keyof T : never' is not assignable to type '{ [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]'.
|
||||
Type 'keyof T' is not assignable to type '{ [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]'.
|
||||
Type 'T[keyof T] extends Function ? keyof T : never' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
|
||||
Type '{ [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
|
||||
Type 'T[keyof T] extends Function ? keyof T : never' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
|
||||
Type 'keyof T' is not assignable to type 'never'.
|
||||
Type 'T[keyof T] extends Function ? never : keyof T' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'.
|
||||
Type 'keyof T' is not assignable to type 'never'.
|
||||
tests/cases/conformance/types/conditional/conditionalTypes1.ts(114,5): error TS2322: Type 'keyof T' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'.
|
||||
Type 'string | number | symbol' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'.
|
||||
Type 'string' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'.
|
||||
tests/cases/conformance/types/conditional/conditionalTypes1.ts(115,5): error TS2322: Type 'T[keyof T] extends Function ? never : keyof T' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'.
|
||||
Type 'keyof T' is not assignable to type 'never'.
|
||||
Type 'string | number | symbol' is not assignable to type 'never'.
|
||||
Type 'string' is not assignable to type 'never'.
|
||||
tests/cases/conformance/types/conditional/conditionalTypes1.ts(116,5): error TS2322: Type 'keyof T' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
|
||||
Type 'string | number | symbol' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
|
||||
Type 'string' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
|
||||
tests/cases/conformance/types/conditional/conditionalTypes1.ts(117,5): error TS2322: Type 'T[keyof T] extends Function ? keyof T : never' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
|
||||
Type 'keyof T' is not assignable to type 'never'.
|
||||
tests/cases/conformance/types/conditional/conditionalTypes1.ts(134,10): error TS2540: Cannot assign to 'id' because it is a constant or a read-only property.
|
||||
tests/cases/conformance/types/conditional/conditionalTypes1.ts(135,5): error TS2542: Index signature in type 'DeepReadonlyArray<Part>' only permits reading.
|
||||
tests/cases/conformance/types/conditional/conditionalTypes1.ts(136,22): error TS2540: Cannot assign to 'id' because it is a constant or a read-only property.
|
||||
@@ -105,9 +88,8 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(288,43): error TS
|
||||
x = y;
|
||||
y = x; // Error
|
||||
~
|
||||
!!! error TS2322: Type 'Partial<T>[keyof T]' is not assignable to type 'NonNullable<Partial<T>[keyof T]>'.
|
||||
!!! error TS2322: Type 'T[keyof T] | undefined' is not assignable to type 'NonNullable<Partial<T>[keyof T]>'.
|
||||
!!! error TS2322: Type 'undefined' is not assignable to type 'NonNullable<Partial<T>[keyof T]>'.
|
||||
!!! error TS2322: Type 'T[keyof T] | undefined' is not assignable to type 'NonNullable<Partial<T>[keyof T]>'.
|
||||
!!! error TS2322: Type 'undefined' is not assignable to type 'NonNullable<Partial<T>[keyof T]>'.
|
||||
}
|
||||
|
||||
function f4<T extends { x: string | undefined }>(x: T["x"], y: NonNullable<T["x"]>) {
|
||||
@@ -204,26 +186,16 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(288,43): error TS
|
||||
y = z; // Error
|
||||
~
|
||||
!!! error TS2322: Type 'Pick<T, { [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]>' is not assignable to type 'Pick<T, { [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]>'.
|
||||
!!! error TS2322: Type '{ [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]' is not assignable to type '{ [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]'.
|
||||
!!! error TS2322: Type 'T[keyof T] extends Function ? keyof T : never' is not assignable to type '{ [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]'.
|
||||
!!! error TS2322: Type 'keyof T' is not assignable to type '{ [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]'.
|
||||
!!! error TS2322: Type 'keyof T' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
|
||||
!!! error TS2322: Type 'T[keyof T] extends Function ? keyof T : never' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
|
||||
!!! error TS2322: Type '{ [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
|
||||
!!! error TS2322: Type 'T[keyof T] extends Function ? keyof T : never' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
|
||||
!!! error TS2322: Type 'keyof T' is not assignable to type 'never'.
|
||||
!!! error TS2322: Type 'T[keyof T] extends Function ? keyof T : never' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
|
||||
!!! error TS2322: Type 'keyof T' is not assignable to type 'never'.
|
||||
!!! error TS2322: Type 'string | number | symbol' is not assignable to type 'never'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'never'.
|
||||
z = x;
|
||||
z = y; // Error
|
||||
~
|
||||
!!! error TS2322: Type 'Pick<T, { [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]>' is not assignable to type 'Pick<T, { [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]>'.
|
||||
!!! error TS2322: Type '{ [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]' is not assignable to type '{ [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]'.
|
||||
!!! error TS2322: Type 'T[keyof T] extends Function ? never : keyof T' is not assignable to type '{ [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]'.
|
||||
!!! error TS2322: Type 'keyof T' is not assignable to type '{ [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]'.
|
||||
!!! error TS2322: Type 'keyof T' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'.
|
||||
!!! error TS2322: Type 'T[keyof T] extends Function ? never : keyof T' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'.
|
||||
!!! error TS2322: Type '{ [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'.
|
||||
!!! error TS2322: Type 'T[keyof T] extends Function ? never : keyof T' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'.
|
||||
!!! error TS2322: Type 'keyof T' is not assignable to type 'never'.
|
||||
!!! error TS2322: Type 'T[keyof T] extends Function ? never : keyof T' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'.
|
||||
!!! error TS2322: Type 'keyof T' is not assignable to type 'never'.
|
||||
}
|
||||
|
||||
function f8<T>(x: keyof T, y: FunctionPropertyNames<T>, z: NonFunctionPropertyNames<T>) {
|
||||
@@ -231,30 +203,24 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(288,43): error TS
|
||||
x = z;
|
||||
y = x; // Error
|
||||
~
|
||||
!!! error TS2322: Type 'keyof T' is not assignable to type '{ [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]'.
|
||||
!!! error TS2322: Type 'keyof T' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'.
|
||||
!!! error TS2322: Type 'keyof T' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'.
|
||||
!!! error TS2322: Type 'string | number | symbol' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'.
|
||||
y = z; // Error
|
||||
~
|
||||
!!! error TS2322: Type '{ [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]' is not assignable to type '{ [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]'.
|
||||
!!! error TS2322: Type 'T[keyof T] extends Function ? never : keyof T' is not assignable to type '{ [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]'.
|
||||
!!! error TS2322: Type 'keyof T' is not assignable to type '{ [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]'.
|
||||
!!! error TS2322: Type 'T[keyof T] extends Function ? never : keyof T' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'.
|
||||
!!! error TS2322: Type '{ [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'.
|
||||
!!! error TS2322: Type 'T[keyof T] extends Function ? never : keyof T' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'.
|
||||
!!! error TS2322: Type 'keyof T' is not assignable to type 'never'.
|
||||
!!! error TS2322: Type 'T[keyof T] extends Function ? never : keyof T' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'.
|
||||
!!! error TS2322: Type 'keyof T' is not assignable to type 'never'.
|
||||
!!! error TS2322: Type 'string | number | symbol' is not assignable to type 'never'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'never'.
|
||||
z = x; // Error
|
||||
~
|
||||
!!! error TS2322: Type 'keyof T' is not assignable to type '{ [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]'.
|
||||
!!! error TS2322: Type 'keyof T' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
|
||||
!!! error TS2322: Type 'keyof T' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
|
||||
!!! error TS2322: Type 'string | number | symbol' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
|
||||
z = y; // Error
|
||||
~
|
||||
!!! error TS2322: Type '{ [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]' is not assignable to type '{ [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]'.
|
||||
!!! error TS2322: Type 'T[keyof T] extends Function ? keyof T : never' is not assignable to type '{ [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]'.
|
||||
!!! error TS2322: Type 'keyof T' is not assignable to type '{ [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]'.
|
||||
!!! error TS2322: Type 'T[keyof T] extends Function ? keyof T : never' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
|
||||
!!! error TS2322: Type '{ [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
|
||||
!!! error TS2322: Type 'T[keyof T] extends Function ? keyof T : never' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
|
||||
!!! error TS2322: Type 'keyof T' is not assignable to type 'never'.
|
||||
!!! error TS2322: Type 'T[keyof T] extends Function ? keyof T : never' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
|
||||
!!! error TS2322: Type 'keyof T' is not assignable to type 'never'.
|
||||
}
|
||||
|
||||
type DeepReadonly<T> =
|
||||
@@ -463,7 +429,7 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(288,43): error TS
|
||||
|
||||
// Repro from #21862
|
||||
|
||||
type OldDiff<T extends string, U extends string> = (
|
||||
type OldDiff<T extends keyof any, U extends keyof any> = (
|
||||
& { [P in T]: P; }
|
||||
& { [P in U]: never; }
|
||||
& { [x: string]: never; }
|
||||
|
||||
@@ -301,7 +301,7 @@ function f50() {
|
||||
|
||||
// Repro from #21862
|
||||
|
||||
type OldDiff<T extends string, U extends string> = (
|
||||
type OldDiff<T extends keyof any, U extends keyof any> = (
|
||||
& { [P in T]: P; }
|
||||
& { [P in U]: never; }
|
||||
& { [x: string]: never; }
|
||||
@@ -656,7 +656,7 @@ declare type T95<T> = T extends string ? boolean : number;
|
||||
declare const f44: <U>(value: T94<U>) => T95<U>;
|
||||
declare const f45: <U>(value: T95<U>) => T94<U>;
|
||||
declare function f50(): void;
|
||||
declare type OldDiff<T extends string, U extends string> = ({
|
||||
declare type OldDiff<T extends keyof any, U extends keyof any> = ({
|
||||
[P in T]: P;
|
||||
} & {
|
||||
[P in U]: never;
|
||||
|
||||
@@ -1186,10 +1186,10 @@ function f50() {
|
||||
|
||||
// Repro from #21862
|
||||
|
||||
type OldDiff<T extends string, U extends string> = (
|
||||
type OldDiff<T extends keyof any, U extends keyof any> = (
|
||||
>OldDiff : Symbol(OldDiff, Decl(conditionalTypes1.ts, 298, 1))
|
||||
>T : Symbol(T, Decl(conditionalTypes1.ts, 302, 13))
|
||||
>U : Symbol(U, Decl(conditionalTypes1.ts, 302, 30))
|
||||
>U : Symbol(U, Decl(conditionalTypes1.ts, 302, 33))
|
||||
|
||||
& { [P in T]: P; }
|
||||
>P : Symbol(P, Decl(conditionalTypes1.ts, 303, 9))
|
||||
@@ -1198,7 +1198,7 @@ type OldDiff<T extends string, U extends string> = (
|
||||
|
||||
& { [P in U]: never; }
|
||||
>P : Symbol(P, Decl(conditionalTypes1.ts, 304, 9))
|
||||
>U : Symbol(U, Decl(conditionalTypes1.ts, 302, 30))
|
||||
>U : Symbol(U, Decl(conditionalTypes1.ts, 302, 33))
|
||||
|
||||
& { [x: string]: never; }
|
||||
>x : Symbol(x, Decl(conditionalTypes1.ts, 305, 9))
|
||||
|
||||
@@ -1343,7 +1343,7 @@ function f50() {
|
||||
|
||||
// Repro from #21862
|
||||
|
||||
type OldDiff<T extends string, U extends string> = (
|
||||
type OldDiff<T extends keyof any, U extends keyof any> = (
|
||||
>OldDiff : ({ [P in T]: P; } & { [P in U]: never; } & { [x: string]: never; })[T]
|
||||
>T : T
|
||||
>U : U
|
||||
|
||||
@@ -6,6 +6,8 @@ tests/cases/conformance/types/conditional/conditionalTypes2.ts(24,5): error TS23
|
||||
Types of property 'foo' are incompatible.
|
||||
Type 'B extends string ? keyof B : B' is not assignable to type 'A extends string ? keyof A : A'.
|
||||
Type 'keyof B' is not assignable to type 'keyof A'.
|
||||
Type 'string | number | symbol' is not assignable to type 'keyof A'.
|
||||
Type 'string' is not assignable to type 'keyof A'.
|
||||
tests/cases/conformance/types/conditional/conditionalTypes2.ts(25,5): error TS2322: Type 'Invariant<A>' is not assignable to type 'Invariant<B>'.
|
||||
Types of property 'foo' are incompatible.
|
||||
Type 'A extends string ? keyof A : A' is not assignable to type 'B extends string ? keyof B : B'.
|
||||
@@ -60,6 +62,8 @@ tests/cases/conformance/types/conditional/conditionalTypes2.ts(75,12): error TS2
|
||||
!!! error TS2322: Types of property 'foo' are incompatible.
|
||||
!!! error TS2322: Type 'B extends string ? keyof B : B' is not assignable to type 'A extends string ? keyof A : A'.
|
||||
!!! error TS2322: Type 'keyof B' is not assignable to type 'keyof A'.
|
||||
!!! error TS2322: Type 'string | number | symbol' is not assignable to type 'keyof A'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'keyof A'.
|
||||
b = a; // Error
|
||||
~
|
||||
!!! error TS2322: Type 'Invariant<A>' is not assignable to type 'Invariant<B>'.
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
tests/cases/conformance/controlFlow/controlFlowIIFE.ts(64,5): error TS2454: Variable 'v' is used before being assigned.
|
||||
tests/cases/conformance/controlFlow/controlFlowIIFE.ts(72,5): error TS2454: Variable 'v' is used before being assigned.
|
||||
|
||||
|
||||
==== tests/cases/conformance/controlFlow/controlFlowIIFE.ts (2 errors) ====
|
||||
declare function getStringOrNumber(): string | number;
|
||||
|
||||
function f1() {
|
||||
let x = getStringOrNumber();
|
||||
if (typeof x === "string") {
|
||||
let n = function() {
|
||||
return x.length;
|
||||
}();
|
||||
}
|
||||
}
|
||||
|
||||
function f2() {
|
||||
let x = getStringOrNumber();
|
||||
if (typeof x === "string") {
|
||||
let n = (function() {
|
||||
return x.length;
|
||||
})();
|
||||
}
|
||||
}
|
||||
|
||||
function f3() {
|
||||
let x = getStringOrNumber();
|
||||
let y: number;
|
||||
if (typeof x === "string") {
|
||||
let n = (z => x.length + y + z)(y = 1);
|
||||
}
|
||||
}
|
||||
|
||||
// Repros from #8381
|
||||
|
||||
let maybeNumber: number | undefined;
|
||||
(function () {
|
||||
maybeNumber = 1;
|
||||
})();
|
||||
maybeNumber++;
|
||||
if (maybeNumber !== undefined) {
|
||||
maybeNumber++;
|
||||
}
|
||||
|
||||
let test: string | undefined;
|
||||
if (!test) {
|
||||
throw new Error('Test is not defined');
|
||||
}
|
||||
(() => {
|
||||
test.slice(1); // No error
|
||||
})();
|
||||
|
||||
// Repro from #23565
|
||||
|
||||
function f4() {
|
||||
let v: number;
|
||||
(function() {
|
||||
v = 1;
|
||||
})();
|
||||
v;
|
||||
}
|
||||
|
||||
function f5() {
|
||||
let v: number;
|
||||
(function*() {
|
||||
yield 1;
|
||||
v = 1;
|
||||
})();
|
||||
v; // still undefined
|
||||
~
|
||||
!!! error TS2454: Variable 'v' is used before being assigned.
|
||||
}
|
||||
|
||||
function f6() {
|
||||
let v: number;
|
||||
(async function() {
|
||||
v = await 1;
|
||||
})();
|
||||
v; // still undefined
|
||||
~
|
||||
!!! error TS2454: Variable 'v' is used before being assigned.
|
||||
}
|
||||
@@ -44,34 +44,61 @@ if (!test) {
|
||||
}
|
||||
(() => {
|
||||
test.slice(1); // No error
|
||||
})();
|
||||
})();
|
||||
|
||||
// Repro from #23565
|
||||
|
||||
function f4() {
|
||||
let v: number;
|
||||
(function() {
|
||||
v = 1;
|
||||
})();
|
||||
v;
|
||||
}
|
||||
|
||||
function f5() {
|
||||
let v: number;
|
||||
(function*() {
|
||||
yield 1;
|
||||
v = 1;
|
||||
})();
|
||||
v; // still undefined
|
||||
}
|
||||
|
||||
function f6() {
|
||||
let v: number;
|
||||
(async function() {
|
||||
v = await 1;
|
||||
})();
|
||||
v; // still undefined
|
||||
}
|
||||
|
||||
//// [controlFlowIIFE.js]
|
||||
function f1() {
|
||||
var x = getStringOrNumber();
|
||||
let x = getStringOrNumber();
|
||||
if (typeof x === "string") {
|
||||
var n = function () {
|
||||
let n = function () {
|
||||
return x.length;
|
||||
}();
|
||||
}
|
||||
}
|
||||
function f2() {
|
||||
var x = getStringOrNumber();
|
||||
let x = getStringOrNumber();
|
||||
if (typeof x === "string") {
|
||||
var n = (function () {
|
||||
let n = (function () {
|
||||
return x.length;
|
||||
})();
|
||||
}
|
||||
}
|
||||
function f3() {
|
||||
var x = getStringOrNumber();
|
||||
var y;
|
||||
let x = getStringOrNumber();
|
||||
let y;
|
||||
if (typeof x === "string") {
|
||||
var n = (function (z) { return x.length + y + z; })(y = 1);
|
||||
let n = (z => x.length + y + z)(y = 1);
|
||||
}
|
||||
}
|
||||
// Repros from #8381
|
||||
var maybeNumber;
|
||||
let maybeNumber;
|
||||
(function () {
|
||||
maybeNumber = 1;
|
||||
})();
|
||||
@@ -79,10 +106,33 @@ maybeNumber++;
|
||||
if (maybeNumber !== undefined) {
|
||||
maybeNumber++;
|
||||
}
|
||||
var test;
|
||||
let test;
|
||||
if (!test) {
|
||||
throw new Error('Test is not defined');
|
||||
}
|
||||
(function () {
|
||||
(() => {
|
||||
test.slice(1); // No error
|
||||
})();
|
||||
// Repro from #23565
|
||||
function f4() {
|
||||
let v;
|
||||
(function () {
|
||||
v = 1;
|
||||
})();
|
||||
v;
|
||||
}
|
||||
function f5() {
|
||||
let v;
|
||||
(function* () {
|
||||
yield 1;
|
||||
v = 1;
|
||||
})();
|
||||
v; // still undefined
|
||||
}
|
||||
function f6() {
|
||||
let v;
|
||||
(async function () {
|
||||
v = await 1;
|
||||
})();
|
||||
v; // still undefined
|
||||
}
|
||||
|
||||
@@ -16,9 +16,9 @@ function f1() {
|
||||
>n : Symbol(n, Decl(controlFlowIIFE.ts, 5, 11))
|
||||
|
||||
return x.length;
|
||||
>x.length : Symbol(String.length, Decl(lib.d.ts, --, --))
|
||||
>x.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --))
|
||||
>x : Symbol(x, Decl(controlFlowIIFE.ts, 3, 7))
|
||||
>length : Symbol(String.length, Decl(lib.d.ts, --, --))
|
||||
>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --))
|
||||
|
||||
}();
|
||||
}
|
||||
@@ -38,9 +38,9 @@ function f2() {
|
||||
>n : Symbol(n, Decl(controlFlowIIFE.ts, 14, 11))
|
||||
|
||||
return x.length;
|
||||
>x.length : Symbol(String.length, Decl(lib.d.ts, --, --))
|
||||
>x.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --))
|
||||
>x : Symbol(x, Decl(controlFlowIIFE.ts, 12, 7))
|
||||
>length : Symbol(String.length, Decl(lib.d.ts, --, --))
|
||||
>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --))
|
||||
|
||||
})();
|
||||
}
|
||||
@@ -62,9 +62,9 @@ function f3() {
|
||||
let n = (z => x.length + y + z)(y = 1);
|
||||
>n : Symbol(n, Decl(controlFlowIIFE.ts, 24, 11))
|
||||
>z : Symbol(z, Decl(controlFlowIIFE.ts, 24, 17))
|
||||
>x.length : Symbol(String.length, Decl(lib.d.ts, --, --))
|
||||
>x.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --))
|
||||
>x : Symbol(x, Decl(controlFlowIIFE.ts, 21, 7))
|
||||
>length : Symbol(String.length, Decl(lib.d.ts, --, --))
|
||||
>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --))
|
||||
>y : Symbol(y, Decl(controlFlowIIFE.ts, 22, 7))
|
||||
>z : Symbol(z, Decl(controlFlowIIFE.ts, 24, 17))
|
||||
>y : Symbol(y, Decl(controlFlowIIFE.ts, 22, 7))
|
||||
@@ -99,12 +99,60 @@ if (!test) {
|
||||
>test : Symbol(test, Decl(controlFlowIIFE.ts, 39, 3))
|
||||
|
||||
throw new Error('Test is not defined');
|
||||
>Error : Symbol(Error, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||||
}
|
||||
(() => {
|
||||
test.slice(1); // No error
|
||||
>test.slice : Symbol(String.slice, Decl(lib.d.ts, --, --))
|
||||
>test.slice : Symbol(String.slice, Decl(lib.es5.d.ts, --, --))
|
||||
>test : Symbol(test, Decl(controlFlowIIFE.ts, 39, 3))
|
||||
>slice : Symbol(String.slice, Decl(lib.d.ts, --, --))
|
||||
>slice : Symbol(String.slice, Decl(lib.es5.d.ts, --, --))
|
||||
|
||||
})();
|
||||
|
||||
// Repro from #23565
|
||||
|
||||
function f4() {
|
||||
>f4 : Symbol(f4, Decl(controlFlowIIFE.ts, 45, 5))
|
||||
|
||||
let v: number;
|
||||
>v : Symbol(v, Decl(controlFlowIIFE.ts, 50, 7))
|
||||
|
||||
(function() {
|
||||
v = 1;
|
||||
>v : Symbol(v, Decl(controlFlowIIFE.ts, 50, 7))
|
||||
|
||||
})();
|
||||
v;
|
||||
>v : Symbol(v, Decl(controlFlowIIFE.ts, 50, 7))
|
||||
}
|
||||
|
||||
function f5() {
|
||||
>f5 : Symbol(f5, Decl(controlFlowIIFE.ts, 55, 1))
|
||||
|
||||
let v: number;
|
||||
>v : Symbol(v, Decl(controlFlowIIFE.ts, 58, 7))
|
||||
|
||||
(function*() {
|
||||
yield 1;
|
||||
v = 1;
|
||||
>v : Symbol(v, Decl(controlFlowIIFE.ts, 58, 7))
|
||||
|
||||
})();
|
||||
v; // still undefined
|
||||
>v : Symbol(v, Decl(controlFlowIIFE.ts, 58, 7))
|
||||
}
|
||||
|
||||
function f6() {
|
||||
>f6 : Symbol(f6, Decl(controlFlowIIFE.ts, 64, 1))
|
||||
|
||||
let v: number;
|
||||
>v : Symbol(v, Decl(controlFlowIIFE.ts, 67, 7))
|
||||
|
||||
(async function() {
|
||||
v = await 1;
|
||||
>v : Symbol(v, Decl(controlFlowIIFE.ts, 67, 7))
|
||||
|
||||
})();
|
||||
v; // still undefined
|
||||
>v : Symbol(v, Decl(controlFlowIIFE.ts, 67, 7))
|
||||
}
|
||||
|
||||
@@ -150,3 +150,73 @@ if (!test) {
|
||||
>1 : 1
|
||||
|
||||
})();
|
||||
|
||||
// Repro from #23565
|
||||
|
||||
function f4() {
|
||||
>f4 : () => void
|
||||
|
||||
let v: number;
|
||||
>v : number
|
||||
|
||||
(function() {
|
||||
>(function() { v = 1; })() : void
|
||||
>(function() { v = 1; }) : () => void
|
||||
>function() { v = 1; } : () => void
|
||||
|
||||
v = 1;
|
||||
>v = 1 : 1
|
||||
>v : number
|
||||
>1 : 1
|
||||
|
||||
})();
|
||||
v;
|
||||
>v : number
|
||||
}
|
||||
|
||||
function f5() {
|
||||
>f5 : () => void
|
||||
|
||||
let v: number;
|
||||
>v : number
|
||||
|
||||
(function*() {
|
||||
>(function*() { yield 1; v = 1; })() : IterableIterator<number>
|
||||
>(function*() { yield 1; v = 1; }) : () => IterableIterator<number>
|
||||
>function*() { yield 1; v = 1; } : () => IterableIterator<number>
|
||||
|
||||
yield 1;
|
||||
>yield 1 : any
|
||||
>1 : 1
|
||||
|
||||
v = 1;
|
||||
>v = 1 : 1
|
||||
>v : number
|
||||
>1 : 1
|
||||
|
||||
})();
|
||||
v; // still undefined
|
||||
>v : number
|
||||
}
|
||||
|
||||
function f6() {
|
||||
>f6 : () => void
|
||||
|
||||
let v: number;
|
||||
>v : number
|
||||
|
||||
(async function() {
|
||||
>(async function() { v = await 1; })() : Promise<void>
|
||||
>(async function() { v = await 1; }) : () => Promise<void>
|
||||
>async function() { v = await 1; } : () => Promise<void>
|
||||
|
||||
v = await 1;
|
||||
>v = await 1 : 1
|
||||
>v : number
|
||||
>await 1 : 1
|
||||
>1 : 1
|
||||
|
||||
})();
|
||||
v; // still undefined
|
||||
>v : number
|
||||
}
|
||||
|
||||
@@ -371,11 +371,11 @@ export class StyleParser {
|
||||
if (!this.styles.hasOwnProperty(key)) {
|
||||
>!this.styles.hasOwnProperty(key) : boolean
|
||||
>this.styles.hasOwnProperty(key) : boolean
|
||||
>this.styles.hasOwnProperty : (v: string) => boolean
|
||||
>this.styles.hasOwnProperty : (v: string | number | symbol) => boolean
|
||||
>this.styles : {}
|
||||
>this : this
|
||||
>styles : {}
|
||||
>hasOwnProperty : (v: string) => boolean
|
||||
>hasOwnProperty : (v: string | number | symbol) => boolean
|
||||
>key : string
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
declare function dec(target: Object, propertyKey: string | symbol, parameterIndex: number): void;
|
||||
>dec : Symbol(dec, Decl(decoratorOnClassMethodParameter1.es6.ts, 0, 0))
|
||||
>target : Symbol(target, Decl(decoratorOnClassMethodParameter1.es6.ts, 0, 21))
|
||||
>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --))
|
||||
>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||||
>propertyKey : Symbol(propertyKey, Decl(decoratorOnClassMethodParameter1.es6.ts, 0, 36))
|
||||
>parameterIndex : Symbol(parameterIndex, Decl(decoratorOnClassMethodParameter1.es6.ts, 0, 66))
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ function x(o: object, k: PropertyKey) { }
|
||||
>x : Symbol(x, Decl(decoratorsOnComputedProperties.ts, 0, 0))
|
||||
>o : Symbol(o, Decl(decoratorsOnComputedProperties.ts, 0, 11))
|
||||
>k : Symbol(k, Decl(decoratorsOnComputedProperties.ts, 0, 21))
|
||||
>PropertyKey : Symbol(PropertyKey, Decl(lib.es2015.core.d.ts, --, --))
|
||||
>PropertyKey : Symbol(PropertyKey, Decl(lib.es5.d.ts, --, --))
|
||||
|
||||
let i = 0;
|
||||
>i : Symbol(i, Decl(decoratorsOnComputedProperties.ts, 1, 3))
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
=== tests/cases/compiler/decoratorsOnComputedProperties.ts ===
|
||||
function x(o: object, k: PropertyKey) { }
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>o : object
|
||||
>k : PropertyKey
|
||||
>PropertyKey : PropertyKey
|
||||
>k : string | number | symbol
|
||||
>PropertyKey : string | number | symbol
|
||||
|
||||
let i = 0;
|
||||
>i : number
|
||||
@@ -32,25 +32,25 @@ class A {
|
||||
>A : A
|
||||
|
||||
@x ["property"]: any;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>["property"] : any
|
||||
>"property" : "property"
|
||||
|
||||
@x [Symbol.toStringTag]: any;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>[Symbol.toStringTag] : any
|
||||
>Symbol.toStringTag : symbol
|
||||
>Symbol : SymbolConstructor
|
||||
>toStringTag : symbol
|
||||
|
||||
@x ["property2"]: any = 2;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>["property2"] : any
|
||||
>"property2" : "property2"
|
||||
>2 : 2
|
||||
|
||||
@x [Symbol.iterator]: any = null;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>[Symbol.iterator] : any
|
||||
>Symbol.iterator : symbol
|
||||
>Symbol : SymbolConstructor
|
||||
@@ -85,13 +85,13 @@ class A {
|
||||
>foo : () => string
|
||||
|
||||
@x [foo()]: any;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>[foo()] : any
|
||||
>foo() : string
|
||||
>foo : () => string
|
||||
|
||||
@x [foo()]: any = null;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>[foo()] : any
|
||||
>foo() : string
|
||||
>foo : () => string
|
||||
@@ -102,12 +102,12 @@ class A {
|
||||
>fieldNameA : string
|
||||
|
||||
@x [fieldNameB]: any;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>[fieldNameB] : any
|
||||
>fieldNameB : string
|
||||
|
||||
@x [fieldNameC]: any = null;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>[fieldNameC] : any
|
||||
>fieldNameC : string
|
||||
>null : null
|
||||
@@ -119,25 +119,25 @@ void class B {
|
||||
>B : typeof B
|
||||
|
||||
@x ["property"]: any;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>["property"] : any
|
||||
>"property" : "property"
|
||||
|
||||
@x [Symbol.toStringTag]: any;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>[Symbol.toStringTag] : any
|
||||
>Symbol.toStringTag : symbol
|
||||
>Symbol : SymbolConstructor
|
||||
>toStringTag : symbol
|
||||
|
||||
@x ["property2"]: any = 2;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>["property2"] : any
|
||||
>"property2" : "property2"
|
||||
>2 : 2
|
||||
|
||||
@x [Symbol.iterator]: any = null;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>[Symbol.iterator] : any
|
||||
>Symbol.iterator : symbol
|
||||
>Symbol : SymbolConstructor
|
||||
@@ -172,13 +172,13 @@ void class B {
|
||||
>foo : () => string
|
||||
|
||||
@x [foo()]: any;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>[foo()] : any
|
||||
>foo() : string
|
||||
>foo : () => string
|
||||
|
||||
@x [foo()]: any = null;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>[foo()] : any
|
||||
>foo() : string
|
||||
>foo : () => string
|
||||
@@ -189,12 +189,12 @@ void class B {
|
||||
>fieldNameA : string
|
||||
|
||||
@x [fieldNameB]: any;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>[fieldNameB] : any
|
||||
>fieldNameB : string
|
||||
|
||||
@x [fieldNameC]: any = null;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>[fieldNameC] : any
|
||||
>fieldNameC : string
|
||||
>null : null
|
||||
@@ -205,25 +205,25 @@ class C {
|
||||
>C : C
|
||||
|
||||
@x ["property"]: any;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>["property"] : any
|
||||
>"property" : "property"
|
||||
|
||||
@x [Symbol.toStringTag]: any;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>[Symbol.toStringTag] : any
|
||||
>Symbol.toStringTag : symbol
|
||||
>Symbol : SymbolConstructor
|
||||
>toStringTag : symbol
|
||||
|
||||
@x ["property2"]: any = 2;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>["property2"] : any
|
||||
>"property2" : "property2"
|
||||
>2 : 2
|
||||
|
||||
@x [Symbol.iterator]: any = null;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>[Symbol.iterator] : any
|
||||
>Symbol.iterator : symbol
|
||||
>Symbol : SymbolConstructor
|
||||
@@ -258,13 +258,13 @@ class C {
|
||||
>foo : () => string
|
||||
|
||||
@x [foo()]: any;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>[foo()] : any
|
||||
>foo() : string
|
||||
>foo : () => string
|
||||
|
||||
@x [foo()]: any = null;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>[foo()] : any
|
||||
>foo() : string
|
||||
>foo : () => string
|
||||
@@ -275,12 +275,12 @@ class C {
|
||||
>fieldNameA : string
|
||||
|
||||
@x [fieldNameB]: any;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>[fieldNameB] : any
|
||||
>fieldNameB : string
|
||||
|
||||
@x [fieldNameC]: any = null;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>[fieldNameC] : any
|
||||
>fieldNameC : string
|
||||
>null : null
|
||||
@@ -298,25 +298,25 @@ void class D {
|
||||
>D : typeof D
|
||||
|
||||
@x ["property"]: any;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>["property"] : any
|
||||
>"property" : "property"
|
||||
|
||||
@x [Symbol.toStringTag]: any;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>[Symbol.toStringTag] : any
|
||||
>Symbol.toStringTag : symbol
|
||||
>Symbol : SymbolConstructor
|
||||
>toStringTag : symbol
|
||||
|
||||
@x ["property2"]: any = 2;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>["property2"] : any
|
||||
>"property2" : "property2"
|
||||
>2 : 2
|
||||
|
||||
@x [Symbol.iterator]: any = null;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>[Symbol.iterator] : any
|
||||
>Symbol.iterator : symbol
|
||||
>Symbol : SymbolConstructor
|
||||
@@ -351,13 +351,13 @@ void class D {
|
||||
>foo : () => string
|
||||
|
||||
@x [foo()]: any;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>[foo()] : any
|
||||
>foo() : string
|
||||
>foo : () => string
|
||||
|
||||
@x [foo()]: any = null;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>[foo()] : any
|
||||
>foo() : string
|
||||
>foo : () => string
|
||||
@@ -368,12 +368,12 @@ void class D {
|
||||
>fieldNameA : string
|
||||
|
||||
@x [fieldNameB]: any;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>[fieldNameB] : any
|
||||
>fieldNameB : string
|
||||
|
||||
@x [fieldNameC]: any = null;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>[fieldNameC] : any
|
||||
>fieldNameC : string
|
||||
>null : null
|
||||
@@ -390,25 +390,25 @@ class E {
|
||||
>E : E
|
||||
|
||||
@x ["property"]: any;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>["property"] : any
|
||||
>"property" : "property"
|
||||
|
||||
@x [Symbol.toStringTag]: any;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>[Symbol.toStringTag] : any
|
||||
>Symbol.toStringTag : symbol
|
||||
>Symbol : SymbolConstructor
|
||||
>toStringTag : symbol
|
||||
|
||||
@x ["property2"]: any = 2;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>["property2"] : any
|
||||
>"property2" : "property2"
|
||||
>2 : 2
|
||||
|
||||
@x [Symbol.iterator]: any = null;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>[Symbol.iterator] : any
|
||||
>Symbol.iterator : symbol
|
||||
>Symbol : SymbolConstructor
|
||||
@@ -443,13 +443,13 @@ class E {
|
||||
>foo : () => string
|
||||
|
||||
@x [foo()]: any;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>[foo()] : any
|
||||
>foo() : string
|
||||
>foo : () => string
|
||||
|
||||
@x [foo()]: any = null;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>[foo()] : any
|
||||
>foo() : string
|
||||
>foo : () => string
|
||||
@@ -466,12 +466,12 @@ class E {
|
||||
>fieldNameA : string
|
||||
|
||||
@x [fieldNameB]: any;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>[fieldNameB] : any
|
||||
>fieldNameB : string
|
||||
|
||||
@x [fieldNameC]: any = null;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>[fieldNameC] : any
|
||||
>fieldNameC : string
|
||||
>null : null
|
||||
@@ -483,25 +483,25 @@ void class F {
|
||||
>F : typeof F
|
||||
|
||||
@x ["property"]: any;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>["property"] : any
|
||||
>"property" : "property"
|
||||
|
||||
@x [Symbol.toStringTag]: any;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>[Symbol.toStringTag] : any
|
||||
>Symbol.toStringTag : symbol
|
||||
>Symbol : SymbolConstructor
|
||||
>toStringTag : symbol
|
||||
|
||||
@x ["property2"]: any = 2;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>["property2"] : any
|
||||
>"property2" : "property2"
|
||||
>2 : 2
|
||||
|
||||
@x [Symbol.iterator]: any = null;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>[Symbol.iterator] : any
|
||||
>Symbol.iterator : symbol
|
||||
>Symbol : SymbolConstructor
|
||||
@@ -536,13 +536,13 @@ void class F {
|
||||
>foo : () => string
|
||||
|
||||
@x [foo()]: any;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>[foo()] : any
|
||||
>foo() : string
|
||||
>foo : () => string
|
||||
|
||||
@x [foo()]: any = null;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>[foo()] : any
|
||||
>foo() : string
|
||||
>foo : () => string
|
||||
@@ -559,12 +559,12 @@ void class F {
|
||||
>fieldNameA : string
|
||||
|
||||
@x [fieldNameB]: any;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>[fieldNameB] : any
|
||||
>fieldNameB : string
|
||||
|
||||
@x [fieldNameC]: any = null;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>[fieldNameC] : any
|
||||
>fieldNameC : string
|
||||
>null : null
|
||||
@@ -575,25 +575,25 @@ class G {
|
||||
>G : G
|
||||
|
||||
@x ["property"]: any;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>["property"] : any
|
||||
>"property" : "property"
|
||||
|
||||
@x [Symbol.toStringTag]: any;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>[Symbol.toStringTag] : any
|
||||
>Symbol.toStringTag : symbol
|
||||
>Symbol : SymbolConstructor
|
||||
>toStringTag : symbol
|
||||
|
||||
@x ["property2"]: any = 2;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>["property2"] : any
|
||||
>"property2" : "property2"
|
||||
>2 : 2
|
||||
|
||||
@x [Symbol.iterator]: any = null;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>[Symbol.iterator] : any
|
||||
>Symbol.iterator : symbol
|
||||
>Symbol : SymbolConstructor
|
||||
@@ -628,13 +628,13 @@ class G {
|
||||
>foo : () => string
|
||||
|
||||
@x [foo()]: any;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>[foo()] : any
|
||||
>foo() : string
|
||||
>foo : () => string
|
||||
|
||||
@x [foo()]: any = null;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>[foo()] : any
|
||||
>foo() : string
|
||||
>foo : () => string
|
||||
@@ -651,7 +651,7 @@ class G {
|
||||
>fieldNameA : string
|
||||
|
||||
@x [fieldNameB]: any;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>[fieldNameB] : any
|
||||
>fieldNameB : string
|
||||
|
||||
@@ -662,7 +662,7 @@ class G {
|
||||
>"method2" : "method2"
|
||||
|
||||
@x [fieldNameC]: any = null;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>[fieldNameC] : any
|
||||
>fieldNameC : string
|
||||
>null : null
|
||||
@@ -674,25 +674,25 @@ void class H {
|
||||
>H : typeof H
|
||||
|
||||
@x ["property"]: any;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>["property"] : any
|
||||
>"property" : "property"
|
||||
|
||||
@x [Symbol.toStringTag]: any;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>[Symbol.toStringTag] : any
|
||||
>Symbol.toStringTag : symbol
|
||||
>Symbol : SymbolConstructor
|
||||
>toStringTag : symbol
|
||||
|
||||
@x ["property2"]: any = 2;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>["property2"] : any
|
||||
>"property2" : "property2"
|
||||
>2 : 2
|
||||
|
||||
@x [Symbol.iterator]: any = null;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>[Symbol.iterator] : any
|
||||
>Symbol.iterator : symbol
|
||||
>Symbol : SymbolConstructor
|
||||
@@ -727,13 +727,13 @@ void class H {
|
||||
>foo : () => string
|
||||
|
||||
@x [foo()]: any;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>[foo()] : any
|
||||
>foo() : string
|
||||
>foo : () => string
|
||||
|
||||
@x [foo()]: any = null;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>[foo()] : any
|
||||
>foo() : string
|
||||
>foo : () => string
|
||||
@@ -750,7 +750,7 @@ void class H {
|
||||
>fieldNameA : string
|
||||
|
||||
@x [fieldNameB]: any;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>[fieldNameB] : any
|
||||
>fieldNameB : string
|
||||
|
||||
@@ -761,7 +761,7 @@ void class H {
|
||||
>"method2" : "method2"
|
||||
|
||||
@x [fieldNameC]: any = null;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>[fieldNameC] : any
|
||||
>fieldNameC : string
|
||||
>null : null
|
||||
@@ -772,25 +772,25 @@ class I {
|
||||
>I : I
|
||||
|
||||
@x ["property"]: any;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>["property"] : any
|
||||
>"property" : "property"
|
||||
|
||||
@x [Symbol.toStringTag]: any;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>[Symbol.toStringTag] : any
|
||||
>Symbol.toStringTag : symbol
|
||||
>Symbol : SymbolConstructor
|
||||
>toStringTag : symbol
|
||||
|
||||
@x ["property2"]: any = 2;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>["property2"] : any
|
||||
>"property2" : "property2"
|
||||
>2 : 2
|
||||
|
||||
@x [Symbol.iterator]: any = null;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>[Symbol.iterator] : any
|
||||
>Symbol.iterator : symbol
|
||||
>Symbol : SymbolConstructor
|
||||
@@ -825,20 +825,20 @@ class I {
|
||||
>foo : () => string
|
||||
|
||||
@x [foo()]: any;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>[foo()] : any
|
||||
>foo() : string
|
||||
>foo : () => string
|
||||
|
||||
@x [foo()]: any = null;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>[foo()] : any
|
||||
>foo() : string
|
||||
>foo : () => string
|
||||
>null : null
|
||||
|
||||
@x ["some" + "method"]() {}
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>["some" + "method"] : () => void
|
||||
>"some" + "method" : string
|
||||
>"some" : "some"
|
||||
@@ -849,7 +849,7 @@ class I {
|
||||
>fieldNameA : string
|
||||
|
||||
@x [fieldNameB]: any;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>[fieldNameB] : any
|
||||
>fieldNameB : string
|
||||
|
||||
@@ -860,7 +860,7 @@ class I {
|
||||
>"method2" : "method2"
|
||||
|
||||
@x [fieldNameC]: any = null;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>[fieldNameC] : any
|
||||
>fieldNameC : string
|
||||
>null : null
|
||||
@@ -872,25 +872,25 @@ void class J {
|
||||
>J : typeof J
|
||||
|
||||
@x ["property"]: any;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>["property"] : any
|
||||
>"property" : "property"
|
||||
|
||||
@x [Symbol.toStringTag]: any;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>[Symbol.toStringTag] : any
|
||||
>Symbol.toStringTag : symbol
|
||||
>Symbol : SymbolConstructor
|
||||
>toStringTag : symbol
|
||||
|
||||
@x ["property2"]: any = 2;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>["property2"] : any
|
||||
>"property2" : "property2"
|
||||
>2 : 2
|
||||
|
||||
@x [Symbol.iterator]: any = null;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>[Symbol.iterator] : any
|
||||
>Symbol.iterator : symbol
|
||||
>Symbol : SymbolConstructor
|
||||
@@ -925,20 +925,20 @@ void class J {
|
||||
>foo : () => string
|
||||
|
||||
@x [foo()]: any;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>[foo()] : any
|
||||
>foo() : string
|
||||
>foo : () => string
|
||||
|
||||
@x [foo()]: any = null;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>[foo()] : any
|
||||
>foo() : string
|
||||
>foo : () => string
|
||||
>null : null
|
||||
|
||||
@x ["some" + "method"]() {}
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>["some" + "method"] : () => void
|
||||
>"some" + "method" : string
|
||||
>"some" : "some"
|
||||
@@ -949,7 +949,7 @@ void class J {
|
||||
>fieldNameA : string
|
||||
|
||||
@x [fieldNameB]: any;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>[fieldNameB] : any
|
||||
>fieldNameB : string
|
||||
|
||||
@@ -960,7 +960,7 @@ void class J {
|
||||
>"method2" : "method2"
|
||||
|
||||
@x [fieldNameC]: any = null;
|
||||
>x : (o: object, k: PropertyKey) => void
|
||||
>x : (o: object, k: string | number | symbol) => void
|
||||
>[fieldNameC] : any
|
||||
>fieldNameC : string
|
||||
>null : null
|
||||
|
||||
@@ -6,7 +6,7 @@ interface DataSnapshot<X = {}> {
|
||||
}
|
||||
|
||||
interface Snapshot<T> extends DataSnapshot {
|
||||
child<U extends keyof T>(path: U): Snapshot<T[U]>;
|
||||
child<U extends Extract<keyof T, string>>(path: U): Snapshot<T[U]>;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -16,11 +16,12 @@ interface Snapshot<T> extends DataSnapshot {
|
||||
>T : Symbol(T, Decl(deeplyNestedCheck.ts, 6, 19))
|
||||
>DataSnapshot : Symbol(DataSnapshot, Decl(deeplyNestedCheck.ts, 0, 0))
|
||||
|
||||
child<U extends keyof T>(path: U): Snapshot<T[U]>;
|
||||
child<U extends Extract<keyof T, string>>(path: U): Snapshot<T[U]>;
|
||||
>child : Symbol(Snapshot.child, Decl(deeplyNestedCheck.ts, 6, 44))
|
||||
>U : Symbol(U, Decl(deeplyNestedCheck.ts, 7, 8))
|
||||
>Extract : Symbol(Extract, Decl(lib.d.ts, --, --))
|
||||
>T : Symbol(T, Decl(deeplyNestedCheck.ts, 6, 19))
|
||||
>path : Symbol(path, Decl(deeplyNestedCheck.ts, 7, 27))
|
||||
>path : Symbol(path, Decl(deeplyNestedCheck.ts, 7, 44))
|
||||
>U : Symbol(U, Decl(deeplyNestedCheck.ts, 7, 8))
|
||||
>Snapshot : Symbol(Snapshot, Decl(deeplyNestedCheck.ts, 4, 1))
|
||||
>T : Symbol(T, Decl(deeplyNestedCheck.ts, 6, 19))
|
||||
|
||||
@@ -16,9 +16,10 @@ interface Snapshot<T> extends DataSnapshot {
|
||||
>T : T
|
||||
>DataSnapshot : DataSnapshot<X>
|
||||
|
||||
child<U extends keyof T>(path: U): Snapshot<T[U]>;
|
||||
>child : <U extends keyof T>(path: U) => Snapshot<T[U]>
|
||||
child<U extends Extract<keyof T, string>>(path: U): Snapshot<T[U]>;
|
||||
>child : <U extends Extract<keyof T, string>>(path: U) => Snapshot<T[U]>
|
||||
>U : U
|
||||
>Extract : Extract<T, U>
|
||||
>T : T
|
||||
>path : U
|
||||
>U : U
|
||||
|
||||
@@ -6,7 +6,7 @@ type StringContains<S extends string, L extends string> = (
|
||||
{ [key: string]: 'false' }
|
||||
)[L]
|
||||
|
||||
type ObjectHasKey<O, L extends string> = StringContains<keyof O, L>
|
||||
type ObjectHasKey<O, L extends string> = StringContains<Extract<keyof O, string>, L>
|
||||
|
||||
type First<T> = ObjectHasKey<T, '0'>; // Should be deferred
|
||||
|
||||
@@ -43,7 +43,7 @@ declare type StringContains<S extends string, L extends string> = ({
|
||||
} & {
|
||||
[key: string]: 'false';
|
||||
})[L];
|
||||
declare type ObjectHasKey<O, L extends string> = StringContains<keyof O, L>;
|
||||
declare type ObjectHasKey<O, L extends string> = StringContains<Extract<keyof O, string>, L>;
|
||||
declare type First<T> = ObjectHasKey<T, '0'>;
|
||||
declare type T1 = ObjectHasKey<{
|
||||
a: string;
|
||||
|
||||
@@ -16,16 +16,17 @@ type StringContains<S extends string, L extends string> = (
|
||||
)[L]
|
||||
>L : Symbol(L, Decl(deferredLookupTypeResolution.ts, 2, 37))
|
||||
|
||||
type ObjectHasKey<O, L extends string> = StringContains<keyof O, L>
|
||||
type ObjectHasKey<O, L extends string> = StringContains<Extract<keyof O, string>, L>
|
||||
>ObjectHasKey : Symbol(ObjectHasKey, Decl(deferredLookupTypeResolution.ts, 5, 6))
|
||||
>O : Symbol(O, Decl(deferredLookupTypeResolution.ts, 7, 18))
|
||||
>L : Symbol(L, Decl(deferredLookupTypeResolution.ts, 7, 20))
|
||||
>StringContains : Symbol(StringContains, Decl(deferredLookupTypeResolution.ts, 0, 0))
|
||||
>Extract : Symbol(Extract, Decl(lib.d.ts, --, --))
|
||||
>O : Symbol(O, Decl(deferredLookupTypeResolution.ts, 7, 18))
|
||||
>L : Symbol(L, Decl(deferredLookupTypeResolution.ts, 7, 20))
|
||||
|
||||
type First<T> = ObjectHasKey<T, '0'>; // Should be deferred
|
||||
>First : Symbol(First, Decl(deferredLookupTypeResolution.ts, 7, 67))
|
||||
>First : Symbol(First, Decl(deferredLookupTypeResolution.ts, 7, 84))
|
||||
>T : Symbol(T, Decl(deferredLookupTypeResolution.ts, 9, 11))
|
||||
>ObjectHasKey : Symbol(ObjectHasKey, Decl(deferredLookupTypeResolution.ts, 5, 6))
|
||||
>T : Symbol(T, Decl(deferredLookupTypeResolution.ts, 9, 11))
|
||||
|
||||
@@ -16,28 +16,29 @@ type StringContains<S extends string, L extends string> = (
|
||||
)[L]
|
||||
>L : L
|
||||
|
||||
type ObjectHasKey<O, L extends string> = StringContains<keyof O, L>
|
||||
>ObjectHasKey : ({ [K in keyof O]: "true"; } & { [key: string]: "false"; })[L]
|
||||
type ObjectHasKey<O, L extends string> = StringContains<Extract<keyof O, string>, L>
|
||||
>ObjectHasKey : ({ [K in Extract<keyof O, string>]: "true"; } & { [key: string]: "false"; })[L]
|
||||
>O : O
|
||||
>L : L
|
||||
>StringContains : ({ [K in S]: "true"; } & { [key: string]: "false"; })[L]
|
||||
>Extract : Extract<T, U>
|
||||
>O : O
|
||||
>L : L
|
||||
|
||||
type First<T> = ObjectHasKey<T, '0'>; // Should be deferred
|
||||
>First : ({ [K in keyof T]: "true"; } & { [key: string]: "false"; })["0"]
|
||||
>First : ({ [K in Extract<keyof T, string>]: "true"; } & { [key: string]: "false"; })["0"]
|
||||
>T : T
|
||||
>ObjectHasKey : ({ [K in keyof O]: "true"; } & { [key: string]: "false"; })[L]
|
||||
>ObjectHasKey : ({ [K in Extract<keyof O, string>]: "true"; } & { [key: string]: "false"; })[L]
|
||||
>T : T
|
||||
|
||||
type T1 = ObjectHasKey<{ a: string }, 'a'>; // 'true'
|
||||
>T1 : "true"
|
||||
>ObjectHasKey : ({ [K in keyof O]: "true"; } & { [key: string]: "false"; })[L]
|
||||
>ObjectHasKey : ({ [K in Extract<keyof O, string>]: "true"; } & { [key: string]: "false"; })[L]
|
||||
>a : string
|
||||
|
||||
type T2 = ObjectHasKey<{ a: string }, 'b'>; // 'false'
|
||||
>T2 : "false"
|
||||
>ObjectHasKey : ({ [K in keyof O]: "true"; } & { [key: string]: "false"; })[L]
|
||||
>ObjectHasKey : ({ [K in Extract<keyof O, string>]: "true"; } & { [key: string]: "false"; })[L]
|
||||
>a : string
|
||||
|
||||
// Verify that mapped type isn't eagerly resolved in type-to-string operation
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/compiler/deferredLookupTypeResolution2.ts(14,13): error TS2536: Type '({ [K in keyof T]: "true"; } & { [key: string]: "false"; })["1"]' cannot be used to index type '{ true: "true"; }'.
|
||||
tests/cases/compiler/deferredLookupTypeResolution2.ts(19,21): error TS2536: Type '({ true: "otherwise"; } & { [k: string]: "true"; })[({ [K in keyof T]: "true"; } & { [key: string]: "false"; })["1"]]' cannot be used to index type '{ true: "true"; }'.
|
||||
tests/cases/compiler/deferredLookupTypeResolution2.ts(14,13): error TS2536: Type '({ [K in Extract<keyof T, string>]: "true"; } & { [key: string]: "false"; })["1"]' cannot be used to index type '{ true: "true"; }'.
|
||||
tests/cases/compiler/deferredLookupTypeResolution2.ts(19,21): error TS2536: Type '({ true: "otherwise"; } & { [k: string]: "true"; })[({ [K in Extract<keyof T, string>]: "true"; } & { [key: string]: "false"; })["1"]]' cannot be used to index type '{ true: "true"; }'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/deferredLookupTypeResolution2.ts (2 errors) ====
|
||||
@@ -7,7 +7,7 @@ tests/cases/compiler/deferredLookupTypeResolution2.ts(19,21): error TS2536: Type
|
||||
|
||||
type StringContains<S extends string, L extends string> = ({ [K in S]: 'true' } & { [key: string]: 'false'})[L];
|
||||
|
||||
type ObjectHasKey<O, L extends string> = StringContains<keyof O, L>;
|
||||
type ObjectHasKey<O, L extends string> = StringContains<Extract<keyof O, string>, L>;
|
||||
|
||||
type A<T> = ObjectHasKey<T, '0'>;
|
||||
|
||||
@@ -18,14 +18,14 @@ tests/cases/compiler/deferredLookupTypeResolution2.ts(19,21): error TS2536: Type
|
||||
// Error, "false" not handled
|
||||
type E<T> = { true: 'true' }[ObjectHasKey<T, '1'>];
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2536: Type '({ [K in keyof T]: "true"; } & { [key: string]: "false"; })["1"]' cannot be used to index type '{ true: "true"; }'.
|
||||
!!! error TS2536: Type '({ [K in Extract<keyof T, string>]: "true"; } & { [key: string]: "false"; })["1"]' cannot be used to index type '{ true: "true"; }'.
|
||||
|
||||
type Juxtapose<T> = ({ true: 'otherwise' } & { [k: string]: 'true' })[ObjectHasKey<T, '1'>];
|
||||
|
||||
// Error, "otherwise" is missing
|
||||
type DeepError<T> = { true: 'true' }[Juxtapose<T>];
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2536: Type '({ true: "otherwise"; } & { [k: string]: "true"; })[({ [K in keyof T]: "true"; } & { [key: string]: "false"; })["1"]]' cannot be used to index type '{ true: "true"; }'.
|
||||
!!! error TS2536: Type '({ true: "otherwise"; } & { [k: string]: "true"; })[({ [K in Extract<keyof T, string>]: "true"; } & { [key: string]: "false"; })["1"]]' cannot be used to index type '{ true: "true"; }'.
|
||||
|
||||
type DeepOK<T> = { true: 'true', otherwise: 'false' }[Juxtapose<T>];
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
type StringContains<S extends string, L extends string> = ({ [K in S]: 'true' } & { [key: string]: 'false'})[L];
|
||||
|
||||
type ObjectHasKey<O, L extends string> = StringContains<keyof O, L>;
|
||||
type ObjectHasKey<O, L extends string> = StringContains<Extract<keyof O, string>, L>;
|
||||
|
||||
type A<T> = ObjectHasKey<T, '0'>;
|
||||
|
||||
@@ -33,7 +33,7 @@ declare type StringContains<S extends string, L extends string> = ({
|
||||
} & {
|
||||
[key: string]: 'false';
|
||||
})[L];
|
||||
declare type ObjectHasKey<O, L extends string> = StringContains<keyof O, L>;
|
||||
declare type ObjectHasKey<O, L extends string> = StringContains<Extract<keyof O, string>, L>;
|
||||
declare type A<T> = ObjectHasKey<T, '0'>;
|
||||
declare type B = ObjectHasKey<[string, number], '1'>;
|
||||
declare type C = ObjectHasKey<[string, number], '2'>;
|
||||
|
||||
@@ -10,16 +10,17 @@ type StringContains<S extends string, L extends string> = ({ [K in S]: 'true' }
|
||||
>key : Symbol(key, Decl(deferredLookupTypeResolution2.ts, 2, 85))
|
||||
>L : Symbol(L, Decl(deferredLookupTypeResolution2.ts, 2, 37))
|
||||
|
||||
type ObjectHasKey<O, L extends string> = StringContains<keyof O, L>;
|
||||
type ObjectHasKey<O, L extends string> = StringContains<Extract<keyof O, string>, L>;
|
||||
>ObjectHasKey : Symbol(ObjectHasKey, Decl(deferredLookupTypeResolution2.ts, 2, 112))
|
||||
>O : Symbol(O, Decl(deferredLookupTypeResolution2.ts, 4, 18))
|
||||
>L : Symbol(L, Decl(deferredLookupTypeResolution2.ts, 4, 20))
|
||||
>StringContains : Symbol(StringContains, Decl(deferredLookupTypeResolution2.ts, 0, 0))
|
||||
>Extract : Symbol(Extract, Decl(lib.d.ts, --, --))
|
||||
>O : Symbol(O, Decl(deferredLookupTypeResolution2.ts, 4, 18))
|
||||
>L : Symbol(L, Decl(deferredLookupTypeResolution2.ts, 4, 20))
|
||||
|
||||
type A<T> = ObjectHasKey<T, '0'>;
|
||||
>A : Symbol(A, Decl(deferredLookupTypeResolution2.ts, 4, 68))
|
||||
>A : Symbol(A, Decl(deferredLookupTypeResolution2.ts, 4, 85))
|
||||
>T : Symbol(T, Decl(deferredLookupTypeResolution2.ts, 6, 7))
|
||||
>ObjectHasKey : Symbol(ObjectHasKey, Decl(deferredLookupTypeResolution2.ts, 2, 112))
|
||||
>T : Symbol(T, Decl(deferredLookupTypeResolution2.ts, 6, 7))
|
||||
@@ -34,7 +35,7 @@ type C = ObjectHasKey<[string, number], '2'>; // "false"
|
||||
|
||||
type D = A<[string]>; // "true"
|
||||
>D : Symbol(D, Decl(deferredLookupTypeResolution2.ts, 9, 45))
|
||||
>A : Symbol(A, Decl(deferredLookupTypeResolution2.ts, 4, 68))
|
||||
>A : Symbol(A, Decl(deferredLookupTypeResolution2.ts, 4, 85))
|
||||
|
||||
// Error, "false" not handled
|
||||
type E<T> = { true: 'true' }[ObjectHasKey<T, '1'>];
|
||||
|
||||
@@ -10,61 +10,62 @@ type StringContains<S extends string, L extends string> = ({ [K in S]: 'true' }
|
||||
>key : string
|
||||
>L : L
|
||||
|
||||
type ObjectHasKey<O, L extends string> = StringContains<keyof O, L>;
|
||||
>ObjectHasKey : ({ [K in keyof O]: "true"; } & { [key: string]: "false"; })[L]
|
||||
type ObjectHasKey<O, L extends string> = StringContains<Extract<keyof O, string>, L>;
|
||||
>ObjectHasKey : ({ [K in Extract<keyof O, string>]: "true"; } & { [key: string]: "false"; })[L]
|
||||
>O : O
|
||||
>L : L
|
||||
>StringContains : ({ [K in S]: "true"; } & { [key: string]: "false"; })[L]
|
||||
>Extract : Extract<T, U>
|
||||
>O : O
|
||||
>L : L
|
||||
|
||||
type A<T> = ObjectHasKey<T, '0'>;
|
||||
>A : ({ [K in keyof T]: "true"; } & { [key: string]: "false"; })["0"]
|
||||
>A : ({ [K in Extract<keyof T, string>]: "true"; } & { [key: string]: "false"; })["0"]
|
||||
>T : T
|
||||
>ObjectHasKey : ({ [K in keyof O]: "true"; } & { [key: string]: "false"; })[L]
|
||||
>ObjectHasKey : ({ [K in Extract<keyof O, string>]: "true"; } & { [key: string]: "false"; })[L]
|
||||
>T : T
|
||||
|
||||
type B = ObjectHasKey<[string, number], '1'>; // "true"
|
||||
>B : "true"
|
||||
>ObjectHasKey : ({ [K in keyof O]: "true"; } & { [key: string]: "false"; })[L]
|
||||
>ObjectHasKey : ({ [K in Extract<keyof O, string>]: "true"; } & { [key: string]: "false"; })[L]
|
||||
|
||||
type C = ObjectHasKey<[string, number], '2'>; // "false"
|
||||
>C : "false"
|
||||
>ObjectHasKey : ({ [K in keyof O]: "true"; } & { [key: string]: "false"; })[L]
|
||||
>ObjectHasKey : ({ [K in Extract<keyof O, string>]: "true"; } & { [key: string]: "false"; })[L]
|
||||
|
||||
type D = A<[string]>; // "true"
|
||||
>D : "true"
|
||||
>A : ({ [K in keyof T]: "true"; } & { [key: string]: "false"; })["0"]
|
||||
>A : ({ [K in Extract<keyof T, string>]: "true"; } & { [key: string]: "false"; })["0"]
|
||||
|
||||
// Error, "false" not handled
|
||||
type E<T> = { true: 'true' }[ObjectHasKey<T, '1'>];
|
||||
>E : { true: "true"; }[({ [K in keyof T]: "true"; } & { [key: string]: "false"; })["1"]]
|
||||
>E : { true: "true"; }[({ [K in Extract<keyof T, string>]: "true"; } & { [key: string]: "false"; })["1"]]
|
||||
>T : T
|
||||
>true : "true"
|
||||
>ObjectHasKey : ({ [K in keyof O]: "true"; } & { [key: string]: "false"; })[L]
|
||||
>ObjectHasKey : ({ [K in Extract<keyof O, string>]: "true"; } & { [key: string]: "false"; })[L]
|
||||
>T : T
|
||||
|
||||
type Juxtapose<T> = ({ true: 'otherwise' } & { [k: string]: 'true' })[ObjectHasKey<T, '1'>];
|
||||
>Juxtapose : ({ true: "otherwise"; } & { [k: string]: "true"; })[({ [K in keyof T]: "true"; } & { [key: string]: "false"; })["1"]]
|
||||
>Juxtapose : ({ true: "otherwise"; } & { [k: string]: "true"; })[({ [K in Extract<keyof T, string>]: "true"; } & { [key: string]: "false"; })["1"]]
|
||||
>T : T
|
||||
>true : "otherwise"
|
||||
>k : string
|
||||
>ObjectHasKey : ({ [K in keyof O]: "true"; } & { [key: string]: "false"; })[L]
|
||||
>ObjectHasKey : ({ [K in Extract<keyof O, string>]: "true"; } & { [key: string]: "false"; })[L]
|
||||
>T : T
|
||||
|
||||
// Error, "otherwise" is missing
|
||||
type DeepError<T> = { true: 'true' }[Juxtapose<T>];
|
||||
>DeepError : { true: "true"; }[({ true: "otherwise"; } & { [k: string]: "true"; })[({ [K in keyof T]: "true"; } & { [key: string]: "false"; })["1"]]]
|
||||
>DeepError : { true: "true"; }[({ true: "otherwise"; } & { [k: string]: "true"; })[({ [K in Extract<keyof T, string>]: "true"; } & { [key: string]: "false"; })["1"]]]
|
||||
>T : T
|
||||
>true : "true"
|
||||
>Juxtapose : ({ true: "otherwise"; } & { [k: string]: "true"; })[({ [K in keyof T]: "true"; } & { [key: string]: "false"; })["1"]]
|
||||
>Juxtapose : ({ true: "otherwise"; } & { [k: string]: "true"; })[({ [K in Extract<keyof T, string>]: "true"; } & { [key: string]: "false"; })["1"]]
|
||||
>T : T
|
||||
|
||||
type DeepOK<T> = { true: 'true', otherwise: 'false' }[Juxtapose<T>];
|
||||
>DeepOK : { true: "true"; otherwise: "false"; }[({ true: "otherwise"; } & { [k: string]: "true"; })[({ [K in keyof T]: "true"; } & { [key: string]: "false"; })["1"]]]
|
||||
>DeepOK : { true: "true"; otherwise: "false"; }[({ true: "otherwise"; } & { [k: string]: "true"; })[({ [K in Extract<keyof T, string>]: "true"; } & { [key: string]: "false"; })["1"]]]
|
||||
>T : T
|
||||
>true : "true"
|
||||
>otherwise : "false"
|
||||
>Juxtapose : ({ true: "otherwise"; } & { [k: string]: "true"; })[({ [K in keyof T]: "true"; } & { [key: string]: "false"; })["1"]]
|
||||
>Juxtapose : ({ true: "otherwise"; } & { [k: string]: "true"; })[({ [K in Extract<keyof T, string>]: "true"; } & { [key: string]: "false"; })["1"]]
|
||||
>T : T
|
||||
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
tests/cases/conformance/enums/enumConstantMemberWithString.ts(5,9): error TS2553: Computed values are not permitted in an enum with string valued members.
|
||||
tests/cases/conformance/enums/enumConstantMemberWithString.ts(6,9): error TS2553: Computed values are not permitted in an enum with string valued members.
|
||||
tests/cases/conformance/enums/enumConstantMemberWithString.ts(18,9): error TS2553: Computed values are not permitted in an enum with string valued members.
|
||||
|
||||
|
||||
==== tests/cases/conformance/enums/enumConstantMemberWithString.ts (3 errors) ====
|
||||
enum T1 {
|
||||
a = "1",
|
||||
b = "1" + "2",
|
||||
c = "1" + "2" + "3",
|
||||
d = "a" - "a",
|
||||
~~~~~~~~~
|
||||
!!! error TS2553: Computed values are not permitted in an enum with string valued members.
|
||||
e = "a" + 1
|
||||
~~~~~~~
|
||||
!!! error TS2553: Computed values are not permitted in an enum with string valued members.
|
||||
}
|
||||
|
||||
enum T2 {
|
||||
a = "1",
|
||||
b = "1" + "2"
|
||||
}
|
||||
|
||||
enum T3 {
|
||||
a = "1",
|
||||
b = "1" + "2",
|
||||
c = 1,
|
||||
d = 1 + 2
|
||||
~~~~~
|
||||
!!! error TS2553: Computed values are not permitted in an enum with string valued members.
|
||||
}
|
||||
|
||||
enum T4 {
|
||||
a = "1"
|
||||
}
|
||||
|
||||
enum T5 {
|
||||
a = "1" + "2"
|
||||
}
|
||||
|
||||
declare enum T6 {
|
||||
a = "1",
|
||||
b = "1" + "2"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
//// [enumConstantMemberWithString.ts]
|
||||
enum T1 {
|
||||
a = "1",
|
||||
b = "1" + "2",
|
||||
c = "1" + "2" + "3",
|
||||
d = "a" - "a",
|
||||
e = "a" + 1
|
||||
}
|
||||
|
||||
enum T2 {
|
||||
a = "1",
|
||||
b = "1" + "2"
|
||||
}
|
||||
|
||||
enum T3 {
|
||||
a = "1",
|
||||
b = "1" + "2",
|
||||
c = 1,
|
||||
d = 1 + 2
|
||||
}
|
||||
|
||||
enum T4 {
|
||||
a = "1"
|
||||
}
|
||||
|
||||
enum T5 {
|
||||
a = "1" + "2"
|
||||
}
|
||||
|
||||
declare enum T6 {
|
||||
a = "1",
|
||||
b = "1" + "2"
|
||||
}
|
||||
|
||||
|
||||
//// [enumConstantMemberWithString.js]
|
||||
var T1;
|
||||
(function (T1) {
|
||||
T1["a"] = "1";
|
||||
T1["b"] = "12";
|
||||
T1["c"] = "123";
|
||||
T1[T1["d"] = 0] = "d";
|
||||
T1[T1["e"] = 0] = "e";
|
||||
})(T1 || (T1 = {}));
|
||||
var T2;
|
||||
(function (T2) {
|
||||
T2["a"] = "1";
|
||||
T2["b"] = "12";
|
||||
})(T2 || (T2 = {}));
|
||||
var T3;
|
||||
(function (T3) {
|
||||
T3["a"] = "1";
|
||||
T3["b"] = "12";
|
||||
T3[T3["c"] = 1] = "c";
|
||||
T3[T3["d"] = 0] = "d";
|
||||
})(T3 || (T3 = {}));
|
||||
var T4;
|
||||
(function (T4) {
|
||||
T4["a"] = "1";
|
||||
})(T4 || (T4 = {}));
|
||||
var T5;
|
||||
(function (T5) {
|
||||
T5["a"] = "12";
|
||||
})(T5 || (T5 = {}));
|
||||
@@ -0,0 +1,70 @@
|
||||
=== tests/cases/conformance/enums/enumConstantMemberWithString.ts ===
|
||||
enum T1 {
|
||||
>T1 : Symbol(T1, Decl(enumConstantMemberWithString.ts, 0, 0))
|
||||
|
||||
a = "1",
|
||||
>a : Symbol(T1.a, Decl(enumConstantMemberWithString.ts, 0, 9))
|
||||
|
||||
b = "1" + "2",
|
||||
>b : Symbol(T1.b, Decl(enumConstantMemberWithString.ts, 1, 12))
|
||||
|
||||
c = "1" + "2" + "3",
|
||||
>c : Symbol(T1.c, Decl(enumConstantMemberWithString.ts, 2, 18))
|
||||
|
||||
d = "a" - "a",
|
||||
>d : Symbol(T1.d, Decl(enumConstantMemberWithString.ts, 3, 24))
|
||||
|
||||
e = "a" + 1
|
||||
>e : Symbol(T1.e, Decl(enumConstantMemberWithString.ts, 4, 18))
|
||||
}
|
||||
|
||||
enum T2 {
|
||||
>T2 : Symbol(T2, Decl(enumConstantMemberWithString.ts, 6, 1))
|
||||
|
||||
a = "1",
|
||||
>a : Symbol(T2.a, Decl(enumConstantMemberWithString.ts, 8, 9))
|
||||
|
||||
b = "1" + "2"
|
||||
>b : Symbol(T2.b, Decl(enumConstantMemberWithString.ts, 9, 12))
|
||||
}
|
||||
|
||||
enum T3 {
|
||||
>T3 : Symbol(T3, Decl(enumConstantMemberWithString.ts, 11, 1))
|
||||
|
||||
a = "1",
|
||||
>a : Symbol(T3.a, Decl(enumConstantMemberWithString.ts, 13, 9))
|
||||
|
||||
b = "1" + "2",
|
||||
>b : Symbol(T3.b, Decl(enumConstantMemberWithString.ts, 14, 12))
|
||||
|
||||
c = 1,
|
||||
>c : Symbol(T3.c, Decl(enumConstantMemberWithString.ts, 15, 18))
|
||||
|
||||
d = 1 + 2
|
||||
>d : Symbol(T3.d, Decl(enumConstantMemberWithString.ts, 16, 10))
|
||||
}
|
||||
|
||||
enum T4 {
|
||||
>T4 : Symbol(T4, Decl(enumConstantMemberWithString.ts, 18, 1))
|
||||
|
||||
a = "1"
|
||||
>a : Symbol(T4.a, Decl(enumConstantMemberWithString.ts, 20, 9))
|
||||
}
|
||||
|
||||
enum T5 {
|
||||
>T5 : Symbol(T5, Decl(enumConstantMemberWithString.ts, 22, 1))
|
||||
|
||||
a = "1" + "2"
|
||||
>a : Symbol(T5.a, Decl(enumConstantMemberWithString.ts, 24, 9))
|
||||
}
|
||||
|
||||
declare enum T6 {
|
||||
>T6 : Symbol(T6, Decl(enumConstantMemberWithString.ts, 26, 1))
|
||||
|
||||
a = "1",
|
||||
>a : Symbol(T6.a, Decl(enumConstantMemberWithString.ts, 28, 17))
|
||||
|
||||
b = "1" + "2"
|
||||
>b : Symbol(T6.b, Decl(enumConstantMemberWithString.ts, 29, 12))
|
||||
}
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
=== tests/cases/conformance/enums/enumConstantMemberWithString.ts ===
|
||||
enum T1 {
|
||||
>T1 : T1
|
||||
|
||||
a = "1",
|
||||
>a : T1.a
|
||||
>"1" : "1"
|
||||
|
||||
b = "1" + "2",
|
||||
>b : T1.b
|
||||
>"1" + "2" : string
|
||||
>"1" : "1"
|
||||
>"2" : "2"
|
||||
|
||||
c = "1" + "2" + "3",
|
||||
>c : T1.c
|
||||
>"1" + "2" + "3" : string
|
||||
>"1" + "2" : string
|
||||
>"1" : "1"
|
||||
>"2" : "2"
|
||||
>"3" : "3"
|
||||
|
||||
d = "a" - "a",
|
||||
>d : T1.d
|
||||
>"a" - "a" : number
|
||||
>"a" : "a"
|
||||
>"a" : "a"
|
||||
|
||||
e = "a" + 1
|
||||
>e : T1.d
|
||||
>"a" + 1 : string
|
||||
>"a" : "a"
|
||||
>1 : 1
|
||||
}
|
||||
|
||||
enum T2 {
|
||||
>T2 : T2
|
||||
|
||||
a = "1",
|
||||
>a : T2.a
|
||||
>"1" : "1"
|
||||
|
||||
b = "1" + "2"
|
||||
>b : T2.b
|
||||
>"1" + "2" : string
|
||||
>"1" : "1"
|
||||
>"2" : "2"
|
||||
}
|
||||
|
||||
enum T3 {
|
||||
>T3 : T3
|
||||
|
||||
a = "1",
|
||||
>a : T3.a
|
||||
>"1" : "1"
|
||||
|
||||
b = "1" + "2",
|
||||
>b : T3.b
|
||||
>"1" + "2" : string
|
||||
>"1" : "1"
|
||||
>"2" : "2"
|
||||
|
||||
c = 1,
|
||||
>c : T3.c
|
||||
>1 : 1
|
||||
|
||||
d = 1 + 2
|
||||
>d : T3.d
|
||||
>1 + 2 : number
|
||||
>1 : 1
|
||||
>2 : 2
|
||||
}
|
||||
|
||||
enum T4 {
|
||||
>T4 : T4
|
||||
|
||||
a = "1"
|
||||
>a : T4
|
||||
>"1" : "1"
|
||||
}
|
||||
|
||||
enum T5 {
|
||||
>T5 : T5
|
||||
|
||||
a = "1" + "2"
|
||||
>a : T5
|
||||
>"1" + "2" : string
|
||||
>"1" : "1"
|
||||
>"2" : "2"
|
||||
}
|
||||
|
||||
declare enum T6 {
|
||||
>T6 : T6
|
||||
|
||||
a = "1",
|
||||
>a : T6.a
|
||||
>"1" : "1"
|
||||
|
||||
b = "1" + "2"
|
||||
>b : T6.b
|
||||
>"1" + "2" : string
|
||||
>"1" : "1"
|
||||
>"2" : "2"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
//// [enumConstantMemberWithStringEmitDeclaration.ts]
|
||||
enum T1 {
|
||||
a = "1",
|
||||
b = "1" + "2",
|
||||
c = "1" + "2" + "3"
|
||||
}
|
||||
|
||||
enum T2 {
|
||||
a = "1",
|
||||
b = "1" + "2"
|
||||
}
|
||||
|
||||
enum T3 {
|
||||
a = "1",
|
||||
b = "1" + "2"
|
||||
}
|
||||
|
||||
enum T4 {
|
||||
a = "1"
|
||||
}
|
||||
|
||||
enum T5 {
|
||||
a = "1" + "2"
|
||||
}
|
||||
|
||||
declare enum T6 {
|
||||
a = "1",
|
||||
b = "1" + "2"
|
||||
}
|
||||
|
||||
|
||||
//// [enumConstantMemberWithStringEmitDeclaration.js]
|
||||
var T1;
|
||||
(function (T1) {
|
||||
T1["a"] = "1";
|
||||
T1["b"] = "12";
|
||||
T1["c"] = "123";
|
||||
})(T1 || (T1 = {}));
|
||||
var T2;
|
||||
(function (T2) {
|
||||
T2["a"] = "1";
|
||||
T2["b"] = "12";
|
||||
})(T2 || (T2 = {}));
|
||||
var T3;
|
||||
(function (T3) {
|
||||
T3["a"] = "1";
|
||||
T3["b"] = "12";
|
||||
})(T3 || (T3 = {}));
|
||||
var T4;
|
||||
(function (T4) {
|
||||
T4["a"] = "1";
|
||||
})(T4 || (T4 = {}));
|
||||
var T5;
|
||||
(function (T5) {
|
||||
T5["a"] = "12";
|
||||
})(T5 || (T5 = {}));
|
||||
|
||||
|
||||
//// [enumConstantMemberWithStringEmitDeclaration.d.ts]
|
||||
declare enum T1 {
|
||||
a = "1",
|
||||
b = "12",
|
||||
c = "123"
|
||||
}
|
||||
declare enum T2 {
|
||||
a = "1",
|
||||
b = "12"
|
||||
}
|
||||
declare enum T3 {
|
||||
a = "1",
|
||||
b = "12"
|
||||
}
|
||||
declare enum T4 {
|
||||
a = "1"
|
||||
}
|
||||
declare enum T5 {
|
||||
a = "12"
|
||||
}
|
||||
declare enum T6 {
|
||||
a = "1",
|
||||
b = "12"
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
=== tests/cases/conformance/enums/enumConstantMemberWithStringEmitDeclaration.ts ===
|
||||
enum T1 {
|
||||
>T1 : Symbol(T1, Decl(enumConstantMemberWithStringEmitDeclaration.ts, 0, 0))
|
||||
|
||||
a = "1",
|
||||
>a : Symbol(T1.a, Decl(enumConstantMemberWithStringEmitDeclaration.ts, 0, 9))
|
||||
|
||||
b = "1" + "2",
|
||||
>b : Symbol(T1.b, Decl(enumConstantMemberWithStringEmitDeclaration.ts, 1, 12))
|
||||
|
||||
c = "1" + "2" + "3"
|
||||
>c : Symbol(T1.c, Decl(enumConstantMemberWithStringEmitDeclaration.ts, 2, 18))
|
||||
}
|
||||
|
||||
enum T2 {
|
||||
>T2 : Symbol(T2, Decl(enumConstantMemberWithStringEmitDeclaration.ts, 4, 1))
|
||||
|
||||
a = "1",
|
||||
>a : Symbol(T2.a, Decl(enumConstantMemberWithStringEmitDeclaration.ts, 6, 9))
|
||||
|
||||
b = "1" + "2"
|
||||
>b : Symbol(T2.b, Decl(enumConstantMemberWithStringEmitDeclaration.ts, 7, 12))
|
||||
}
|
||||
|
||||
enum T3 {
|
||||
>T3 : Symbol(T3, Decl(enumConstantMemberWithStringEmitDeclaration.ts, 9, 1))
|
||||
|
||||
a = "1",
|
||||
>a : Symbol(T3.a, Decl(enumConstantMemberWithStringEmitDeclaration.ts, 11, 9))
|
||||
|
||||
b = "1" + "2"
|
||||
>b : Symbol(T3.b, Decl(enumConstantMemberWithStringEmitDeclaration.ts, 12, 12))
|
||||
}
|
||||
|
||||
enum T4 {
|
||||
>T4 : Symbol(T4, Decl(enumConstantMemberWithStringEmitDeclaration.ts, 14, 1))
|
||||
|
||||
a = "1"
|
||||
>a : Symbol(T4.a, Decl(enumConstantMemberWithStringEmitDeclaration.ts, 16, 9))
|
||||
}
|
||||
|
||||
enum T5 {
|
||||
>T5 : Symbol(T5, Decl(enumConstantMemberWithStringEmitDeclaration.ts, 18, 1))
|
||||
|
||||
a = "1" + "2"
|
||||
>a : Symbol(T5.a, Decl(enumConstantMemberWithStringEmitDeclaration.ts, 20, 9))
|
||||
}
|
||||
|
||||
declare enum T6 {
|
||||
>T6 : Symbol(T6, Decl(enumConstantMemberWithStringEmitDeclaration.ts, 22, 1))
|
||||
|
||||
a = "1",
|
||||
>a : Symbol(T6.a, Decl(enumConstantMemberWithStringEmitDeclaration.ts, 24, 17))
|
||||
|
||||
b = "1" + "2"
|
||||
>b : Symbol(T6.b, Decl(enumConstantMemberWithStringEmitDeclaration.ts, 25, 12))
|
||||
}
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
=== tests/cases/conformance/enums/enumConstantMemberWithStringEmitDeclaration.ts ===
|
||||
enum T1 {
|
||||
>T1 : T1
|
||||
|
||||
a = "1",
|
||||
>a : T1.a
|
||||
>"1" : "1"
|
||||
|
||||
b = "1" + "2",
|
||||
>b : T1.b
|
||||
>"1" + "2" : string
|
||||
>"1" : "1"
|
||||
>"2" : "2"
|
||||
|
||||
c = "1" + "2" + "3"
|
||||
>c : T1.c
|
||||
>"1" + "2" + "3" : string
|
||||
>"1" + "2" : string
|
||||
>"1" : "1"
|
||||
>"2" : "2"
|
||||
>"3" : "3"
|
||||
}
|
||||
|
||||
enum T2 {
|
||||
>T2 : T2
|
||||
|
||||
a = "1",
|
||||
>a : T2.a
|
||||
>"1" : "1"
|
||||
|
||||
b = "1" + "2"
|
||||
>b : T2.b
|
||||
>"1" + "2" : string
|
||||
>"1" : "1"
|
||||
>"2" : "2"
|
||||
}
|
||||
|
||||
enum T3 {
|
||||
>T3 : T3
|
||||
|
||||
a = "1",
|
||||
>a : T3.a
|
||||
>"1" : "1"
|
||||
|
||||
b = "1" + "2"
|
||||
>b : T3.b
|
||||
>"1" + "2" : string
|
||||
>"1" : "1"
|
||||
>"2" : "2"
|
||||
}
|
||||
|
||||
enum T4 {
|
||||
>T4 : T4
|
||||
|
||||
a = "1"
|
||||
>a : T4
|
||||
>"1" : "1"
|
||||
}
|
||||
|
||||
enum T5 {
|
||||
>T5 : T5
|
||||
|
||||
a = "1" + "2"
|
||||
>a : T5
|
||||
>"1" + "2" : string
|
||||
>"1" : "1"
|
||||
>"2" : "2"
|
||||
}
|
||||
|
||||
declare enum T6 {
|
||||
>T6 : T6
|
||||
|
||||
a = "1",
|
||||
>a : T6.a
|
||||
>"1" : "1"
|
||||
|
||||
b = "1" + "2"
|
||||
>b : T6.b
|
||||
>"1" + "2" : string
|
||||
>"1" : "1"
|
||||
>"2" : "2"
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user