diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 131dbc38cf74c..cb2d35963f7de 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -979,10 +979,65 @@ namespace ts { const builtinGlobals = createSymbolTable(); builtinGlobals.set(undefinedSymbol.escapedName, undefinedSymbol); + const typeAliases = createMultiMap(); + initializeTypeChecker(); return checker; + function compareAliases(a: TypeAlias, b: TypeAlias) { + if (a.kind !== b.kind) return false; + switch (a.kind) { + case AliasKind.Reference: return compareAliasReferences(a, b as AliasReference); + case AliasKind.Keyof: return compareAliasKeyofs(a, b as AliasKeyof); + default: return Debug.assertNever(a); + } + } + + function compareAliasReferences(a: AliasReference, b: AliasReference) { + return a.symbol === b.symbol && getTypeListId(a.typeArguments) === getTypeListId(b.typeArguments); + } + + function compareAliasKeyofs(a: AliasKeyof, b: AliasKeyof) { + return a.type === b.type; + } + + function registerAliasReferenceForType(type: Type, aliasSymbol: Symbol | undefined, aliasTypeArguments?: readonly Type[]): void { + if (!aliasSymbol) return; + const newAlias: AliasReference = { kind: AliasKind.Reference, symbol: aliasSymbol, typeArguments: aliasTypeArguments }; + const existing = find(typeAliases.get(type) || emptyArray, t => compareAliases(newAlias, t)); + if (existing) return; + registerNewAlias(type, newAlias); + } + + function registerNewAlias(type: Type, alias: TypeAlias) { + if (type.flags & TypeFlags.SupportsAliases) { + if (type.flags & TypeFlags.Object && !(getObjectFlags(type) & ObjectFlags.SupportsAliases)) return; + // Don't add aliases which trivially contain the type in question directly in their type arguments + if (alias.kind === AliasKind.Reference && some(alias.typeArguments, typeIsOrTriviallyContainsType)) return; + typeAliases.add(type, alias); + } + + function typeIsOrTriviallyContainsType(t2: Type, visited: Set = new Set()): boolean { + if (type === t2) return true; + if (visited.has(t2)) return false; + visited.add(t2); + if (t2.flags & TypeFlags.UnionOrIntersection) return some((t2 as UnionOrIntersectionType).types, recur); + if (t2.flags & TypeFlags.Index) return recur((t2 as IndexType).type); + if (t2.flags & TypeFlags.IndexedAccess) return recur((t2 as IndexedAccessType).objectType) || recur((t2 as IndexedAccessType).indexType); + if (getObjectFlags(t2) & ObjectFlags.Reference) return some(getTypeArguments(t2 as TypeReference), recur); + return false; + + function recur(t: Type) { + return typeIsOrTriviallyContainsType(t, visited); + } + } + } + + function getMatchingAliasPair(source: Type, target: Type) { + return forEach(typeAliases.get(source), s => s.kind !== AliasKind.Reference ? undefined : forEach(typeAliases.get(target), t => t.kind === AliasKind.Reference && s.symbol === t.symbol ? [s, t] as const : undefined)); + } + function getJsxNamespace(location: Node | undefined): __String { if (location) { const file = getSourceFileOfNode(location); @@ -4480,10 +4535,16 @@ namespace ts { return factory.createThisTypeNode(); } - if (!inTypeAlias && type.aliasSymbol && (context.flags & NodeBuilderFlags.UseAliasDefinedOutsideCurrentScope || isTypeSymbolAccessible(type.aliasSymbol, context.enclosingDeclaration))) { - const typeArgumentNodes = mapToTypeNodes(type.aliasTypeArguments, context); - if (isReservedMemberName(type.aliasSymbol.escapedName) && !(type.aliasSymbol.flags & SymbolFlags.Class)) return factory.createTypeReferenceNode(factory.createIdentifier(""), typeArgumentNodes); - return symbolToTypeNode(type.aliasSymbol, context, SymbolFlags.Type, typeArgumentNodes); + if (!inTypeAlias) { + ensureAliasesDiscovered(context.enclosingDeclaration); + const accessibleAlias = find(typeAliases.get(type) || emptyArray, t => t.kind === AliasKind.Reference && !!(context.flags & NodeBuilderFlags.UseAliasDefinedOutsideCurrentScope || isTypeSymbolAccessible(t.symbol, context.enclosingDeclaration))) as AliasReference | undefined; + if (accessibleAlias && (!context.aliasStack || context.aliasStack.indexOf(accessibleAlias) === -1)) { + (context.aliasStack ||= []).push(accessibleAlias); + const typeArgumentNodes = mapToTypeNodes(accessibleAlias.typeArguments, context); + context.aliasStack.pop(); + if (isReservedMemberName(accessibleAlias.symbol.escapedName) && !(accessibleAlias.symbol.flags & SymbolFlags.Class)) return factory.createTypeReferenceNode(factory.createIdentifier(""), typeArgumentNodes); + return symbolToTypeNode(accessibleAlias.symbol, context, SymbolFlags.Type, typeArgumentNodes); + } } const objectFlags = getObjectFlags(type); @@ -5088,7 +5149,7 @@ namespace ts { function typesAreSameReference(a: Type, b: Type): boolean { return a === b || !!a.symbol && a.symbol === b.symbol - || !!a.aliasSymbol && a.aliasSymbol === b.aliasSymbol; + || some(typeAliases.get(a), t1 => t1.kind === AliasKind.Reference && some(typeAliases.get(b), t2 => t2.kind === AliasKind.Reference && t1.symbol === t2.symbol)); } function indexInfoToIndexSignatureDeclarationHelper(indexInfo: IndexInfo, kind: IndexKind, context: NodeBuilderContext, typeNode: TypeNode | undefined): IndexSignatureDeclaration { @@ -7394,6 +7455,7 @@ namespace ts { typeParameterNamesByText?: Set; usedSymbolNames?: Set; remappedSymbolNames?: ESMap; + aliasStack?: TypeAlias[]; } function isDefaultBindingContext(location: Node) { @@ -7624,6 +7686,30 @@ namespace ts { } } + function ensureAliasesDiscovered(node: Node | undefined) { + if (!node) return; + const links = getNodeLinks(node); + if (!(links.flags & NodeCheckFlags.AllTypeAliasesAcessibleAreMaterialized)) { + links.flags |= NodeCheckFlags.AllTypeAliasesAcessibleAreMaterialized; + forEachSymbolTableInScope(node, table => { + forEachEntry(table, s => { + // So... this is kinda an approximation - technically we'd wanna guarantee + // that the whole program is typechecked (and thus all aliases are available) + // however that's a bit much to do - so we do a kind of first order approximation + // and guarantee that at least all type aliases with local references (and therefore are trivially visible to print) have been materialized. + // This notably means that type aliases who are members of namespaces which have local references + // may not have been materialized. We _could_ traverse all local references looking for those, too... but + // then we get into essentially performing the traversal recursively on every symbol table in scope, + // which, if symbol visibility checking has taught us anything, could be a costly endeavor. + const resolved = resolveSymbol(s); + if (resolved.flags & SymbolFlags.TypeAlias) { + getDeclaredTypeOfTypeAlias(resolved); + } + }); + }); + } + } + /** * Push an entry on the type resolution stack. If an entry with the given target and the given property name * is already on the stack, and no entries in between already have a type, then a circularity has occurred. @@ -12091,8 +12177,7 @@ namespace ts { type.target = target; type.node = node; type.mapper = mapper; - type.aliasSymbol = aliasSymbol; - type.aliasTypeArguments = mapper ? instantiateTypes(aliasTypeArguments, mapper) : aliasTypeArguments; + registerAliasReferenceForType(type, aliasSymbol, mapper ? instantiateTypes(aliasTypeArguments, mapper) : aliasTypeArguments); return type; } @@ -13072,7 +13157,9 @@ namespace ts { } const objectFlags = (includes & TypeFlags.NotPrimitiveUnion ? 0 : ObjectFlags.PrimitiveUnion) | (includes & TypeFlags.Intersection ? ObjectFlags.ContainsIntersections : 0); - return getUnionTypeFromSortedList(typeSet, objectFlags, aliasSymbol, aliasTypeArguments); + const result = getUnionTypeFromSortedList(typeSet, objectFlags); + registerAliasReferenceForType(result, aliasSymbol, aliasTypeArguments); + return result; } function getUnionTypePredicate(signatures: readonly Signature[]): TypePredicate | undefined { @@ -13108,7 +13195,7 @@ namespace ts { } // This function assumes the constituent type list is sorted and deduplicated. - function getUnionTypeFromSortedList(types: Type[], objectFlags: ObjectFlags, aliasSymbol?: Symbol, aliasTypeArguments?: readonly Type[]): Type { + function getUnionTypeFromSortedList(types: Type[], objectFlags: ObjectFlags): Type { if (types.length === 0) { return neverType; } @@ -13122,14 +13209,6 @@ namespace ts { unionTypes.set(id, type); type.objectFlags = objectFlags | getPropagatingFlagsOfTypes(types, /*excludeKinds*/ TypeFlags.Nullable); type.types = types; - /* - Note: This is the alias symbol (or lack thereof) that we see when we first encounter this union type. - For aliases of identical unions, eg `type T = A | B; type U = A | B`, the symbol of the first alias encountered is the aliasSymbol. - (In the language service, the order may depend on the order in which a user takes actions, such as hovering over symbols.) - It's important that we create equivalent union types only once, so that's an unfortunate side effect. - */ - type.aliasSymbol = aliasSymbol; - type.aliasTypeArguments = aliasTypeArguments; } return type; } @@ -13295,12 +13374,10 @@ namespace ts { return true; } - function createIntersectionType(types: Type[], aliasSymbol?: Symbol, aliasTypeArguments?: readonly Type[]) { + function createIntersectionType(types: Type[]) { const result = createType(TypeFlags.Intersection); result.objectFlags = getPropagatingFlagsOfTypes(types, /*excludeKinds*/ TypeFlags.Nullable); result.types = types; - result.aliasSymbol = aliasSymbol; // See comment in `getUnionTypeFromSortedList`. - result.aliasTypeArguments = aliasTypeArguments; return result; } @@ -13392,11 +13469,12 @@ namespace ts { result = neverType; } else { - result = createIntersectionType(typeSet, aliasSymbol, aliasTypeArguments); + result = createIntersectionType(typeSet); } } intersectionTypes.set(id, result); } + registerAliasReferenceForType(result, aliasSymbol, aliasTypeArguments); return result; } @@ -13641,12 +13719,10 @@ namespace ts { return result; } - function createIndexedAccessType(objectType: Type, indexType: Type, aliasSymbol: Symbol | undefined, aliasTypeArguments: readonly Type[] | undefined) { + function createIndexedAccessType(objectType: Type, indexType: Type) { const type = createType(TypeFlags.IndexedAccess); type.objectType = objectType; type.indexType = indexType; - type.aliasSymbol = aliasSymbol; - type.aliasTypeArguments = aliasTypeArguments; return type; } @@ -14058,9 +14134,9 @@ namespace ts { const id = objectType.id + "," + indexType.id; let type = indexedAccessTypes.get(id); if (!type) { - indexedAccessTypes.set(id, type = createIndexedAccessType(objectType, indexType, aliasSymbol, aliasTypeArguments)); + indexedAccessTypes.set(id, type = createIndexedAccessType(objectType, indexType)); } - + registerAliasReferenceForType(type, aliasSymbol, aliasTypeArguments); return shouldIncludeUndefined ? getUnionType([type, undefinedType]) : type; } // In the following we resolve T[K] to the type of the property in T selected by K. @@ -14114,8 +14190,9 @@ namespace ts { if (!links.resolvedType) { const type = createObjectType(ObjectFlags.Mapped, node.symbol); type.declaration = node; - type.aliasSymbol = getAliasSymbolForTypeNode(node); - type.aliasTypeArguments = getTypeArgumentsForAliasSymbol(type.aliasSymbol); + const aliasSymbol = getAliasSymbolForTypeNode(node); + const aliasTypeArguments = getTypeArgumentsForAliasSymbol(aliasSymbol); + registerAliasReferenceForType(type, aliasSymbol, aliasTypeArguments); links.resolvedType = type; // Eagerly resolve the constraint type which forces an error if the constraint type circularly // references itself through one or more type aliases. @@ -14208,8 +14285,8 @@ namespace ts { result.extendsType = extendsType; result.mapper = mapper; result.combinedMapper = combinedMapper; - result.aliasSymbol = root.aliasSymbol; - result.aliasTypeArguments = instantiateTypes(root.aliasTypeArguments, mapper!); // TODO: GH#18217 + const referenceSymbol = getAliasSymbolForTypeNode(root.node); + registerAliasReferenceForType(result, referenceSymbol, instantiateTypes(getTypeArgumentsForAliasSymbol(referenceSymbol), mapper!)); break; } return extraTypes ? getUnionType(append(extraTypes, result)) : result; @@ -14255,8 +14332,6 @@ namespace ts { inferTypeParameters: getInferTypeParameters(node), outerTypeParameters, instantiations: undefined, - aliasSymbol, - aliasTypeArguments }; links.resolvedType = getConditionalType(root, /*mapper*/ undefined); if (outerTypeParameters) { @@ -14362,8 +14437,7 @@ namespace ts { } else { let type = createObjectType(ObjectFlags.Anonymous, node.symbol); - type.aliasSymbol = aliasSymbol; - type.aliasTypeArguments = getTypeArgumentsForAliasSymbol(aliasSymbol); + registerAliasReferenceForType(type, aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol)); if (isJSDocTypeLiteral(node) && node.isArrayType) { type = createArrayType(type); } @@ -15020,7 +15094,7 @@ namespace ts { outerTypeParameters = addRange(outerTypeParameters, templateTagParameters); } typeParameters = outerTypeParameters || emptyArray; - typeParameters = (target.objectFlags & ObjectFlags.Reference || target.symbol.flags & SymbolFlags.TypeLiteral) && !target.aliasTypeArguments ? + typeParameters = (target.objectFlags & ObjectFlags.Reference || target.symbol.flags & SymbolFlags.TypeLiteral) && !some(typeAliases.get(target), t => t.kind === AliasKind.Reference && !!t.typeArguments) ? filter(typeParameters, tp => isTypeParameterPossiblyReferenced(tp, declaration)) : typeParameters; links.outerTypeParameters = typeParameters; @@ -15146,7 +15220,10 @@ namespace ts { elementFlags[i] & ElementFlags.Rest ? createArrayType(t) : createTupleType([t], [elementFlags[i]]); // The singleton is never a generic tuple type, so it is safe to recurse here. - return instantiateMappedType(mappedType, prependTypeMapping(typeVariable, singleton, mapper)); + const elemMapper = prependTypeMapping(typeVariable, singleton, mapper); + const result = instantiateMappedType(mappedType, elemMapper); + instantiateAliasesForResult(mappedType, elemMapper, result); + return result; }); const newReadonly = getModifiedReadonlyState(tupleType.target.readonly, getMappedTypeModifiers(mappedType)); return createTupleType(elementTypes, map(elementTypes, _ => ElementFlags.Variadic), newReadonly); @@ -15180,6 +15257,36 @@ namespace ts { propType; } + function instantiateAliasesForResult(type: Type, mapper: TypeMapper, result: Type) { + // Quick bail if type was unaffected by instantiation + if (type === result) return; + // Quick bail if result doesn't support aliasing + if (!(result.flags & TypeFlags.SupportsAliases)) return; + // Bail if a conditional resolves to a non-conditional (this is usually "simplifying", so recording the alias only complicates output) + if (type.flags & TypeFlags.Conditional && !(result.flags & TypeFlags.Conditional)) return; + // If a mapped type somehow maps into a simple reference type (ie, via a homomorphic mapped type), don't bother keeping around aliases on it (they'll probably just confuse the printback) + if (getObjectFlags(type) & ObjectFlags.Mapped && getObjectFlags(result) & ObjectFlags.Reference) return; + // Lastly, bail if we've already recorded starting instantiation for the aliases associated with this type and mapper + if (mapper.aliasCache?.has(type)) return; + const aliases = typeAliases.get(type) || emptyArray; + (mapper.aliasCache ||= new Set()).add(type); + for (const a of aliases) { + registerNewAlias(result, instantiateAlias(a, mapper)); + } + } + + function instantiateAlias(a: TypeAlias, mapper: TypeMapper) { + // TODO: we could defer this so easily + switch (a.kind) { + case AliasKind.Reference: + return { ...a, typeArguments: instantiateTypes(a.typeArguments, mapper) }; + case AliasKind.Keyof: + return { ...a, type: instantiateType(a.type, mapper) }; + default: + return Debug.assertNever(a); + } + } + function instantiateAnonymousType(type: AnonymousType, mapper: TypeMapper): AnonymousType { const result = createObjectType(type.objectFlags | ObjectFlags.Instantiated, type.symbol); if (type.objectFlags & ObjectFlags.Mapped) { @@ -15193,8 +15300,6 @@ namespace ts { } result.target = type; result.mapper = mapper; - result.aliasSymbol = type.aliasSymbol; - result.aliasTypeArguments = instantiateTypes(type.aliasTypeArguments, mapper); return result; } @@ -15249,6 +15354,7 @@ namespace ts { instantiationCount++; instantiationDepth++; const result = instantiateTypeWorker(type, mapper); + instantiateAliasesForResult(type, mapper, result); instantiationDepth--; return result; } @@ -15275,8 +15381,8 @@ namespace ts { const newTypes = instantiateTypes(types, mapper); return newTypes === types ? type : flags & TypeFlags.Intersection ? - getIntersectionType(newTypes, type.aliasSymbol, instantiateTypes(type.aliasTypeArguments, mapper)) : - getUnionType(newTypes, UnionReduction.Literal, type.aliasSymbol, instantiateTypes(type.aliasTypeArguments, mapper)); + getIntersectionType(newTypes) : + getUnionType(newTypes, UnionReduction.Literal); } if (flags & TypeFlags.Index) { return getIndexType(instantiateType((type).type, mapper)); @@ -15288,7 +15394,7 @@ namespace ts { return getStringMappingType((type).symbol, instantiateType((type).type, mapper)); } if (flags & TypeFlags.IndexedAccess) { - return getIndexedAccessType(instantiateType((type).objectType, mapper), instantiateType((type).indexType, mapper), /*accessNode*/ undefined, type.aliasSymbol, instantiateTypes(type.aliasTypeArguments, mapper)); + return getIndexedAccessType(instantiateType((type).objectType, mapper), instantiateType((type).indexType, mapper), /*accessNode*/ undefined); } if (flags & TypeFlags.Conditional) { return getConditionalTypeInstantiation(type, combineTypeMappers((type).mapper, mapper)); @@ -16831,8 +16937,8 @@ namespace ts { function reportErrorResults(source: Type, target: Type, result: Ternary, isComparingJsxAttributes: boolean) { if (!result && reportErrors) { - source = originalSource.aliasSymbol ? originalSource : source; - target = originalTarget.aliasSymbol ? originalTarget : target; + source = typeAliases.get(originalSource) ? originalSource : source; + target = typeAliases.get(originalTarget) ? originalTarget : target; let maybeSuppress = overrideNextErrorInfo > 0; if (maybeSuppress) { overrideNextErrorInfo--; @@ -17273,16 +17379,18 @@ namespace ts { // We limit alias variance probing to only object and conditional types since their alias behavior // is more predictable than other, interned types, which may or may not have an alias depending on // the order in which things were checked. - if (source.flags & (TypeFlags.Object | TypeFlags.Conditional) && source.aliasSymbol && - source.aliasTypeArguments && source.aliasSymbol === target.aliasSymbol && - !(source.aliasTypeArgumentsContainsMarker || target.aliasTypeArgumentsContainsMarker)) { - const variances = getAliasVariances(source.aliasSymbol); - if (variances === emptyArray) { - return Ternary.Maybe; - } - const varianceResult = relateVariances(source.aliasTypeArguments, target.aliasTypeArguments, variances, intersectionState); - if (varianceResult !== undefined) { - return varianceResult; + if (source.flags & (TypeFlags.Object | TypeFlags.Conditional)) { + const matchingAliasPair = getMatchingAliasPair(source, target); + if (matchingAliasPair && + !(matchingAliasPair[0].typeArgumentsContainMarker || matchingAliasPair[1].typeArgumentsContainMarker)) { + const variances = getAliasVariances(matchingAliasPair[0].symbol); + if (variances === emptyArray) { + return Ternary.Maybe; + } + const varianceResult = relateVariances(matchingAliasPair[0].typeArguments, matchingAliasPair[1].typeArguments, variances, intersectionState); + if (varianceResult !== undefined) { + return varianceResult; + } } } @@ -18467,7 +18575,7 @@ namespace ts { const links = getSymbolLinks(symbol); return getVariancesWorker(links.typeParameters, links, (_links, param, marker) => { const type = getTypeAliasInstantiation(symbol, instantiateTypes(links.typeParameters!, makeUnaryTypeMapper(param, marker))); - type.aliasTypeArgumentsContainsMarker = true; + typeAliases.get(type)!.forEach(a => a.kind === AliasKind.Reference && !!a.typeArguments && void (a.typeArgumentsContainMarker = true)); return type; }); } @@ -19600,11 +19708,11 @@ namespace ts { } function isNonGenericTopLevelType(type: Type) { - if (type.aliasSymbol && !type.aliasTypeArguments) { - const declaration = getDeclarationOfKind(type.aliasSymbol, SyntaxKind.TypeAliasDeclaration); - return !!(declaration && findAncestor(declaration.parent, n => n.kind === SyntaxKind.SourceFile ? true : n.kind === SyntaxKind.ModuleDeclaration ? false : "quit")); - } - return false; + return some(typeAliases.get(type), a => + a.kind === AliasKind.Reference && + !a.typeArguments && + !!findAncestor(getDeclarationOfKind(a.symbol, SyntaxKind.TypeAliasDeclaration), n => n.kind === SyntaxKind.SourceFile ? true : n.kind === SyntaxKind.ModuleDeclaration ? false : "quit") + ); } function isTypeParameterAtTopLevel(type: Type, typeParameter: TypeParameter): boolean { @@ -19842,10 +19950,12 @@ namespace ts { propagationType = savePropagationType; return; } - if (source.aliasSymbol && source.aliasTypeArguments && source.aliasSymbol === target.aliasSymbol) { + + const aliases = getMatchingAliasPair(source, target); + if (aliases && !!aliases[0].typeArguments) { // Source and target are types originating in the same generic type alias declaration. // Simply infer from source type arguments to target type arguments. - inferFromTypeArguments(source.aliasTypeArguments, target.aliasTypeArguments!, getAliasVariances(source.aliasSymbol)); + inferFromTypeArguments(aliases[0].typeArguments, aliases[1].typeArguments!, getAliasVariances(aliases[0].symbol)); return; } if (source === target && source.flags & TypeFlags.UnionOrIntersection) { @@ -20453,7 +20563,7 @@ namespace ts { function isTypeCloselyMatchedBy(s: Type, t: Type) { return !!(s.flags & TypeFlags.Object && t.flags & TypeFlags.Object && s.symbol && s.symbol === t.symbol || - s.aliasSymbol && s.aliasTypeArguments && s.aliasSymbol === t.aliasSymbol); + !!getMatchingAliasPair(s, t)?.[0]?.typeArguments); } function hasPrimitiveConstraint(type: TypeParameter): boolean { @@ -24195,9 +24305,10 @@ namespace ts { const args = fillMissingTypeArguments([ctorType, attributesType], (declaredManagedType as GenericType).typeParameters, 2, isInJSFile(context)); return createTypeReference((declaredManagedType as GenericType), args); } - else if (length(declaredManagedType.aliasTypeArguments) >= 2) { - const args = fillMissingTypeArguments([ctorType, attributesType], declaredManagedType.aliasTypeArguments, 2, isInJSFile(context)); - return getTypeAliasInstantiation(declaredManagedType.aliasSymbol!, args); + const alias = find(typeAliases.get(declaredManagedType) || emptyArray, a => a.kind === AliasKind.Reference) as AliasReference | undefined; + if (alias && length(alias.typeArguments) >= 2) { + const args = fillMissingTypeArguments([ctorType, attributesType], alias.typeArguments, 2, isInJSFile(context)); + return getTypeAliasInstantiation(alias.symbol, args); } } return attributesType; @@ -40010,7 +40121,7 @@ namespace ts { return (source as TypeReference).target === (target as TypeReference).target; } if (overlapObjFlags & ObjectFlags.Anonymous) { - return !!(source as AnonymousType).aliasSymbol && (source as AnonymousType).aliasSymbol === (target as AnonymousType).aliasSymbol; + return !!getMatchingAliasPair(source, target); } } return false; diff --git a/src/compiler/tracing.ts b/src/compiler/tracing.ts index 30b90a2b0d1a2..9eabbd38a903a 100644 --- a/src/compiler/tracing.ts +++ b/src/compiler/tracing.ts @@ -148,7 +148,7 @@ namespace ts.tracing { for (let i = 0; i < numTypes; i++) { const type = types[i]; const objectFlags = (type as any).objectFlags; - const symbol = type.aliasSymbol ?? type.symbol; + const symbol = type.symbol; const firstDeclaration = symbol?.declarations?.[0]; const firstFile = firstDeclaration && getSourceFileOfNode(firstDeclaration); @@ -211,7 +211,6 @@ namespace ts.tracing { recursionId: recursionToken, unionTypes: (type.flags & TypeFlags.Union) ? (type as UnionType).types?.map(t => t.id) : undefined, intersectionTypes: (type.flags & TypeFlags.Intersection) ? (type as IntersectionType).types.map(t => t.id) : undefined, - aliasTypeArguments: type.aliasTypeArguments?.map(t => t.id), keyofType: (type.flags & TypeFlags.Index) ? (type as IndexType).type?.id : undefined, ...indexedAccessProperties, ...referenceProperties, diff --git a/src/compiler/types.ts b/src/compiler/types.ts index a584cf7a0994e..29ce67db77494 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -4818,6 +4818,7 @@ namespace ts { ClassWithConstructorReference = 0x01000000, // Class that contains a binding to its constructor inside of the class body. ConstructorReferenceInClass = 0x02000000, // Binding to a class constructor inside of the class's body. ContainsClassWithPrivateIdentifiers = 0x04000000, // Marked on all block-scoped containers containing a class with private identifiers. + AllTypeAliasesAcessibleAreMaterialized = 0x08000000, // Indicates that, if the file hasn't been typechecked, it's at least had its imports traversed and checked } /* @internal */ @@ -4935,6 +4936,8 @@ namespace ts { IncludesWildcard = IndexedAccess, /* @internal */ IncludesEmptyObject = Conditional, + /* @internal */ + SupportsAliases = Union | Intersection | Object | IndexedAccess | Conditional, // This list is likely open to expansion } export type DestructuringPattern = BindingPattern | ObjectLiteralExpression | ArrayLiteralExpression; @@ -4949,9 +4952,6 @@ namespace ts { /* @internal */ checker: TypeChecker; symbol: Symbol; // Symbol associated with type (if any) pattern?: DestructuringPattern; // Destructuring pattern represented by type (if any) - aliasSymbol?: Symbol; // Alias associated with type - aliasTypeArguments?: readonly Type[]; // Alias type arguments (if any) - /* @internal */ aliasTypeArgumentsContainsMarker?: boolean; // Alias type arguments (if any) /* @internal */ permissiveInstantiation?: Type; // Instantiation with type parameters mapped to wildcard type /* @internal */ @@ -5066,6 +5066,8 @@ namespace ts { RequiresWidening = ContainsWideningType | ContainsObjectOrArrayLiteral, /* @internal */ PropagatingFlags = ContainsWideningType | ContainsObjectOrArrayLiteral | NonInferrableType, + /* @internal */ + SupportsAliases = Anonymous | Mapped | ReverseMapped | Reference, // Object flags that uniquely identify the kind of ObjectType /* @internal */ @@ -5344,8 +5346,6 @@ namespace ts { inferTypeParameters?: TypeParameter[]; outerTypeParameters?: TypeParameter[]; instantiations?: Map; - aliasSymbol?: Symbol; - aliasTypeArguments?: Type[]; } // T extends U ? X : Y (TypeFlags.Conditional) @@ -5475,10 +5475,10 @@ namespace ts { /* @internal */ export type TypeMapper = - | { kind: TypeMapKind.Simple, source: Type, target: Type } - | { kind: TypeMapKind.Array, sources: readonly Type[], targets: readonly Type[] | undefined } - | { kind: TypeMapKind.Function, func: (t: Type) => Type } - | { kind: TypeMapKind.Composite | TypeMapKind.Merged, mapper1: TypeMapper, mapper2: TypeMapper }; + | { kind: TypeMapKind.Simple, source: Type, target: Type, aliasCache?: Set } + | { kind: TypeMapKind.Array, sources: readonly Type[], targets: readonly Type[] | undefined, aliasCache?: Set } + | { kind: TypeMapKind.Function, func: (t: Type) => Type, aliasCache?: Set } + | { kind: TypeMapKind.Composite | TypeMapKind.Merged, mapper1: TypeMapper, mapper2: TypeMapper, aliasCache?: Set }; export const enum InferencePriority { NakedTypeVariable = 1 << 0, // Naked type variable in union or intersection type @@ -8153,4 +8153,24 @@ namespace ts { negative: boolean; base10Value: string; } + + export type TypeAlias = AliasReference | AliasKeyof; + + export enum AliasKind { + Reference, + Keyof, // Unimplemented + } + + export interface AliasReference { + kind: AliasKind.Reference; + symbol: Symbol; + typeArguments?: readonly Type[]; + /* @internal */ + typeArgumentsContainMarker?: boolean; + } + + export interface AliasKeyof { + kind: AliasKind.Keyof; + type: Type; + } } diff --git a/tests/baselines/reference/aliasDeclaredAfterFirstUsageUsedByDeclarationEmit.js b/tests/baselines/reference/aliasDeclaredAfterFirstUsageUsedByDeclarationEmit.js new file mode 100644 index 0000000000000..604c5f47fab59 --- /dev/null +++ b/tests/baselines/reference/aliasDeclaredAfterFirstUsageUsedByDeclarationEmit.js @@ -0,0 +1,59 @@ +//// [tests/cases/compiler/aliasDeclaredAfterFirstUsageUsedByDeclarationEmit.ts] //// + +//// [init.ts] +export interface A { + a: true; +} + +export interface B { + b: true; +} + +export function f(thing?: A | B): A | B { return null as any; }; +//// [utils.ts] +import {A, B} from "./init"; + +export type Either = A | B; +//// [usage.ts] +import {Either} from "./utils"; +import {f} from "./init"; + +export function doThing() { + return f(); +} + +//// [init.js] +"use strict"; +exports.__esModule = true; +exports.f = void 0; +function f(thing) { return null; } +exports.f = f; +; +//// [utils.js] +"use strict"; +exports.__esModule = true; +//// [usage.js] +"use strict"; +exports.__esModule = true; +exports.doThing = void 0; +var init_1 = require("./init"); +function doThing() { + return init_1.f(); +} +exports.doThing = doThing; + + +//// [init.d.ts] +export interface A { + a: true; +} +export interface B { + b: true; +} +export declare function f(thing?: A | B): A | B; +//// [utils.d.ts] +import { A, B } from "./init"; +export declare type Either = A | B; +//// [usage.d.ts] +import { Either } from "./utils"; +export declare function doThing(): Either; diff --git a/tests/baselines/reference/aliasDeclaredAfterFirstUsageUsedByDeclarationEmit.symbols b/tests/baselines/reference/aliasDeclaredAfterFirstUsageUsedByDeclarationEmit.symbols new file mode 100644 index 0000000000000..1143cf40c2ca7 --- /dev/null +++ b/tests/baselines/reference/aliasDeclaredAfterFirstUsageUsedByDeclarationEmit.symbols @@ -0,0 +1,46 @@ +=== tests/cases/compiler/init.ts === +export interface A { +>A : Symbol(A, Decl(init.ts, 0, 0)) + + a: true; +>a : Symbol(A.a, Decl(init.ts, 0, 20)) +} + +export interface B { +>B : Symbol(B, Decl(init.ts, 2, 1)) + + b: true; +>b : Symbol(B.b, Decl(init.ts, 4, 20)) +} + +export function f(thing?: A | B): A | B { return null as any; }; +>f : Symbol(f, Decl(init.ts, 6, 1)) +>thing : Symbol(thing, Decl(init.ts, 8, 18)) +>A : Symbol(A, Decl(init.ts, 0, 0)) +>B : Symbol(B, Decl(init.ts, 2, 1)) +>A : Symbol(A, Decl(init.ts, 0, 0)) +>B : Symbol(B, Decl(init.ts, 2, 1)) + +=== tests/cases/compiler/utils.ts === +import {A, B} from "./init"; +>A : Symbol(A, Decl(utils.ts, 0, 8)) +>B : Symbol(B, Decl(utils.ts, 0, 10)) + +export type Either = A | B; +>Either : Symbol(Either, Decl(utils.ts, 0, 28)) +>A : Symbol(A, Decl(utils.ts, 0, 8)) +>B : Symbol(B, Decl(utils.ts, 0, 10)) + +=== tests/cases/compiler/usage.ts === +import {Either} from "./utils"; +>Either : Symbol(Either, Decl(usage.ts, 0, 8)) + +import {f} from "./init"; +>f : Symbol(f, Decl(usage.ts, 1, 8)) + +export function doThing() { +>doThing : Symbol(doThing, Decl(usage.ts, 1, 25)) + + return f(); +>f : Symbol(f, Decl(usage.ts, 1, 8)) +} diff --git a/tests/baselines/reference/aliasDeclaredAfterFirstUsageUsedByDeclarationEmit.types b/tests/baselines/reference/aliasDeclaredAfterFirstUsageUsedByDeclarationEmit.types new file mode 100644 index 0000000000000..89b0a30c00c8f --- /dev/null +++ b/tests/baselines/reference/aliasDeclaredAfterFirstUsageUsedByDeclarationEmit.types @@ -0,0 +1,41 @@ +=== tests/cases/compiler/init.ts === +export interface A { + a: true; +>a : true +>true : true +} + +export interface B { + b: true; +>b : true +>true : true +} + +export function f(thing?: A | B): A | B { return null as any; }; +>f : (thing?: A | B) => A | B +>thing : import("tests/cases/compiler/utils").Either +>null as any : any +>null : null + +=== tests/cases/compiler/utils.ts === +import {A, B} from "./init"; +>A : any +>B : any + +export type Either = A | B; +>Either : Either + +=== tests/cases/compiler/usage.ts === +import {Either} from "./utils"; +>Either : any + +import {f} from "./init"; +>f : (thing?: Either) => Either + +export function doThing() { +>doThing : () => Either + + return f(); +>f() : Either +>f : (thing?: Either) => Either +} diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index a4f5a9a74dec2..817e218328415 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -2504,8 +2504,6 @@ declare namespace ts { flags: TypeFlags; symbol: Symbol; pattern?: DestructuringPattern; - aliasSymbol?: Symbol; - aliasTypeArguments?: readonly Type[]; } export interface LiteralType extends Type { value: string | number | PseudoBigInt; @@ -2638,8 +2636,6 @@ declare namespace ts { inferTypeParameters?: TypeParameter[]; outerTypeParameters?: TypeParameter[]; instantiations?: Map; - aliasSymbol?: Symbol; - aliasTypeArguments?: Type[]; } export interface ConditionalType extends InstantiableType { root: ConditionalRoot; @@ -3874,6 +3870,20 @@ declare namespace ts { negative: boolean; base10Value: string; } + export type TypeAlias = AliasReference | AliasKeyof; + export enum AliasKind { + Reference = 0, + Keyof = 1 + } + export interface AliasReference { + kind: AliasKind.Reference; + symbol: Symbol; + typeArguments?: readonly Type[]; + } + export interface AliasKeyof { + kind: AliasKind.Keyof; + type: Type; + } export {}; } declare function setTimeout(handler: (...args: any[]) => void, timeout: number): any; diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 5bff8c8059e60..8d8e74b819bfa 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -2504,8 +2504,6 @@ declare namespace ts { flags: TypeFlags; symbol: Symbol; pattern?: DestructuringPattern; - aliasSymbol?: Symbol; - aliasTypeArguments?: readonly Type[]; } export interface LiteralType extends Type { value: string | number | PseudoBigInt; @@ -2638,8 +2636,6 @@ declare namespace ts { inferTypeParameters?: TypeParameter[]; outerTypeParameters?: TypeParameter[]; instantiations?: Map; - aliasSymbol?: Symbol; - aliasTypeArguments?: Type[]; } export interface ConditionalType extends InstantiableType { root: ConditionalRoot; @@ -3874,6 +3870,20 @@ declare namespace ts { negative: boolean; base10Value: string; } + export type TypeAlias = AliasReference | AliasKeyof; + export enum AliasKind { + Reference = 0, + Keyof = 1 + } + export interface AliasReference { + kind: AliasKind.Reference; + symbol: Symbol; + typeArguments?: readonly Type[]; + } + export interface AliasKeyof { + kind: AliasKind.Keyof; + type: Type; + } export {}; } declare function setTimeout(handler: (...args: any[]) => void, timeout: number): any; diff --git a/tests/baselines/reference/assignmentCompatWithDiscriminatedUnion.errors.txt b/tests/baselines/reference/assignmentCompatWithDiscriminatedUnion.errors.txt index ab5ed2fba8b9c..1479d824429a1 100644 --- a/tests/baselines/reference/assignmentCompatWithDiscriminatedUnion.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithDiscriminatedUnion.errors.txt @@ -6,9 +6,9 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithDiscriminatedUnion.ts(58,5): error TS2322: Type 'S' is not assignable to type 'T'. Property 'c' is missing in type 'S' but required in type '{ a: 2; b: 4 | 3; c: string; }'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithDiscriminatedUnion.ts(82,5): error TS2322: Type 'S' is not assignable to type 'T'. - Type 'S' is not assignable to type '{ a: 0 | 2 | 1; b: 0 | 2 | 1; c: 2; }'. + Type 'S' is not assignable to type '{ a: N; b: N; c: 2; }'. Types of property 'c' are incompatible. - Type '0 | 2 | 1' is not assignable to type '2'. + Type 'N' is not assignable to type '2'. Type '0' is not assignable to type '2'. @@ -107,9 +107,9 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme t = s; ~ !!! error TS2322: Type 'S' is not assignable to type 'T'. -!!! error TS2322: Type 'S' is not assignable to type '{ a: 0 | 2 | 1; b: 0 | 2 | 1; c: 2; }'. +!!! error TS2322: Type 'S' is not assignable to type '{ a: N; b: N; c: 2; }'. !!! error TS2322: Types of property 'c' are incompatible. -!!! error TS2322: Type '0 | 2 | 1' is not assignable to type '2'. +!!! error TS2322: Type 'N' is not assignable to type '2'. !!! error TS2322: Type '0' is not assignable to type '2'. } diff --git a/tests/baselines/reference/assignmentCompatWithDiscriminatedUnion.types b/tests/baselines/reference/assignmentCompatWithDiscriminatedUnion.types index 4677ed878058b..b703e4dfe1f8d 100644 --- a/tests/baselines/reference/assignmentCompatWithDiscriminatedUnion.types +++ b/tests/baselines/reference/assignmentCompatWithDiscriminatedUnion.types @@ -155,58 +155,58 @@ namespace Example5 { // 3 discriminant properties with 3 types a piece // is 27 possible combinations. type N = 0 | 1 | 2; ->N : 0 | 2 | 1 +>N : N type S = { a: N, b: N, c: N }; >S : S ->a : 0 | 2 | 1 ->b : 0 | 2 | 1 ->c : 0 | 2 | 1 +>a : N +>b : N +>c : N type T = { a: 0, b: N, c: N } >T : T >a : 0 ->b : 0 | 2 | 1 ->c : 0 | 2 | 1 +>b : N +>c : N | { a: 1, b: N, c: N } >a : 1 ->b : 0 | 2 | 1 ->c : 0 | 2 | 1 +>b : N +>c : N | { a: 2, b: N, c: N } >a : 2 ->b : 0 | 2 | 1 ->c : 0 | 2 | 1 +>b : N +>c : N | { a: N, b: 0, c: N } ->a : 0 | 2 | 1 +>a : N >b : 0 ->c : 0 | 2 | 1 +>c : N | { a: N, b: 1, c: N } ->a : 0 | 2 | 1 +>a : N >b : 1 ->c : 0 | 2 | 1 +>c : N | { a: N, b: 2, c: N } ->a : 0 | 2 | 1 +>a : N >b : 2 ->c : 0 | 2 | 1 +>c : N | { a: N, b: N, c: 0 } ->a : 0 | 2 | 1 ->b : 0 | 2 | 1 +>a : N +>b : N >c : 0 | { a: N, b: N, c: 1 } ->a : 0 | 2 | 1 ->b : 0 | 2 | 1 +>a : N +>b : N >c : 1 | { a: N, b: N, c: 2 }; ->a : 0 | 2 | 1 ->b : 0 | 2 | 1 +>a : N +>b : N >c : 2 declare let s: S; @@ -473,17 +473,17 @@ namespace GH39357 { >A : A type B = "a" | "b" | "c"; ->B : "a" | "b" | "c" +>B : B declare const b: B; ->b : "a" | "b" | "c" +>b : B const a: A = b === "a" || b === "b" ? [b, 1] : ["c", ""]; >a : A >b === "a" || b === "b" ? [b, 1] : ["c", ""] : ["a" | "b", number] | ["c", string] >b === "a" || b === "b" : boolean >b === "a" : boolean ->b : "a" | "b" | "c" +>b : B >"a" : "a" >b === "b" : boolean >b : "b" | "c" diff --git a/tests/baselines/reference/bigintIndex.types b/tests/baselines/reference/bigintIndex.types index a70c1f9aec573..772e6b5639a2e 100644 --- a/tests/baselines/reference/bigintIndex.types +++ b/tests/baselines/reference/bigintIndex.types @@ -32,27 +32,27 @@ num = arr[1n]; // should error >1n : 1n let key: keyof any; // should be type "string | number | symbol" ->key : string | number | symbol +>key : PropertyKey key = 123; >key = 123 : 123 ->key : string | number | symbol +>key : PropertyKey >123 : 123 key = "abc"; >key = "abc" : "abc" ->key : string | number | symbol +>key : PropertyKey >"abc" : "abc" key = Symbol(); >key = Symbol() : symbol ->key : string | number | symbol +>key : PropertyKey >Symbol() : symbol >Symbol : SymbolConstructor key = 123n; // should error >key = 123n : 123n ->key : string | number | symbol +>key : PropertyKey >123n : 123n // Show correct usage of bigint index: explicitly convert to string diff --git a/tests/baselines/reference/checkExportsObjectAssignProperty.types b/tests/baselines/reference/checkExportsObjectAssignProperty.types index f5519ddfac339..78bbbc8f3559f 100644 --- a/tests/baselines/reference/checkExportsObjectAssignProperty.types +++ b/tests/baselines/reference/checkExportsObjectAssignProperty.types @@ -176,9 +176,9 @@ m2.setonlyAccessor = 0; === tests/cases/conformance/jsdoc/mod1.js === Object.defineProperty(exports, "thing", { value: 42, writable: true }); >Object.defineProperty(exports, "thing", { value: 42, writable: true }) : any ->Object.defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>Object.defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Object : ObjectConstructor ->defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >exports : typeof import("tests/cases/conformance/jsdoc/mod1") >"thing" : "thing" >{ value: 42, writable: true } : { value: number; writable: true; } @@ -189,9 +189,9 @@ Object.defineProperty(exports, "thing", { value: 42, writable: true }); Object.defineProperty(exports, "readonlyProp", { value: "Smith", writable: false }); >Object.defineProperty(exports, "readonlyProp", { value: "Smith", writable: false }) : any ->Object.defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>Object.defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Object : ObjectConstructor ->defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >exports : typeof import("tests/cases/conformance/jsdoc/mod1") >"readonlyProp" : "readonlyProp" >{ value: "Smith", writable: false } : { value: string; writable: false; } @@ -202,9 +202,9 @@ Object.defineProperty(exports, "readonlyProp", { value: "Smith", writable: false Object.defineProperty(exports, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }); >Object.defineProperty(exports, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }) : any ->Object.defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>Object.defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Object : ObjectConstructor ->defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >exports : typeof import("tests/cases/conformance/jsdoc/mod1") >"rwAccessors" : "rwAccessors" >{ get() { return 98122 }, set(_) { /*ignore*/ } } : { get(): number; set(_: any): void; } @@ -215,9 +215,9 @@ Object.defineProperty(exports, "rwAccessors", { get() { return 98122 }, set(_) { Object.defineProperty(exports, "readonlyAccessor", { get() { return 21.75 } }); >Object.defineProperty(exports, "readonlyAccessor", { get() { return 21.75 } }) : any ->Object.defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>Object.defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Object : ObjectConstructor ->defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >exports : typeof import("tests/cases/conformance/jsdoc/mod1") >"readonlyAccessor" : "readonlyAccessor" >{ get() { return 21.75 } } : { get(): number; } @@ -226,9 +226,9 @@ Object.defineProperty(exports, "readonlyAccessor", { get() { return 21.75 } }); Object.defineProperty(exports, "setonlyAccessor", { >Object.defineProperty(exports, "setonlyAccessor", { /** @param {string} str */ set(str) { this.rwAccessors = Number(str) }}) : any ->Object.defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>Object.defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Object : ObjectConstructor ->defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >exports : typeof import("tests/cases/conformance/jsdoc/mod1") >"setonlyAccessor" : "setonlyAccessor" >{ /** @param {string} str */ set(str) { this.rwAccessors = Number(str) }} : { set(str: string): void; } @@ -252,9 +252,9 @@ Object.defineProperty(exports, "setonlyAccessor", { === tests/cases/conformance/jsdoc/mod2.js === Object.defineProperty(module.exports, "thing", { value: "yes", writable: true }); >Object.defineProperty(module.exports, "thing", { value: "yes", writable: true }) : any ->Object.defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>Object.defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Object : ObjectConstructor ->defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >module.exports : typeof import("tests/cases/conformance/jsdoc/mod2") >module : { "\"tests/cases/conformance/jsdoc/mod2\"": typeof import("tests/cases/conformance/jsdoc/mod2"); } >exports : typeof import("tests/cases/conformance/jsdoc/mod2") @@ -267,9 +267,9 @@ Object.defineProperty(module.exports, "thing", { value: "yes", writable: true }) Object.defineProperty(module.exports, "readonlyProp", { value: "Smith", writable: false }); >Object.defineProperty(module.exports, "readonlyProp", { value: "Smith", writable: false }) : any ->Object.defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>Object.defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Object : ObjectConstructor ->defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >module.exports : typeof import("tests/cases/conformance/jsdoc/mod2") >module : { "\"tests/cases/conformance/jsdoc/mod2\"": typeof import("tests/cases/conformance/jsdoc/mod2"); } >exports : typeof import("tests/cases/conformance/jsdoc/mod2") @@ -282,9 +282,9 @@ Object.defineProperty(module.exports, "readonlyProp", { value: "Smith", writable Object.defineProperty(module.exports, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }); >Object.defineProperty(module.exports, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }) : any ->Object.defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>Object.defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Object : ObjectConstructor ->defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >module.exports : typeof import("tests/cases/conformance/jsdoc/mod2") >module : { "\"tests/cases/conformance/jsdoc/mod2\"": typeof import("tests/cases/conformance/jsdoc/mod2"); } >exports : typeof import("tests/cases/conformance/jsdoc/mod2") @@ -297,9 +297,9 @@ Object.defineProperty(module.exports, "rwAccessors", { get() { return 98122 }, s Object.defineProperty(module.exports, "readonlyAccessor", { get() { return 21.75 } }); >Object.defineProperty(module.exports, "readonlyAccessor", { get() { return 21.75 } }) : any ->Object.defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>Object.defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Object : ObjectConstructor ->defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >module.exports : typeof import("tests/cases/conformance/jsdoc/mod2") >module : { "\"tests/cases/conformance/jsdoc/mod2\"": typeof import("tests/cases/conformance/jsdoc/mod2"); } >exports : typeof import("tests/cases/conformance/jsdoc/mod2") @@ -310,9 +310,9 @@ Object.defineProperty(module.exports, "readonlyAccessor", { get() { return 21.75 Object.defineProperty(module.exports, "setonlyAccessor", { >Object.defineProperty(module.exports, "setonlyAccessor", { /** @param {string} str */ set(str) { this.rwAccessors = Number(str) }}) : any ->Object.defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>Object.defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Object : ObjectConstructor ->defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >module.exports : typeof import("tests/cases/conformance/jsdoc/mod2") >module : { "\"tests/cases/conformance/jsdoc/mod2\"": typeof import("tests/cases/conformance/jsdoc/mod2"); } >exports : typeof import("tests/cases/conformance/jsdoc/mod2") diff --git a/tests/baselines/reference/checkExportsObjectAssignPrototypeProperty.types b/tests/baselines/reference/checkExportsObjectAssignPrototypeProperty.types index 6634a1a45ed3d..77875ad8c6374 100644 --- a/tests/baselines/reference/checkExportsObjectAssignPrototypeProperty.types +++ b/tests/baselines/reference/checkExportsObjectAssignPrototypeProperty.types @@ -129,9 +129,9 @@ Person.prototype.describe = function () { }; Object.defineProperty(Person.prototype, "thing", { value: 42, writable: true }); >Object.defineProperty(Person.prototype, "thing", { value: 42, writable: true }) : any ->Object.defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>Object.defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Object : ObjectConstructor ->defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Person.prototype : any >Person : typeof Person >prototype : any @@ -144,9 +144,9 @@ Object.defineProperty(Person.prototype, "thing", { value: 42, writable: true }); Object.defineProperty(Person.prototype, "readonlyProp", { value: "Smith", writable: false }); >Object.defineProperty(Person.prototype, "readonlyProp", { value: "Smith", writable: false }) : any ->Object.defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>Object.defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Object : ObjectConstructor ->defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Person.prototype : any >Person : typeof Person >prototype : any @@ -159,9 +159,9 @@ Object.defineProperty(Person.prototype, "readonlyProp", { value: "Smith", writab Object.defineProperty(Person.prototype, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }); >Object.defineProperty(Person.prototype, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }) : any ->Object.defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>Object.defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Object : ObjectConstructor ->defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Person.prototype : any >Person : typeof Person >prototype : any @@ -174,9 +174,9 @@ Object.defineProperty(Person.prototype, "rwAccessors", { get() { return 98122 }, Object.defineProperty(Person.prototype, "readonlyAccessor", { get() { return 21.75 } }); >Object.defineProperty(Person.prototype, "readonlyAccessor", { get() { return 21.75 } }) : any ->Object.defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>Object.defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Object : ObjectConstructor ->defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Person.prototype : any >Person : typeof Person >prototype : any @@ -187,9 +187,9 @@ Object.defineProperty(Person.prototype, "readonlyAccessor", { get() { return 21. Object.defineProperty(Person.prototype, "setonlyAccessor", { >Object.defineProperty(Person.prototype, "setonlyAccessor", { /** @param {string} str */ set(str) { this.rwAccessors = Number(str) }}) : any ->Object.defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>Object.defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Object : ObjectConstructor ->defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Person.prototype : any >Person : typeof Person >prototype : any diff --git a/tests/baselines/reference/checkObjectDefineProperty.types b/tests/baselines/reference/checkObjectDefineProperty.types index e129624a5810e..05359b68bb183 100644 --- a/tests/baselines/reference/checkObjectDefineProperty.types +++ b/tests/baselines/reference/checkObjectDefineProperty.types @@ -89,9 +89,9 @@ const x = {}; Object.defineProperty(x, "name", { value: "Charles", writable: true }); >Object.defineProperty(x, "name", { value: "Charles", writable: true }) : any ->Object.defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>Object.defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Object : ObjectConstructor ->defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >x : typeof x >"name" : "name" >{ value: "Charles", writable: true } : { value: string; writable: true; } @@ -102,9 +102,9 @@ Object.defineProperty(x, "name", { value: "Charles", writable: true }); Object.defineProperty(x, "middleInit", { value: "H" }); >Object.defineProperty(x, "middleInit", { value: "H" }) : any ->Object.defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>Object.defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Object : ObjectConstructor ->defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >x : typeof x >"middleInit" : "middleInit" >{ value: "H" } : { value: string; } @@ -113,9 +113,9 @@ Object.defineProperty(x, "middleInit", { value: "H" }); Object.defineProperty(x, "lastName", { value: "Smith", writable: false }); >Object.defineProperty(x, "lastName", { value: "Smith", writable: false }) : any ->Object.defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>Object.defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Object : ObjectConstructor ->defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >x : typeof x >"lastName" : "lastName" >{ value: "Smith", writable: false } : { value: string; writable: false; } @@ -126,9 +126,9 @@ Object.defineProperty(x, "lastName", { value: "Smith", writable: false }); Object.defineProperty(x, "zip", { get() { return 98122 }, set(_) { /*ignore*/ } }); >Object.defineProperty(x, "zip", { get() { return 98122 }, set(_) { /*ignore*/ } }) : any ->Object.defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>Object.defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Object : ObjectConstructor ->defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >x : typeof x >"zip" : "zip" >{ get() { return 98122 }, set(_) { /*ignore*/ } } : { get(): number; set(_: any): void; } @@ -139,9 +139,9 @@ Object.defineProperty(x, "zip", { get() { return 98122 }, set(_) { /*ignore*/ } Object.defineProperty(x, "houseNumber", { get() { return 21.75 } }); >Object.defineProperty(x, "houseNumber", { get() { return 21.75 } }) : any ->Object.defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>Object.defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Object : ObjectConstructor ->defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >x : typeof x >"houseNumber" : "houseNumber" >{ get() { return 21.75 } } : { get(): number; } @@ -150,9 +150,9 @@ Object.defineProperty(x, "houseNumber", { get() { return 21.75 } }); Object.defineProperty(x, "zipStr", { >Object.defineProperty(x, "zipStr", { /** @param {string} str */ set(str) { this.zip = Number(str) }}) : any ->Object.defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>Object.defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Object : ObjectConstructor ->defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >x : typeof x >"zipStr" : "zipStr" >{ /** @param {string} str */ set(str) { this.zip = Number(str) }} : { set(str: string): void; } diff --git a/tests/baselines/reference/checkOtherObjectAssignProperty.types b/tests/baselines/reference/checkOtherObjectAssignProperty.types index 950e1266154e2..83204a02ffe64 100644 --- a/tests/baselines/reference/checkOtherObjectAssignProperty.types +++ b/tests/baselines/reference/checkOtherObjectAssignProperty.types @@ -89,9 +89,9 @@ const obj = { value: 42, writable: true }; Object.defineProperty(exports, "thing", obj); >Object.defineProperty(exports, "thing", obj) : any ->Object.defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>Object.defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Object : ObjectConstructor ->defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >exports : typeof import("tests/cases/conformance/jsdoc/mod1") >"thing" : "thing" >obj : { value: number; writable: boolean; } @@ -106,9 +106,9 @@ let str = /** @type {string} */("other"); Object.defineProperty(exports, str, { value: 42, writable: true }); >Object.defineProperty(exports, str, { value: 42, writable: true }) : any ->Object.defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>Object.defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Object : ObjectConstructor ->defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >exports : typeof import("tests/cases/conformance/jsdoc/mod1") >str : string >{ value: 42, writable: true } : { value: number; writable: true; } @@ -123,9 +123,9 @@ const propName = "prop" Object.defineProperty(exports, propName, { value: 42, writable: true }); >Object.defineProperty(exports, propName, { value: 42, writable: true }) : any ->Object.defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>Object.defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Object : ObjectConstructor ->defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >exports : typeof import("tests/cases/conformance/jsdoc/mod1") >propName : "prop" >{ value: 42, writable: true } : { value: number; writable: true; } @@ -137,18 +137,18 @@ Object.defineProperty(exports, propName, { value: 42, writable: true }); Object.defineProperty(exports, "bad1", { }); >Object.defineProperty(exports, "bad1", { }) : any ->Object.defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>Object.defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Object : ObjectConstructor ->defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >exports : typeof import("tests/cases/conformance/jsdoc/mod1") >"bad1" : "bad1" >{ } : {} Object.defineProperty(exports, "bad2", { get() { return 12 }, value: "no" }); >Object.defineProperty(exports, "bad2", { get() { return 12 }, value: "no" }) : any ->Object.defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>Object.defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Object : ObjectConstructor ->defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >exports : typeof import("tests/cases/conformance/jsdoc/mod1") >"bad2" : "bad2" >{ get() { return 12 }, value: "no" } : { get(): number; value: string; } @@ -159,9 +159,9 @@ Object.defineProperty(exports, "bad2", { get() { return 12 }, value: "no" }); Object.defineProperty(exports, "bad3", { writable: true }); >Object.defineProperty(exports, "bad3", { writable: true }) : any ->Object.defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>Object.defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Object : ObjectConstructor ->defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >exports : typeof import("tests/cases/conformance/jsdoc/mod1") >"bad3" : "bad3" >{ writable: true } : { writable: true; } diff --git a/tests/baselines/reference/classAppearsToHaveMembersOfObject.types b/tests/baselines/reference/classAppearsToHaveMembersOfObject.types index 883d1e101073b..484521f4c39c7 100644 --- a/tests/baselines/reference/classAppearsToHaveMembersOfObject.types +++ b/tests/baselines/reference/classAppearsToHaveMembersOfObject.types @@ -16,9 +16,9 @@ var r = c.toString(); var r2 = c.hasOwnProperty(''); >r2 : boolean >c.hasOwnProperty('') : boolean ->c.hasOwnProperty : (v: string | number | symbol) => boolean +>c.hasOwnProperty : (v: PropertyKey) => boolean >c : C ->hasOwnProperty : (v: string | number | symbol) => boolean +>hasOwnProperty : (v: PropertyKey) => boolean >'' : "" var o: Object = c; diff --git a/tests/baselines/reference/computedPropertyNames15_ES5.types b/tests/baselines/reference/computedPropertyNames15_ES5.types index d5a5dda41482f..8a509f8700655 100644 --- a/tests/baselines/reference/computedPropertyNames15_ES5.types +++ b/tests/baselines/reference/computedPropertyNames15_ES5.types @@ -3,7 +3,7 @@ var p1: number | string; >p1 : string | number var p2: number | number[]; ->p2 : number | number[] +>p2 : VibratePattern var p3: string | boolean; >p3 : string | boolean @@ -17,7 +17,7 @@ class C { [p2]() { } >[p2] : () => void ->p2 : number | number[] +>p2 : VibratePattern [p3]() { } >[p3] : () => void diff --git a/tests/baselines/reference/computedPropertyNames15_ES6.types b/tests/baselines/reference/computedPropertyNames15_ES6.types index 0d4746e2c1699..74a4aca07de60 100644 --- a/tests/baselines/reference/computedPropertyNames15_ES6.types +++ b/tests/baselines/reference/computedPropertyNames15_ES6.types @@ -3,7 +3,7 @@ var p1: number | string; >p1 : string | number var p2: number | number[]; ->p2 : number | number[] +>p2 : VibratePattern var p3: string | boolean; >p3 : string | boolean @@ -17,7 +17,7 @@ class C { [p2]() { } >[p2] : () => void ->p2 : number | number[] +>p2 : VibratePattern [p3]() { } >[p3] : () => void diff --git a/tests/baselines/reference/computedPropertyNames6_ES5.types b/tests/baselines/reference/computedPropertyNames6_ES5.types index c80455f734475..e0acc5a5404c2 100644 --- a/tests/baselines/reference/computedPropertyNames6_ES5.types +++ b/tests/baselines/reference/computedPropertyNames6_ES5.types @@ -3,7 +3,7 @@ var p1: number | string; >p1 : string | number var p2: number | number[]; ->p2 : number | number[] +>p2 : VibratePattern var p3: string | boolean; >p3 : string | boolean @@ -19,7 +19,7 @@ var v = { [p2]: 1, >[p2] : number ->p2 : number | number[] +>p2 : VibratePattern >1 : 1 [p3]: 2 diff --git a/tests/baselines/reference/computedPropertyNames6_ES6.types b/tests/baselines/reference/computedPropertyNames6_ES6.types index 38a4a6c49f38b..2d36ceb004609 100644 --- a/tests/baselines/reference/computedPropertyNames6_ES6.types +++ b/tests/baselines/reference/computedPropertyNames6_ES6.types @@ -3,7 +3,7 @@ var p1: number | string; >p1 : string | number var p2: number | number[]; ->p2 : number | number[] +>p2 : VibratePattern var p3: string | boolean; >p3 : string | boolean @@ -19,7 +19,7 @@ var v = { [p2]: 1, >[p2] : number ->p2 : number | number[] +>p2 : VibratePattern >1 : 1 [p3]: 2 diff --git a/tests/baselines/reference/conditionalTypeDoesntSpinForever.types b/tests/baselines/reference/conditionalTypeDoesntSpinForever.types index e60be08b85d4c..bbf4ae3e2ab34 100644 --- a/tests/baselines/reference/conditionalTypeDoesntSpinForever.types +++ b/tests/baselines/reference/conditionalTypeDoesntSpinForever.types @@ -369,7 +369,7 @@ export enum PubSubRecordIsStoredInRedisAsA { hasField: (fieldName: string | number | symbol) => fieldName is keyof SO_FAR >hasField : (fieldName: string | number | symbol) => fieldName is keyof SO_FAR ->fieldName : string | number | symbol +>fieldName : PropertyKey } : {} @@ -418,9 +418,9 @@ export enum PubSubRecordIsStoredInRedisAsA { hasField: (fieldName: string | number | symbol) => fieldName in soFar >hasField : (fieldName: string | number | symbol) => boolean >(fieldName: string | number | symbol) => fieldName in soFar : (fieldName: string | number | symbol) => boolean ->fieldName : string | number | symbol +>fieldName : PropertyKey >fieldName in soFar : boolean ->fieldName : string | number | symbol +>fieldName : PropertyKey >soFar : SO_FAR } ); @@ -474,8 +474,8 @@ export enum PubSubRecordIsStoredInRedisAsA { >soFar : SO_FAR buildType(soFar) ->buildType(soFar) : { type?: undefined; fields?: undefined; hasField?: undefined; } | { type: SO_FAR; fields: () => Set; hasField: (fieldName: string | number | symbol) => boolean; } ->buildType : (soFar: SO_FAR) => { type?: undefined; fields?: undefined; hasField?: undefined; } | { type: SO_FAR; fields: () => Set; hasField: (fieldName: string | number | symbol) => boolean; } +>buildType(soFar) : { type?: undefined; fields?: undefined; hasField?: undefined; } | { type: SO_FAR; fields: () => Set; hasField: (fieldName: PropertyKey) => boolean; } +>buildType : (soFar: SO_FAR) => { type?: undefined; fields?: undefined; hasField?: undefined; } | { type: SO_FAR; fields: () => Set; hasField: (fieldName: PropertyKey) => boolean; } >soFar : SO_FAR ) as BuildPubSubRecordType; diff --git a/tests/baselines/reference/contextuallyTypedParametersWithInitializers.types b/tests/baselines/reference/contextuallyTypedParametersWithInitializers.types index db65878b320d3..2d7f40b6df0e4 100644 --- a/tests/baselines/reference/contextuallyTypedParametersWithInitializers.types +++ b/tests/baselines/reference/contextuallyTypedParametersWithInitializers.types @@ -335,14 +335,14 @@ const memoizedAdd3 = memoize((x: number, y = 0): number => x + y); declare function execute(script: string | Function): Promise; >execute : (script: string | Function) => Promise ->script : string | Function +>script : TimerHandler export function executeSomething() { >executeSomething : () => Promise return execute((root: HTMLElement, debug = true) => { >execute((root: HTMLElement, debug = true) => { if (debug) { root.innerHTML = ''; } }) : Promise ->execute : (script: string | Function) => Promise +>execute : (script: TimerHandler) => Promise >(root: HTMLElement, debug = true) => { if (debug) { root.innerHTML = ''; } } : (root: HTMLElement, debug?: boolean) => void >root : HTMLElement >debug : boolean diff --git a/tests/baselines/reference/controlFlowPropertyDeclarations.types b/tests/baselines/reference/controlFlowPropertyDeclarations.types index 1cbe996961089..d1b74c8feb7bf 100644 --- a/tests/baselines/reference/controlFlowPropertyDeclarations.types +++ b/tests/baselines/reference/controlFlowPropertyDeclarations.types @@ -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 | number | symbol) => boolean +>this.styles.hasOwnProperty : (v: PropertyKey) => boolean >this.styles : {} >this : this >styles : {} ->hasOwnProperty : (v: string | number | symbol) => boolean +>hasOwnProperty : (v: PropertyKey) => boolean >key : string } } diff --git a/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorTypeAlias.types b/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorTypeAlias.types index 55385050d5666..e1f08d5893836 100644 --- a/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorTypeAlias.types +++ b/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorTypeAlias.types @@ -25,7 +25,7 @@ module M1 { >M1 : typeof M1 export type W = Window | string; ->W : string | Window +>W : W export module N { >N : typeof N @@ -34,7 +34,7 @@ module M1 { >Window : Window export var p: W; // No error ->p : string | globalThis.Window +>p : W } } diff --git a/tests/baselines/reference/decoratorsOnComputedProperties.types b/tests/baselines/reference/decoratorsOnComputedProperties.types index 9ceea659e9a3e..aa1571a516e1d 100644 --- a/tests/baselines/reference/decoratorsOnComputedProperties.types +++ b/tests/baselines/reference/decoratorsOnComputedProperties.types @@ -2,7 +2,7 @@ function x(o: object, k: PropertyKey) { } >x : (o: object, k: PropertyKey) => void >o : object ->k : string | number | symbol +>k : PropertyKey let i = 0; >i : number @@ -31,25 +31,25 @@ class A { >A : A @x ["property"]: any; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >["property"] : any >"property" : "property" @x [Symbol.toStringTag]: any; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >[Symbol.toStringTag] : any >Symbol.toStringTag : symbol >Symbol : SymbolConstructor >toStringTag : symbol @x ["property2"]: any = 2; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >["property2"] : any >"property2" : "property2" >2 : 2 @x [Symbol.iterator]: any = null; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >[Symbol.iterator] : any >Symbol.iterator : symbol >Symbol : SymbolConstructor @@ -84,13 +84,13 @@ class A { >foo : () => string @x [foo()]: any; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >[foo()] : any >foo() : string >foo : () => string @x [foo()]: any = null; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >[foo()] : any >foo() : string >foo : () => string @@ -101,12 +101,12 @@ class A { >fieldNameA : string @x [fieldNameB]: any; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >[fieldNameB] : any >fieldNameB : string @x [fieldNameC]: any = null; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >[fieldNameC] : any >fieldNameC : string >null : null @@ -118,25 +118,25 @@ void class B { >B : typeof B @x ["property"]: any; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >["property"] : any >"property" : "property" @x [Symbol.toStringTag]: any; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >[Symbol.toStringTag] : any >Symbol.toStringTag : symbol >Symbol : SymbolConstructor >toStringTag : symbol @x ["property2"]: any = 2; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >["property2"] : any >"property2" : "property2" >2 : 2 @x [Symbol.iterator]: any = null; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >[Symbol.iterator] : any >Symbol.iterator : symbol >Symbol : SymbolConstructor @@ -171,13 +171,13 @@ void class B { >foo : () => string @x [foo()]: any; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >[foo()] : any >foo() : string >foo : () => string @x [foo()]: any = null; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >[foo()] : any >foo() : string >foo : () => string @@ -188,12 +188,12 @@ void class B { >fieldNameA : string @x [fieldNameB]: any; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >[fieldNameB] : any >fieldNameB : string @x [fieldNameC]: any = null; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >[fieldNameC] : any >fieldNameC : string >null : null @@ -204,25 +204,25 @@ class C { >C : C @x ["property"]: any; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >["property"] : any >"property" : "property" @x [Symbol.toStringTag]: any; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >[Symbol.toStringTag] : any >Symbol.toStringTag : symbol >Symbol : SymbolConstructor >toStringTag : symbol @x ["property2"]: any = 2; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >["property2"] : any >"property2" : "property2" >2 : 2 @x [Symbol.iterator]: any = null; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >[Symbol.iterator] : any >Symbol.iterator : symbol >Symbol : SymbolConstructor @@ -257,13 +257,13 @@ class C { >foo : () => string @x [foo()]: any; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >[foo()] : any >foo() : string >foo : () => string @x [foo()]: any = null; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >[foo()] : any >foo() : string >foo : () => string @@ -274,12 +274,12 @@ class C { >fieldNameA : string @x [fieldNameB]: any; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >[fieldNameB] : any >fieldNameB : string @x [fieldNameC]: any = null; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >[fieldNameC] : any >fieldNameC : string >null : null @@ -297,25 +297,25 @@ void class D { >D : typeof D @x ["property"]: any; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >["property"] : any >"property" : "property" @x [Symbol.toStringTag]: any; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >[Symbol.toStringTag] : any >Symbol.toStringTag : symbol >Symbol : SymbolConstructor >toStringTag : symbol @x ["property2"]: any = 2; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >["property2"] : any >"property2" : "property2" >2 : 2 @x [Symbol.iterator]: any = null; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >[Symbol.iterator] : any >Symbol.iterator : symbol >Symbol : SymbolConstructor @@ -350,13 +350,13 @@ void class D { >foo : () => string @x [foo()]: any; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >[foo()] : any >foo() : string >foo : () => string @x [foo()]: any = null; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >[foo()] : any >foo() : string >foo : () => string @@ -367,12 +367,12 @@ void class D { >fieldNameA : string @x [fieldNameB]: any; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >[fieldNameB] : any >fieldNameB : string @x [fieldNameC]: any = null; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >[fieldNameC] : any >fieldNameC : string >null : null @@ -389,25 +389,25 @@ class E { >E : E @x ["property"]: any; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >["property"] : any >"property" : "property" @x [Symbol.toStringTag]: any; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >[Symbol.toStringTag] : any >Symbol.toStringTag : symbol >Symbol : SymbolConstructor >toStringTag : symbol @x ["property2"]: any = 2; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >["property2"] : any >"property2" : "property2" >2 : 2 @x [Symbol.iterator]: any = null; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >[Symbol.iterator] : any >Symbol.iterator : symbol >Symbol : SymbolConstructor @@ -442,13 +442,13 @@ class E { >foo : () => string @x [foo()]: any; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >[foo()] : any >foo() : string >foo : () => string @x [foo()]: any = null; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >[foo()] : any >foo() : string >foo : () => string @@ -465,12 +465,12 @@ class E { >fieldNameA : string @x [fieldNameB]: any; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >[fieldNameB] : any >fieldNameB : string @x [fieldNameC]: any = null; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >[fieldNameC] : any >fieldNameC : string >null : null @@ -482,25 +482,25 @@ void class F { >F : typeof F @x ["property"]: any; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >["property"] : any >"property" : "property" @x [Symbol.toStringTag]: any; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >[Symbol.toStringTag] : any >Symbol.toStringTag : symbol >Symbol : SymbolConstructor >toStringTag : symbol @x ["property2"]: any = 2; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >["property2"] : any >"property2" : "property2" >2 : 2 @x [Symbol.iterator]: any = null; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >[Symbol.iterator] : any >Symbol.iterator : symbol >Symbol : SymbolConstructor @@ -535,13 +535,13 @@ void class F { >foo : () => string @x [foo()]: any; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >[foo()] : any >foo() : string >foo : () => string @x [foo()]: any = null; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >[foo()] : any >foo() : string >foo : () => string @@ -558,12 +558,12 @@ void class F { >fieldNameA : string @x [fieldNameB]: any; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >[fieldNameB] : any >fieldNameB : string @x [fieldNameC]: any = null; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >[fieldNameC] : any >fieldNameC : string >null : null @@ -574,25 +574,25 @@ class G { >G : G @x ["property"]: any; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >["property"] : any >"property" : "property" @x [Symbol.toStringTag]: any; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >[Symbol.toStringTag] : any >Symbol.toStringTag : symbol >Symbol : SymbolConstructor >toStringTag : symbol @x ["property2"]: any = 2; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >["property2"] : any >"property2" : "property2" >2 : 2 @x [Symbol.iterator]: any = null; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >[Symbol.iterator] : any >Symbol.iterator : symbol >Symbol : SymbolConstructor @@ -627,13 +627,13 @@ class G { >foo : () => string @x [foo()]: any; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >[foo()] : any >foo() : string >foo : () => string @x [foo()]: any = null; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >[foo()] : any >foo() : string >foo : () => string @@ -650,7 +650,7 @@ class G { >fieldNameA : string @x [fieldNameB]: any; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >[fieldNameB] : any >fieldNameB : string @@ -661,7 +661,7 @@ class G { >"method2" : "method2" @x [fieldNameC]: any = null; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >[fieldNameC] : any >fieldNameC : string >null : null @@ -673,25 +673,25 @@ void class H { >H : typeof H @x ["property"]: any; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >["property"] : any >"property" : "property" @x [Symbol.toStringTag]: any; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >[Symbol.toStringTag] : any >Symbol.toStringTag : symbol >Symbol : SymbolConstructor >toStringTag : symbol @x ["property2"]: any = 2; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >["property2"] : any >"property2" : "property2" >2 : 2 @x [Symbol.iterator]: any = null; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >[Symbol.iterator] : any >Symbol.iterator : symbol >Symbol : SymbolConstructor @@ -726,13 +726,13 @@ void class H { >foo : () => string @x [foo()]: any; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >[foo()] : any >foo() : string >foo : () => string @x [foo()]: any = null; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >[foo()] : any >foo() : string >foo : () => string @@ -749,7 +749,7 @@ void class H { >fieldNameA : string @x [fieldNameB]: any; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >[fieldNameB] : any >fieldNameB : string @@ -760,7 +760,7 @@ void class H { >"method2" : "method2" @x [fieldNameC]: any = null; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >[fieldNameC] : any >fieldNameC : string >null : null @@ -771,25 +771,25 @@ class I { >I : I @x ["property"]: any; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >["property"] : any >"property" : "property" @x [Symbol.toStringTag]: any; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >[Symbol.toStringTag] : any >Symbol.toStringTag : symbol >Symbol : SymbolConstructor >toStringTag : symbol @x ["property2"]: any = 2; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >["property2"] : any >"property2" : "property2" >2 : 2 @x [Symbol.iterator]: any = null; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >[Symbol.iterator] : any >Symbol.iterator : symbol >Symbol : SymbolConstructor @@ -824,20 +824,20 @@ class I { >foo : () => string @x [foo()]: any; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >[foo()] : any >foo() : string >foo : () => string @x [foo()]: any = null; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >[foo()] : any >foo() : string >foo : () => string >null : null @x ["some" + "method"]() {} ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >["some" + "method"] : () => void >"some" + "method" : string >"some" : "some" @@ -848,7 +848,7 @@ class I { >fieldNameA : string @x [fieldNameB]: any; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >[fieldNameB] : any >fieldNameB : string @@ -859,7 +859,7 @@ class I { >"method2" : "method2" @x [fieldNameC]: any = null; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >[fieldNameC] : any >fieldNameC : string >null : null @@ -871,25 +871,25 @@ void class J { >J : typeof J @x ["property"]: any; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >["property"] : any >"property" : "property" @x [Symbol.toStringTag]: any; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >[Symbol.toStringTag] : any >Symbol.toStringTag : symbol >Symbol : SymbolConstructor >toStringTag : symbol @x ["property2"]: any = 2; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >["property2"] : any >"property2" : "property2" >2 : 2 @x [Symbol.iterator]: any = null; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >[Symbol.iterator] : any >Symbol.iterator : symbol >Symbol : SymbolConstructor @@ -924,20 +924,20 @@ void class J { >foo : () => string @x [foo()]: any; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >[foo()] : any >foo() : string >foo : () => string @x [foo()]: any = null; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >[foo()] : any >foo() : string >foo : () => string >null : null @x ["some" + "method"]() {} ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >["some" + "method"] : () => void >"some" + "method" : string >"some" : "some" @@ -948,7 +948,7 @@ void class J { >fieldNameA : string @x [fieldNameB]: any; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >[fieldNameB] : any >fieldNameB : string @@ -959,7 +959,7 @@ void class J { >"method2" : "method2" @x [fieldNameC]: any = null; ->x : (o: object, k: string | number | symbol) => void +>x : (o: object, k: PropertyKey) => void >[fieldNameC] : any >fieldNameC : string >null : null diff --git a/tests/baselines/reference/discriminantPropertyCheck.types b/tests/baselines/reference/discriminantPropertyCheck.types index da884470e6f14..ad071abc1e298 100644 --- a/tests/baselines/reference/discriminantPropertyCheck.types +++ b/tests/baselines/reference/discriminantPropertyCheck.types @@ -464,18 +464,18 @@ type TypeBar2 = { type: BarEnum.bar2 }; function func3(value: Partial) { >func3 : (value: Partial) => void ->value : Partial | Partial +>value : Partial if (value.type !== undefined) { >value.type !== undefined : boolean >value.type : BarEnum | undefined ->value : Partial | Partial +>value : Partial >type : BarEnum | undefined >undefined : undefined switch (value.type) { >value.type : BarEnum ->value : Partial | Partial +>value : Partial >type : BarEnum case BarEnum.bar1: @@ -495,7 +495,7 @@ function func3(value: Partial) { >never(value.type) : never >never : (value: never) => never >value.type : never ->value : Partial | Partial +>value : Partial >type : never } } diff --git a/tests/baselines/reference/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.types b/tests/baselines/reference/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.types index cb026f00735df..f9bd4704f288c 100644 --- a/tests/baselines/reference/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.types +++ b/tests/baselines/reference/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.types @@ -14,9 +14,9 @@ module.exports = 12; Object.defineProperty(module, "exports", { value: "oh no" }); >Object.defineProperty(module, "exports", { value: "oh no" }) : any ->Object.defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>Object.defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Object : ObjectConstructor ->defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >module : typeof module >"exports" : "exports" >{ value: "oh no" } : { value: string; } @@ -59,9 +59,9 @@ B.NS = require("./namespacey"); Object.defineProperty(B, "NS", { value: "why though", writable: true }); >Object.defineProperty(B, "NS", { value: "why though", writable: true }) : any ->Object.defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>Object.defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Object : ObjectConstructor ->defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >B : typeof B >"NS" : "NS" >{ value: "why though", writable: true } : { value: string; writable: true; } diff --git a/tests/baselines/reference/excessPropertyCheckWithEmptyObject.types b/tests/baselines/reference/excessPropertyCheckWithEmptyObject.types index 9f3535423d90a..3893ea1999e27 100644 --- a/tests/baselines/reference/excessPropertyCheckWithEmptyObject.types +++ b/tests/baselines/reference/excessPropertyCheckWithEmptyObject.types @@ -4,9 +4,9 @@ // Excess property error expected here Object.defineProperty(window, "prop", { value: "v1.0.0", readonly: false }); >Object.defineProperty(window, "prop", { value: "v1.0.0", readonly: false }) : any ->Object.defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>Object.defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Object : ObjectConstructor ->defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >window : Window & typeof globalThis >"prop" : "prop" >{ value: "v1.0.0", readonly: false } : { value: string; readonly: boolean; } diff --git a/tests/baselines/reference/fixSignatureCaching.types b/tests/baselines/reference/fixSignatureCaching.types index 8765e8fc310f4..61731306df57f 100644 --- a/tests/baselines/reference/fixSignatureCaching.types +++ b/tests/baselines/reference/fixSignatureCaching.types @@ -1068,12 +1068,12 @@ define(function () { }; var hasOwnProp = Object.prototype.hasOwnProperty, ->hasOwnProp : (v: string | number | symbol) => boolean ->Object.prototype.hasOwnProperty : (v: string | number | symbol) => boolean +>hasOwnProp : (v: PropertyKey) => boolean +>Object.prototype.hasOwnProperty : (v: PropertyKey) => boolean >Object.prototype : Object >Object : ObjectConstructor >prototype : Object ->hasOwnProperty : (v: string | number | symbol) => boolean +>hasOwnProperty : (v: PropertyKey) => boolean isArray; >isArray : any @@ -1249,7 +1249,7 @@ define(function () { if (hasOwnProp.call(object, key)) { >hasOwnProp.call(object, key) : any >hasOwnProp.call : (this: Function, thisArg: any, ...argArray: any[]) => any ->hasOwnProp : (v: string | number | symbol) => boolean +>hasOwnProp : (v: PropertyKey) => boolean >call : (this: Function, thisArg: any, ...argArray: any[]) => any >object : any >key : string @@ -1296,7 +1296,7 @@ define(function () { if (hasOwnProp.call(mobileDetectRules.props, key)) { >hasOwnProp.call(mobileDetectRules.props, key) : any >hasOwnProp.call : (this: Function, thisArg: any, ...argArray: any[]) => any ->hasOwnProp : (v: string | number | symbol) => boolean +>hasOwnProp : (v: PropertyKey) => boolean >call : (this: Function, thisArg: any, ...argArray: any[]) => any >mobileDetectRules.props : any >mobileDetectRules : any @@ -1487,7 +1487,7 @@ define(function () { if (hasOwnProp.call(rules, key)) { >hasOwnProp.call(rules, key) : any >hasOwnProp.call : (this: Function, thisArg: any, ...argArray: any[]) => any ->hasOwnProp : (v: string | number | symbol) => boolean +>hasOwnProp : (v: PropertyKey) => boolean >call : (this: Function, thisArg: any, ...argArray: any[]) => any >rules : any >key : string @@ -1538,7 +1538,7 @@ define(function () { if (hasOwnProp.call(rules, key)) { >hasOwnProp.call(rules, key) : any >hasOwnProp.call : (this: Function, thisArg: any, ...argArray: any[]) => any ->hasOwnProp : (v: string | number | symbol) => boolean +>hasOwnProp : (v: PropertyKey) => boolean >call : (this: Function, thisArg: any, ...argArray: any[]) => any >rules : any >key : string @@ -1598,7 +1598,7 @@ define(function () { if (hasOwnProp.call(props, propertyName)) { >hasOwnProp.call(props, propertyName) : any >hasOwnProp.call : (this: Function, thisArg: any, ...argArray: any[]) => any ->hasOwnProp : (v: string | number | symbol) => boolean +>hasOwnProp : (v: PropertyKey) => boolean >call : (this: Function, thisArg: any, ...argArray: any[]) => any >props : any >propertyName : any diff --git a/tests/baselines/reference/getterSetterNonAccessor.types b/tests/baselines/reference/getterSetterNonAccessor.types index 67d186b21e8cb..1d9484f9bc9a6 100644 --- a/tests/baselines/reference/getterSetterNonAccessor.types +++ b/tests/baselines/reference/getterSetterNonAccessor.types @@ -9,9 +9,9 @@ function setFunc(v){} Object.defineProperty({}, "0", ({ >Object.defineProperty({}, "0", ({ get: getFunc, set: setFunc, configurable: true })) : any ->Object.defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>Object.defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Object : ObjectConstructor ->defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >{} : {} >"0" : "0" >({ get: getFunc, set: setFunc, configurable: true }) : PropertyDescriptor diff --git a/tests/baselines/reference/importAliasModuleExports.types b/tests/baselines/reference/importAliasModuleExports.types index 1a850c7c6f02d..eff243dee47db 100644 --- a/tests/baselines/reference/importAliasModuleExports.types +++ b/tests/baselines/reference/importAliasModuleExports.types @@ -42,9 +42,9 @@ A.prototype.func = function() { this._func = 0; } Object.defineProperty(A.prototype, "def", { value: 0 }); >Object.defineProperty(A.prototype, "def", { value: 0 }) : any ->Object.defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>Object.defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Object : ObjectConstructor ->defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >A.prototype : A >A : typeof A >prototype : A diff --git a/tests/baselines/reference/inOperatorWithValidOperands.types b/tests/baselines/reference/inOperatorWithValidOperands.types index ed99262f8b08c..714836e2764a1 100644 --- a/tests/baselines/reference/inOperatorWithValidOperands.types +++ b/tests/baselines/reference/inOperatorWithValidOperands.types @@ -11,7 +11,7 @@ var a2: number; >a2 : number var a3: string | number | symbol; ->a3 : string | number | symbol +>a3 : PropertyKey var a4: any; >a4 : any @@ -49,7 +49,7 @@ var ra5 = 0 in x; var ra6 = a3 in x; >ra6 : boolean >a3 in x : boolean ->a3 : string | number | symbol +>a3 : PropertyKey >x : any var ra7 = a4 in x; diff --git a/tests/baselines/reference/indexingTypesWithNever.types b/tests/baselines/reference/indexingTypesWithNever.types index de66f51bdc825..3340eb023f9fd 100644 --- a/tests/baselines/reference/indexingTypesWithNever.types +++ b/tests/baselines/reference/indexingTypesWithNever.types @@ -270,7 +270,7 @@ type Example> = T['a']; >Example : Example type Res1 = Example<{ a: "x" } | { a: "y" }>; // "x" | "y" ->Res1 : "x" | "y" +>Res1 : Example<{ a: "x"; } | { a: "y"; }> >a : "x" >a : "y" diff --git a/tests/baselines/reference/inferFromGenericFunctionReturnTypes3.types b/tests/baselines/reference/inferFromGenericFunctionReturnTypes3.types index deb0288d52567..e8dc00b7be391 100644 --- a/tests/baselines/reference/inferFromGenericFunctionReturnTypes3.types +++ b/tests/baselines/reference/inferFromGenericFunctionReturnTypes3.types @@ -312,10 +312,10 @@ let zz: Box = box({ type: 'draw' }); >'draw' : "draw" type WinType = 'win' | 'draw'; ->WinType : "win" | "draw" +>WinType : WinType let yy: Box = box('draw'); ->yy : Box<"win" | "draw"> +>yy : Box >box('draw') : Box<"draw"> >box : (value: T) => Box >'draw' : "draw" diff --git a/tests/baselines/reference/inferTypes1.types b/tests/baselines/reference/inferTypes1.types index aa421dd4c4d76..936b5c4ae28f5 100644 --- a/tests/baselines/reference/inferTypes1.types +++ b/tests/baselines/reference/inferTypes1.types @@ -434,7 +434,7 @@ type Test2 = EnsureIsString<42>; // never // Repros from #26856 function invoker (key: K, ...args: A) { ->invoker : (key: K, ...args: A) => any>>(obj: T) => ReturnType +>invoker : (key: K, ...args: A) => any>>(obj: T) => ReturnType >key : K >args : A @@ -454,7 +454,7 @@ const result = invoker('test', true)({ test: (a: boolean) => 123 }) >result : number >invoker('test', true)({ test: (a: boolean) => 123 }) : number >invoker('test', true) : any>>(obj: T) => ReturnType ->invoker : (key: K, ...args: A) => any>>(obj: T) => ReturnType +>invoker : (key: K, ...args: A) => any>>(obj: T) => ReturnType >'test' : "test" >true : true >{ test: (a: boolean) => 123 } : { test: (a: boolean) => number; } diff --git a/tests/baselines/reference/inferrenceInfiniteLoopWithSubtyping.types b/tests/baselines/reference/inferrenceInfiniteLoopWithSubtyping.types index 6a46d7350a52f..fb5570bbe9f2d 100644 --- a/tests/baselines/reference/inferrenceInfiniteLoopWithSubtyping.types +++ b/tests/baselines/reference/inferrenceInfiniteLoopWithSubtyping.types @@ -7,7 +7,7 @@ export type Thunk = (() => T) | T; >Thunk : Thunk export type ComposeOutputTypeDefinition = Readonly | EnumTypeComposer>; ->ComposeOutputTypeDefinition : Readonly> | Readonly +>ComposeOutputTypeDefinition : Readonly | EnumTypeComposer> export class EnumTypeComposer { >EnumTypeComposer : EnumTypeComposer @@ -29,7 +29,7 @@ export class ObjectTypeComposer { public addResolver(opts: { type?: Thunk }): this; >addResolver : (opts: { type?: Thunk;}) => this >opts : { type?: Thunk; } ->type : Thunk> | Readonly> +>type : Thunk | EnumTypeComposer>> } export class Resolver { @@ -61,9 +61,9 @@ declare const User: ObjectTypeComposer; User.addResolver({ >User.addResolver({ type: User, // `User as any` fix the problem}) : ObjectTypeComposer ->User.addResolver : (opts: { type?: import("tests/cases/compiler/graphql-compose").Thunk> | Readonly>; }) => ObjectTypeComposer +>User.addResolver : (opts: { type?: import("tests/cases/compiler/graphql-compose").Thunk | import("tests/cases/compiler/graphql-compose").EnumTypeComposer>>; }) => ObjectTypeComposer >User : ObjectTypeComposer ->addResolver : (opts: { type?: import("tests/cases/compiler/graphql-compose").Thunk> | Readonly>; }) => ObjectTypeComposer +>addResolver : (opts: { type?: import("tests/cases/compiler/graphql-compose").Thunk | import("tests/cases/compiler/graphql-compose").EnumTypeComposer>>; }) => ObjectTypeComposer >{ type: User, // `User as any` fix the problem} : { type: ObjectTypeComposer; } type: User, // `User as any` fix the problem diff --git a/tests/baselines/reference/intersectionReduction.types b/tests/baselines/reference/intersectionReduction.types index c1ae0685836b6..c44dccba4206f 100644 --- a/tests/baselines/reference/intersectionReduction.types +++ b/tests/baselines/reference/intersectionReduction.types @@ -31,10 +31,10 @@ type T7 = string & 'a' & number & 10 & symbol & typeof sym1; // never >sym1 : unique symbol type T10 = string & ('a' | 'b'); // 'a' | 'b' ->T10 : "a" | "b" +>T10 : T10 type T11 = (string | number) & ('a' | 10); // 'a' | 10 ->T11 : "a" | 10 +>T11 : T11 type N1 = 'a' & 'b'; >N1 : never @@ -140,10 +140,10 @@ type U5 = A | B & C; // A >U5 : A type K1 = keyof (A & B); // string | number | symbol ->K1 : string | number | symbol +>K1 : PropertyKey type K2 = keyof A | keyof B; // 'kind' | 'foo' ->K2 : "kind" | "foo" +>K2 : K2 type Merge1 = { [P in keyof (T & U)]: P extends keyof T ? T[P] : U[P & keyof U] } >Merge1 : Merge1 @@ -224,13 +224,13 @@ const x2 = { a: 'foo', b: true }; >true : true declare let k: 'a' | 'b'; ->k : "a" | "b" +>k : T10 x1[k] = 'bar' as any; // Error >x1[k] = 'bar' as any : any >x1[k] : never >x1 : { a: string; b: number; } ->k : "a" | "b" +>k : T10 >'bar' as any : any >'bar' : "bar" @@ -238,7 +238,7 @@ x2[k] = 'bar' as any; // Error >x2[k] = 'bar' as any : any >x2[k] : never >x2 : { a: string; b: boolean; } ->k : "a" | "b" +>k : T10 >'bar' as any : any >'bar' : "bar" @@ -353,7 +353,7 @@ function inGeneric(alsoShouldBeB: T & B2) { interface ABI { kind: 'a' | 'b'; ->kind : "a" | "b" +>kind : T10 } declare class CA { kind: 'a'; a: string; x: number }; diff --git a/tests/baselines/reference/intersectionReductionStrict.types b/tests/baselines/reference/intersectionReductionStrict.types index 4c7b5b0b4c378..ca283e03ec06e 100644 --- a/tests/baselines/reference/intersectionReductionStrict.types +++ b/tests/baselines/reference/intersectionReductionStrict.types @@ -31,10 +31,10 @@ type T7 = string & 'a' & number & 10 & symbol & typeof sym1; // never >sym1 : unique symbol type T10 = string & ('a' | 'b'); // 'a' | 'b' ->T10 : "a" | "b" +>T10 : T10 type T11 = (string | number) & ('a' | 10); // 'a' | 10 ->T11 : "a" | 10 +>T11 : T11 type N1 = 'a' & 'b'; >N1 : never @@ -140,10 +140,10 @@ type U5 = A | B & C; // A >U5 : A type K1 = keyof (A & B); // string | number | symbol ->K1 : string | number | symbol +>K1 : PropertyKey type K2 = keyof A | keyof B; // 'kind' | 'foo' ->K2 : "kind" | "foo" +>K2 : K2 type Merge1 = { [P in keyof (T & U)]: P extends keyof T ? T[P] : U[P & keyof U] } >Merge1 : Merge1 @@ -191,13 +191,13 @@ const x2 = { a: 'foo', b: true }; >true : true declare let k: 'a' | 'b'; ->k : "a" | "b" +>k : T10 x1[k] = 'bar' as any; // Error >x1[k] = 'bar' as any : any >x1[k] : never >x1 : { a: string; b: number; } ->k : "a" | "b" +>k : T10 >'bar' as any : any >'bar' : "bar" @@ -205,7 +205,7 @@ x2[k] = 'bar' as any; // Error >x2[k] = 'bar' as any : any >x2[k] : never >x2 : { a: string; b: boolean; } ->k : "a" | "b" +>k : T10 >'bar' as any : any >'bar' : "bar" diff --git a/tests/baselines/reference/intersectionWithUnionConstraint.types b/tests/baselines/reference/intersectionWithUnionConstraint.types index b209913e75bda..43c9edfc333d5 100644 --- a/tests/baselines/reference/intersectionWithUnionConstraint.types +++ b/tests/baselines/reference/intersectionWithUnionConstraint.types @@ -24,7 +24,7 @@ function f2x : T & U let y3: string | undefined = x; ->y3 : string | undefined +>y3 : T1 >x : T & U let y4: number | null = x; // Error @@ -43,7 +43,7 @@ function f2T1 : string | undefined +>T1 : T1 >null : null function f3(x: T & (number | object | undefined)) { @@ -69,7 +69,7 @@ function f5(x: keyof T & U) { >x : keyof T & U let y: keyof any = x; ->y : string | number | symbol +>y : PropertyKey >x : keyof T & U } diff --git a/tests/baselines/reference/intersectionsAndEmptyObjects.types b/tests/baselines/reference/intersectionsAndEmptyObjects.types index 423882a14f388..069d739bf360e 100644 --- a/tests/baselines/reference/intersectionsAndEmptyObjects.types +++ b/tests/baselines/reference/intersectionsAndEmptyObjects.types @@ -189,10 +189,10 @@ type IUnknownChoiceList = {}; >IUnknownChoiceList : IUnknownChoiceList var defaultChoices: choices<{}>; ->defaultChoices : { shoes: boolean; food: boolean; } +>defaultChoices : choices<{}> var defaultChoicesAndEmpty: choices<{} & {}>; ->defaultChoicesAndEmpty : { shoes: boolean; food: boolean; } +>defaultChoicesAndEmpty : choices<{}> var myChoices: choices; >myChoices : choices @@ -201,10 +201,10 @@ var myChoicesAndEmpty: choices; >myChoicesAndEmpty : choices var unknownChoices: choices; ->unknownChoices : { shoes: boolean; food: boolean; } +>unknownChoices : choices<{}> var unknownChoicesAndEmpty: choices; ->unknownChoicesAndEmpty : { shoes: boolean; food: boolean; } +>unknownChoicesAndEmpty : choices<{}> // Repro from #38672 diff --git a/tests/baselines/reference/isArray.types b/tests/baselines/reference/isArray.types index 2e70eca8fb188..7730702a08720 100644 --- a/tests/baselines/reference/isArray.types +++ b/tests/baselines/reference/isArray.types @@ -1,6 +1,6 @@ === tests/cases/compiler/isArray.ts === var maybeArray: number | number[]; ->maybeArray : number | number[] +>maybeArray : VibratePattern if (Array.isArray(maybeArray)) { @@ -8,7 +8,7 @@ if (Array.isArray(maybeArray)) { >Array.isArray : (arg: {} | T) => arg is T extends readonly any[] ? unknown extends T ? never : readonly any[] : any[] >Array : ArrayConstructor >isArray : (arg: {} | T) => arg is T extends readonly any[] ? unknown extends T ? never : readonly any[] : any[] ->maybeArray : number | number[] +>maybeArray : VibratePattern maybeArray.length; // OK >maybeArray.length : number diff --git a/tests/baselines/reference/javascriptDefinePropertyPrototypeNonConstructor.types b/tests/baselines/reference/javascriptDefinePropertyPrototypeNonConstructor.types index 9c873b65d0897..b08c924117a3b 100644 --- a/tests/baselines/reference/javascriptDefinePropertyPrototypeNonConstructor.types +++ b/tests/baselines/reference/javascriptDefinePropertyPrototypeNonConstructor.types @@ -5,9 +5,9 @@ function Graphic() { Object.defineProperty(Graphic.prototype, "instance", { >Object.defineProperty(Graphic.prototype, "instance", { get: function() { return this; }}) : any ->Object.defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>Object.defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Object : ObjectConstructor ->defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Graphic.prototype : any >Graphic : typeof Graphic >prototype : any diff --git a/tests/baselines/reference/jsCheckObjectDefineThisNoCrash.types b/tests/baselines/reference/jsCheckObjectDefineThisNoCrash.types index 5b771cb514228..626a1aec6216b 100644 --- a/tests/baselines/reference/jsCheckObjectDefineThisNoCrash.types +++ b/tests/baselines/reference/jsCheckObjectDefineThisNoCrash.types @@ -6,9 +6,9 @@ class C { // Neither of the following should be recognized as declarations yet Object.defineProperty(this, "_prop", { value: {} }); >Object.defineProperty(this, "_prop", { value: {} }) : any ->Object.defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>Object.defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Object : ObjectConstructor ->defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >this : this >"_prop" : "_prop" >{ value: {} } : { value: {}; } @@ -17,9 +17,9 @@ class C { Object.defineProperty(this._prop, "num", { value: 12 }); >Object.defineProperty(this._prop, "num", { value: 12 }) : any ->Object.defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>Object.defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Object : ObjectConstructor ->defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >this._prop : any >this : this >_prop : any diff --git a/tests/baselines/reference/jsDeclarationsExportDefinePropertyEmit.types b/tests/baselines/reference/jsDeclarationsExportDefinePropertyEmit.types index 310e11820ed6f..9328ad0feec6e 100644 --- a/tests/baselines/reference/jsDeclarationsExportDefinePropertyEmit.types +++ b/tests/baselines/reference/jsDeclarationsExportDefinePropertyEmit.types @@ -1,9 +1,9 @@ === tests/cases/conformance/jsdoc/declarations/index.js === Object.defineProperty(module.exports, "a", { value: function a() {} }); >Object.defineProperty(module.exports, "a", { value: function a() {} }) : any ->Object.defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>Object.defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Object : ObjectConstructor ->defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >module.exports : typeof import("tests/cases/conformance/jsdoc/declarations/index") >module : { "\"tests/cases/conformance/jsdoc/declarations/index\"": typeof import("tests/cases/conformance/jsdoc/declarations/index"); } >exports : typeof import("tests/cases/conformance/jsdoc/declarations/index") @@ -15,9 +15,9 @@ Object.defineProperty(module.exports, "a", { value: function a() {} }); Object.defineProperty(module.exports, "b", { value: function b() {} }); >Object.defineProperty(module.exports, "b", { value: function b() {} }) : any ->Object.defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>Object.defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Object : ObjectConstructor ->defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >module.exports : typeof import("tests/cases/conformance/jsdoc/declarations/index") >module : { "\"tests/cases/conformance/jsdoc/declarations/index\"": typeof import("tests/cases/conformance/jsdoc/declarations/index"); } >exports : typeof import("tests/cases/conformance/jsdoc/declarations/index") @@ -29,9 +29,9 @@ Object.defineProperty(module.exports, "b", { value: function b() {} }); Object.defineProperty(module.exports.b, "cat", { value: "cat" }); >Object.defineProperty(module.exports.b, "cat", { value: "cat" }) : any ->Object.defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>Object.defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Object : ObjectConstructor ->defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >module.exports.b : () => void >module.exports : typeof import("tests/cases/conformance/jsdoc/declarations/index") >module : { "\"tests/cases/conformance/jsdoc/declarations/index\"": typeof import("tests/cases/conformance/jsdoc/declarations/index"); } @@ -56,9 +56,9 @@ function d(a, b) { return /** @type {*} */(null); } Object.defineProperty(module.exports, "d", { value: d }); >Object.defineProperty(module.exports, "d", { value: d }) : any ->Object.defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>Object.defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Object : ObjectConstructor ->defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >module.exports : typeof import("tests/cases/conformance/jsdoc/declarations/index") >module : { "\"tests/cases/conformance/jsdoc/declarations/index\"": typeof import("tests/cases/conformance/jsdoc/declarations/index"); } >exports : typeof import("tests/cases/conformance/jsdoc/declarations/index") @@ -83,9 +83,9 @@ function e(a, b) { return /** @type {*} */(null); } Object.defineProperty(module.exports, "e", { value: e }); >Object.defineProperty(module.exports, "e", { value: e }) : any ->Object.defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>Object.defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Object : ObjectConstructor ->defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >module.exports : typeof import("tests/cases/conformance/jsdoc/declarations/index") >module : { "\"tests/cases/conformance/jsdoc/declarations/index\"": typeof import("tests/cases/conformance/jsdoc/declarations/index"); } >exports : typeof import("tests/cases/conformance/jsdoc/declarations/index") @@ -107,9 +107,9 @@ function f(a) { } Object.defineProperty(module.exports, "f", { value: f }); >Object.defineProperty(module.exports, "f", { value: f }) : any ->Object.defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>Object.defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Object : ObjectConstructor ->defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >module.exports : typeof import("tests/cases/conformance/jsdoc/declarations/index") >module : { "\"tests/cases/conformance/jsdoc/declarations/index\"": typeof import("tests/cases/conformance/jsdoc/declarations/index"); } >exports : typeof import("tests/cases/conformance/jsdoc/declarations/index") @@ -120,9 +120,9 @@ Object.defineProperty(module.exports, "f", { value: f }); Object.defineProperty(module.exports.f, "self", { value: module.exports.f }); >Object.defineProperty(module.exports.f, "self", { value: module.exports.f }) : any ->Object.defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>Object.defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Object : ObjectConstructor ->defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >module.exports.f : (a: T) => T >module.exports : typeof import("tests/cases/conformance/jsdoc/declarations/index") >module : { "\"tests/cases/conformance/jsdoc/declarations/index\"": typeof import("tests/cases/conformance/jsdoc/declarations/index"); } @@ -158,9 +158,9 @@ function g(a, b) { } Object.defineProperty(module.exports, "g", { value: g }); >Object.defineProperty(module.exports, "g", { value: g }) : any ->Object.defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>Object.defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Object : ObjectConstructor ->defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >module.exports : typeof import("tests/cases/conformance/jsdoc/declarations/index") >module : { "\"tests/cases/conformance/jsdoc/declarations/index\"": typeof import("tests/cases/conformance/jsdoc/declarations/index"); } >exports : typeof import("tests/cases/conformance/jsdoc/declarations/index") @@ -191,9 +191,9 @@ function hh(a, b) { } Object.defineProperty(module.exports, "h", { value: hh }); >Object.defineProperty(module.exports, "h", { value: hh }) : any ->Object.defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>Object.defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Object : ObjectConstructor ->defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >module.exports : typeof import("tests/cases/conformance/jsdoc/declarations/index") >module : { "\"tests/cases/conformance/jsdoc/declarations/index\"": typeof import("tests/cases/conformance/jsdoc/declarations/index"); } >exports : typeof import("tests/cases/conformance/jsdoc/declarations/index") @@ -204,9 +204,9 @@ Object.defineProperty(module.exports, "h", { value: hh }); Object.defineProperty(module.exports, "i", { value: function i(){} }); >Object.defineProperty(module.exports, "i", { value: function i(){} }) : any ->Object.defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>Object.defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Object : ObjectConstructor ->defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >module.exports : typeof import("tests/cases/conformance/jsdoc/declarations/index") >module : { "\"tests/cases/conformance/jsdoc/declarations/index\"": typeof import("tests/cases/conformance/jsdoc/declarations/index"); } >exports : typeof import("tests/cases/conformance/jsdoc/declarations/index") @@ -218,9 +218,9 @@ Object.defineProperty(module.exports, "i", { value: function i(){} }); Object.defineProperty(module.exports, "ii", { value: module.exports.i }); >Object.defineProperty(module.exports, "ii", { value: module.exports.i }) : any ->Object.defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>Object.defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Object : ObjectConstructor ->defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >module.exports : typeof import("tests/cases/conformance/jsdoc/declarations/index") >module : { "\"tests/cases/conformance/jsdoc/declarations/index\"": typeof import("tests/cases/conformance/jsdoc/declarations/index"); } >exports : typeof import("tests/cases/conformance/jsdoc/declarations/index") @@ -236,9 +236,9 @@ Object.defineProperty(module.exports, "ii", { value: module.exports.i }); // note that this last one doesn't make much sense in cjs, since exports aren't hoisted bindings Object.defineProperty(module.exports, "jj", { value: module.exports.j }); >Object.defineProperty(module.exports, "jj", { value: module.exports.j }) : any ->Object.defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>Object.defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Object : ObjectConstructor ->defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >module.exports : typeof import("tests/cases/conformance/jsdoc/declarations/index") >module : { "\"tests/cases/conformance/jsdoc/declarations/index\"": typeof import("tests/cases/conformance/jsdoc/declarations/index"); } >exports : typeof import("tests/cases/conformance/jsdoc/declarations/index") @@ -253,9 +253,9 @@ Object.defineProperty(module.exports, "jj", { value: module.exports.j }); Object.defineProperty(module.exports, "j", { value: function j() {} }); >Object.defineProperty(module.exports, "j", { value: function j() {} }) : any ->Object.defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>Object.defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Object : ObjectConstructor ->defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >module.exports : typeof import("tests/cases/conformance/jsdoc/declarations/index") >module : { "\"tests/cases/conformance/jsdoc/declarations/index\"": typeof import("tests/cases/conformance/jsdoc/declarations/index"); } >exports : typeof import("tests/cases/conformance/jsdoc/declarations/index") diff --git a/tests/baselines/reference/jsDeclarationsGetterSetter.types b/tests/baselines/reference/jsDeclarationsGetterSetter.types index c426e822b125c..42c3e08e13611 100644 --- a/tests/baselines/reference/jsDeclarationsGetterSetter.types +++ b/tests/baselines/reference/jsDeclarationsGetterSetter.types @@ -42,9 +42,9 @@ export class D {} Object.defineProperty(D.prototype, "x", { >Object.defineProperty(D.prototype, "x", { get() { return 12; }}) : any ->Object.defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>Object.defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Object : ObjectConstructor ->defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >D.prototype : D >D : typeof D >prototype : D @@ -64,9 +64,9 @@ export class E {} Object.defineProperty(E.prototype, "x", { >Object.defineProperty(E.prototype, "x", { /** * @param {number} _arg */ set(_arg) {}}) : any ->Object.defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>Object.defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Object : ObjectConstructor ->defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >E.prototype : E >E : typeof E >prototype : E @@ -87,9 +87,9 @@ export class F {} Object.defineProperty(F.prototype, "x", { >Object.defineProperty(F.prototype, "x", { get() { return 12; }, /** * @param {number} _arg */ set(_arg) {}}) : any ->Object.defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>Object.defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Object : ObjectConstructor ->defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >F.prototype : F >F : typeof F >prototype : F diff --git a/tests/baselines/reference/jsExpandoObjectDefineProperty.types b/tests/baselines/reference/jsExpandoObjectDefineProperty.types index 3eb9a456220b8..4192b27425e4d 100644 --- a/tests/baselines/reference/jsExpandoObjectDefineProperty.types +++ b/tests/baselines/reference/jsExpandoObjectDefineProperty.types @@ -5,9 +5,9 @@ var chrome = {} Object.defineProperty(chrome, 'devtools', { value: {}, enumerable: true }) >Object.defineProperty(chrome, 'devtools', { value: {}, enumerable: true }) : any ->Object.defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>Object.defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Object : ObjectConstructor ->defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >chrome : typeof chrome >'devtools' : "devtools" >{ value: {}, enumerable: true } : { value: {}; enumerable: true; } diff --git a/tests/baselines/reference/jsFileESModuleWithEnumTag.types b/tests/baselines/reference/jsFileESModuleWithEnumTag.types index c3165a75f2ffc..bc66add7f507b 100644 --- a/tests/baselines/reference/jsFileESModuleWithEnumTag.types +++ b/tests/baselines/reference/jsFileESModuleWithEnumTag.types @@ -34,9 +34,9 @@ ChangeDetectionStrategy[ChangeDetectionStrategy.Default] = 'Default'; Object.defineProperty(ChangeDetectionStrategy, "aField", {value: 42}); >Object.defineProperty(ChangeDetectionStrategy, "aField", {value: 42}) : any ->Object.defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>Object.defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Object : ObjectConstructor ->defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >ChangeDetectionStrategy : { OnPush: number; Default: number; } >"aField" : "aField" >{value: 42} : { value: number; } diff --git a/tests/baselines/reference/jsxIntrinsicElementsTypeArgumentErrors.errors.txt b/tests/baselines/reference/jsxIntrinsicElementsTypeArgumentErrors.errors.txt index 538dfcd50449a..ae7f58d7c51b9 100644 --- a/tests/baselines/reference/jsxIntrinsicElementsTypeArgumentErrors.errors.txt +++ b/tests/baselines/reference/jsxIntrinsicElementsTypeArgumentErrors.errors.txt @@ -7,7 +7,7 @@ tests/cases/compiler/jsxIntrinsicElementsTypeArgumentErrors.tsx(11,16): error TS tests/cases/compiler/jsxIntrinsicElementsTypeArgumentErrors.tsx(11,16): error TS2558: Expected 0 type arguments, but got 1. tests/cases/compiler/jsxIntrinsicElementsTypeArgumentErrors.tsx(11,24): error TS2304: Cannot find name 'AlsoMissing'. tests/cases/compiler/jsxIntrinsicElementsTypeArgumentErrors.tsx(13,16): error TS2558: Expected 0 type arguments, but got 1. -tests/cases/compiler/jsxIntrinsicElementsTypeArgumentErrors.tsx(13,23): error TS2344: Type 'object' does not satisfy the constraint 'string | number | symbol'. +tests/cases/compiler/jsxIntrinsicElementsTypeArgumentErrors.tsx(13,23): error TS2344: Type 'object' does not satisfy the constraint 'PropertyKey'. Type 'object' is not assignable to type 'symbol'. tests/cases/compiler/jsxIntrinsicElementsTypeArgumentErrors.tsx(15,16): error TS2558: Expected 0 type arguments, but got 1. tests/cases/compiler/jsxIntrinsicElementsTypeArgumentErrors.tsx(18,15): error TS1099: Type argument list cannot be empty. @@ -19,7 +19,7 @@ tests/cases/compiler/jsxIntrinsicElementsTypeArgumentErrors.tsx(24,16): error TS tests/cases/compiler/jsxIntrinsicElementsTypeArgumentErrors.tsx(24,16): error TS2558: Expected 0 type arguments, but got 1. tests/cases/compiler/jsxIntrinsicElementsTypeArgumentErrors.tsx(24,24): error TS2304: Cannot find name 'AlsoMissing'. tests/cases/compiler/jsxIntrinsicElementsTypeArgumentErrors.tsx(26,16): error TS2558: Expected 0 type arguments, but got 1. -tests/cases/compiler/jsxIntrinsicElementsTypeArgumentErrors.tsx(26,23): error TS2344: Type 'object' does not satisfy the constraint 'string | number | symbol'. +tests/cases/compiler/jsxIntrinsicElementsTypeArgumentErrors.tsx(26,23): error TS2344: Type 'object' does not satisfy the constraint 'PropertyKey'. Type 'object' is not assignable to type 'symbol'. tests/cases/compiler/jsxIntrinsicElementsTypeArgumentErrors.tsx(28,16): error TS2558: Expected 0 type arguments, but got 1. @@ -57,7 +57,7 @@ tests/cases/compiler/jsxIntrinsicElementsTypeArgumentErrors.tsx(28,16): error TS ~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2558: Expected 0 type arguments, but got 1. ~~~~~~ -!!! error TS2344: Type 'object' does not satisfy the constraint 'string | number | symbol'. +!!! error TS2344: Type 'object' does not satisfy the constraint 'PropertyKey'. !!! error TS2344: Type 'object' is not assignable to type 'symbol'. const f = >; // existing type argument with no internal issues @@ -93,7 +93,7 @@ tests/cases/compiler/jsxIntrinsicElementsTypeArgumentErrors.tsx(28,16): error TS ~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2558: Expected 0 type arguments, but got 1. ~~~~~~ -!!! error TS2344: Type 'object' does not satisfy the constraint 'string | number | symbol'. +!!! error TS2344: Type 'object' does not satisfy the constraint 'PropertyKey'. !!! error TS2344: Type 'object' is not assignable to type 'symbol'. const l = />; // existing type argument with no internal issues diff --git a/tests/baselines/reference/keyofAndIndexedAccess.types b/tests/baselines/reference/keyofAndIndexedAccess.types index e0b3e13ed60b4..9dec6746a9731 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess.types +++ b/tests/baselines/reference/keyofAndIndexedAccess.types @@ -55,7 +55,7 @@ const enum E { A, B, C } >C : E.C type K00 = keyof any; // string ->K00 : string | number | symbol +>K00 : PropertyKey type K01 = keyof string; // "toString" | "charAt" | ... >K01 : number | "length" | "toString" | "concat" | "slice" | "indexOf" | "lastIndexOf" | "valueOf" | "charAt" | "charCodeAt" | "localeCompare" | "match" | "replace" | "search" | "split" | "substring" | "toLowerCase" | "toLocaleLowerCase" | "toUpperCase" | "toLocaleUpperCase" | "trim" | "substr" @@ -77,7 +77,7 @@ type K06 = keyof null; // never >null : null type K07 = keyof never; // string | number | symbol ->K07 : string | number | symbol +>K07 : PropertyKey type K08 = keyof unknown; // never >K08 : never @@ -1207,15 +1207,15 @@ type S2 = { }; function f90(x1: S2[keyof S2], x2: T[keyof S2], x3: S2[K]) { ->f90 : (x1: S2[keyof S2], x2: T[keyof S2], x3: S2[K]) => void +>f90 : (x1: S2[keyof S2], x2: T[keyof S2], x3: S2[K]) => void >x1 : string ->x2 : T["a" | "b"] +>x2 : T[KeyTypes] >x3 : S2[K] x1 = x2; ->x1 = x2 : T["a" | "b"] +>x1 = x2 : T[KeyTypes] >x1 : string ->x2 : T["a" | "b"] +>x2 : T[KeyTypes] x1 = x3; >x1 = x3 : S2[K] @@ -1224,12 +1224,12 @@ function f90(x1: S2[keyof S2], x2: T[keyof S2] x2 = x1; >x2 = x1 : string ->x2 : T["a" | "b"] +>x2 : T[KeyTypes] >x1 : string x2 = x3; >x2 = x3 : S2[K] ->x2 : T["a" | "b"] +>x2 : T[KeyTypes] >x3 : S2[K] x3 = x1; @@ -1238,9 +1238,9 @@ function f90(x1: S2[keyof S2], x2: T[keyof S2] >x1 : string x3 = x2; ->x3 = x2 : T["a" | "b"] +>x3 = x2 : T[KeyTypes] >x3 : S2[K] ->x2 : T["a" | "b"] +>x2 : T[KeyTypes] x1.length; >x1.length : number @@ -1249,7 +1249,7 @@ function f90(x1: S2[keyof S2], x2: T[keyof S2] x2.length; >x2.length : number ->x2 : T["a" | "b"] +>x2 : T[KeyTypes] >length : number x3.length; @@ -1688,13 +1688,13 @@ let result = dispatchMethod("someMethod", ["hello", 35]); // Repro from #13073 type KeyTypes = "a" | "b" ->KeyTypes : "a" | "b" +>KeyTypes : KeyTypes let MyThingy: { [key in KeyTypes]: string[] }; >MyThingy : { a: string[]; b: string[]; } function addToMyThingy(key: S) { ->addToMyThingy : (key: S) => void +>addToMyThingy : (key: S) => void >key : S MyThingy[key].push("a"); diff --git a/tests/baselines/reference/keyofAndIndexedAccessErrors.types b/tests/baselines/reference/keyofAndIndexedAccessErrors.types index 80ffabefaf2bb..642dec113a806 100644 --- a/tests/baselines/reference/keyofAndIndexedAccessErrors.types +++ b/tests/baselines/reference/keyofAndIndexedAccessErrors.types @@ -20,7 +20,7 @@ type Dictionary = { [x: string]: T }; >x : string type T00 = keyof K0; // Error ->T00 : string | number | symbol +>T00 : PropertyKey type T01 = keyof Object; >T01 : "toString" | "valueOf" | "toLocaleString" | "constructor" | "hasOwnProperty" | "isPrototypeOf" | "propertyIsEnumerable" diff --git a/tests/baselines/reference/keyofDoesntContainSymbols.types b/tests/baselines/reference/keyofDoesntContainSymbols.types index 5971064fa36c5..e33593262cd6d 100644 --- a/tests/baselines/reference/keyofDoesntContainSymbols.types +++ b/tests/baselines/reference/keyofDoesntContainSymbols.types @@ -57,8 +57,8 @@ const valB = set(obj, 'num', ''); // Expect type error // Argument of type '""' is not assignable to parameter of type 'number'. const valC = set(obj, sym, sym); ->valC : string | number ->set(obj, sym, sym) : string | number +>valC : Values<{ num: number; str: string; 0: 0; [sym]: symbol; }> +>set(obj, sym, sym) : Values<{ num: number; str: string; 0: 0; [sym]: symbol; }> >set : (obj: T, key: K, value: T[K]) => T[K] >obj : { num: number; str: string; 0: 0; [sym]: symbol; } >sym : unique symbol @@ -67,8 +67,8 @@ const valC = set(obj, sym, sym); // Expect type error // Argument of type 'unique symbol' is not assignable to parameter of type "str" | "num" const valD = set(obj, num, num); ->valD : string | number ->set(obj, num, num) : string | number +>valD : Values<{ num: number; str: string; 0: 0; [sym]: symbol; }> +>set(obj, num, num) : Values<{ num: number; str: string; 0: 0; [sym]: symbol; }> >set : (obj: T, key: K, value: T[K]) => T[K] >obj : { num: number; str: string; 0: 0; [sym]: symbol; } >num : 0 @@ -85,6 +85,6 @@ type Values = T[keyof T]; >Values : Values type ValuesOfObj = Values; ->ValuesOfObj : string | number +>ValuesOfObj : Values<{ num: number; str: string; 0: 0; [sym]: symbol; }> >obj : { num: number; str: string; 0: 0; [sym]: symbol; } diff --git a/tests/baselines/reference/lateBoundAssignmentDeclarationSupport3.types b/tests/baselines/reference/lateBoundAssignmentDeclarationSupport3.types index 511f2e6153e9f..8fc76045c486c 100644 --- a/tests/baselines/reference/lateBoundAssignmentDeclarationSupport3.types +++ b/tests/baselines/reference/lateBoundAssignmentDeclarationSupport3.types @@ -32,9 +32,9 @@ const _str = "my-fake-sym"; Object.defineProperty(module.exports, _sym, { value: "ok" }); >Object.defineProperty(module.exports, _sym, { value: "ok" }) : any ->Object.defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>Object.defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Object : ObjectConstructor ->defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >module.exports : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport3") >module : { "\"tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport3\"": typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport3"); } >exports : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport3") @@ -45,9 +45,9 @@ Object.defineProperty(module.exports, _sym, { value: "ok" }); Object.defineProperty(module.exports, _str, { value: "ok" }); >Object.defineProperty(module.exports, _str, { value: "ok" }) : any ->Object.defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>Object.defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Object : ObjectConstructor ->defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >module.exports : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport3") >module : { "\"tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport3\"": typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport3"); } >exports : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport3") diff --git a/tests/baselines/reference/lateBoundAssignmentDeclarationSupport6.types b/tests/baselines/reference/lateBoundAssignmentDeclarationSupport6.types index e25880167c6a9..8de2b0c0555da 100644 --- a/tests/baselines/reference/lateBoundAssignmentDeclarationSupport6.types +++ b/tests/baselines/reference/lateBoundAssignmentDeclarationSupport6.types @@ -51,9 +51,9 @@ F.prototype.defsAClass = true; Object.defineProperty(F.prototype, _str, {value: "ok"}); >Object.defineProperty(F.prototype, _str, {value: "ok"}) : any ->Object.defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>Object.defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Object : ObjectConstructor ->defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >F.prototype : any >F : typeof F >prototype : any @@ -64,9 +64,9 @@ Object.defineProperty(F.prototype, _str, {value: "ok"}); Object.defineProperty(F.prototype, _sym, {value: "ok"}); >Object.defineProperty(F.prototype, _sym, {value: "ok"}) : any ->Object.defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>Object.defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Object : ObjectConstructor ->defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >F.prototype : any >F : typeof F >prototype : any diff --git a/tests/baselines/reference/library_ObjectPrototypeProperties.types b/tests/baselines/reference/library_ObjectPrototypeProperties.types index 093b787a0ceed..0761554026019 100644 --- a/tests/baselines/reference/library_ObjectPrototypeProperties.types +++ b/tests/baselines/reference/library_ObjectPrototypeProperties.types @@ -34,11 +34,11 @@ Object.prototype.valueOf(); Object.prototype.hasOwnProperty("string"); >Object.prototype.hasOwnProperty("string") : boolean ->Object.prototype.hasOwnProperty : (v: string | number | symbol) => boolean +>Object.prototype.hasOwnProperty : (v: PropertyKey) => boolean >Object.prototype : Object >Object : ObjectConstructor >prototype : Object ->hasOwnProperty : (v: string | number | symbol) => boolean +>hasOwnProperty : (v: PropertyKey) => boolean >"string" : "string" Object.prototype.isPrototypeOf(Object); @@ -52,10 +52,10 @@ Object.prototype.isPrototypeOf(Object); Object.prototype.propertyIsEnumerable("string"); >Object.prototype.propertyIsEnumerable("string") : boolean ->Object.prototype.propertyIsEnumerable : (v: string | number | symbol) => boolean +>Object.prototype.propertyIsEnumerable : (v: PropertyKey) => boolean >Object.prototype : Object >Object : ObjectConstructor >prototype : Object ->propertyIsEnumerable : (v: string | number | symbol) => boolean +>propertyIsEnumerable : (v: PropertyKey) => boolean >"string" : "string" diff --git a/tests/baselines/reference/literalTypeWidening.types b/tests/baselines/reference/literalTypeWidening.types index 808c5c918dbdb..43ffd0c8f6dcb 100644 --- a/tests/baselines/reference/literalTypeWidening.types +++ b/tests/baselines/reference/literalTypeWidening.types @@ -224,7 +224,7 @@ declare function widening(x: T): T; >x : T declare function nonWidening(x: T): T; ->nonWidening : (x: T) => T +>nonWidening : (x: T) => T >x : T function f6(cond: boolean) { @@ -255,19 +255,19 @@ function f6(cond: boolean) { let y1 = nonWidening('a'); >y1 : "a" >nonWidening('a') : "a" ->nonWidening : (x: T) => T +>nonWidening : (x: T) => T >'a' : "a" let y2 = nonWidening(10); >y2 : 10 >nonWidening(10) : 10 ->nonWidening : (x: T) => T +>nonWidening : (x: T) => T >10 : 10 let y3 = nonWidening(cond ? 'a' : 10); >y3 : "a" | 10 >nonWidening(cond ? 'a' : 10) : "a" | 10 ->nonWidening : (x: T) => T +>nonWidening : (x: T) => T >cond ? 'a' : 10 : "a" | 10 >cond : boolean >'a' : "a" diff --git a/tests/baselines/reference/literalTypes2.types b/tests/baselines/reference/literalTypes2.types index fb66b15d3203f..b8ca12a5b1c0f 100644 --- a/tests/baselines/reference/literalTypes2.types +++ b/tests/baselines/reference/literalTypes2.types @@ -406,7 +406,7 @@ function f4() { const c2: { a : 0 | 1, b: "foo" | "bar" } = { a: 1, b: "foo" }; >c2 : { a: 0 | 1; b: "foo" | "bar"; } ->a : 0 | 1 +>a : Bit >b : "foo" | "bar" >{ a: 1, b: "foo" } : { a: 1; b: "foo"; } >a : 1 @@ -424,7 +424,7 @@ function f4() { let x2: { a : 0 | 1, b: "foo" | "bar" } = { a: 1, b: "foo" }; >x2 : { a: 0 | 1; b: "foo" | "bar"; } ->a : 0 | 1 +>a : Bit >b : "foo" | "bar" >{ a: 1, b: "foo" } : { a: 1; b: "foo"; } >a : 1 @@ -552,7 +552,7 @@ class C2 { >bar : () => 1 | 0 return cond ? 0 : 1; ->cond ? 0 : 1 : 0 | 1 +>cond ? 0 : 1 : Bit >cond : boolean >0 : 0 >1 : 1 @@ -756,19 +756,19 @@ function append(a: T[], x: T): T[] { } type Bit = 0 | 1; ->Bit : 0 | 1 +>Bit : Bit let aa = makeArray(0); ->aa : (0 | 1)[] ->makeArray(0) : (0 | 1)[] +>aa : Bit[] +>makeArray(0) : Bit[] >makeArray : (x: T) => T[] >0 : 0 aa = append(aa, 1); ->aa = append(aa, 1) : (0 | 1)[] ->aa : (0 | 1)[] ->append(aa, 1) : (0 | 1)[] +>aa = append(aa, 1) : Bit[] +>aa : Bit[] +>append(aa, 1) : Bit[] >append : (a: T[], x: T) => T[] ->aa : (0 | 1)[] +>aa : Bit[] >1 : 1 diff --git a/tests/baselines/reference/mappedTypeContextualTypesApplied.types b/tests/baselines/reference/mappedTypeContextualTypesApplied.types index fc539785d1b0e..c38ce8717f80a 100644 --- a/tests/baselines/reference/mappedTypeContextualTypesApplied.types +++ b/tests/baselines/reference/mappedTypeContextualTypesApplied.types @@ -30,7 +30,7 @@ declare function mapped6(obj: {[P in K]: TakeString}): void; >obj : { [P in K]: TakeString; } declare function mapped7(obj: {[P in K]: TakeString}): void; ->mapped7 : (obj: { [P in K]: TakeString; }) => void +>mapped7 : (obj: { [P in K]: TakeString; }) => void >obj : { [P in K]: TakeString; } declare function mapped8(obj: {[P in K]: TakeString}): void; @@ -97,7 +97,7 @@ mapped6({foo: s => 42}); mapped7({foo: s => 42}); >mapped7({foo: s => 42}) : void ->mapped7 : (obj: { [P in K]: TakeString; }) => void +>mapped7 : (obj: { [P in K]: TakeString; }) => void >{foo: s => 42} : { foo: (s: string) => number; } >foo : (s: string) => number >s => 42 : (s: string) => number diff --git a/tests/baselines/reference/mappedTypeErrors.errors.txt b/tests/baselines/reference/mappedTypeErrors.errors.txt index 0dc68732e81a2..e1e99e7c46f38 100644 --- a/tests/baselines/reference/mappedTypeErrors.errors.txt +++ b/tests/baselines/reference/mappedTypeErrors.errors.txt @@ -36,7 +36,7 @@ tests/cases/conformance/types/mapped/mappedTypeErrors.ts(124,14): error TS2345: tests/cases/conformance/types/mapped/mappedTypeErrors.ts(128,16): error TS2322: Type 'string' is not assignable to type 'number | undefined'. tests/cases/conformance/types/mapped/mappedTypeErrors.ts(129,25): error TS2322: Type 'string' is not assignable to type 'number | undefined'. tests/cases/conformance/types/mapped/mappedTypeErrors.ts(130,39): error TS2322: Type 'string' is not assignable to type 'number | undefined'. -tests/cases/conformance/types/mapped/mappedTypeErrors.ts(136,16): error TS2322: Type 'T' is not assignable to type 'string | number | symbol'. +tests/cases/conformance/types/mapped/mappedTypeErrors.ts(136,16): error TS2322: Type 'T' is not assignable to type 'PropertyKey'. Type 'T' is not assignable to type 'symbol'. tests/cases/conformance/types/mapped/mappedTypeErrors.ts(136,21): error TS2536: Type 'P' cannot be used to index type 'T'. tests/cases/conformance/types/mapped/mappedTypeErrors.ts(148,17): error TS2339: Property 'foo' does not exist on type 'Pick'. @@ -252,7 +252,7 @@ tests/cases/conformance/types/mapped/mappedTypeErrors.ts(152,17): error TS2339: pf: {[P in F]?: T[P]}, pt: {[P in T]?: T[P]}, // note: should be in keyof T ~ -!!! error TS2322: Type 'T' is not assignable to type 'string | number | symbol'. +!!! error TS2322: Type 'T' is not assignable to type 'PropertyKey'. !!! error TS2322: Type 'T' is not assignable to type 'symbol'. ~~~~ !!! error TS2536: Type 'P' cannot be used to index type 'T'. diff --git a/tests/baselines/reference/mappedTypeWithAny.types b/tests/baselines/reference/mappedTypeWithAny.types index 6aa71ef174070..e9893bef4fd0d 100644 --- a/tests/baselines/reference/mappedTypeWithAny.types +++ b/tests/baselines/reference/mappedTypeWithAny.types @@ -7,7 +7,7 @@ type ItemMap = { [P in keyof T]: Item }; >ItemMap : ItemMap declare let x0: keyof any; ->x0 : string | number | symbol +>x0 : PropertyKey declare let x1: { [P in any]: Item }; >x1 : { [x: string]: Item; [x: number]: Item; } diff --git a/tests/baselines/reference/mappedTypes4.js b/tests/baselines/reference/mappedTypes4.js index 395d6490b4e60..6237476906a75 100644 --- a/tests/baselines/reference/mappedTypes4.js +++ b/tests/baselines/reference/mappedTypes4.js @@ -106,7 +106,7 @@ declare type B = { declare type C = { c: string; }; -declare function f1(x: A | B | C | undefined): Boxified | Boxified | Boxified | undefined; +declare function f1(x: A | B | C | undefined): Boxified; declare type T00 = Partial; declare type T01 = Readonly; declare type T02 = Boxified; diff --git a/tests/baselines/reference/mappedTypes4.types b/tests/baselines/reference/mappedTypes4.types index d59d500d08937..dc317ec10ba82 100644 --- a/tests/baselines/reference/mappedTypes4.types +++ b/tests/baselines/reference/mappedTypes4.types @@ -61,24 +61,24 @@ type C = { c: string }; >c : string function f1(x: A | B | C | undefined) { ->f1 : (x: A | B | C | undefined) => Boxified | Boxified | Boxified | undefined +>f1 : (x: A | B | C | undefined) => Boxified >x : A | B | C | undefined return boxify(x); ->boxify(x) : Boxified | Boxified | Boxified | undefined +>boxify(x) : Boxified >boxify : (obj: T) => Boxified >x : A | B | C | undefined } type T00 = Partial; ->T00 : Partial | Partial | Partial +>T00 : Partial type T01 = Readonly; ->T01 : Readonly | Readonly | Readonly | null | undefined +>T01 : Readonly >null : null type T02 = Boxified ->T02 : string | Boxified | Boxified | Box[] +>T02 : Boxified type T03 = Readonly; >T03 : string | number | boolean | void | null | undefined @@ -98,11 +98,11 @@ type BoxifiedWithSentinel = { } type T10 = BoxifiedWithSentinel; ->T10 : BoxifiedWithSentinel | BoxifiedWithSentinel | BoxifiedWithSentinel +>T10 : BoxifiedWithSentinel >null : null type T11 = BoxifiedWithSentinel; ->T11 : BoxifiedWithSentinel | BoxifiedWithSentinel | BoxifiedWithSentinel +>T11 : BoxifiedWithSentinel type T12 = BoxifiedWithSentinel; >T12 : string diff --git a/tests/baselines/reference/mappedTypesArraysTuples.types b/tests/baselines/reference/mappedTypesArraysTuples.types index ba7d3dc50bdf4..35f506d382802 100644 --- a/tests/baselines/reference/mappedTypesArraysTuples.types +++ b/tests/baselines/reference/mappedTypesArraysTuples.types @@ -66,7 +66,7 @@ type B = { b: string }; >b : string type T40 = Boxified | [A, B] | string | string[]>; ->T40 : string | Box[] | Boxified | readonly Box[] | [Box, Box] | Box[] +>T40 : Boxified type ReadWrite = { -readonly [P in keyof T] : T[P] }; >ReadWrite : ReadWrite diff --git a/tests/baselines/reference/modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.types b/tests/baselines/reference/modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.types index 6081b16c835d6..7d4c7acc1deaf 100644 --- a/tests/baselines/reference/modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.types +++ b/tests/baselines/reference/modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.types @@ -80,9 +80,9 @@ var o = { }; o.hasOwnProperty(Symbol.hasInstance); >o.hasOwnProperty(Symbol.hasInstance) : boolean ->o.hasOwnProperty : (v: string | number | symbol) => boolean +>o.hasOwnProperty : (v: PropertyKey) => boolean >o : { a: number; [Symbol.hasInstance](value: any): boolean; } ->hasOwnProperty : (v: string | number | symbol) => boolean +>hasOwnProperty : (v: PropertyKey) => boolean >Symbol.hasInstance : any >Symbol : any >hasInstance : any diff --git a/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions1.types b/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions1.types index 7847fa8d6b90a..f885083eac0b0 100644 --- a/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions1.types +++ b/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions1.types @@ -124,9 +124,9 @@ var o = { }; o.hasOwnProperty(Symbol.hasInstance); >o.hasOwnProperty(Symbol.hasInstance) : boolean ->o.hasOwnProperty : (v: string | number | symbol) => boolean +>o.hasOwnProperty : (v: PropertyKey) => boolean >o : { a: number; [Symbol.hasInstance](value: any): boolean; } ->hasOwnProperty : (v: string | number | symbol) => boolean +>hasOwnProperty : (v: PropertyKey) => boolean >Symbol.hasInstance : symbol >Symbol : SymbolConstructor >hasInstance : symbol diff --git a/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions2.types b/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions2.types index fbaeabadf6fef..22ed7e3b636db 100644 --- a/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions2.types +++ b/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions2.types @@ -124,9 +124,9 @@ var o = { }; o.hasOwnProperty(Symbol.hasInstance); >o.hasOwnProperty(Symbol.hasInstance) : boolean ->o.hasOwnProperty : (v: string | number | symbol) => boolean +>o.hasOwnProperty : (v: PropertyKey) => boolean >o : { a: number; [Symbol.hasInstance](value: any): boolean; } ->hasOwnProperty : (v: string | number | symbol) => boolean +>hasOwnProperty : (v: PropertyKey) => boolean >Symbol.hasInstance : symbol >Symbol : SymbolConstructor >hasInstance : symbol diff --git a/tests/baselines/reference/modularizeLibrary_TargetES5UsingES6Lib.types b/tests/baselines/reference/modularizeLibrary_TargetES5UsingES6Lib.types index e11ad3030a58a..610df69522a2c 100644 --- a/tests/baselines/reference/modularizeLibrary_TargetES5UsingES6Lib.types +++ b/tests/baselines/reference/modularizeLibrary_TargetES5UsingES6Lib.types @@ -124,9 +124,9 @@ var o = { }; o.hasOwnProperty(Symbol.hasInstance); >o.hasOwnProperty(Symbol.hasInstance) : boolean ->o.hasOwnProperty : (v: string | number | symbol) => boolean +>o.hasOwnProperty : (v: PropertyKey) => boolean >o : { a: number; [Symbol.hasInstance](value: any): boolean; } ->hasOwnProperty : (v: string | number | symbol) => boolean +>hasOwnProperty : (v: PropertyKey) => boolean >Symbol.hasInstance : symbol >Symbol : SymbolConstructor >hasInstance : symbol diff --git a/tests/baselines/reference/modularizeLibrary_TargetES6UsingES6Lib.types b/tests/baselines/reference/modularizeLibrary_TargetES6UsingES6Lib.types index f4eaba5875235..e59666753d531 100644 --- a/tests/baselines/reference/modularizeLibrary_TargetES6UsingES6Lib.types +++ b/tests/baselines/reference/modularizeLibrary_TargetES6UsingES6Lib.types @@ -79,9 +79,9 @@ var o = { }; o.hasOwnProperty(Symbol.hasInstance); >o.hasOwnProperty(Symbol.hasInstance) : boolean ->o.hasOwnProperty : (v: string | number | symbol) => boolean +>o.hasOwnProperty : (v: PropertyKey) => boolean >o : { a: number; [Symbol.hasInstance](value: any): boolean; } ->hasOwnProperty : (v: string | number | symbol) => boolean +>hasOwnProperty : (v: PropertyKey) => boolean >Symbol.hasInstance : symbol >Symbol : SymbolConstructor >hasInstance : symbol diff --git a/tests/baselines/reference/modularizeLibrary_UsingES5LibAndES6FeatureLibs.types b/tests/baselines/reference/modularizeLibrary_UsingES5LibAndES6FeatureLibs.types index f18184101cff9..2835879e53de9 100644 --- a/tests/baselines/reference/modularizeLibrary_UsingES5LibAndES6FeatureLibs.types +++ b/tests/baselines/reference/modularizeLibrary_UsingES5LibAndES6FeatureLibs.types @@ -16,10 +16,10 @@ var p = new Proxy(t, {}); >{} : {} Reflect.ownKeys({}); ->Reflect.ownKeys({}) : (string | number | symbol)[] ->Reflect.ownKeys : (target: object) => (string | number | symbol)[] +>Reflect.ownKeys({}) : PropertyKey[] +>Reflect.ownKeys : (target: object) => PropertyKey[] >Reflect : typeof Reflect ->ownKeys : (target: object) => (string | number | symbol)[] +>ownKeys : (target: object) => PropertyKey[] >{} : {} function* idGen() { diff --git a/tests/baselines/reference/narrowingTruthyObject.types b/tests/baselines/reference/narrowingTruthyObject.types index 1f1a4a86f5e01..c562f3da2d3ed 100644 --- a/tests/baselines/reference/narrowingTruthyObject.types +++ b/tests/baselines/reference/narrowingTruthyObject.types @@ -133,9 +133,9 @@ function f1(x: unknown): any { >x : unknown >'object' : "object" >x.hasOwnProperty('x') : boolean ->x.hasOwnProperty : (v: string | number | symbol) => boolean +>x.hasOwnProperty : (v: PropertyKey) => boolean >x : object ->hasOwnProperty : (v: string | number | symbol) => boolean +>hasOwnProperty : (v: PropertyKey) => boolean >'x' : "x" } diff --git a/tests/baselines/reference/neverUnionIntersection.types b/tests/baselines/reference/neverUnionIntersection.types index 4f578052e9c23..a1dc5506940c4 100644 --- a/tests/baselines/reference/neverUnionIntersection.types +++ b/tests/baselines/reference/neverUnionIntersection.types @@ -32,7 +32,7 @@ type T10 = null & never; >null : null type T11 = { a: string } | never; ->T11 : { a: string; } +>T11 : T11 >a : string type T12 = { a: string } & never; diff --git a/tests/baselines/reference/numberPropertyAccess.types b/tests/baselines/reference/numberPropertyAccess.types index b2baf38873c69..713a3950dee12 100644 --- a/tests/baselines/reference/numberPropertyAccess.types +++ b/tests/baselines/reference/numberPropertyAccess.types @@ -13,9 +13,9 @@ var a = x.toExponential(); var b = x.hasOwnProperty('toFixed'); >b : boolean >x.hasOwnProperty('toFixed') : boolean ->x.hasOwnProperty : (v: string | number | symbol) => boolean +>x.hasOwnProperty : (v: PropertyKey) => boolean >x : number ->hasOwnProperty : (v: string | number | symbol) => boolean +>hasOwnProperty : (v: PropertyKey) => boolean >'toFixed' : "toFixed" var c = x['toExponential'](); @@ -28,7 +28,7 @@ var c = x['toExponential'](); var d = x['hasOwnProperty']('toFixed'); >d : boolean >x['hasOwnProperty']('toFixed') : boolean ->x['hasOwnProperty'] : (v: string | number | symbol) => boolean +>x['hasOwnProperty'] : (v: PropertyKey) => boolean >x : number >'hasOwnProperty' : "hasOwnProperty" >'toFixed' : "toFixed" diff --git a/tests/baselines/reference/numericLiteralTypes1.types b/tests/baselines/reference/numericLiteralTypes1.types index 1ef5854173ae5..548241f2c7814 100644 --- a/tests/baselines/reference/numericLiteralTypes1.types +++ b/tests/baselines/reference/numericLiteralTypes1.types @@ -73,124 +73,124 @@ function f2() { function f3(a: 1, b: 0 | 1 | 2) { >f3 : (a: 1, b: 0 | 1 | 2) => void >a : 1 ->b : 0 | 1 | 2 +>b : Tag var x = a + b; >x : number >a + b : number >a : 1 ->b : 0 | 1 | 2 +>b : Tag var x = a - b; >x : number >a - b : number >a : 1 ->b : 0 | 1 | 2 +>b : Tag var x = a * b; >x : number >a * b : number >a : 1 ->b : 0 | 1 | 2 +>b : Tag var x = a / b; >x : number >a / b : number >a : 1 ->b : 0 | 1 | 2 +>b : Tag var x = a % b; >x : number >a % b : number >a : 1 ->b : 0 | 1 | 2 +>b : Tag var x = a | b; >x : number >a | b : number >a : 1 ->b : 0 | 1 | 2 +>b : Tag var x = a & b; >x : number >a & b : number >a : 1 ->b : 0 | 1 | 2 +>b : Tag var x = a ^ b; >x : number >a ^ b : number >a : 1 ->b : 0 | 1 | 2 +>b : Tag var x = -b; >x : number >-b : number ->b : 0 | 1 | 2 +>b : Tag var x = ~b; >x : number >~b : number ->b : 0 | 1 | 2 +>b : Tag var y = a == b; >y : boolean >a == b : boolean >a : 1 ->b : 0 | 1 | 2 +>b : Tag var y = a != b; >y : boolean >a != b : boolean >a : 1 ->b : 0 | 1 | 2 +>b : Tag var y = a === b; >y : boolean >a === b : boolean >a : 1 ->b : 0 | 1 | 2 +>b : Tag var y = a !== b; >y : boolean >a !== b : boolean >a : 1 ->b : 0 | 1 | 2 +>b : Tag var y = a > b; >y : boolean >a > b : boolean >a : 1 ->b : 0 | 1 | 2 +>b : Tag var y = a < b; >y : boolean >a < b : boolean >a : 1 ->b : 0 | 1 | 2 +>b : Tag var y = a >= b; >y : boolean >a >= b : boolean >a : 1 ->b : 0 | 1 | 2 +>b : Tag var y = a <= b; >y : boolean >a <= b : boolean >a : 1 ->b : 0 | 1 | 2 +>b : Tag var y = !b; >y : boolean >!b : boolean ->b : 0 | 1 | 2 +>b : Tag } function f4(a: 1, b: 0 | 1 | 2) { >f4 : (a: 1, b: 0 | 1 | 2) => void >a : 1 ->b : 0 | 1 | 2 +>b : Tag a++; >a++ : number @@ -216,7 +216,7 @@ declare function g(x: number): number; function f5(a: 1, b: 0 | 1 | 2) { >f5 : (a: 1, b: 0 | 1 | 2) => void >a : 1 ->b : 0 | 1 | 2 +>b : Tag var z1 = g(0); >z1 : string @@ -246,7 +246,7 @@ function f5(a: 1, b: 0 | 1 | 2) { >z5 : number >g(b) : number >g : { (x: 0): string; (x: 1): boolean; (x: number): number; } ->b : 0 | 1 | 2 +>b : Tag } function assertNever(x: never): never { @@ -260,14 +260,14 @@ function assertNever(x: never): never { } type Tag = 0 | 1 | 2; ->Tag : 0 | 1 | 2 +>Tag : Tag function f10(x: Tag) { >f10 : (x: Tag) => "a" | "b" | "c" ->x : 0 | 1 | 2 +>x : Tag switch (x) { ->x : 0 | 1 | 2 +>x : Tag case 0: return "a"; >0 : 0 @@ -285,10 +285,10 @@ function f10(x: Tag) { function f11(x: Tag) { >f11 : (x: Tag) => "a" | "b" | "c" ->x : 0 | 1 | 2 +>x : Tag switch (x) { ->x : 0 | 1 | 2 +>x : Tag case 0: return "a"; >0 : 0 @@ -310,28 +310,28 @@ function f11(x: Tag) { function f12(x: Tag) { >f12 : (x: Tag) => void ->x : 0 | 1 | 2 +>x : Tag if (x) { ->x : 0 | 1 | 2 +>x : Tag x; >x : 1 | 2 } else { x; ->x : 0 | 1 | 2 +>x : Tag } } function f13(x: Tag) { >f13 : (x: Tag) => void ->x : 0 | 1 | 2 +>x : Tag if (x === 0 || x === 2) { >x === 0 || x === 2 : boolean >x === 0 : boolean ->x : 0 | 1 | 2 +>x : Tag >0 : 0 >x === 2 : boolean >x : 1 | 2 @@ -348,19 +348,19 @@ function f13(x: Tag) { function f14(x: 0 | 1 | 2, y: string) { >f14 : (x: 0 | 1 | 2, y: string) => void ->x : 0 | 1 | 2 +>x : Tag >y : string var a = x && y; >a : string >x && y : string ->x : 0 | 1 | 2 +>x : Tag >y : string var b = x || y; >b : string | 1 | 2 >x || y : string | 1 | 2 ->x : 0 | 1 | 2 +>x : Tag >y : string } @@ -425,9 +425,9 @@ function f20(x: Item) { >x : Item switch (x.kind) { ->x.kind : 0 | 1 | 2 +>x.kind : Tag >x : Item ->kind : 0 | 1 | 2 +>kind : Tag case 0: return x.a; >0 : 0 @@ -454,9 +454,9 @@ function f21(x: Item) { >x : Item switch (x.kind) { ->x.kind : 0 | 1 | 2 +>x.kind : Tag >x : Item ->kind : 0 | 1 | 2 +>kind : Tag case 0: return x.a; >0 : 0 diff --git a/tests/baselines/reference/numericLiteralTypes2.types b/tests/baselines/reference/numericLiteralTypes2.types index 815cd80f42a89..062f0ef9c7b8b 100644 --- a/tests/baselines/reference/numericLiteralTypes2.types +++ b/tests/baselines/reference/numericLiteralTypes2.types @@ -73,124 +73,124 @@ function f2() { function f3(a: 1, b: 0 | 1 | 2) { >f3 : (a: 1, b: 0 | 1 | 2) => void >a : 1 ->b : 0 | 1 | 2 +>b : Tag var x = a + b; >x : number >a + b : number >a : 1 ->b : 0 | 1 | 2 +>b : Tag var x = a - b; >x : number >a - b : number >a : 1 ->b : 0 | 1 | 2 +>b : Tag var x = a * b; >x : number >a * b : number >a : 1 ->b : 0 | 1 | 2 +>b : Tag var x = a / b; >x : number >a / b : number >a : 1 ->b : 0 | 1 | 2 +>b : Tag var x = a % b; >x : number >a % b : number >a : 1 ->b : 0 | 1 | 2 +>b : Tag var x = a | b; >x : number >a | b : number >a : 1 ->b : 0 | 1 | 2 +>b : Tag var x = a & b; >x : number >a & b : number >a : 1 ->b : 0 | 1 | 2 +>b : Tag var x = a ^ b; >x : number >a ^ b : number >a : 1 ->b : 0 | 1 | 2 +>b : Tag var x = -b; >x : number >-b : number ->b : 0 | 1 | 2 +>b : Tag var x = ~b; >x : number >~b : number ->b : 0 | 1 | 2 +>b : Tag var y = a == b; >y : boolean >a == b : boolean >a : 1 ->b : 0 | 1 | 2 +>b : Tag var y = a != b; >y : boolean >a != b : boolean >a : 1 ->b : 0 | 1 | 2 +>b : Tag var y = a === b; >y : boolean >a === b : boolean >a : 1 ->b : 0 | 1 | 2 +>b : Tag var y = a !== b; >y : boolean >a !== b : boolean >a : 1 ->b : 0 | 1 | 2 +>b : Tag var y = a > b; >y : boolean >a > b : boolean >a : 1 ->b : 0 | 1 | 2 +>b : Tag var y = a < b; >y : boolean >a < b : boolean >a : 1 ->b : 0 | 1 | 2 +>b : Tag var y = a >= b; >y : boolean >a >= b : boolean >a : 1 ->b : 0 | 1 | 2 +>b : Tag var y = a <= b; >y : boolean >a <= b : boolean >a : 1 ->b : 0 | 1 | 2 +>b : Tag var y = !b; >y : boolean >!b : boolean ->b : 0 | 1 | 2 +>b : Tag } function f4(a: 1, b: 0 | 1 | 2) { >f4 : (a: 1, b: 0 | 1 | 2) => void >a : 1 ->b : 0 | 1 | 2 +>b : Tag a++; >a++ : number @@ -216,7 +216,7 @@ declare function g(x: number): number; function f5(a: 1, b: 0 | 1 | 2) { >f5 : (a: 1, b: 0 | 1 | 2) => void >a : 1 ->b : 0 | 1 | 2 +>b : Tag var z1 = g(0); >z1 : string @@ -246,7 +246,7 @@ function f5(a: 1, b: 0 | 1 | 2) { >z5 : number >g(b) : number >g : { (x: 0): string; (x: 1): boolean; (x: number): number; } ->b : 0 | 1 | 2 +>b : Tag } function assertNever(x: never): never { @@ -260,14 +260,14 @@ function assertNever(x: never): never { } type Tag = 0 | 1 | 2; ->Tag : 0 | 1 | 2 +>Tag : Tag function f10(x: Tag) { >f10 : (x: Tag) => "a" | "b" | "c" ->x : 0 | 1 | 2 +>x : Tag switch (x) { ->x : 0 | 1 | 2 +>x : Tag case 0: return "a"; >0 : 0 @@ -285,10 +285,10 @@ function f10(x: Tag) { function f11(x: Tag) { >f11 : (x: Tag) => "a" | "b" | "c" ->x : 0 | 1 | 2 +>x : Tag switch (x) { ->x : 0 | 1 | 2 +>x : Tag case 0: return "a"; >0 : 0 @@ -310,10 +310,10 @@ function f11(x: Tag) { function f12(x: Tag) { >f12 : (x: Tag) => void ->x : 0 | 1 | 2 +>x : Tag if (x) { ->x : 0 | 1 | 2 +>x : Tag x; >x : 1 | 2 @@ -326,12 +326,12 @@ function f12(x: Tag) { function f13(x: Tag) { >f13 : (x: Tag) => void ->x : 0 | 1 | 2 +>x : Tag if (x === 0 || x === 2) { >x === 0 || x === 2 : boolean >x === 0 : boolean ->x : 0 | 1 | 2 +>x : Tag >0 : 0 >x === 2 : boolean >x : 1 | 2 @@ -348,19 +348,19 @@ function f13(x: Tag) { function f14(x: 0 | 1 | 2, y: string) { >f14 : (x: 0 | 1 | 2, y: string) => void ->x : 0 | 1 | 2 +>x : Tag >y : string var a = x && y; >a : string | 0 >x && y : string | 0 ->x : 0 | 1 | 2 +>x : Tag >y : string var b = x || y; >b : string | 1 | 2 >x || y : string | 1 | 2 ->x : 0 | 1 | 2 +>x : Tag >y : string } @@ -425,9 +425,9 @@ function f20(x: Item) { >x : Item switch (x.kind) { ->x.kind : 0 | 1 | 2 +>x.kind : Tag >x : Item ->kind : 0 | 1 | 2 +>kind : Tag case 0: return x.a; >0 : 0 @@ -454,9 +454,9 @@ function f21(x: Item) { >x : Item switch (x.kind) { ->x.kind : 0 | 1 | 2 +>x.kind : Tag >x : Item ->kind : 0 | 1 | 2 +>kind : Tag case 0: return x.a; >0 : 0 diff --git a/tests/baselines/reference/objectFromEntries.types b/tests/baselines/reference/objectFromEntries.types index 4d5c71447705a..9cfee4f310dd5 100644 --- a/tests/baselines/reference/objectFromEntries.types +++ b/tests/baselines/reference/objectFromEntries.types @@ -2,9 +2,9 @@ const o = Object.fromEntries([['a', 1], ['b', 2], ['c', 3]]); >o : { [k: string]: number; } >Object.fromEntries([['a', 1], ['b', 2], ['c', 3]]) : { [k: string]: number; } ->Object.fromEntries : { (entries: Iterable): { [k: string]: T; }; (entries: Iterable): any; } +>Object.fromEntries : { (entries: Iterable): { [k: string]: T; }; (entries: Iterable): any; } >Object : ObjectConstructor ->fromEntries : { (entries: Iterable): { [k: string]: T; }; (entries: Iterable): any; } +>fromEntries : { (entries: Iterable): { [k: string]: T; }; (entries: Iterable): any; } >[['a', 1], ['b', 2], ['c', 3]] : [string, number][] >['a', 1] : [string, number] >'a' : "a" @@ -19,18 +19,18 @@ const o = Object.fromEntries([['a', 1], ['b', 2], ['c', 3]]); const o2 = Object.fromEntries(new URLSearchParams()); >o2 : { [k: string]: string; } >Object.fromEntries(new URLSearchParams()) : { [k: string]: string; } ->Object.fromEntries : { (entries: Iterable): { [k: string]: T; }; (entries: Iterable): any; } +>Object.fromEntries : { (entries: Iterable): { [k: string]: T; }; (entries: Iterable): any; } >Object : ObjectConstructor ->fromEntries : { (entries: Iterable): { [k: string]: T; }; (entries: Iterable): any; } +>fromEntries : { (entries: Iterable): { [k: string]: T; }; (entries: Iterable): any; } >new URLSearchParams() : URLSearchParams >URLSearchParams : { new (init?: string | URLSearchParams | string[][] | Record): URLSearchParams; prototype: URLSearchParams; toString(): string; } const o3 = Object.fromEntries(new Map([[Symbol("key"), "value"]])); >o3 : { [k: string]: string; } >Object.fromEntries(new Map([[Symbol("key"), "value"]])) : { [k: string]: string; } ->Object.fromEntries : { (entries: Iterable): { [k: string]: T; }; (entries: Iterable): any; } +>Object.fromEntries : { (entries: Iterable): { [k: string]: T; }; (entries: Iterable): any; } >Object : ObjectConstructor ->fromEntries : { (entries: Iterable): { [k: string]: T; }; (entries: Iterable): any; } +>fromEntries : { (entries: Iterable): { [k: string]: T; }; (entries: Iterable): any; } >new Map([[Symbol("key"), "value"]]) : Map >Map : MapConstructor >[[Symbol("key"), "value"]] : [symbol, string][] @@ -60,9 +60,9 @@ const frozenArray = Object.freeze([['a', 1], ['b', 2], ['c', 3]]); const o4 = Object.fromEntries(frozenArray); >o4 : any >Object.fromEntries(frozenArray) : any ->Object.fromEntries : { (entries: Iterable): { [k: string]: T; }; (entries: Iterable): any; } +>Object.fromEntries : { (entries: Iterable): { [k: string]: T; }; (entries: Iterable): any; } >Object : ObjectConstructor ->fromEntries : { (entries: Iterable): { [k: string]: T; }; (entries: Iterable): any; } +>fromEntries : { (entries: Iterable): { [k: string]: T; }; (entries: Iterable): any; } >frozenArray : readonly (string | number)[][] const frozenArray2: readonly [string, number][] = Object.freeze([['a', 1], ['b', 2], ['c', 3]]); @@ -85,8 +85,8 @@ const frozenArray2: readonly [string, number][] = Object.freeze([['a', 1], ['b', const o5 = Object.fromEntries(frozenArray2); >o5 : { [k: string]: number; } >Object.fromEntries(frozenArray2) : { [k: string]: number; } ->Object.fromEntries : { (entries: Iterable): { [k: string]: T; }; (entries: Iterable): any; } +>Object.fromEntries : { (entries: Iterable): { [k: string]: T; }; (entries: Iterable): any; } >Object : ObjectConstructor ->fromEntries : { (entries: Iterable): { [k: string]: T; }; (entries: Iterable): any; } +>fromEntries : { (entries: Iterable): { [k: string]: T; }; (entries: Iterable): any; } >frozenArray2 : readonly [string, number][] diff --git a/tests/baselines/reference/objectLitGetterSetter.types b/tests/baselines/reference/objectLitGetterSetter.types index 9c7bb2e1b45a7..8484a6d26dc89 100644 --- a/tests/baselines/reference/objectLitGetterSetter.types +++ b/tests/baselines/reference/objectLitGetterSetter.types @@ -5,9 +5,9 @@ Object.defineProperty(obj, "accProperty", ({ >Object.defineProperty(obj, "accProperty", ({ get: function () { eval("public = 1;"); return 11; }, set: function (v) { } })) : any ->Object.defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>Object.defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Object : ObjectConstructor ->defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >obj : {} >"accProperty" : "accProperty" >({ get: function () { eval("public = 1;"); return 11; }, set: function (v) { } }) : PropertyDescriptor diff --git a/tests/baselines/reference/objectTypeHidingMembersOfExtendedObject.errors.txt b/tests/baselines/reference/objectTypeHidingMembersOfExtendedObject.errors.txt index 4f27c62e67df2..94810f6d0028f 100644 --- a/tests/baselines/reference/objectTypeHidingMembersOfExtendedObject.errors.txt +++ b/tests/baselines/reference/objectTypeHidingMembersOfExtendedObject.errors.txt @@ -1,8 +1,8 @@ tests/cases/conformance/types/members/objectTypeHidingMembersOfExtendedObject.ts(11,5): error TS2411: Property 'constructor' of type 'Function' is not assignable to string index type 'Object'. tests/cases/conformance/types/members/objectTypeHidingMembersOfExtendedObject.ts(11,5): error TS2411: Property 'data' of type 'A' is not assignable to string index type 'Object'. -tests/cases/conformance/types/members/objectTypeHidingMembersOfExtendedObject.ts(11,5): error TS2411: Property 'hasOwnProperty' of type '(v: string | number | symbol) => boolean' is not assignable to string index type 'Object'. +tests/cases/conformance/types/members/objectTypeHidingMembersOfExtendedObject.ts(11,5): error TS2411: Property 'hasOwnProperty' of type '(v: PropertyKey) => boolean' is not assignable to string index type 'Object'. tests/cases/conformance/types/members/objectTypeHidingMembersOfExtendedObject.ts(11,5): error TS2411: Property 'isPrototypeOf' of type '(v: Object) => boolean' is not assignable to string index type 'Object'. -tests/cases/conformance/types/members/objectTypeHidingMembersOfExtendedObject.ts(11,5): error TS2411: Property 'propertyIsEnumerable' of type '(v: string | number | symbol) => boolean' is not assignable to string index type 'Object'. +tests/cases/conformance/types/members/objectTypeHidingMembersOfExtendedObject.ts(11,5): error TS2411: Property 'propertyIsEnumerable' of type '(v: PropertyKey) => boolean' is not assignable to string index type 'Object'. tests/cases/conformance/types/members/objectTypeHidingMembersOfExtendedObject.ts(11,5): error TS2411: Property 'toLocaleString' of type '() => string' is not assignable to string index type 'Object'. tests/cases/conformance/types/members/objectTypeHidingMembersOfExtendedObject.ts(11,5): error TS2411: Property 'toString' of type '() => string' is not assignable to string index type 'Object'. tests/cases/conformance/types/members/objectTypeHidingMembersOfExtendedObject.ts(11,5): error TS2411: Property 'valueOf' of type '() => Object' is not assignable to string index type 'Object'. @@ -25,11 +25,11 @@ tests/cases/conformance/types/members/objectTypeHidingMembersOfExtendedObject.ts ~~~~~~~~~~~~~~~~~~~~ !!! error TS2411: Property 'data' of type 'A' is not assignable to string index type 'Object'. ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2411: Property 'hasOwnProperty' of type '(v: string | number | symbol) => boolean' is not assignable to string index type 'Object'. +!!! error TS2411: Property 'hasOwnProperty' of type '(v: PropertyKey) => boolean' is not assignable to string index type 'Object'. ~~~~~~~~~~~~~~~~~~~~ !!! error TS2411: Property 'isPrototypeOf' of type '(v: Object) => boolean' is not assignable to string index type 'Object'. ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2411: Property 'propertyIsEnumerable' of type '(v: string | number | symbol) => boolean' is not assignable to string index type 'Object'. +!!! error TS2411: Property 'propertyIsEnumerable' of type '(v: PropertyKey) => boolean' is not assignable to string index type 'Object'. ~~~~~~~~~~~~~~~~~~~~ !!! error TS2411: Property 'toLocaleString' of type '() => string' is not assignable to string index type 'Object'. ~~~~~~~~~~~~~~~~~~~~ diff --git a/tests/baselines/reference/objectTypeWithStringIndexerHidingObjectIndexer.errors.txt b/tests/baselines/reference/objectTypeWithStringIndexerHidingObjectIndexer.errors.txt index 2fadffd195dda..d85cc3ddfdb11 100644 --- a/tests/baselines/reference/objectTypeWithStringIndexerHidingObjectIndexer.errors.txt +++ b/tests/baselines/reference/objectTypeWithStringIndexerHidingObjectIndexer.errors.txt @@ -1,7 +1,7 @@ tests/cases/conformance/types/members/objectTypeWithStringIndexerHidingObjectIndexer.ts(5,5): error TS2411: Property 'constructor' of type 'Function' is not assignable to string index type 'Object'. -tests/cases/conformance/types/members/objectTypeWithStringIndexerHidingObjectIndexer.ts(5,5): error TS2411: Property 'hasOwnProperty' of type '(v: string | number | symbol) => boolean' is not assignable to string index type 'Object'. +tests/cases/conformance/types/members/objectTypeWithStringIndexerHidingObjectIndexer.ts(5,5): error TS2411: Property 'hasOwnProperty' of type '(v: PropertyKey) => boolean' is not assignable to string index type 'Object'. tests/cases/conformance/types/members/objectTypeWithStringIndexerHidingObjectIndexer.ts(5,5): error TS2411: Property 'isPrototypeOf' of type '(v: Object) => boolean' is not assignable to string index type 'Object'. -tests/cases/conformance/types/members/objectTypeWithStringIndexerHidingObjectIndexer.ts(5,5): error TS2411: Property 'propertyIsEnumerable' of type '(v: string | number | symbol) => boolean' is not assignable to string index type 'Object'. +tests/cases/conformance/types/members/objectTypeWithStringIndexerHidingObjectIndexer.ts(5,5): error TS2411: Property 'propertyIsEnumerable' of type '(v: PropertyKey) => boolean' is not assignable to string index type 'Object'. tests/cases/conformance/types/members/objectTypeWithStringIndexerHidingObjectIndexer.ts(5,5): error TS2411: Property 'toLocaleString' of type '() => string' is not assignable to string index type 'Object'. tests/cases/conformance/types/members/objectTypeWithStringIndexerHidingObjectIndexer.ts(5,5): error TS2411: Property 'toString' of type '() => string' is not assignable to string index type 'Object'. tests/cases/conformance/types/members/objectTypeWithStringIndexerHidingObjectIndexer.ts(5,5): error TS2411: Property 'valueOf' of type '() => Object' is not assignable to string index type 'Object'. @@ -16,11 +16,11 @@ tests/cases/conformance/types/members/objectTypeWithStringIndexerHidingObjectInd ~~~~~~~~~~~~~~~~~~~~ !!! error TS2411: Property 'constructor' of type 'Function' is not assignable to string index type 'Object'. ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2411: Property 'hasOwnProperty' of type '(v: string | number | symbol) => boolean' is not assignable to string index type 'Object'. +!!! error TS2411: Property 'hasOwnProperty' of type '(v: PropertyKey) => boolean' is not assignable to string index type 'Object'. ~~~~~~~~~~~~~~~~~~~~ !!! error TS2411: Property 'isPrototypeOf' of type '(v: Object) => boolean' is not assignable to string index type 'Object'. ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2411: Property 'propertyIsEnumerable' of type '(v: string | number | symbol) => boolean' is not assignable to string index type 'Object'. +!!! error TS2411: Property 'propertyIsEnumerable' of type '(v: PropertyKey) => boolean' is not assignable to string index type 'Object'. ~~~~~~~~~~~~~~~~~~~~ !!! error TS2411: Property 'toLocaleString' of type '() => string' is not assignable to string index type 'Object'. ~~~~~~~~~~~~~~~~~~~~ diff --git a/tests/baselines/reference/observableInferenceCanBeMade.types b/tests/baselines/reference/observableInferenceCanBeMade.types index 4efbf360b991f..f64e73f63a26f 100644 --- a/tests/baselines/reference/observableInferenceCanBeMade.types +++ b/tests/baselines/reference/observableInferenceCanBeMade.types @@ -39,13 +39,13 @@ declare class Observable implements Subscribable { function asObservable(input: string | ObservableInput): Observable { >asObservable : (input: string | ObservableInput) => Observable ->input : string | Subscribable | Subscribable +>input : string | ObservableInput | Subscribable return typeof input === 'string' ? of(input) : from(input) >typeof input === 'string' ? of(input) : from(input) : Observable >typeof input === 'string' : boolean >typeof input : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" ->input : string | Subscribable | Subscribable +>input : string | ObservableInput | Subscribable >'string' : "string" >of(input) : Observable >of : (a: T) => Observable diff --git a/tests/baselines/reference/paramsOnlyHaveLiteralTypesWhenAppropriatelyContextualized.types b/tests/baselines/reference/paramsOnlyHaveLiteralTypesWhenAppropriatelyContextualized.types index 4e4f667b549c9..afa482cc04a13 100644 --- a/tests/baselines/reference/paramsOnlyHaveLiteralTypesWhenAppropriatelyContextualized.types +++ b/tests/baselines/reference/paramsOnlyHaveLiteralTypesWhenAppropriatelyContextualized.types @@ -7,7 +7,7 @@ type Lower = { [K in keyof T]: T[K] }; >Lower : Lower export function appendToOptionalArray< ->appendToOptionalArray : (object: { [x in K]?: Lower[] | undefined; }, key: K, value: T) => void +>appendToOptionalArray : (object: { [x in K]?: Lower[] | undefined; }, key: K, value: T) => void K extends string | number | symbol, T @@ -58,28 +58,28 @@ const foo: {x?: number[]; y?: string[]; } = {}; appendToOptionalArray(foo, 'x', 123); // ok >appendToOptionalArray(foo, 'x', 123) : void ->appendToOptionalArray : (object: { [x in K]?: Lower[] | undefined; }, key: K, value: T) => void +>appendToOptionalArray : (object: { [x in K]?: Lower[] | undefined; }, key: K, value: T) => void >foo : { x?: number[] | undefined; y?: string[] | undefined; } >'x' : "x" >123 : 123 appendToOptionalArray(foo, 'y', 'bar'); // ok >appendToOptionalArray(foo, 'y', 'bar') : void ->appendToOptionalArray : (object: { [x in K]?: Lower[] | undefined; }, key: K, value: T) => void +>appendToOptionalArray : (object: { [x in K]?: Lower[] | undefined; }, key: K, value: T) => void >foo : { x?: number[] | undefined; y?: string[] | undefined; } >'y' : "y" >'bar' : "bar" appendToOptionalArray(foo, 'y', 12); // should fail >appendToOptionalArray(foo, 'y', 12) : void ->appendToOptionalArray : (object: { [x in K]?: Lower[] | undefined; }, key: K, value: T) => void +>appendToOptionalArray : (object: { [x in K]?: Lower[] | undefined; }, key: K, value: T) => void >foo : { x?: number[] | undefined; y?: string[] | undefined; } >'y' : "y" >12 : 12 appendToOptionalArray(foo, 'x', "no"); // should fail >appendToOptionalArray(foo, 'x', "no") : void ->appendToOptionalArray : (object: { [x in K]?: Lower[] | undefined; }, key: K, value: T) => void +>appendToOptionalArray : (object: { [x in K]?: Lower[] | undefined; }, key: K, value: T) => void >foo : { x?: number[] | undefined; y?: string[] | undefined; } >'x' : "x" >"no" : "no" diff --git a/tests/baselines/reference/parserOverloadOnConstants1.types b/tests/baselines/reference/parserOverloadOnConstants1.types index 6a786c50eb59e..2532713e2dfcd 100644 --- a/tests/baselines/reference/parserOverloadOnConstants1.types +++ b/tests/baselines/reference/parserOverloadOnConstants1.types @@ -1,18 +1,18 @@ === tests/cases/conformance/parser/ecmascript5/parserOverloadOnConstants1.ts === interface Document { createElement(tagName: string): HTMLElement; ->createElement : { (tagName: K, options?: ElementCreationOptions): HTMLElementTagNameMap[K]; (tagName: K, options?: ElementCreationOptions): HTMLElementDeprecatedTagNameMap[K]; (tagName: string, options?: ElementCreationOptions): HTMLElement; (tagName: string): HTMLElement; (tagName: "canvas"): HTMLCanvasElement; (tagName: "div"): HTMLDivElement; (tagName: "span"): HTMLSpanElement; } +>createElement : { (tagName: K, options?: ElementCreationOptions): HTMLElementTagNameMap[K]; (tagName: K, options?: ElementCreationOptions): HTMLElementDeprecatedTagNameMap[K]; (tagName: string, options?: ElementCreationOptions): HTMLElement; (tagName: string): HTMLElement; (tagName: "canvas"): HTMLCanvasElement; (tagName: "div"): HTMLDivElement; (tagName: "span"): HTMLSpanElement; } >tagName : string createElement(tagName: 'canvas'): HTMLCanvasElement; ->createElement : { (tagName: K, options?: ElementCreationOptions): HTMLElementTagNameMap[K]; (tagName: K, options?: ElementCreationOptions): HTMLElementDeprecatedTagNameMap[K]; (tagName: string, options?: ElementCreationOptions): HTMLElement; (tagName: string): HTMLElement; (tagName: 'canvas'): HTMLCanvasElement; (tagName: "div"): HTMLDivElement; (tagName: "span"): HTMLSpanElement; } +>createElement : { (tagName: K, options?: ElementCreationOptions): HTMLElementTagNameMap[K]; (tagName: K, options?: ElementCreationOptions): HTMLElementDeprecatedTagNameMap[K]; (tagName: string, options?: ElementCreationOptions): HTMLElement; (tagName: string): HTMLElement; (tagName: 'canvas'): HTMLCanvasElement; (tagName: "div"): HTMLDivElement; (tagName: "span"): HTMLSpanElement; } >tagName : "canvas" createElement(tagName: 'div'): HTMLDivElement; ->createElement : { (tagName: K, options?: ElementCreationOptions): HTMLElementTagNameMap[K]; (tagName: K, options?: ElementCreationOptions): HTMLElementDeprecatedTagNameMap[K]; (tagName: string, options?: ElementCreationOptions): HTMLElement; (tagName: string): HTMLElement; (tagName: "canvas"): HTMLCanvasElement; (tagName: 'div'): HTMLDivElement; (tagName: "span"): HTMLSpanElement; } +>createElement : { (tagName: K, options?: ElementCreationOptions): HTMLElementTagNameMap[K]; (tagName: K, options?: ElementCreationOptions): HTMLElementDeprecatedTagNameMap[K]; (tagName: string, options?: ElementCreationOptions): HTMLElement; (tagName: string): HTMLElement; (tagName: "canvas"): HTMLCanvasElement; (tagName: 'div'): HTMLDivElement; (tagName: "span"): HTMLSpanElement; } >tagName : "div" createElement(tagName: 'span'): HTMLSpanElement; ->createElement : { (tagName: K, options?: ElementCreationOptions): HTMLElementTagNameMap[K]; (tagName: K, options?: ElementCreationOptions): HTMLElementDeprecatedTagNameMap[K]; (tagName: string, options?: ElementCreationOptions): HTMLElement; (tagName: string): HTMLElement; (tagName: "canvas"): HTMLCanvasElement; (tagName: "div"): HTMLDivElement; (tagName: 'span'): HTMLSpanElement; } +>createElement : { (tagName: K, options?: ElementCreationOptions): HTMLElementTagNameMap[K]; (tagName: K, options?: ElementCreationOptions): HTMLElementDeprecatedTagNameMap[K]; (tagName: string, options?: ElementCreationOptions): HTMLElement; (tagName: string): HTMLElement; (tagName: "canvas"): HTMLCanvasElement; (tagName: "div"): HTMLDivElement; (tagName: 'span'): HTMLSpanElement; } >tagName : "span" } diff --git a/tests/baselines/reference/parserUsingConstructorAsIdentifier.types b/tests/baselines/reference/parserUsingConstructorAsIdentifier.types index d0cd25f887d38..2a330b89a9026 100644 --- a/tests/baselines/reference/parserUsingConstructorAsIdentifier.types +++ b/tests/baselines/reference/parserUsingConstructorAsIdentifier.types @@ -90,9 +90,9 @@ Object.defineProperty(constructor.prototype, "constructor", { value: constructor, writable: true, configurable: true, enumerable: true }); >Object.defineProperty(constructor.prototype, "constructor", { value: constructor, writable: true, configurable: true, enumerable: true }) : any ->Object.defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>Object.defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >Object : ObjectConstructor ->defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any +>defineProperty : (o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => any >constructor.prototype : any >constructor : any >prototype : any diff --git a/tests/baselines/reference/parserharness.types b/tests/baselines/reference/parserharness.types index f4af8d0d64b8d..f61c47945162a 100644 --- a/tests/baselines/reference/parserharness.types +++ b/tests/baselines/reference/parserharness.types @@ -2743,11 +2743,11 @@ module Harness { if (this.fileCollection.hasOwnProperty(p)) { >this.fileCollection.hasOwnProperty(p) : boolean ->this.fileCollection.hasOwnProperty : (v: string | number | symbol) => boolean +>this.fileCollection.hasOwnProperty : (v: PropertyKey) => boolean >this.fileCollection : {} >this : this >fileCollection : {} ->hasOwnProperty : (v: string | number | symbol) => boolean +>hasOwnProperty : (v: PropertyKey) => boolean >p : string var current = this.fileCollection[p]; diff --git a/tests/baselines/reference/privacyGloImportParseErrors.errors.txt b/tests/baselines/reference/privacyGloImportParseErrors.errors.txt index 2724d972987cf..b88a2f400067e 100644 --- a/tests/baselines/reference/privacyGloImportParseErrors.errors.txt +++ b/tests/baselines/reference/privacyGloImportParseErrors.errors.txt @@ -1,3 +1,4 @@ +error TS-1: Pre-emit (16) and post-emit (18) diagnostic counts do not match! This can indicate that a semantic _error_ was added by the emit resolver - such an error may not be reflected on the command line or in the editor, but may be captured in a baseline here! tests/cases/compiler/privacyGloImportParseErrors.ts(22,5): error TS2668: 'export' modifier cannot be applied to ambient modules and module augmentations since they are always visible. tests/cases/compiler/privacyGloImportParseErrors.ts(22,27): error TS2435: Ambient modules cannot be nested in other modules or namespaces. tests/cases/compiler/privacyGloImportParseErrors.ts(30,20): error TS2435: Ambient modules cannot be nested in other modules or namespaces. @@ -6,7 +7,9 @@ tests/cases/compiler/privacyGloImportParseErrors.ts(59,37): error TS2307: Cannot tests/cases/compiler/privacyGloImportParseErrors.ts(69,37): error TS1147: Import declarations in a namespace cannot reference a module. tests/cases/compiler/privacyGloImportParseErrors.ts(69,37): error TS2307: Cannot find module 'm1_M4_private' or its corresponding type declarations. tests/cases/compiler/privacyGloImportParseErrors.ts(81,43): error TS1147: Import declarations in a namespace cannot reference a module. +tests/cases/compiler/privacyGloImportParseErrors.ts(81,43): error TS2307: Cannot find module 'm1_M3_public' or its corresponding type declarations. tests/cases/compiler/privacyGloImportParseErrors.ts(82,43): error TS1147: Import declarations in a namespace cannot reference a module. +tests/cases/compiler/privacyGloImportParseErrors.ts(82,43): error TS2307: Cannot find module 'm1_M4_private' or its corresponding type declarations. tests/cases/compiler/privacyGloImportParseErrors.ts(121,38): error TS1147: Import declarations in a namespace cannot reference a module. tests/cases/compiler/privacyGloImportParseErrors.ts(125,45): error TS1147: Import declarations in a namespace cannot reference a module. tests/cases/compiler/privacyGloImportParseErrors.ts(133,9): error TS1038: A 'declare' modifier cannot be used in an already ambient context. @@ -16,7 +19,11 @@ tests/cases/compiler/privacyGloImportParseErrors.ts(146,25): error TS1147: Impor tests/cases/compiler/privacyGloImportParseErrors.ts(149,29): error TS1147: Import declarations in a namespace cannot reference a module. -==== tests/cases/compiler/privacyGloImportParseErrors.ts (16 errors) ==== +!!! error TS-1: Pre-emit (16) and post-emit (18) diagnostic counts do not match! This can indicate that a semantic _error_ was added by the emit resolver - such an error may not be reflected on the command line or in the editor, but may be captured in a baseline here! +!!! related TS-1: The excess diagnostics are: +!!! related TS2307 tests/cases/compiler/privacyGloImportParseErrors.ts:81:43: Cannot find module 'm1_M3_public' or its corresponding type declarations. +!!! related TS2307 tests/cases/compiler/privacyGloImportParseErrors.ts:82:43: Cannot find module 'm1_M4_private' or its corresponding type declarations. +==== tests/cases/compiler/privacyGloImportParseErrors.ts (18 errors) ==== module m1 { export module m1_M1_public { export class c1 { @@ -114,9 +121,13 @@ tests/cases/compiler/privacyGloImportParseErrors.ts(149,29): error TS1147: Impor export import m1_im3_public = require("m1_M3_public"); ~~~~~~~~~~~~~~ !!! error TS1147: Import declarations in a namespace cannot reference a module. + ~~~~~~~~~~~~~~ +!!! error TS2307: Cannot find module 'm1_M3_public' or its corresponding type declarations. export import m1_im4_public = require("m1_M4_private"); ~~~~~~~~~~~~~~~ !!! error TS1147: Import declarations in a namespace cannot reference a module. + ~~~~~~~~~~~~~~~ +!!! error TS2307: Cannot find module 'm1_M4_private' or its corresponding type declarations. } module glo_M1_public { diff --git a/tests/baselines/reference/propertyAccess.types b/tests/baselines/reference/propertyAccess.types index 20e8d77070b1d..b81767eb8c066 100644 --- a/tests/baselines/reference/propertyAccess.types +++ b/tests/baselines/reference/propertyAccess.types @@ -136,10 +136,10 @@ var aa = obj.x; // Dotted property access of property that exists on value's apparent type var bb = obj.hasOwnProperty; ->bb : (v: string | number | symbol) => boolean ->obj.hasOwnProperty : (v: string | number | symbol) => boolean +>bb : (v: PropertyKey) => boolean +>obj.hasOwnProperty : (v: PropertyKey) => boolean >obj : { 10: string; x: string; y: number; z: { n: string; m: number; o: () => boolean; }; 'literal property': number; } ->hasOwnProperty : (v: string | number | symbol) => boolean +>hasOwnProperty : (v: PropertyKey) => boolean // Dotted property access of property that doesn't exist on value's apparent type var cc = obj.qqq; // error diff --git a/tests/baselines/reference/recursiveMappedTypes.types b/tests/baselines/reference/recursiveMappedTypes.types index 3d317f688bfba..17bc1c31a69f3 100644 --- a/tests/baselines/reference/recursiveMappedTypes.types +++ b/tests/baselines/reference/recursiveMappedTypes.types @@ -79,9 +79,9 @@ declare var product: Transform; >product : Transform product.users; // (Transform | Transform)[] ->product.users : (Transform | Transform)[] +>product.users : Transform[] >product : Transform ->users : (Transform | Transform)[] +>users : Transform[] // Repro from #29702 diff --git a/tests/baselines/reference/recursiveTypeReferences1.types b/tests/baselines/reference/recursiveTypeReferences1.types index 8259f392c5ba8..a357c1928f388 100644 --- a/tests/baselines/reference/recursiveTypeReferences1.types +++ b/tests/baselines/reference/recursiveTypeReferences1.types @@ -256,7 +256,7 @@ flat([1, ['a']]); // Error >'a' : "a" flat1([1, [2, [3]]]); // (number | number[])[] ->flat1([1, [2, [3]]]) : (number | number[])[] +>flat1([1, [2, [3]]]) : VibratePattern[] >flat1 : (a: (T | T[])[]) => T[] >[1, [2, [3]]] : (number | (number | number[])[])[] >1 : 1 diff --git a/tests/baselines/reference/restTupleElements1.js b/tests/baselines/reference/restTupleElements1.js index a15c7fd4dd119..79b266bb25ff9 100644 --- a/tests/baselines/reference/restTupleElements1.js +++ b/tests/baselines/reference/restTupleElements1.js @@ -129,7 +129,7 @@ declare let e0: number; declare let e1: string; declare let e2: boolean; declare let e3: boolean; -declare let ex: string | number | boolean; +declare let ex: T23; declare function f0(x: [T, ...U[]]): [T, U]; declare function f1(a: [(x: number) => number, ...((x: string) => number)[]]): void; declare function f2(...a: [(x: number) => number, ...((x: string) => number)[]]): void; diff --git a/tests/baselines/reference/restTupleElements1.types b/tests/baselines/reference/restTupleElements1.types index a910315c51d82..3fc5a57a30ca7 100644 --- a/tests/baselines/reference/restTupleElements1.types +++ b/tests/baselines/reference/restTupleElements1.types @@ -110,10 +110,10 @@ type T22 = T20[0 | 1]; >T22 : T22 type T23 = T20[0 | 1 | 2]; ->T23 : string | number | boolean +>T23 : T23 type T24 = T20[0 | 1 | 2 | 3]; ->T24 : string | number | boolean +>T24 : T23 type T25 = T20[1 | 2 | 3]; >T25 : T25 @@ -125,7 +125,7 @@ type T27 = T20[3]; >T27 : boolean type T28 = T20[number]; ->T28 : string | number | boolean +>T28 : T23 declare const t: T20; >t : T20 @@ -158,8 +158,8 @@ let e3 = t[3]; // boolean >3 : 3 let ex = t[x]; // number | string | boolean ->ex : string | number | boolean ->t[x] : string | number | boolean +>ex : T23 +>t[x] : T23 >t : T20 >x : number diff --git a/tests/baselines/reference/staticInstanceResolution2.types b/tests/baselines/reference/staticInstanceResolution2.types index e44f99d212f18..577b98e58c73a 100644 --- a/tests/baselines/reference/staticInstanceResolution2.types +++ b/tests/baselines/reference/staticInstanceResolution2.types @@ -4,9 +4,9 @@ class A { } A.hasOwnProperty('foo'); >A.hasOwnProperty('foo') : boolean ->A.hasOwnProperty : (v: string | number | symbol) => boolean +>A.hasOwnProperty : (v: PropertyKey) => boolean >A : typeof A ->hasOwnProperty : (v: string | number | symbol) => boolean +>hasOwnProperty : (v: PropertyKey) => boolean >'foo' : "foo" class B { @@ -16,9 +16,9 @@ class B { } B.hasOwnProperty('foo'); >B.hasOwnProperty('foo') : boolean ->B.hasOwnProperty : (v: string | number | symbol) => boolean +>B.hasOwnProperty : (v: PropertyKey) => boolean >B : typeof B ->hasOwnProperty : (v: string | number | symbol) => boolean +>hasOwnProperty : (v: PropertyKey) => boolean >'foo' : "foo" diff --git a/tests/baselines/reference/stringPropertyAccess.types b/tests/baselines/reference/stringPropertyAccess.types index da8298178b65c..d395753dcb9d6 100644 --- a/tests/baselines/reference/stringPropertyAccess.types +++ b/tests/baselines/reference/stringPropertyAccess.types @@ -14,9 +14,9 @@ var a = x.charAt(0); var b = x.hasOwnProperty('charAt'); >b : boolean >x.hasOwnProperty('charAt') : boolean ->x.hasOwnProperty : (v: string | number | symbol) => boolean +>x.hasOwnProperty : (v: PropertyKey) => boolean >x : string ->hasOwnProperty : (v: string | number | symbol) => boolean +>hasOwnProperty : (v: PropertyKey) => boolean >'charAt' : "charAt" var c = x['charAt'](0); @@ -30,7 +30,7 @@ var c = x['charAt'](0); var e = x['hasOwnProperty']('toFixed'); >e : boolean >x['hasOwnProperty']('toFixed') : boolean ->x['hasOwnProperty'] : (v: string | number | symbol) => boolean +>x['hasOwnProperty'] : (v: PropertyKey) => boolean >x : string >'hasOwnProperty' : "hasOwnProperty" >'toFixed' : "toFixed" diff --git a/tests/baselines/reference/typeGuardFunctionOfFormThisErrors.types b/tests/baselines/reference/typeGuardFunctionOfFormThisErrors.types index a282438523829..cea765e127711 100644 --- a/tests/baselines/reference/typeGuardFunctionOfFormThisErrors.types +++ b/tests/baselines/reference/typeGuardFunctionOfFormThisErrors.types @@ -93,19 +93,19 @@ function invalidGuard(c: any): this is number { } let c: number | number[]; ->c : number | number[] +>c : VibratePattern if (invalidGuard(c)) { >invalidGuard(c) : boolean >invalidGuard : (c: any) => this is number ->c : number | number[] +>c : VibratePattern c; ->c : number | number[] +>c : VibratePattern } else { c; ->c : number | number[] +>c : VibratePattern } let holder = {invalidGuard}; @@ -118,17 +118,17 @@ if (holder.invalidGuard(c)) { >holder.invalidGuard : (c: any) => this is number >holder : { invalidGuard: (c: any) => this is number; } >invalidGuard : (c: any) => this is number ->c : number | number[] +>c : VibratePattern c; ->c : number | number[] +>c : VibratePattern holder; >holder : { invalidGuard: (c: any) => this is number; } & number } else { c; ->c : number | number[] +>c : VibratePattern holder; >holder : { invalidGuard: (c: any) => this is number; } diff --git a/tests/baselines/reference/typePredicateStructuralMatch.types b/tests/baselines/reference/typePredicateStructuralMatch.types index 5235a14dc8d3c..4d0b371b1071d 100644 --- a/tests/baselines/reference/typePredicateStructuralMatch.types +++ b/tests/baselines/reference/typePredicateStructuralMatch.types @@ -40,9 +40,9 @@ function isResponseInData(value: T | { data: T}): value is { data: T } { return value.hasOwnProperty('data'); >value.hasOwnProperty('data') : boolean ->value.hasOwnProperty : (v: string | number | symbol) => boolean +>value.hasOwnProperty : (v: PropertyKey) => boolean >value : T | { data: T; } ->hasOwnProperty : (v: string | number | symbol) => boolean +>hasOwnProperty : (v: PropertyKey) => boolean >'data' : "data" } @@ -70,9 +70,9 @@ function isPlainResponse(value: T | { data: T}): value is T { return !value.hasOwnProperty('data'); >!value.hasOwnProperty('data') : boolean >value.hasOwnProperty('data') : boolean ->value.hasOwnProperty : (v: string | number | symbol) => boolean +>value.hasOwnProperty : (v: PropertyKey) => boolean >value : T | { data: T; } ->hasOwnProperty : (v: string | number | symbol) => boolean +>hasOwnProperty : (v: PropertyKey) => boolean >'data' : "data" } diff --git a/tests/baselines/reference/unionTypeInference.types b/tests/baselines/reference/unionTypeInference.types index 268d4ed86ebfb..23470da5e7a60 100644 --- a/tests/baselines/reference/unionTypeInference.types +++ b/tests/baselines/reference/unionTypeInference.types @@ -213,26 +213,26 @@ async function fun(deepPromised: DeepPromised) { >deepPromised : DeepPromised for (const value of Object.values(deepPromisedWithIndexer)) { ->value : {} | ({ [containsPromises]?: true | undefined; } & {}) | Promise<{ [containsPromises]?: true | undefined; } & {}> | null | undefined ->Object.values(deepPromisedWithIndexer) : ({} | ({ [containsPromises]?: true | undefined; } & {}) | Promise<{ [containsPromises]?: true | undefined; } & {}> | null | undefined)[] +>value : {} | DeepPromised<{} | null | undefined> | Promise> | null | undefined +>Object.values(deepPromisedWithIndexer) : ({} | DeepPromised<{} | null | undefined> | Promise> | null | undefined)[] >Object.values : { (o: { [s: string]: T; } | ArrayLike): T[]; (o: {}): any[]; } >Object : ObjectConstructor >values : { (o: { [s: string]: T; } | ArrayLike): T[]; (o: {}): any[]; } >deepPromisedWithIndexer : DeepPromised<{ [name: string]: {} | null | undefined; }> const awaitedValue = await value; ->awaitedValue : {} | ({ [containsPromises]?: true | undefined; } & {}) | null | undefined ->await value : {} | ({ [containsPromises]?: true | undefined; } & {}) | null | undefined ->value : {} | ({ [containsPromises]?: true | undefined; } & {}) | Promise<{ [containsPromises]?: true | undefined; } & {}> | null | undefined +>awaitedValue : {} | DeepPromised<{} | null | undefined> | null | undefined +>await value : {} | DeepPromised<{} | null | undefined> | null | undefined +>value : {} | DeepPromised<{} | null | undefined> | Promise> | null | undefined if (awaitedValue) ->awaitedValue : {} | ({ [containsPromises]?: true | undefined; } & {}) | null | undefined +>awaitedValue : {} | DeepPromised<{} | null | undefined> | null | undefined await fun(awaitedValue); >await fun(awaitedValue) : void >fun(awaitedValue) : Promise >fun : (deepPromised: DeepPromised) => Promise ->awaitedValue : {} | ({ [containsPromises]?: true | undefined; } & {}) +>awaitedValue : {} | DeepPromised<{} | null | undefined> } } diff --git a/tests/baselines/reference/unknownType1.types b/tests/baselines/reference/unknownType1.types index c6911e0bf3bdd..b4b9ad0f2cb69 100644 --- a/tests/baselines/reference/unknownType1.types +++ b/tests/baselines/reference/unknownType1.types @@ -102,7 +102,7 @@ type T38 = T35; // { x: unknown } // keyof unknown type T40 = keyof any; // string | number | symbol ->T40 : string | number | symbol +>T40 : PropertyKey type T41 = keyof unknown; // never >T41 : never diff --git a/tests/baselines/reference/unspecializedConstraints.types b/tests/baselines/reference/unspecializedConstraints.types index be0cd32f4ae2d..2bcba62cc45b0 100644 --- a/tests/baselines/reference/unspecializedConstraints.types +++ b/tests/baselines/reference/unspecializedConstraints.types @@ -438,12 +438,12 @@ module ts { var hasOwnProperty = Object.prototype.hasOwnProperty; ->hasOwnProperty : (v: string | number | symbol) => boolean ->Object.prototype.hasOwnProperty : (v: string | number | symbol) => boolean +>hasOwnProperty : (v: PropertyKey) => boolean +>Object.prototype.hasOwnProperty : (v: PropertyKey) => boolean >Object.prototype : Object >Object : ObjectConstructor >prototype : Object ->hasOwnProperty : (v: string | number | symbol) => boolean +>hasOwnProperty : (v: PropertyKey) => boolean function getProperty(map: Map, key: string): T { >getProperty : (map: Map, key: string) => T @@ -454,7 +454,7 @@ module ts { >!hasOwnProperty.call(map, key) : boolean >hasOwnProperty.call(map, key) : any >hasOwnProperty.call : (this: Function, thisArg: any, ...argArray: any[]) => any ->hasOwnProperty : (v: string | number | symbol) => boolean +>hasOwnProperty : (v: PropertyKey) => boolean >call : (this: Function, thisArg: any, ...argArray: any[]) => any >map : Map >key : string @@ -474,7 +474,7 @@ module ts { return hasOwnProperty.call(map, key); >hasOwnProperty.call(map, key) : any >hasOwnProperty.call : (this: Function, thisArg: any, ...argArray: any[]) => any ->hasOwnProperty : (v: string | number | symbol) => boolean +>hasOwnProperty : (v: PropertyKey) => boolean >call : (this: Function, thisArg: any, ...argArray: any[]) => any >map : Map >key : string diff --git a/tests/cases/compiler/aliasDeclaredAfterFirstUsageUsedByDeclarationEmit.ts b/tests/cases/compiler/aliasDeclaredAfterFirstUsageUsedByDeclarationEmit.ts new file mode 100644 index 0000000000000..38e926f598928 --- /dev/null +++ b/tests/cases/compiler/aliasDeclaredAfterFirstUsageUsedByDeclarationEmit.ts @@ -0,0 +1,22 @@ +// @declaration: true +// @filename: init.ts +export interface A { + a: true; +} + +export interface B { + b: true; +} + +export function f(thing?: A | B): A | B { return null as any; }; +// @filename: utils.ts +import {A, B} from "./init"; + +export type Either = A | B; +// @filename: usage.ts +import {Either} from "./utils"; +import {f} from "./init"; + +export function doThing() { + return f(); +} \ No newline at end of file