mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Look for usable type nodes in associated expressions for declaration emit (#57772)
This commit is contained in:
+160
-39
@@ -797,6 +797,7 @@ import {
|
||||
JsxAttributeLike,
|
||||
JsxAttributeName,
|
||||
JsxAttributes,
|
||||
JsxAttributeValue,
|
||||
JsxChild,
|
||||
JsxClosingElement,
|
||||
JsxElement,
|
||||
@@ -6456,6 +6457,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
return {
|
||||
typeToTypeNode: (type: Type, enclosingDeclaration?: Node, flags?: NodeBuilderFlags, tracker?: SymbolTracker) => withContext(enclosingDeclaration, flags, tracker, context => typeToTypeNodeHelper(type, context)),
|
||||
typePredicateToTypePredicateNode: (typePredicate: TypePredicate, enclosingDeclaration?: Node, flags?: NodeBuilderFlags, tracker?: SymbolTracker) => withContext(enclosingDeclaration, flags, tracker, context => typePredicateToTypePredicateNodeHelper(typePredicate, context)),
|
||||
expressionOrTypeToTypeNode: (expr: Expression | JsxAttributeValue | undefined, type: Type, addUndefined?: boolean, enclosingDeclaration?: Node, flags?: NodeBuilderFlags, tracker?: SymbolTracker) => withContext(enclosingDeclaration, flags, tracker, context => expressionOrTypeToTypeNode(context, expr, type, addUndefined)),
|
||||
serializeTypeForDeclaration: (type: Type, symbol: Symbol, addUndefined?: boolean, enclosingDeclaration?: Node, flags?: NodeBuilderFlags, tracker?: SymbolTracker) => withContext(enclosingDeclaration, flags, tracker, context => serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, /*includePrivateSymbol*/ undefined, /*bundled*/ undefined, addUndefined)),
|
||||
indexInfoToIndexSignatureDeclaration: (indexInfo: IndexInfo, enclosingDeclaration?: Node, flags?: NodeBuilderFlags, tracker?: SymbolTracker) => withContext(enclosingDeclaration, flags, tracker, context => indexInfoToIndexSignatureDeclarationHelper(indexInfo, context, /*typeNode*/ undefined)),
|
||||
signatureToSignatureDeclaration: (signature: Signature, kind: SignatureDeclaration["kind"], enclosingDeclaration?: Node, flags?: NodeBuilderFlags, tracker?: SymbolTracker) => withContext(enclosingDeclaration, flags, tracker, context => signatureToSignatureDeclarationHelper(signature, kind, context)),
|
||||
symbolToEntityName: (symbol: Symbol, meaning: SymbolFlags, enclosingDeclaration?: Node, flags?: NodeBuilderFlags, tracker?: SymbolTracker) => withContext(enclosingDeclaration, flags, tracker, context => symbolToName(symbol, context, meaning, /*expectsIdentifier*/ false)),
|
||||
@@ -6467,6 +6470,73 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
symbolToNode: (symbol: Symbol, meaning: SymbolFlags, enclosingDeclaration?: Node, flags?: NodeBuilderFlags, tracker?: SymbolTracker) => withContext(enclosingDeclaration, flags, tracker, context => symbolToNode(symbol, context, meaning)),
|
||||
};
|
||||
|
||||
function expressionOrTypeToTypeNode(context: NodeBuilderContext, expr: Expression | JsxAttributeValue | undefined, type: Type, addUndefined?: boolean) {
|
||||
if (expr) {
|
||||
const typeNode = isAssertionExpression(expr) ? expr.type
|
||||
: isJSDocTypeAssertion(expr) ? getJSDocTypeAssertionType(expr)
|
||||
: undefined;
|
||||
if (typeNode && !isConstTypeReference(typeNode)) {
|
||||
const result = tryReuseExistingTypeNode(context, typeNode, type, expr.parent, addUndefined);
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (addUndefined) {
|
||||
type = getOptionalType(type);
|
||||
}
|
||||
|
||||
return typeToTypeNodeHelper(type, context);
|
||||
}
|
||||
|
||||
function tryReuseExistingTypeNode(
|
||||
context: NodeBuilderContext,
|
||||
typeNode: TypeNode,
|
||||
type: Type,
|
||||
host: Node,
|
||||
addUndefined?: boolean,
|
||||
includePrivateSymbol?: (s: Symbol) => void,
|
||||
bundled?: boolean,
|
||||
) {
|
||||
const originalType = type;
|
||||
if (addUndefined) {
|
||||
type = getOptionalType(type);
|
||||
}
|
||||
const clone = tryReuseExistingNonParameterTypeNode(context, typeNode, type, host, includePrivateSymbol, bundled);
|
||||
if (clone) {
|
||||
if (addUndefined && !someType(getTypeFromTypeNode(typeNode), t => !!(t.flags & TypeFlags.Undefined))) {
|
||||
return factory.createUnionTypeNode([clone, factory.createKeywordTypeNode(SyntaxKind.UndefinedKeyword)]);
|
||||
}
|
||||
return clone;
|
||||
}
|
||||
if (addUndefined && originalType !== type) {
|
||||
const cloneMissingUndefined = tryReuseExistingNonParameterTypeNode(context, typeNode, originalType, host, includePrivateSymbol, bundled);
|
||||
if (cloneMissingUndefined) {
|
||||
return factory.createUnionTypeNode([cloneMissingUndefined, factory.createKeywordTypeNode(SyntaxKind.UndefinedKeyword)]);
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function tryReuseExistingNonParameterTypeNode(
|
||||
context: NodeBuilderContext,
|
||||
existing: TypeNode,
|
||||
type: Type,
|
||||
host = context.enclosingDeclaration,
|
||||
includePrivateSymbol?: (s: Symbol) => void,
|
||||
bundled?: boolean,
|
||||
annotationType?: Type,
|
||||
) {
|
||||
if (typeNodeIsEquivalentToType(existing, host, type, annotationType) && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type)) {
|
||||
const result = tryReuseExistingTypeNodeHelper(context, existing, includePrivateSymbol, bundled);
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function symbolToNode(symbol: Symbol, context: NodeBuilderContext, meaning: SymbolFlags) {
|
||||
if (context.flags & NodeBuilderFlags.WriteComputedProps) {
|
||||
if (symbol.valueDeclaration) {
|
||||
@@ -6916,8 +6986,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
if (isInstantiationExpressionType) {
|
||||
const instantiationExpressionType = type as InstantiationExpressionType;
|
||||
const existing = instantiationExpressionType.node;
|
||||
if (isTypeQueryNode(existing) && getTypeFromTypeNode(existing) === type) {
|
||||
const typeNode = serializeExistingTypeNode(context, existing);
|
||||
if (isTypeQueryNode(existing)) {
|
||||
const typeNode = tryReuseExistingNonParameterTypeNode(context, existing, type);
|
||||
if (typeNode) {
|
||||
return typeNode;
|
||||
}
|
||||
@@ -7807,11 +7877,9 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
function symbolToParameterDeclaration(parameterSymbol: Symbol, context: NodeBuilderContext, preserveModifierFlags?: boolean, privateSymbolVisitor?: (s: Symbol) => void, bundledImports?: boolean): ParameterDeclaration {
|
||||
const parameterDeclaration = getEffectiveParameterDeclaration(parameterSymbol);
|
||||
|
||||
let parameterType = getTypeOfSymbol(parameterSymbol);
|
||||
if (parameterDeclaration && isRequiredInitializedParameter(parameterDeclaration)) {
|
||||
parameterType = getOptionalType(parameterType);
|
||||
}
|
||||
const parameterTypeNode = serializeTypeForDeclaration(context, parameterType, parameterSymbol, context.enclosingDeclaration, privateSymbolVisitor, bundledImports);
|
||||
const parameterType = getTypeOfSymbol(parameterSymbol);
|
||||
const addUndefined = parameterDeclaration && isRequiredInitializedParameter(parameterDeclaration);
|
||||
const parameterTypeNode = serializeTypeForDeclaration(context, parameterType, parameterSymbol, context.enclosingDeclaration, privateSymbolVisitor, bundledImports, addUndefined);
|
||||
|
||||
const modifiers = !(context.flags & NodeBuilderFlags.OmitParameterModifiers) && preserveModifierFlags && parameterDeclaration && canHaveModifiers(parameterDeclaration) ? map(getModifiers(parameterDeclaration), factory.cloneNode) : undefined;
|
||||
const isRest = parameterDeclaration && isRestParameter(parameterDeclaration) || getCheckFlags(parameterSymbol) & CheckFlags.RestParameter;
|
||||
@@ -8465,17 +8533,15 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
* Unlike `typeToTypeNodeHelper`, this handles setting up the `AllowUniqueESSymbolType` flag
|
||||
* so a `unique symbol` is returned when appropriate for the input symbol, rather than `typeof sym`
|
||||
*/
|
||||
function serializeTypeForDeclaration(context: NodeBuilderContext, type: Type, symbol: Symbol, enclosingDeclaration: Node | undefined, includePrivateSymbol?: (s: Symbol) => void, bundled?: boolean) {
|
||||
function serializeTypeForDeclaration(context: NodeBuilderContext, type: Type, symbol: Symbol, enclosingDeclaration: Node | undefined, includePrivateSymbol?: (s: Symbol) => void, bundled?: boolean, addUndefined?: boolean) {
|
||||
if (!isErrorType(type) && enclosingDeclaration) {
|
||||
const declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration));
|
||||
if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
|
||||
// try to reuse the existing annotation
|
||||
const existing = getEffectiveTypeAnnotationNode(declWithExistingAnnotation)!;
|
||||
if (typeNodeIsEquivalentToType(existing, declWithExistingAnnotation, type) && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type)) {
|
||||
const result = serializeExistingTypeNode(context, existing, includePrivateSymbol, bundled);
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
const result = tryReuseExistingTypeNode(context, existing, type, declWithExistingAnnotation, addUndefined, includePrivateSymbol, bundled);
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8486,17 +8552,20 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
) {
|
||||
context.flags |= NodeBuilderFlags.AllowUniqueESSymbolType;
|
||||
}
|
||||
const result = typeToTypeNodeHelper(type, context);
|
||||
|
||||
const decl = symbol.valueDeclaration ?? symbol.declarations?.[0];
|
||||
const expr = decl && isDeclarationWithPossibleInnerTypeNodeReuse(decl) ? getPossibleTypeNodeReuseExpression(decl) : undefined;
|
||||
|
||||
const result = expressionOrTypeToTypeNode(context, expr, type, addUndefined);
|
||||
context.flags = oldFlags;
|
||||
return result;
|
||||
}
|
||||
|
||||
function typeNodeIsEquivalentToType(typeNode: TypeNode, annotatedDeclaration: Declaration, type: Type) {
|
||||
const typeFromTypeNode = getTypeFromTypeNode(typeNode);
|
||||
function typeNodeIsEquivalentToType(typeNode: TypeNode, annotatedDeclaration: Node | undefined, type: Type, typeFromTypeNode = getTypeFromTypeNode(typeNode)) {
|
||||
if (typeFromTypeNode === type) {
|
||||
return true;
|
||||
}
|
||||
if (isParameter(annotatedDeclaration) && annotatedDeclaration.questionToken) {
|
||||
if (annotatedDeclaration && (isParameter(annotatedDeclaration) || isPropertyDeclaration(annotatedDeclaration)) && annotatedDeclaration.questionToken) {
|
||||
return getTypeWithFacts(type, TypeFacts.NEUndefined) === typeFromTypeNode;
|
||||
}
|
||||
return false;
|
||||
@@ -8509,11 +8578,9 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
if (!!findAncestor(annotation, n => n === enclosingDeclarationIgnoringFakeScope) && annotation) {
|
||||
const annotated = getTypeFromTypeNode(annotation);
|
||||
const thisInstantiated = annotated.flags & TypeFlags.TypeParameter && (annotated as TypeParameter).isThisType ? instantiateType(annotated, signature.mapper) : annotated;
|
||||
if (thisInstantiated === type && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(annotation, type)) {
|
||||
const result = serializeExistingTypeNode(context, annotation, includePrivateSymbol, bundled);
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
const result = tryReuseExistingNonParameterTypeNode(context, annotation, type, signature.declaration, includePrivateSymbol, bundled, thisInstantiated);
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8530,7 +8597,9 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
const sym = resolveEntityName(leftmost, SymbolFlags.All, /*ignoreErrors*/ true, /*dontResolveAlias*/ true);
|
||||
if (sym) {
|
||||
if (isSymbolAccessible(sym, context.enclosingDeclaration, SymbolFlags.All, /*shouldComputeAliasesToMakeVisible*/ false).accessibility !== SymbolAccessibility.Accessible) {
|
||||
introducesError = true;
|
||||
if (!isDeclarationName(node)) {
|
||||
introducesError = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
context.tracker.trackSymbol(sym, context.enclosingDeclaration, SymbolFlags.All);
|
||||
@@ -8547,7 +8616,11 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
return { introducesError, node };
|
||||
}
|
||||
|
||||
function serializeExistingTypeNode(context: NodeBuilderContext, existing: TypeNode, includePrivateSymbol?: (s: Symbol) => void, bundled?: boolean) {
|
||||
/**
|
||||
* Do you mean to call this directly? You probably should use `tryReuseExistingTypeNode` instead,
|
||||
* which performs sanity checking on the type before doing this.
|
||||
*/
|
||||
function tryReuseExistingTypeNodeHelper(context: NodeBuilderContext, existing: TypeNode, includePrivateSymbol?: (s: Symbol) => void, bundled?: boolean) {
|
||||
if (cancellationToken && cancellationToken.throwIfCancellationRequested) {
|
||||
cancellationToken.throwIfCancellationRequested();
|
||||
}
|
||||
@@ -8669,6 +8742,16 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
node.isTypeOf,
|
||||
);
|
||||
}
|
||||
if (isParameter(node)) {
|
||||
if (!node.type && !node.initializer) {
|
||||
return factory.updateParameterDeclaration(node, /*modifiers*/ undefined, node.dotDotDotToken, visitEachChild(node.name, visitExistingNodeTreeSymbols, /*context*/ undefined), node.questionToken, factory.createKeywordTypeNode(SyntaxKind.AnyKeyword), /*initializer*/ undefined);
|
||||
}
|
||||
}
|
||||
if (isPropertySignature(node)) {
|
||||
if (!node.type && !node.initializer) {
|
||||
return factory.updatePropertySignature(node, node.modifiers, node.name, node.questionToken, factory.createKeywordTypeNode(SyntaxKind.AnyKeyword));
|
||||
}
|
||||
}
|
||||
|
||||
if (isEntityName(node) || isEntityNameExpression(node)) {
|
||||
const { introducesError, node: result } = trackExistingEntityName(node, context, includePrivateSymbol);
|
||||
@@ -8678,7 +8761,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
}
|
||||
}
|
||||
|
||||
if (file && isTupleTypeNode(node) && (getLineAndCharacterOfPosition(file, node.pos).line === getLineAndCharacterOfPosition(file, node.end).line)) {
|
||||
if (file && isTupleTypeNode(node) && !nodeIsSynthesized(node) && (getLineAndCharacterOfPosition(file, node.pos).line === getLineAndCharacterOfPosition(file, node.end).line)) {
|
||||
setEmitFlags(node, EmitFlags.SingleLine);
|
||||
}
|
||||
|
||||
@@ -9272,7 +9355,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
context.enclosingDeclaration = jsdocAliasDecl;
|
||||
const typeNode = jsdocAliasDecl && jsdocAliasDecl.typeExpression
|
||||
&& isJSDocTypeExpression(jsdocAliasDecl.typeExpression)
|
||||
&& serializeExistingTypeNode(context, jsdocAliasDecl.typeExpression.type, includePrivateSymbol, bundled)
|
||||
&& tryReuseExistingNonParameterTypeNode(context, jsdocAliasDecl.typeExpression.type, aliasType, /*host*/ undefined, includePrivateSymbol, bundled)
|
||||
|| typeToTypeNodeHelper(aliasType, context);
|
||||
addResult(
|
||||
setSyntheticLeadingComments(
|
||||
@@ -9503,7 +9586,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
return cleanup(factory.createExpressionWithTypeArguments(
|
||||
expr,
|
||||
map(e.typeArguments, a =>
|
||||
serializeExistingTypeNode(context, a, includePrivateSymbol, bundled)
|
||||
tryReuseExistingNonParameterTypeNode(context, a, getTypeFromTypeNode(a), /*host*/ undefined, includePrivateSymbol, bundled)
|
||||
|| typeToTypeNodeHelper(getTypeFromTypeNode(a), context)),
|
||||
));
|
||||
|
||||
@@ -9961,6 +10044,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
// whose input is not type annotated (if the input symbol has an annotation we can reuse, we should prefer it)
|
||||
const ctxSrc = getSourceFileOfNode(context.enclosingDeclaration);
|
||||
return getObjectFlags(typeToSerialize) & (ObjectFlags.Anonymous | ObjectFlags.Mapped) &&
|
||||
!some(typeToSerialize.symbol?.declarations, isTypeNode) && // If the type comes straight from a type node, we shouldn't try to break it up
|
||||
!length(getIndexInfosOfType(typeToSerialize)) &&
|
||||
!isClassInstanceSide(typeToSerialize) && // While a class instance is potentially representable as a NS, prefer printing a reference to the instance type and serializing the class
|
||||
!!(length(filter(getPropertiesOfType(typeToSerialize), isNamespaceMember)) || length(getSignaturesOfType(typeToSerialize, SignatureKind.Call))) &&
|
||||
@@ -48567,19 +48651,56 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
}
|
||||
// Get type of the symbol if this is the valid symbol otherwise get type at location
|
||||
const symbol = getSymbolOfDeclaration(declaration);
|
||||
let type = symbol && !(symbol.flags & (SymbolFlags.TypeLiteral | SymbolFlags.Signature))
|
||||
const type = symbol && !(symbol.flags & (SymbolFlags.TypeLiteral | SymbolFlags.Signature))
|
||||
? getWidenedLiteralType(getTypeOfSymbol(symbol))
|
||||
: errorType;
|
||||
if (
|
||||
type.flags & TypeFlags.UniqueESSymbol &&
|
||||
type.symbol === symbol
|
||||
) {
|
||||
flags |= NodeBuilderFlags.AllowUniqueESSymbolType;
|
||||
|
||||
return nodeBuilder.serializeTypeForDeclaration(type, symbol, addUndefined, enclosingDeclaration, flags | NodeBuilderFlags.MultilineObjectLiterals, tracker);
|
||||
}
|
||||
|
||||
type DeclarationWithPotentialInnerNodeReuse =
|
||||
| SignatureDeclaration
|
||||
| AccessorDeclaration
|
||||
| VariableLikeDeclaration
|
||||
| PropertyAccessExpression
|
||||
| ExportAssignment;
|
||||
|
||||
function isDeclarationWithPossibleInnerTypeNodeReuse(declaration: Declaration): declaration is DeclarationWithPotentialInnerNodeReuse {
|
||||
return isFunctionLike(declaration) || isExportAssignment(declaration) || isVariableLike(declaration);
|
||||
}
|
||||
|
||||
function getPossibleTypeNodeReuseExpression(declaration: DeclarationWithPotentialInnerNodeReuse) {
|
||||
return isFunctionLike(declaration) && !isSetAccessor(declaration)
|
||||
? getSingleReturnExpression(declaration)
|
||||
: isExportAssignment(declaration)
|
||||
? declaration.expression
|
||||
: !!(declaration as HasInitializer).initializer
|
||||
? (declaration as HasInitializer & typeof declaration).initializer
|
||||
: isParameter(declaration) && isSetAccessor(declaration.parent)
|
||||
? getSingleReturnExpression(getAllAccessorDeclarations(getSymbolOfDeclaration(declaration.parent)?.declarations, declaration.parent).getAccessor)
|
||||
: undefined;
|
||||
}
|
||||
|
||||
function getSingleReturnExpression(declaration: SignatureDeclaration | undefined): Expression | undefined {
|
||||
let candidateExpr: Expression | undefined;
|
||||
if (declaration && !nodeIsMissing((declaration as FunctionLikeDeclaration).body)) {
|
||||
const body = (declaration as FunctionLikeDeclaration).body;
|
||||
if (body && isBlock(body)) {
|
||||
forEachReturnStatement(body, s => {
|
||||
if (!candidateExpr) {
|
||||
candidateExpr = s.expression;
|
||||
}
|
||||
else {
|
||||
candidateExpr = undefined;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
candidateExpr = body;
|
||||
}
|
||||
}
|
||||
if (addUndefined) {
|
||||
type = getOptionalType(type);
|
||||
}
|
||||
return nodeBuilder.typeToTypeNode(type, enclosingDeclaration, flags | NodeBuilderFlags.MultilineObjectLiterals, tracker);
|
||||
return candidateExpr;
|
||||
}
|
||||
|
||||
function createReturnTypeOfSignatureDeclaration(signatureDeclarationIn: SignatureDeclaration, enclosingDeclaration: Node, flags: NodeBuilderFlags, tracker: SymbolTracker) {
|
||||
@@ -48593,7 +48714,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
// Inferred type predicates
|
||||
return nodeBuilder.typePredicateToTypePredicateNode(typePredicate, enclosingDeclaration, flags | NodeBuilderFlags.MultilineObjectLiterals, tracker);
|
||||
}
|
||||
return nodeBuilder.typeToTypeNode(getReturnTypeOfSignature(signature), enclosingDeclaration, flags | NodeBuilderFlags.MultilineObjectLiterals, tracker);
|
||||
return nodeBuilder.expressionOrTypeToTypeNode(getPossibleTypeNodeReuseExpression(signatureDeclaration), getReturnTypeOfSignature(signature), /*addUndefined*/ undefined, enclosingDeclaration, flags | NodeBuilderFlags.MultilineObjectLiterals, tracker);
|
||||
}
|
||||
|
||||
function createTypeOfExpression(exprIn: Expression, enclosingDeclaration: Node, flags: NodeBuilderFlags, tracker: SymbolTracker) {
|
||||
@@ -48602,7 +48723,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
return factory.createToken(SyntaxKind.AnyKeyword) as KeywordTypeNode;
|
||||
}
|
||||
const type = getWidenedType(getRegularTypeOfExpression(expr));
|
||||
return nodeBuilder.typeToTypeNode(type, enclosingDeclaration, flags | NodeBuilderFlags.MultilineObjectLiterals, tracker);
|
||||
return nodeBuilder.expressionOrTypeToTypeNode(expr, type, /*addUndefined*/ undefined, enclosingDeclaration, flags | NodeBuilderFlags.MultilineObjectLiterals, tracker);
|
||||
}
|
||||
|
||||
function hasGlobalName(name: string): boolean {
|
||||
|
||||
@@ -6517,7 +6517,7 @@ export function identifierIsThisKeyword(id: Identifier): boolean {
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
export function getAllAccessorDeclarations(declarations: readonly Declaration[], accessor: AccessorDeclaration): AllAccessorDeclarations {
|
||||
export function getAllAccessorDeclarations(declarations: readonly Declaration[] | undefined, accessor: AccessorDeclaration): AllAccessorDeclarations {
|
||||
// TODO: GH#18217
|
||||
let firstAccessor!: AccessorDeclaration;
|
||||
let secondAccessor!: AccessorDeclaration;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// from webpack/lib/Compilation.js and filed at #26427
|
||||
/** @param {{ [s: string]: number }} map */
|
||||
function mappy(map) {}
|
||||
>mappy : (map: { [s: string]: number; }) => void
|
||||
>mappy : (map: { [s: string]: number;}) => void
|
||||
>map : { [s: string]: number; }
|
||||
|
||||
export class C {
|
||||
|
||||
@@ -8,7 +8,7 @@ module M {
|
||||
>C : C
|
||||
|
||||
m(fn:{ (n:number):string; },n2:number):string {
|
||||
>m : (fn: (n: number) => string, n2: number) => string
|
||||
>m : (fn: { (n: number): string;}, n2: number) => string
|
||||
>fn : (n: number) => string
|
||||
>n : number
|
||||
>n2 : number
|
||||
|
||||
@@ -35,7 +35,7 @@ function foo(animals: IAnimal[]) { }
|
||||
>animals : IAnimal[]
|
||||
|
||||
function bar(animals: { [n: number]: IAnimal }) { }
|
||||
>bar : (animals: { [n: number]: IAnimal; }) => void
|
||||
>bar : (animals: { [n: number]: IAnimal;}) => void
|
||||
>animals : { [n: number]: IAnimal; }
|
||||
>n : number
|
||||
|
||||
|
||||
@@ -130,7 +130,7 @@ var a17: {
|
||||
|
||||
};
|
||||
var a18: {
|
||||
>a18 : { (x: { (a: number): number; (a: string): string; }): any[]; (x: { (a: boolean): boolean; (a: Date): Date; }): any[]; }
|
||||
>a18 : { (x: { (a: number): number; (a: string): string;}): any[]; (x: { (a: boolean): boolean; (a: Date): Date;}): any[]; }
|
||||
|
||||
(x: {
|
||||
>x : { (a: number): number; (a: string): string; }
|
||||
|
||||
@@ -81,7 +81,7 @@ module Errors {
|
||||
>b : number
|
||||
|
||||
var a16: {
|
||||
>a16 : { (x: { (a: number): number; (a?: number): number; }): number[]; (x: { (a: boolean): boolean; (a?: boolean): boolean; }): boolean[]; }
|
||||
>a16 : { (x: { (a: number): number; (a?: number): number;}): number[]; (x: { (a: boolean): boolean; (a?: boolean): boolean;}): boolean[]; }
|
||||
|
||||
(x: {
|
||||
>x : { (a: number): number; (a?: number): number; }
|
||||
|
||||
@@ -130,7 +130,7 @@ var a17: {
|
||||
|
||||
};
|
||||
var a18: {
|
||||
>a18 : { new (x: { new (a: number): number; new (a: string): string; }): any[]; new (x: { new (a: boolean): boolean; new (a: Date): Date; }): any[]; }
|
||||
>a18 : { new (x: { new (a: number): number; new (a: string): string;}): any[]; new (x: { new (a: boolean): boolean; new (a: Date): Date;}): any[]; }
|
||||
|
||||
new (x: {
|
||||
>x : { new (a: number): number; new (a: string): string; }
|
||||
|
||||
@@ -81,7 +81,7 @@ module Errors {
|
||||
>b : number
|
||||
|
||||
var a16: {
|
||||
>a16 : { new (x: { new (a: number): number; new (a?: number): number; }): number[]; new (x: { new (a: boolean): boolean; new (a?: boolean): boolean; }): boolean[]; }
|
||||
>a16 : { new (x: { new (a: number): number; new (a?: number): number;}): number[]; new (x: { new (a: boolean): boolean; new (a?: boolean): boolean;}): boolean[]; }
|
||||
|
||||
new (x: {
|
||||
>x : { new (a: number): number; new (a?: number): number; }
|
||||
|
||||
@@ -104,7 +104,7 @@ h(async v => v ? (def) => { } : Promise.reject());
|
||||
|
||||
// repro from #29196
|
||||
const increment: (
|
||||
>increment : (num: number, str: string) => string | Promise<string | ((s: string) => any)>
|
||||
>increment : (num: number, str: string) => Promise<((s: string) => any) | string> | string
|
||||
|
||||
num: number,
|
||||
>num : number
|
||||
@@ -130,7 +130,7 @@ const increment: (
|
||||
}
|
||||
|
||||
const increment2: (
|
||||
>increment2 : (num: number, str: string) => Promise<string | ((s: string) => any)>
|
||||
>increment2 : (num: number, str: string) => Promise<((s: string) => any) | string>
|
||||
|
||||
num: number,
|
||||
>num : number
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
declare namespace Windows.Foundation {
|
||||
interface IPromise<TResult> {
|
||||
then<U>(success?: (value: TResult) => IPromise<U>, error?: (error: any) => IPromise<U>, progress?: (progress: any) => void): IPromise<U>;
|
||||
>then : { <U>(success?: ((value: TResult) => IPromise<U>) | undefined, error?: ((error: any) => IPromise<U>) | undefined, progress?: ((progress: any) => void) | undefined): IPromise<U>; <U_1>(success?: ((value: TResult) => IPromise<U_1>) | undefined, error?: ((error: any) => U_1) | undefined, progress?: ((progress: any) => void) | undefined): IPromise<U_1>; <U_2>(success?: ((value: TResult) => U_2) | undefined, error?: ((error: any) => IPromise<U_2>) | undefined, progress?: ((progress: any) => void) | undefined): IPromise<U_2>; <U_3>(success?: ((value: TResult) => U_3) | undefined, error?: ((error: any) => U_3) | undefined, progress?: ((progress: any) => void) | undefined): IPromise<U_3>; }
|
||||
>then : { <U>(success?: (value: TResult) => IPromise<U>, error?: (error: any) => IPromise<U>, progress?: (progress: any) => void): IPromise<U>; <U_1>(success?: ((value: TResult) => IPromise<U_1>) | undefined, error?: ((error: any) => U_1) | undefined, progress?: ((progress: any) => void) | undefined): IPromise<U_1>; <U_2>(success?: ((value: TResult) => U_2) | undefined, error?: ((error: any) => IPromise<U_2>) | undefined, progress?: ((progress: any) => void) | undefined): IPromise<U_2>; <U_3>(success?: ((value: TResult) => U_3) | undefined, error?: ((error: any) => U_3) | undefined, progress?: ((progress: any) => void) | undefined): IPromise<U_3>; }
|
||||
>success : ((value: TResult) => IPromise<U>) | undefined
|
||||
>value : TResult
|
||||
>error : ((error: any) => IPromise<U>) | undefined
|
||||
@@ -13,7 +13,7 @@ declare namespace Windows.Foundation {
|
||||
>progress : any
|
||||
|
||||
then<U>(success?: (value: TResult) => IPromise<U>, error?: (error: any) => U, progress?: (progress: any) => void): IPromise<U>;
|
||||
>then : { <U_1>(success?: ((value: TResult) => IPromise<U_1>) | undefined, error?: ((error: any) => IPromise<U_1>) | undefined, progress?: ((progress: any) => void) | undefined): IPromise<U_1>; <U>(success?: ((value: TResult) => IPromise<U>) | undefined, error?: ((error: any) => U) | undefined, progress?: ((progress: any) => void) | undefined): IPromise<U>; <U_2>(success?: ((value: TResult) => U_2) | undefined, error?: ((error: any) => IPromise<U_2>) | undefined, progress?: ((progress: any) => void) | undefined): IPromise<U_2>; <U_3>(success?: ((value: TResult) => U_3) | undefined, error?: ((error: any) => U_3) | undefined, progress?: ((progress: any) => void) | undefined): IPromise<U_3>; }
|
||||
>then : { <U_1>(success?: ((value: TResult) => IPromise<U_1>) | undefined, error?: ((error: any) => IPromise<U_1>) | undefined, progress?: ((progress: any) => void) | undefined): IPromise<U_1>; <U>(success?: (value: TResult) => IPromise<U>, error?: (error: any) => U, progress?: (progress: any) => void): IPromise<U>; <U_2>(success?: ((value: TResult) => U_2) | undefined, error?: ((error: any) => IPromise<U_2>) | undefined, progress?: ((progress: any) => void) | undefined): IPromise<U_2>; <U_3>(success?: ((value: TResult) => U_3) | undefined, error?: ((error: any) => U_3) | undefined, progress?: ((progress: any) => void) | undefined): IPromise<U_3>; }
|
||||
>success : ((value: TResult) => IPromise<U>) | undefined
|
||||
>value : TResult
|
||||
>error : ((error: any) => U) | undefined
|
||||
@@ -22,7 +22,7 @@ declare namespace Windows.Foundation {
|
||||
>progress : any
|
||||
|
||||
then<U>(success?: (value: TResult) => U, error?: (error: any) => IPromise<U>, progress?: (progress: any) => void): IPromise<U>;
|
||||
>then : { <U_1>(success?: ((value: TResult) => IPromise<U_1>) | undefined, error?: ((error: any) => IPromise<U_1>) | undefined, progress?: ((progress: any) => void) | undefined): IPromise<U_1>; <U_2>(success?: ((value: TResult) => IPromise<U_2>) | undefined, error?: ((error: any) => U_2) | undefined, progress?: ((progress: any) => void) | undefined): IPromise<U_2>; <U>(success?: ((value: TResult) => U) | undefined, error?: ((error: any) => IPromise<U>) | undefined, progress?: ((progress: any) => void) | undefined): IPromise<U>; <U_3>(success?: ((value: TResult) => U_3) | undefined, error?: ((error: any) => U_3) | undefined, progress?: ((progress: any) => void) | undefined): IPromise<U_3>; }
|
||||
>then : { <U_1>(success?: ((value: TResult) => IPromise<U_1>) | undefined, error?: ((error: any) => IPromise<U_1>) | undefined, progress?: ((progress: any) => void) | undefined): IPromise<U_1>; <U_2>(success?: ((value: TResult) => IPromise<U_2>) | undefined, error?: ((error: any) => U_2) | undefined, progress?: ((progress: any) => void) | undefined): IPromise<U_2>; <U>(success?: (value: TResult) => U, error?: (error: any) => IPromise<U>, progress?: (progress: any) => void): IPromise<U>; <U_3>(success?: ((value: TResult) => U_3) | undefined, error?: ((error: any) => U_3) | undefined, progress?: ((progress: any) => void) | undefined): IPromise<U_3>; }
|
||||
>success : ((value: TResult) => U) | undefined
|
||||
>value : TResult
|
||||
>error : ((error: any) => IPromise<U>) | undefined
|
||||
@@ -31,7 +31,7 @@ declare namespace Windows.Foundation {
|
||||
>progress : any
|
||||
|
||||
then<U>(success?: (value: TResult) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise<U>;
|
||||
>then : { <U_1>(success?: ((value: TResult) => IPromise<U_1>) | undefined, error?: ((error: any) => IPromise<U_1>) | undefined, progress?: ((progress: any) => void) | undefined): IPromise<U_1>; <U_2>(success?: ((value: TResult) => IPromise<U_2>) | undefined, error?: ((error: any) => U_2) | undefined, progress?: ((progress: any) => void) | undefined): IPromise<U_2>; <U_3>(success?: ((value: TResult) => U_3) | undefined, error?: ((error: any) => IPromise<U_3>) | undefined, progress?: ((progress: any) => void) | undefined): IPromise<U_3>; <U>(success?: ((value: TResult) => U) | undefined, error?: ((error: any) => U) | undefined, progress?: ((progress: any) => void) | undefined): IPromise<U>; }
|
||||
>then : { <U_1>(success?: ((value: TResult) => IPromise<U_1>) | undefined, error?: ((error: any) => IPromise<U_1>) | undefined, progress?: ((progress: any) => void) | undefined): IPromise<U_1>; <U_2>(success?: ((value: TResult) => IPromise<U_2>) | undefined, error?: ((error: any) => U_2) | undefined, progress?: ((progress: any) => void) | undefined): IPromise<U_2>; <U_3>(success?: ((value: TResult) => U_3) | undefined, error?: ((error: any) => IPromise<U_3>) | undefined, progress?: ((progress: any) => void) | undefined): IPromise<U_3>; <U>(success?: (value: TResult) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise<U>; }
|
||||
>success : ((value: TResult) => U) | undefined
|
||||
>value : TResult
|
||||
>error : ((error: any) => U) | undefined
|
||||
@@ -40,7 +40,7 @@ declare namespace Windows.Foundation {
|
||||
>progress : any
|
||||
|
||||
done<U>(success?: (value: TResult) => any, error?: (error: any) => any, progress?: (progress: any) => void): void;
|
||||
>done : <U>(success?: ((value: TResult) => any) | undefined, error?: ((error: any) => any) | undefined, progress?: ((progress: any) => void) | undefined) => void
|
||||
>done : <U>(success?: (value: TResult) => any, error?: (error: any) => any, progress?: (progress: any) => void) => void
|
||||
>success : ((value: TResult) => any) | undefined
|
||||
>value : TResult
|
||||
>error : ((error: any) => any) | undefined
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ declare const foo: ["a", string, number] | ["b", string, boolean];
|
||||
>foo : ["a", string, number] | ["b", string, boolean]
|
||||
|
||||
export function test(arg: { index?: number }) {
|
||||
>test : (arg: { index?: number | undefined; }) => void
|
||||
>test : (arg: { index?: number;}) => void
|
||||
>arg : { index?: number | undefined; }
|
||||
>index : number | undefined
|
||||
|
||||
|
||||
@@ -175,7 +175,7 @@ interface Obj { x: number }
|
||||
>x : number
|
||||
|
||||
async function fn<T>(): Promise<T extends object ? { [K in keyof T]: Obj } : Obj> {
|
||||
>fn : <T>() => Promise<T extends object ? { [K in keyof T]: Obj; } : Obj>
|
||||
>fn : <T>() => Promise<T extends object ? { [K in keyof T]: Obj;} : Obj>
|
||||
|
||||
// Per #45924, this was failing due to incorrect inference both above and here.
|
||||
// Should not error.
|
||||
|
||||
@@ -134,7 +134,7 @@ interface A { // T
|
||||
|
||||
};
|
||||
a18: {
|
||||
>a18 : { (x: { (a: number): number; (a: string): string; }): any[]; (x: { (a: boolean): boolean; (a: Date): Date; }): any[]; }
|
||||
>a18 : { (x: { (a: number): number; (a: string): string;}): any[]; (x: { (a: boolean): boolean; (a: Date): Date;}): any[]; }
|
||||
|
||||
(x: {
|
||||
>x : { (a: number): number; (a: string): string; }
|
||||
|
||||
@@ -81,7 +81,7 @@ module Errors {
|
||||
>b : number
|
||||
|
||||
a16: {
|
||||
>a16 : { (x: { (a: number): number; (a?: number): number; }): number[]; (x: { (a: boolean): boolean; (a?: boolean): boolean; }): boolean[]; }
|
||||
>a16 : { (x: { (a: number): number; (a?: number): number;}): number[]; (x: { (a: boolean): boolean; (a?: boolean): boolean;}): boolean[]; }
|
||||
|
||||
// type of parameter is overload set which means we can't do inference based on this type
|
||||
(x: {
|
||||
|
||||
@@ -53,13 +53,13 @@ function test2() {
|
||||
|
||||
interface Messages {
|
||||
readonly foo: (options: { [key: string]: any, b: number }) => string;
|
||||
>foo : (options: { [key: string]: any; b: number; }) => string
|
||||
>foo : (options: { [key: string]: any; b: number;}) => string
|
||||
>options : { [key: string]: any; b: number; }
|
||||
>key : string
|
||||
>b : number
|
||||
|
||||
readonly bar: (options: { [key: string]: any, a: string }) => string;
|
||||
>bar : (options: { [key: string]: any; a: string; }) => string
|
||||
>bar : (options: { [key: string]: any; a: string;}) => string
|
||||
>options : { [key: string]: any; a: string; }
|
||||
>key : string
|
||||
>a : string
|
||||
|
||||
@@ -35,9 +35,9 @@ let a;
|
||||
>a : any
|
||||
|
||||
function foo3(y = { x: <typeof z>a }, z = 1) {
|
||||
>foo3 : (y?: { x: number; }, z?: number) => void
|
||||
>y : { x: number; }
|
||||
>{ x: <typeof z>a } : { x: number; }
|
||||
>foo3 : (y?: { x: typeof z; }, z?: number) => void
|
||||
>y : { x: typeof z; }
|
||||
>{ x: <typeof z>a } : { x: typeof z; }
|
||||
>x : number
|
||||
><typeof z>a : number
|
||||
>z : number
|
||||
|
||||
@@ -70,7 +70,7 @@ interface Action<TName extends string, TPayload> {
|
||||
name: TName;
|
||||
payload: TPayload;
|
||||
}
|
||||
declare const actionA: Action<"ACTION_A", string>;
|
||||
declare const actionB: Action<"ACTION_B", boolean>;
|
||||
declare const actionA: Action<'ACTION_A', string>;
|
||||
declare const actionB: Action<'ACTION_B', boolean>;
|
||||
declare function call<TName extends string, TPayload>(action: Action<TName, TPayload>, fn: (action: Action<TName, TPayload>) => any): void;
|
||||
declare const printFn: (action: typeof actionA | typeof actionB) => void;
|
||||
|
||||
@@ -12,7 +12,7 @@ var v12: (arguments: number, ...restParameters) => void; // no error - no code g
|
||||
>restParameters : any[]
|
||||
|
||||
var v2: {
|
||||
>v2 : { (arguments: number, ...restParameters: any[]): any; new (arguments: number, ...restParameters: any[]): any; foo(arguments: number, ...restParameters: any[]): any; prop: (arguments: number, ...restParameters: any[]) => void; }
|
||||
>v2 : { (arguments: number, ...restParameters: any[]): any; new (arguments: number, ...restParameters: any[]): any; foo(arguments: number, ...restParameters: any[]): any; prop: (arguments: number, ...restParameters: any) => void; }
|
||||
|
||||
(arguments: number, ...restParameters); // no error - no code gen
|
||||
>arguments : number
|
||||
@@ -33,7 +33,7 @@ var v2: {
|
||||
>restParameters : any[]
|
||||
}
|
||||
var v21: {
|
||||
>v21 : { (i: number, ...arguments: any[]): any; new (i: number, ...arguments: any[]): any; foo(i: number, ...arguments: any[]): any; prop: (i: number, ...arguments: any[]) => void; }
|
||||
>v21 : { (i: number, ...arguments: any[]): any; new (i: number, ...arguments: any[]): any; foo(i: number, ...arguments: any[]): any; prop: (i: number, ...arguments: any) => void; }
|
||||
|
||||
(i: number, ...arguments); // no error - no code gen
|
||||
>i : number
|
||||
|
||||
@@ -7,7 +7,7 @@ var v1: (_i: number, ...restParameters) => void; // no error - no code gen
|
||||
>restParameters : any[]
|
||||
|
||||
var v2: {
|
||||
>v2 : { (_i: number, ...restParameters: any[]): any; new (_i: number, ...restParameters: any[]): any; foo(_i: number, ...restParameters: any[]): any; prop: (_i: number, ...restParameters: any[]) => void; }
|
||||
>v2 : { (_i: number, ...restParameters: any[]): any; new (_i: number, ...restParameters: any[]): any; foo(_i: number, ...restParameters: any[]): any; prop: (_i: number, ...restParameters: any) => void; }
|
||||
|
||||
(_i: number, ...restParameters); // no error - no code gen
|
||||
>_i : number
|
||||
|
||||
@@ -425,12 +425,12 @@ declare module Immutable {
|
||||
>value : this
|
||||
|
||||
merge(...collections: Array<Collection<K, V> | {[key: string]: V}>): this;
|
||||
>merge : (...collections: (Collection<K, V> | { [key: string]: V; })[]) => this
|
||||
>merge : (...collections: Array<Collection<K, V> | { [key: string]: V;}>) => this
|
||||
>collections : (Collection<K, V> | { [key: string]: V; })[]
|
||||
>key : string
|
||||
|
||||
mergeWith(merger: (oldVal: V, newVal: V, key: K) => V, ...collections: Array<Collection<K, V> | {[key: string]: V}>): this;
|
||||
>mergeWith : (merger: (oldVal: V, newVal: V, key: K) => V, ...collections: (Collection<K, V> | { [key: string]: V; })[]) => this
|
||||
>mergeWith : (merger: (oldVal: V, newVal: V, key: K) => V, ...collections: Array<Collection<K, V> | { [key: string]: V;}>) => this
|
||||
>merger : (oldVal: V, newVal: V, key: K) => V
|
||||
>oldVal : V
|
||||
>newVal : V
|
||||
@@ -439,12 +439,12 @@ declare module Immutable {
|
||||
>key : string
|
||||
|
||||
mergeDeep(...collections: Array<Collection<K, V> | {[key: string]: V}>): this;
|
||||
>mergeDeep : (...collections: (Collection<K, V> | { [key: string]: V; })[]) => this
|
||||
>mergeDeep : (...collections: Array<Collection<K, V> | { [key: string]: V;}>) => this
|
||||
>collections : (Collection<K, V> | { [key: string]: V; })[]
|
||||
>key : string
|
||||
|
||||
mergeDeepWith(merger: (oldVal: V, newVal: V, key: K) => V, ...collections: Array<Collection<K, V> | {[key: string]: V}>): this;
|
||||
>mergeDeepWith : (merger: (oldVal: V, newVal: V, key: K) => V, ...collections: (Collection<K, V> | { [key: string]: V; })[]) => this
|
||||
>mergeDeepWith : (merger: (oldVal: V, newVal: V, key: K) => V, ...collections: Array<Collection<K, V> | { [key: string]: V;}>) => this
|
||||
>merger : (oldVal: V, newVal: V, key: K) => V
|
||||
>oldVal : V
|
||||
>newVal : V
|
||||
@@ -507,7 +507,7 @@ declare module Immutable {
|
||||
>collections : Iterable<[KC, VC]>[]
|
||||
|
||||
concat<C>(...collections: Array<{[key: string]: C}>): Map<K | string, V | C>;
|
||||
>concat : { <KC, VC>(...collections: Iterable<[KC, VC]>[]): Map<K | KC, V | VC>; <C>(...collections: { [key: string]: C; }[]): Map<K | string, V | C>; }
|
||||
>concat : { <KC, VC>(...collections: Iterable<[KC, VC]>[]): Map<K | KC, V | VC>; <C>(...collections: Array<{ [key: string]: C;}>): Map<K | string, V | C>; }
|
||||
>collections : { [key: string]: C; }[]
|
||||
>key : string
|
||||
|
||||
@@ -592,7 +592,7 @@ declare module Immutable {
|
||||
>collections : Iterable<[KC, VC]>[]
|
||||
|
||||
concat<C>(...collections: Array<{[key: string]: C}>): OrderedMap<K | string, V | C>;
|
||||
>concat : { <KC, VC>(...collections: Iterable<[KC, VC]>[]): OrderedMap<K | KC, V | VC>; <C>(...collections: { [key: string]: C; }[]): OrderedMap<K | string, V | C>; }
|
||||
>concat : { <KC, VC>(...collections: Iterable<[KC, VC]>[]): OrderedMap<K | KC, V | VC>; <C>(...collections: Array<{ [key: string]: C;}>): OrderedMap<K | string, V | C>; }
|
||||
>collections : { [key: string]: C; }[]
|
||||
>key : string
|
||||
|
||||
@@ -660,7 +660,7 @@ declare module Immutable {
|
||||
>iter : Collection<T, any>
|
||||
|
||||
function fromKeys(obj: {[key: string]: any}): Set<string>;
|
||||
>fromKeys : { <T>(iter: Collection<T, any>): Set<T>; (obj: { [key: string]: any; }): Set<string>; }
|
||||
>fromKeys : { <T>(iter: Collection<T, any>): Set<T>; (obj: { [key: string]: any;}): Set<string>; }
|
||||
>obj : { [key: string]: any; }
|
||||
>key : string
|
||||
|
||||
@@ -782,7 +782,7 @@ declare module Immutable {
|
||||
>iter : Collection<T, any>
|
||||
|
||||
function fromKeys(obj: {[key: string]: any}): OrderedSet<string>;
|
||||
>fromKeys : { <T>(iter: Collection<T, any>): OrderedSet<T>; (obj: { [key: string]: any; }): OrderedSet<string>; }
|
||||
>fromKeys : { <T>(iter: Collection<T, any>): OrderedSet<T>; (obj: { [key: string]: any;}): OrderedSet<string>; }
|
||||
>obj : { [key: string]: any; }
|
||||
>key : string
|
||||
}
|
||||
@@ -1104,7 +1104,7 @@ declare module Immutable {
|
||||
|
||||
// Conversion to JavaScript types
|
||||
toJS(): { [K in keyof T]: any };
|
||||
>toJS : () => { [K in keyof T]: any; }
|
||||
>toJS : () => { [K in keyof T]: any;}
|
||||
|
||||
toJSON(): T;
|
||||
>toJSON : () => T
|
||||
@@ -1163,7 +1163,7 @@ declare module Immutable {
|
||||
>Seq : any
|
||||
|
||||
export function Keyed<V>(obj: {[key: string]: V}): Seq.Keyed<string, V>;
|
||||
>Keyed : { <K, V_1>(collection: Iterable<[K, V_1]>): Keyed<K, V_1>; <V>(obj: { [key: string]: V; }): Seq.Keyed<string, V>; <K_1, V_2>(): Keyed<K_1, V_2>; (): Keyed<any, any>; }
|
||||
>Keyed : { <K, V_1>(collection: Iterable<[K, V_1]>): Keyed<K, V_1>; <V>(obj: { [key: string]: V;}): Seq.Keyed<string, V>; <K_1, V_2>(): Keyed<K_1, V_2>; (): Keyed<any, any>; }
|
||||
>obj : { [key: string]: V; }
|
||||
>key : string
|
||||
>Seq : any
|
||||
@@ -1183,7 +1183,7 @@ declare module Immutable {
|
||||
>toJS : () => Object
|
||||
|
||||
toJSON(): { [key: string]: V };
|
||||
>toJSON : () => { [key: string]: V; }
|
||||
>toJSON : () => { [key: string]: V;}
|
||||
>key : string
|
||||
|
||||
toSeq(): this;
|
||||
@@ -1195,7 +1195,7 @@ declare module Immutable {
|
||||
>Seq : any
|
||||
|
||||
concat<C>(...collections: Array<{[key: string]: C}>): Seq.Keyed<K | string, V | C>;
|
||||
>concat : { <KC, VC>(...collections: Iterable<[KC, VC]>[]): Keyed<K | KC, V | VC>; <C>(...collections: { [key: string]: C; }[]): Seq.Keyed<K | string, V | C>; }
|
||||
>concat : { <KC, VC>(...collections: Iterable<[KC, VC]>[]): Keyed<K | KC, V | VC>; <C>(...collections: Array<{ [key: string]: C;}>): Seq.Keyed<K | string, V | C>; }
|
||||
>collections : { [key: string]: C; }[]
|
||||
>key : string
|
||||
>Seq : any
|
||||
@@ -1507,7 +1507,7 @@ declare module Immutable {
|
||||
>Collection : any
|
||||
|
||||
export function Keyed<V>(obj: {[key: string]: V}): Collection.Keyed<string, V>;
|
||||
>Keyed : { <K, V_1>(collection: Iterable<[K, V_1]>): Keyed<K, V_1>; <V>(obj: { [key: string]: V; }): Collection.Keyed<string, V>; }
|
||||
>Keyed : { <K, V_1>(collection: Iterable<[K, V_1]>): Keyed<K, V_1>; <V>(obj: { [key: string]: V;}): Collection.Keyed<string, V>; }
|
||||
>obj : { [key: string]: V; }
|
||||
>key : string
|
||||
>Collection : any
|
||||
@@ -1517,7 +1517,7 @@ declare module Immutable {
|
||||
>toJS : () => Object
|
||||
|
||||
toJSON(): { [key: string]: V };
|
||||
>toJSON : () => { [key: string]: V; }
|
||||
>toJSON : () => { [key: string]: V;}
|
||||
>key : string
|
||||
|
||||
toSeq(): Seq.Keyed<K, V>;
|
||||
@@ -1534,7 +1534,7 @@ declare module Immutable {
|
||||
>Collection : any
|
||||
|
||||
concat<C>(...collections: Array<{[key: string]: C}>): Collection.Keyed<K | string, V | C>;
|
||||
>concat : { <KC, VC>(...collections: Iterable<[KC, VC]>[]): Keyed<K | KC, V | VC>; <C>(...collections: { [key: string]: C; }[]): Collection.Keyed<K | string, V | C>; }
|
||||
>concat : { <KC, VC>(...collections: Iterable<[KC, VC]>[]): Keyed<K | KC, V | VC>; <C>(...collections: Array<{ [key: string]: C;}>): Collection.Keyed<K | string, V | C>; }
|
||||
>collections : { [key: string]: C; }[]
|
||||
>key : string
|
||||
>Collection : any
|
||||
@@ -1882,18 +1882,18 @@ declare module Immutable {
|
||||
|
||||
// Conversion to JavaScript types
|
||||
toJS(): Array<any> | { [key: string]: any };
|
||||
>toJS : () => any[] | { [key: string]: any; }
|
||||
>toJS : () => Array<any> | { [key: string]: any;}
|
||||
>key : string
|
||||
|
||||
toJSON(): Array<V> | { [key: string]: V };
|
||||
>toJSON : () => V[] | { [key: string]: V; }
|
||||
>toJSON : () => Array<V> | { [key: string]: V;}
|
||||
>key : string
|
||||
|
||||
toArray(): Array<V>;
|
||||
>toArray : () => Array<V>
|
||||
|
||||
toObject(): { [key: string]: V };
|
||||
>toObject : () => { [key: string]: V; }
|
||||
>toObject : () => { [key: string]: V;}
|
||||
>key : string
|
||||
|
||||
// Conversion to Collections
|
||||
|
||||
@@ -52,7 +52,7 @@ module m1 {
|
||||
}
|
||||
|
||||
export function f3(): {
|
||||
>f3 : () => (a: number) => C1
|
||||
>f3 : () => { (a: number): C1;}
|
||||
|
||||
(a: number) : C1;
|
||||
>a : number
|
||||
@@ -74,7 +74,7 @@ module m1 {
|
||||
|
||||
|
||||
export function f5(arg2: {
|
||||
>f5 : (arg2: new (arg1: C1) => C1) => void
|
||||
>f5 : (arg2: { new (arg1: C1): C1;}) => void
|
||||
>arg2 : new (arg1: C1) => C1
|
||||
|
||||
new (arg1: C1) : C1
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
=== computedPropertyNames48_ES5.ts ===
|
||||
declare function extractIndexer<T>(p: { [n: number]: T }): T;
|
||||
>extractIndexer : <T>(p: { [n: number]: T; }) => T
|
||||
>extractIndexer : <T>(p: { [n: number]: T;}) => T
|
||||
>p : { [n: number]: T; }
|
||||
>n : number
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
=== computedPropertyNames48_ES6.ts ===
|
||||
declare function extractIndexer<T>(p: { [n: number]: T }): T;
|
||||
>extractIndexer : <T>(p: { [n: number]: T; }) => T
|
||||
>extractIndexer : <T>(p: { [n: number]: T;}) => T
|
||||
>p : { [n: number]: T; }
|
||||
>n : number
|
||||
|
||||
|
||||
+2
-2
@@ -6,7 +6,7 @@ declare function useState1<S>(initialState: (S extends (() => any) ? never : S)
|
||||
>initialState : (S extends () => any ? never : S) | (() => S)
|
||||
|
||||
declare function useState2<S>(initialState: (S extends ((...args: any[]) => any) ? never : S) | (() => S)): S; // Any args
|
||||
>useState2 : <S>(initialState: (S extends (...args: any[]) => any ? never : S) | (() => S)) => S
|
||||
>useState2 : <S>(initialState: (S extends ((...args: any[]) => any) ? never : S) | (() => S)) => S
|
||||
>initialState : (S extends (...args: any[]) => any ? never : S) | (() => S)
|
||||
>args : any[]
|
||||
|
||||
@@ -31,7 +31,7 @@ declare function useState3<S, T extends S>(initialState: (T extends (() => any)
|
||||
>initialState : (T extends () => any ? never : T) | (() => S)
|
||||
|
||||
declare function useState4<S, T extends S>(initialState: (T extends ((...args: any[]) => any) ? never : T) | (() => S)): S; // Any args
|
||||
>useState4 : <S, T extends S>(initialState: (T extends (...args: any[]) => any ? never : T) | (() => S)) => S
|
||||
>useState4 : <S, T extends S>(initialState: (T extends ((...args: any[]) => any) ? never : T) | (() => S)) => S
|
||||
>initialState : (T extends (...args: any[]) => any ? never : T) | (() => S)
|
||||
>args : any[]
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
=== constraintWithIndexedAccess.ts ===
|
||||
// #52399
|
||||
type DataFetchFns = {
|
||||
>DataFetchFns : { Boat: { requiresLicense: (id: string) => boolean; maxGroundSpeed: (id: string) => number; description: (id: string) => string; displacement: (id: string) => number; name: (id: string) => string; }; Plane: { requiresLicense: (id: string) => boolean; maxGroundSpeed: (id: string) => number; maxTakeoffWeight: (id: string) => number; maxCruisingAltitude: (id: string) => number; name: (id: string) => string; }; }
|
||||
>DataFetchFns : { Boat: { requiresLicense: (id: string) => boolean; maxGroundSpeed: (id: string) => number; description: (id: string) => string; displacement: (id: string) => number; name: (id: string) => string;}; Plane: { requiresLicense: (id: string) => boolean; maxGroundSpeed: (id: string) => number; maxTakeoffWeight: (id: string) => number; maxCruisingAltitude: (id: string) => number; name: (id: string) => string;}; }
|
||||
|
||||
Boat: {
|
||||
>Boat : { requiresLicense: (id: string) => boolean; maxGroundSpeed: (id: string) => number; description: (id: string) => string; displacement: (id: string) => number; name: (id: string) => string; }
|
||||
|
||||
@@ -134,7 +134,7 @@ interface A { // T
|
||||
|
||||
};
|
||||
a18: {
|
||||
>a18 : { new (x: { new (a: number): number; new (a: string): string; }): any[]; new (x: { new (a: boolean): boolean; new (a: Date): Date; }): any[]; }
|
||||
>a18 : { new (x: { new (a: number): number; new (a: string): string;}): any[]; new (x: { new (a: boolean): boolean; new (a: Date): Date;}): any[]; }
|
||||
|
||||
new (x: {
|
||||
>x : { new (a: number): number; new (a: string): string; }
|
||||
|
||||
@@ -81,7 +81,7 @@ module Errors {
|
||||
>b : number
|
||||
|
||||
a16: {
|
||||
>a16 : { new (x: { new (a: number): number; new (a?: number): number; }): number[]; new (x: { new (a: boolean): boolean; new (a?: boolean): boolean; }): boolean[]; }
|
||||
>a16 : { new (x: { new (a: number): number; new (a?: number): number;}): number[]; new (x: { new (a: boolean): boolean; new (a?: boolean): boolean;}): boolean[]; }
|
||||
|
||||
// type of parameter is overload set which means we can't do inference based on this type
|
||||
new (x: {
|
||||
|
||||
@@ -5,7 +5,7 @@ declare namespace app {
|
||||
>app : typeof app
|
||||
|
||||
var foo: {
|
||||
>foo : { bar: { someFun: (arg: number) => void; }; }
|
||||
>foo : { bar: { someFun: (arg: number) => void;}; }
|
||||
|
||||
bar: {
|
||||
>bar : { someFun: (arg: number) => void; }
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// See: https://github.com/microsoft/TypeScript/pull/53280#discussion_r1138684984
|
||||
|
||||
declare function test(
|
||||
>test : (arg: Record<string, (arg: string) => void> | ((arg: number) => void)[]) => void
|
||||
>test : (arg: Record<string, (arg: string) => void> | Array<(arg: number) => void>) => void
|
||||
|
||||
arg: Record<string, (arg: string) => void> | Array<(arg: number) => void>
|
||||
>arg : Record<string, (arg: string) => void> | ((arg: number) => void)[]
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// See: https://github.com/microsoft/TypeScript/pull/53280#discussion_r1138684984
|
||||
|
||||
declare function test(
|
||||
>test : (arg: Record<string, (arg: string) => void> | ((arg: number) => void)[]) => void
|
||||
>test : (arg: Record<string, (arg: string) => void> | Array<(arg: number) => void>) => void
|
||||
|
||||
arg: Record<string, (arg: string) => void> | Array<(arg: number) => void>
|
||||
>arg : Record<string, (arg: string) => void> | ((arg: number) => void)[]
|
||||
|
||||
@@ -5,7 +5,7 @@ type Keys = "a" | "b";
|
||||
>Keys : "a" | "b"
|
||||
|
||||
type OptionsForKey = { a: { cb: (p: number) => number } } & { b: {} };
|
||||
>OptionsForKey : { a: { cb: (p: number) => number; }; } & { b: {}; }
|
||||
>OptionsForKey : { a: { cb: (p: number) => number;}; } & { b: {}; }
|
||||
>a : { cb: (p: number) => number; }
|
||||
>cb : (p: number) => number
|
||||
>p : number
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
=== contextualTypeOnYield1.ts ===
|
||||
type FuncOrGeneratorFunc = () => (number | Generator<(arg: number) => void, any, void>)
|
||||
>FuncOrGeneratorFunc : () => number | Generator<(arg: number) => void, any, void>
|
||||
>FuncOrGeneratorFunc : () => (number | Generator<(arg: number) => void, any, void>)
|
||||
>arg : number
|
||||
|
||||
const f: FuncOrGeneratorFunc = function*() {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
=== contextualTypeOnYield2.ts ===
|
||||
type OrGen = () => (number | Generator<string, (arg: number) => void, undefined>);
|
||||
>OrGen : () => number | Generator<string, (arg: number) => void, undefined>
|
||||
>OrGen : () => (number | Generator<string, (arg: number) => void, undefined>)
|
||||
>arg : number
|
||||
|
||||
const g: OrGen = function* () {
|
||||
|
||||
@@ -327,7 +327,7 @@ interface IPlaceHolder {
|
||||
}
|
||||
|
||||
var objc8: {
|
||||
>objc8 : { t1: (s: string) => string; t2: IFoo; t3: number[]; t4: () => IFoo; t5: (n: number) => IFoo; t6: (n: number, s: string) => IFoo; t7: (n: number, s: string) => number; t8: (n: number, s: string) => number; t9: number[][]; t10: IFoo[]; t11: ((n: number, s: string) => string)[]; t12: IBar; t13: IFoo; t14: IFoo; }
|
||||
>objc8 : { t1: (s: string) => string; t2: IFoo; t3: number[]; t4: () => IFoo; t5: (n: number) => IFoo; t6: (n: number, s: string) => IFoo; t7: { (n: number, s: string): number;}; t8: (n: number, s: string) => number; t9: number[][]; t10: IFoo[]; t11: { (n: number, s: string): string;}[]; t12: IBar; t13: IFoo; t14: IFoo; }
|
||||
|
||||
t1: (s: string) => string;
|
||||
>t1 : (s: string) => string
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
=== contextualTyping23.ts ===
|
||||
var foo:(a:{():number; (i:number):number; })=>number; foo = function(a){return 5};
|
||||
>foo : (a: { (): number; (i: number): number; }) => number
|
||||
>foo : (a: { (): number; (i: number): number;}) => number
|
||||
>a : { (): number; (i: number): number; }
|
||||
>i : number
|
||||
>foo = function(a){return 5} : (a: { (): number; (i: number): number; }) => number
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
=== contextualTyping24.ts ===
|
||||
var foo:(a:{():number; (i:number):number; })=>number; foo = function(this: void, a:string){return 5};
|
||||
>foo : (a: { (): number; (i: number): number; }) => number
|
||||
>foo : (a: { (): number; (i: number): number;}) => number
|
||||
>a : { (): number; (i: number): number; }
|
||||
>i : number
|
||||
>foo = function(this: void, a:string){return 5} : (this: void, a: string) => number
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
=== contextualTyping32.ts ===
|
||||
function foo(param: {():number; (i:number):number; }[]) { }; foo([function(){return 1;}, function(){return 4}]);
|
||||
>foo : (param: { (): number; (i: number): number; }[]) => void
|
||||
>foo : (param: { (): number; (i: number): number;}[]) => void
|
||||
>param : { (): number; (i: number): number; }[]
|
||||
>i : number
|
||||
>foo([function(){return 1;}, function(){return 4}]) : void
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
=== contextualTyping33.ts ===
|
||||
function foo(param: {():number; (i:number):number; }[]) { }; foo([function(){return 1;}, function(){return "foo"}]);
|
||||
>foo : (param: { (): number; (i: number): number; }[]) => void
|
||||
>foo : (param: { (): number; (i: number): number;}[]) => void
|
||||
>param : { (): number; (i: number): number; }[]
|
||||
>i : number
|
||||
>foo([function(){return 1;}, function(){return "foo"}]) : void
|
||||
|
||||
@@ -22,7 +22,7 @@ obj1 = obj2; // Error - indexer doesn't match
|
||||
>obj2 : { x: string; }
|
||||
|
||||
function f(x: { [s: string]: string }) { }
|
||||
>f : (x: { [s: string]: string; }) => void
|
||||
>f : (x: { [s: string]: string;}) => void
|
||||
>x : { [s: string]: string; }
|
||||
>s : string
|
||||
|
||||
|
||||
@@ -580,7 +580,7 @@ function f28(obj?: { kind: 'foo', foo: string } | { kind: 'bar', bar: number })
|
||||
// Narrowing by aliased discriminant property access
|
||||
|
||||
function f30(obj: { kind: 'foo', foo: string } | { kind: 'bar', bar: number }) {
|
||||
>f30 : (obj: { kind: 'foo'; foo: string; } | { kind: 'bar'; bar: number; }) => void
|
||||
>f30 : (obj: { kind: 'foo'; foo: string;} | { kind: 'bar'; bar: number;}) => void
|
||||
>obj : { kind: 'foo'; foo: string; } | { kind: 'bar'; bar: number; }
|
||||
>kind : "foo"
|
||||
>foo : string
|
||||
@@ -612,7 +612,7 @@ function f30(obj: { kind: 'foo', foo: string } | { kind: 'bar', bar: number }) {
|
||||
}
|
||||
|
||||
function f31(obj: { kind: 'foo', foo: string } | { kind: 'bar', bar: number }) {
|
||||
>f31 : (obj: { kind: 'foo'; foo: string; } | { kind: 'bar'; bar: number; }) => void
|
||||
>f31 : (obj: { kind: 'foo'; foo: string;} | { kind: 'bar'; bar: number;}) => void
|
||||
>obj : { kind: 'foo'; foo: string; } | { kind: 'bar'; bar: number; }
|
||||
>kind : "foo"
|
||||
>foo : string
|
||||
@@ -673,7 +673,7 @@ function f32(obj: { kind: 'foo', foo: string } | { kind: 'bar', bar: number }) {
|
||||
}
|
||||
|
||||
function f33(obj: { kind: 'foo', foo: string } | { kind: 'bar', bar: number }) {
|
||||
>f33 : (obj: { kind: 'foo'; foo: string; } | { kind: 'bar'; bar: number; }) => void
|
||||
>f33 : (obj: { kind: 'foo'; foo: string;} | { kind: 'bar'; bar: number;}) => void
|
||||
>obj : { kind: 'foo'; foo: string; } | { kind: 'bar'; bar: number; }
|
||||
>kind : "foo"
|
||||
>foo : string
|
||||
@@ -809,7 +809,7 @@ class C11 {
|
||||
// Mixing of aliased discriminants and conditionals
|
||||
|
||||
function f40(obj: { kind: 'foo', foo?: string } | { kind: 'bar', bar?: number }) {
|
||||
>f40 : (obj: { kind: 'foo'; foo?: string | undefined; } | { kind: 'bar'; bar?: number | undefined; }) => void
|
||||
>f40 : (obj: { kind: 'foo'; foo?: string;} | { kind: 'bar'; bar?: number;}) => void
|
||||
>obj : { kind: 'foo'; foo?: string | undefined; } | { kind: 'bar'; bar?: number | undefined; }
|
||||
>kind : "foo"
|
||||
>foo : string | undefined
|
||||
|
||||
@@ -8,7 +8,7 @@ declare function f2(): [b: string];
|
||||
>f2 : () => [b: string]
|
||||
|
||||
declare function f3(): { c: string };
|
||||
>f3 : () => { c: string; }
|
||||
>f3 : () => { c: string;}
|
||||
>c : string
|
||||
|
||||
try {
|
||||
|
||||
@@ -75,7 +75,7 @@ if (d in c) {
|
||||
// repro from https://github.com/microsoft/TypeScript/issues/54790
|
||||
|
||||
function uniqueID_54790(
|
||||
>uniqueID_54790 : (id: string | undefined, seenIDs: { [key: string]: string; }) => string
|
||||
>uniqueID_54790 : (id: string | undefined, seenIDs: { [key: string]: string;}) => string
|
||||
|
||||
id: string | undefined,
|
||||
>id : string
|
||||
|
||||
@@ -58,7 +58,7 @@ function test2(foo: Foo | undefined) {
|
||||
}
|
||||
|
||||
function Test3({ foo }: { foo: Foo | undefined }) {
|
||||
>Test3 : ({ foo }: { foo: Foo | undefined; }) => JSX.Element
|
||||
>Test3 : ({ foo }: { foo: Foo | undefined;}) => JSX.Element
|
||||
>foo : Foo | undefined
|
||||
>foo : Foo | undefined
|
||||
|
||||
|
||||
@@ -6,12 +6,12 @@ function f1(...args) { }
|
||||
>args : any[]
|
||||
|
||||
function f2(x: (...args) => void) { }
|
||||
>f2 : (x: (...args: any[]) => void) => void
|
||||
>f2 : (x: (...args: any) => void) => void
|
||||
>x : (...args: any[]) => void
|
||||
>args : any[]
|
||||
|
||||
function f3(x: { (...args): void }) { }
|
||||
>f3 : (x: (...args: any[]) => void) => void
|
||||
>f3 : (x: { (...args: any): void;}) => void
|
||||
>x : (...args: any[]) => void
|
||||
>args : any[]
|
||||
|
||||
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
//// [tests/cases/compiler/declarationEmitCastReusesTypeNode1.ts] ////
|
||||
|
||||
//// [declarationEmitCastReusesTypeNode1.ts]
|
||||
type P = { } & { name: string }
|
||||
|
||||
export let vLet = null! as P
|
||||
export const vConst = null! as P
|
||||
|
||||
export function fn(p = null! as P) {}
|
||||
|
||||
export function fnWithRequiredDefaultParam(p = null! as P, req: number) {}
|
||||
|
||||
export class C {
|
||||
field = null! as P;
|
||||
optField? = null! as P;
|
||||
readonly roFiled = null! as P;
|
||||
method(p = null! as P) {}
|
||||
methodWithRequiredDefault(p = null! as P, req: number) {}
|
||||
|
||||
constructor(public ctorField = null! as P) {}
|
||||
|
||||
get x() { return null! as P }
|
||||
set x(v) { }
|
||||
}
|
||||
|
||||
export default null! as P;
|
||||
|
||||
// allows `undefined` on the input side, thanks to the initializer
|
||||
export function fnWithPartialAnnotationOnDefaultparam(x: P = null! as P, b: number) {}
|
||||
|
||||
|
||||
|
||||
//// [declarationEmitCastReusesTypeNode1.d.ts]
|
||||
type P = {} & {
|
||||
name: string;
|
||||
};
|
||||
export declare let vLet: P;
|
||||
export declare const vConst: P;
|
||||
export declare function fn(p?: P): void;
|
||||
export declare function fnWithRequiredDefaultParam(p: P, req: number): void;
|
||||
export declare class C {
|
||||
ctorField: P;
|
||||
field: P;
|
||||
optField?: P;
|
||||
readonly roFiled: P;
|
||||
method(p?: P): void;
|
||||
methodWithRequiredDefault(p: P, req: number): void;
|
||||
constructor(ctorField?: P);
|
||||
get x(): P;
|
||||
set x(v: P);
|
||||
}
|
||||
declare const _default: P;
|
||||
export default _default;
|
||||
export declare function fnWithPartialAnnotationOnDefaultparam(x: P, b: number): void;
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
//// [tests/cases/compiler/declarationEmitCastReusesTypeNode1.ts] ////
|
||||
|
||||
//// [declarationEmitCastReusesTypeNode1.ts]
|
||||
type P = { } & { name: string }
|
||||
|
||||
export let vLet = null! as P
|
||||
export const vConst = null! as P
|
||||
|
||||
export function fn(p = null! as P) {}
|
||||
|
||||
export function fnWithRequiredDefaultParam(p = null! as P, req: number) {}
|
||||
|
||||
export class C {
|
||||
field = null! as P;
|
||||
optField? = null! as P;
|
||||
readonly roFiled = null! as P;
|
||||
method(p = null! as P) {}
|
||||
methodWithRequiredDefault(p = null! as P, req: number) {}
|
||||
|
||||
constructor(public ctorField = null! as P) {}
|
||||
|
||||
get x() { return null! as P }
|
||||
set x(v) { }
|
||||
}
|
||||
|
||||
export default null! as P;
|
||||
|
||||
// allows `undefined` on the input side, thanks to the initializer
|
||||
export function fnWithPartialAnnotationOnDefaultparam(x: P = null! as P, b: number) {}
|
||||
|
||||
|
||||
|
||||
//// [declarationEmitCastReusesTypeNode1.d.ts]
|
||||
type P = {} & {
|
||||
name: string;
|
||||
};
|
||||
export declare let vLet: P;
|
||||
export declare const vConst: P;
|
||||
export declare function fn(p?: P): void;
|
||||
export declare function fnWithRequiredDefaultParam(p: P | undefined, req: number): void;
|
||||
export declare class C {
|
||||
ctorField: P;
|
||||
field: P;
|
||||
optField?: P;
|
||||
readonly roFiled: P;
|
||||
method(p?: P): void;
|
||||
methodWithRequiredDefault(p: P | undefined, req: number): void;
|
||||
constructor(ctorField?: P);
|
||||
get x(): P;
|
||||
set x(v: P);
|
||||
}
|
||||
declare const _default: P;
|
||||
export default _default;
|
||||
export declare function fnWithPartialAnnotationOnDefaultparam(x: P | undefined, b: number): void;
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
//// [tests/cases/compiler/declarationEmitCastReusesTypeNode2.ts] ////
|
||||
|
||||
//// [declarationEmitCastReusesTypeNode2.ts]
|
||||
export let vLet = null! as {} & { name: string }
|
||||
export const vConst = null! as {} & { name: string }
|
||||
|
||||
export function fn(p = null! as {} & { name: string }) {}
|
||||
|
||||
export function fnWithRequiredDefaultParam(p = null! as {} & { name: string }, req: number) {}
|
||||
|
||||
export class C {
|
||||
field = null! as {} & { name: string };
|
||||
optField? = null! as {} & { name: string };
|
||||
readonly roFiled = null! as {} & { name: string };
|
||||
method(p = null! as {} & { name: string }) {}
|
||||
methodWithRequiredDefault(p = null! as {} & { name: string }, req: number) {}
|
||||
|
||||
constructor(public ctorField = null! as {} & { name: string }) {}
|
||||
|
||||
get x() { return null! as {} & { name: string } }
|
||||
set x(v) { }
|
||||
}
|
||||
|
||||
export default null! as {} & { name: string }
|
||||
|
||||
// allows `undefined` on the input side, thanks to the initializer
|
||||
export function fnWithPartialAnnotationOnDefaultparam(x: {} & { name: string } = null! as {} & { name: string }, b: number) {}
|
||||
|
||||
|
||||
|
||||
//// [declarationEmitCastReusesTypeNode2.d.ts]
|
||||
export declare let vLet: {} & {
|
||||
name: string;
|
||||
};
|
||||
export declare const vConst: {} & {
|
||||
name: string;
|
||||
};
|
||||
export declare function fn(p?: {} & {
|
||||
name: string;
|
||||
}): void;
|
||||
export declare function fnWithRequiredDefaultParam(p: {} & {
|
||||
name: string;
|
||||
}, req: number): void;
|
||||
export declare class C {
|
||||
ctorField: {} & {
|
||||
name: string;
|
||||
};
|
||||
field: {} & {
|
||||
name: string;
|
||||
};
|
||||
optField?: {} & {
|
||||
name: string;
|
||||
};
|
||||
readonly roFiled: {} & {
|
||||
name: string;
|
||||
};
|
||||
method(p?: {} & {
|
||||
name: string;
|
||||
}): void;
|
||||
methodWithRequiredDefault(p: {} & {
|
||||
name: string;
|
||||
}, req: number): void;
|
||||
constructor(ctorField?: {} & {
|
||||
name: string;
|
||||
});
|
||||
get x(): {} & {
|
||||
name: string;
|
||||
};
|
||||
set x(v: {} & {
|
||||
name: string;
|
||||
});
|
||||
}
|
||||
declare const _default: {} & {
|
||||
name: string;
|
||||
};
|
||||
export default _default;
|
||||
export declare function fnWithPartialAnnotationOnDefaultparam(x: {} & {
|
||||
name: string;
|
||||
}, b: number): void;
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
//// [tests/cases/compiler/declarationEmitCastReusesTypeNode2.ts] ////
|
||||
|
||||
//// [declarationEmitCastReusesTypeNode2.ts]
|
||||
export let vLet = null! as {} & { name: string }
|
||||
export const vConst = null! as {} & { name: string }
|
||||
|
||||
export function fn(p = null! as {} & { name: string }) {}
|
||||
|
||||
export function fnWithRequiredDefaultParam(p = null! as {} & { name: string }, req: number) {}
|
||||
|
||||
export class C {
|
||||
field = null! as {} & { name: string };
|
||||
optField? = null! as {} & { name: string };
|
||||
readonly roFiled = null! as {} & { name: string };
|
||||
method(p = null! as {} & { name: string }) {}
|
||||
methodWithRequiredDefault(p = null! as {} & { name: string }, req: number) {}
|
||||
|
||||
constructor(public ctorField = null! as {} & { name: string }) {}
|
||||
|
||||
get x() { return null! as {} & { name: string } }
|
||||
set x(v) { }
|
||||
}
|
||||
|
||||
export default null! as {} & { name: string }
|
||||
|
||||
// allows `undefined` on the input side, thanks to the initializer
|
||||
export function fnWithPartialAnnotationOnDefaultparam(x: {} & { name: string } = null! as {} & { name: string }, b: number) {}
|
||||
|
||||
|
||||
|
||||
//// [declarationEmitCastReusesTypeNode2.d.ts]
|
||||
export declare let vLet: {} & {
|
||||
name: string;
|
||||
};
|
||||
export declare const vConst: {} & {
|
||||
name: string;
|
||||
};
|
||||
export declare function fn(p?: {} & {
|
||||
name: string;
|
||||
}): void;
|
||||
export declare function fnWithRequiredDefaultParam(p: ({} & {
|
||||
name: string;
|
||||
}) | undefined, req: number): void;
|
||||
export declare class C {
|
||||
ctorField: {} & {
|
||||
name: string;
|
||||
};
|
||||
field: {} & {
|
||||
name: string;
|
||||
};
|
||||
optField?: {} & {
|
||||
name: string;
|
||||
};
|
||||
readonly roFiled: {} & {
|
||||
name: string;
|
||||
};
|
||||
method(p?: {} & {
|
||||
name: string;
|
||||
}): void;
|
||||
methodWithRequiredDefault(p: ({} & {
|
||||
name: string;
|
||||
}) | undefined, req: number): void;
|
||||
constructor(ctorField?: {} & {
|
||||
name: string;
|
||||
});
|
||||
get x(): {} & {
|
||||
name: string;
|
||||
};
|
||||
set x(v: {} & {
|
||||
name: string;
|
||||
});
|
||||
}
|
||||
declare const _default: {} & {
|
||||
name: string;
|
||||
};
|
||||
export default _default;
|
||||
export declare function fnWithPartialAnnotationOnDefaultparam(x: ({} & {
|
||||
name: string;
|
||||
}) | undefined, b: number): void;
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
//// [tests/cases/compiler/declarationEmitCastReusesTypeNode3.ts] ////
|
||||
|
||||
//// [declarationEmitCastReusesTypeNode3.ts]
|
||||
type P = { } & { name: string }
|
||||
|
||||
export let vLet = <P>null!
|
||||
export const vConst = <P>null!
|
||||
|
||||
export function fn(p = <P>null!) {}
|
||||
|
||||
export function fnWithRequiredDefaultParam(p = <P>null!, req: number) {}
|
||||
|
||||
export class C {
|
||||
field = <P>null!
|
||||
optField? = <P>null!
|
||||
readonly roFiled = <P>null!;
|
||||
method(p = <P>null!) {}
|
||||
methodWithRequiredDefault(p = <P>null!, req: number) {}
|
||||
|
||||
constructor(public ctorField = <P>null!) {}
|
||||
|
||||
get x() { return <P>null! }
|
||||
set x(v) { }
|
||||
}
|
||||
|
||||
export default <P>null!;
|
||||
|
||||
// allows `undefined` on the input side, thanks to the initializer
|
||||
export function fnWithPartialAnnotationOnDefaultparam(x: P = <P>null!, b: number) {}
|
||||
|
||||
|
||||
|
||||
//// [declarationEmitCastReusesTypeNode3.d.ts]
|
||||
type P = {} & {
|
||||
name: string;
|
||||
};
|
||||
export declare let vLet: P;
|
||||
export declare const vConst: P;
|
||||
export declare function fn(p?: P): void;
|
||||
export declare function fnWithRequiredDefaultParam(p: P, req: number): void;
|
||||
export declare class C {
|
||||
ctorField: P;
|
||||
field: P;
|
||||
optField?: P;
|
||||
readonly roFiled: P;
|
||||
method(p?: P): void;
|
||||
methodWithRequiredDefault(p: P, req: number): void;
|
||||
constructor(ctorField?: P);
|
||||
get x(): P;
|
||||
set x(v: P);
|
||||
}
|
||||
declare const _default: P;
|
||||
export default _default;
|
||||
export declare function fnWithPartialAnnotationOnDefaultparam(x: P, b: number): void;
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
//// [tests/cases/compiler/declarationEmitCastReusesTypeNode3.ts] ////
|
||||
|
||||
//// [declarationEmitCastReusesTypeNode3.ts]
|
||||
type P = { } & { name: string }
|
||||
|
||||
export let vLet = <P>null!
|
||||
export const vConst = <P>null!
|
||||
|
||||
export function fn(p = <P>null!) {}
|
||||
|
||||
export function fnWithRequiredDefaultParam(p = <P>null!, req: number) {}
|
||||
|
||||
export class C {
|
||||
field = <P>null!
|
||||
optField? = <P>null!
|
||||
readonly roFiled = <P>null!;
|
||||
method(p = <P>null!) {}
|
||||
methodWithRequiredDefault(p = <P>null!, req: number) {}
|
||||
|
||||
constructor(public ctorField = <P>null!) {}
|
||||
|
||||
get x() { return <P>null! }
|
||||
set x(v) { }
|
||||
}
|
||||
|
||||
export default <P>null!;
|
||||
|
||||
// allows `undefined` on the input side, thanks to the initializer
|
||||
export function fnWithPartialAnnotationOnDefaultparam(x: P = <P>null!, b: number) {}
|
||||
|
||||
|
||||
|
||||
//// [declarationEmitCastReusesTypeNode3.d.ts]
|
||||
type P = {} & {
|
||||
name: string;
|
||||
};
|
||||
export declare let vLet: P;
|
||||
export declare const vConst: P;
|
||||
export declare function fn(p?: P): void;
|
||||
export declare function fnWithRequiredDefaultParam(p: P | undefined, req: number): void;
|
||||
export declare class C {
|
||||
ctorField: P;
|
||||
field: P;
|
||||
optField?: P;
|
||||
readonly roFiled: P;
|
||||
method(p?: P): void;
|
||||
methodWithRequiredDefault(p: P | undefined, req: number): void;
|
||||
constructor(ctorField?: P);
|
||||
get x(): P;
|
||||
set x(v: P);
|
||||
}
|
||||
declare const _default: P;
|
||||
export default _default;
|
||||
export declare function fnWithPartialAnnotationOnDefaultparam(x: P | undefined, b: number): void;
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
//// [tests/cases/compiler/declarationEmitCastReusesTypeNode4.ts] ////
|
||||
|
||||
//// [input.js]
|
||||
/**
|
||||
* @typedef {{ } & { name?: string }} P
|
||||
*/
|
||||
|
||||
const something = /** @type {*} */(null);
|
||||
|
||||
export let vLet = /** @type {P} */(something);
|
||||
export const vConst = /** @type {P} */(something);
|
||||
|
||||
export function fn(p = /** @type {P} */(something)) {}
|
||||
|
||||
/** @param {number} req */
|
||||
export function fnWithRequiredDefaultParam(p = /** @type {P} */(something), req) {}
|
||||
|
||||
export class C {
|
||||
field = /** @type {P} */(something);
|
||||
/** @optional */ optField = /** @type {P} */(something); // not a thing
|
||||
/** @readonly */ roFiled = /** @type {P} */(something);
|
||||
method(p = /** @type {P} */(something)) {}
|
||||
/** @param {number} req */
|
||||
methodWithRequiredDefault(p = /** @type {P} */(something), req) {}
|
||||
|
||||
constructor(ctorField = /** @type {P} */(something)) {}
|
||||
|
||||
get x() { return /** @type {P} */(something) }
|
||||
set x(v) { }
|
||||
}
|
||||
|
||||
export default /** @type {P} */(something);
|
||||
|
||||
// allows `undefined` on the input side, thanks to the initializer
|
||||
/**
|
||||
*
|
||||
* @param {P} x
|
||||
* @param {number} b
|
||||
*/
|
||||
export function fnWithPartialAnnotationOnDefaultparam(x = /** @type {P} */(something), b) {}
|
||||
|
||||
|
||||
|
||||
//// [input.d.ts]
|
||||
export function fn(p?: P): void;
|
||||
/** @param {number} req */
|
||||
export function fnWithRequiredDefaultParam(p: P, req: number): void;
|
||||
/**
|
||||
*
|
||||
* @param {P} x
|
||||
* @param {number} b
|
||||
*/
|
||||
export function fnWithPartialAnnotationOnDefaultparam(x: P, b: number): void;
|
||||
export let vLet: P;
|
||||
export const vConst: P;
|
||||
export class C {
|
||||
constructor(ctorField?: P);
|
||||
field: P;
|
||||
/** @optional */ optField: P;
|
||||
/** @readonly */ readonly roFiled: P;
|
||||
method(p?: P): void;
|
||||
/** @param {number} req */
|
||||
methodWithRequiredDefault(p: P, req: number): void;
|
||||
set x(v: P);
|
||||
get x(): P;
|
||||
}
|
||||
declare const _default: P;
|
||||
export default _default;
|
||||
export type P = {} & {
|
||||
name?: string;
|
||||
};
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
//// [tests/cases/compiler/declarationEmitCastReusesTypeNode4.ts] ////
|
||||
|
||||
//// [input.js]
|
||||
/**
|
||||
* @typedef {{ } & { name?: string }} P
|
||||
*/
|
||||
|
||||
const something = /** @type {*} */(null);
|
||||
|
||||
export let vLet = /** @type {P} */(something);
|
||||
export const vConst = /** @type {P} */(something);
|
||||
|
||||
export function fn(p = /** @type {P} */(something)) {}
|
||||
|
||||
/** @param {number} req */
|
||||
export function fnWithRequiredDefaultParam(p = /** @type {P} */(something), req) {}
|
||||
|
||||
export class C {
|
||||
field = /** @type {P} */(something);
|
||||
/** @optional */ optField = /** @type {P} */(something); // not a thing
|
||||
/** @readonly */ roFiled = /** @type {P} */(something);
|
||||
method(p = /** @type {P} */(something)) {}
|
||||
/** @param {number} req */
|
||||
methodWithRequiredDefault(p = /** @type {P} */(something), req) {}
|
||||
|
||||
constructor(ctorField = /** @type {P} */(something)) {}
|
||||
|
||||
get x() { return /** @type {P} */(something) }
|
||||
set x(v) { }
|
||||
}
|
||||
|
||||
export default /** @type {P} */(something);
|
||||
|
||||
// allows `undefined` on the input side, thanks to the initializer
|
||||
/**
|
||||
*
|
||||
* @param {P} x
|
||||
* @param {number} b
|
||||
*/
|
||||
export function fnWithPartialAnnotationOnDefaultparam(x = /** @type {P} */(something), b) {}
|
||||
|
||||
|
||||
|
||||
//// [input.d.ts]
|
||||
export function fn(p?: P): void;
|
||||
/** @param {number} req */
|
||||
export function fnWithRequiredDefaultParam(p: P | undefined, req: number): void;
|
||||
/**
|
||||
*
|
||||
* @param {P} x
|
||||
* @param {number} b
|
||||
*/
|
||||
export function fnWithPartialAnnotationOnDefaultparam(x: P | undefined, b: number): void;
|
||||
export let vLet: P;
|
||||
export const vConst: P;
|
||||
export class C {
|
||||
constructor(ctorField?: P);
|
||||
field: P;
|
||||
/** @optional */ optField: P;
|
||||
/** @readonly */ readonly roFiled: P;
|
||||
method(p?: P): void;
|
||||
/** @param {number} req */
|
||||
methodWithRequiredDefault(p: P | undefined, req: number): void;
|
||||
set x(v: P);
|
||||
get x(): P;
|
||||
}
|
||||
declare const _default: P;
|
||||
export default _default;
|
||||
export type P = {} & {
|
||||
name?: string;
|
||||
};
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
//// [tests/cases/compiler/declarationEmitCastReusesTypeNode5.ts] ////
|
||||
|
||||
//// [declarationEmitCastReusesTypeNode5.ts]
|
||||
export const vNumberLiteral = null! as 1 | 1
|
||||
export const vStringLiteral = null! as "1" | "1"
|
||||
export const vLiteral = null! as "1" | "1"
|
||||
|
||||
type R = { foo: string }
|
||||
|
||||
export class C {
|
||||
// under !strictNullChecks all types can be reused from the assertion
|
||||
// under strictNullChecks we need to add undefined, and we can't always know we can
|
||||
// Can't know if references contain undefined, fall back to inference
|
||||
tsResolve? = null! as R | R;
|
||||
tsResolve2? = null! as R | R | string;
|
||||
// Simple type. we can add undefined
|
||||
reuseType? = null! as ((p: R) => void) | string | string;
|
||||
reuseType2? = null! as (new (p: R) => R) | string | string;
|
||||
reuseType3? = null! as string | number | bigint | symbol | unknown | any | never | symbol;
|
||||
reuseType4? = null! as [R, R, R] | [R, R, R];
|
||||
reuseType5? = null! as R[] | R[];
|
||||
reuseType6? = null! as 1 | "2" | 1n | 1n;
|
||||
reuseType7? = null! as `A` | `A`;
|
||||
reuseType8? = null! as `${string}-ok` | `${string}-ok`;
|
||||
reuseType9? = null! as this | this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//// [declarationEmitCastReusesTypeNode5.d.ts]
|
||||
export declare const vNumberLiteral: 1 | 1;
|
||||
export declare const vStringLiteral: "1" | "1";
|
||||
export declare const vLiteral: "1" | "1";
|
||||
type R = {
|
||||
foo: string;
|
||||
};
|
||||
export declare class C {
|
||||
tsResolve?: R | R;
|
||||
tsResolve2?: R | R | string;
|
||||
reuseType?: ((p: R) => void) | string | string;
|
||||
reuseType2?: (new (p: R) => R) | string | string;
|
||||
reuseType3?: string | number | bigint | symbol | unknown | any | never | symbol;
|
||||
reuseType4?: [R, R, R] | [R, R, R];
|
||||
reuseType5?: R[] | R[];
|
||||
reuseType6?: 1 | "2" | 1n | 1n;
|
||||
reuseType7?: `A` | `A`;
|
||||
reuseType8?: `${string}-ok` | `${string}-ok`;
|
||||
reuseType9?: this | this;
|
||||
}
|
||||
export {};
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
//// [tests/cases/compiler/declarationEmitCastReusesTypeNode5.ts] ////
|
||||
|
||||
//// [declarationEmitCastReusesTypeNode5.ts]
|
||||
export const vNumberLiteral = null! as 1 | 1
|
||||
export const vStringLiteral = null! as "1" | "1"
|
||||
export const vLiteral = null! as "1" | "1"
|
||||
|
||||
type R = { foo: string }
|
||||
|
||||
export class C {
|
||||
// under !strictNullChecks all types can be reused from the assertion
|
||||
// under strictNullChecks we need to add undefined, and we can't always know we can
|
||||
// Can't know if references contain undefined, fall back to inference
|
||||
tsResolve? = null! as R | R;
|
||||
tsResolve2? = null! as R | R | string;
|
||||
// Simple type. we can add undefined
|
||||
reuseType? = null! as ((p: R) => void) | string | string;
|
||||
reuseType2? = null! as (new (p: R) => R) | string | string;
|
||||
reuseType3? = null! as string | number | bigint | symbol | unknown | any | never | symbol;
|
||||
reuseType4? = null! as [R, R, R] | [R, R, R];
|
||||
reuseType5? = null! as R[] | R[];
|
||||
reuseType6? = null! as 1 | "2" | 1n | 1n;
|
||||
reuseType7? = null! as `A` | `A`;
|
||||
reuseType8? = null! as `${string}-ok` | `${string}-ok`;
|
||||
reuseType9? = null! as this | this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//// [declarationEmitCastReusesTypeNode5.d.ts]
|
||||
export declare const vNumberLiteral: 1 | 1;
|
||||
export declare const vStringLiteral: "1" | "1";
|
||||
export declare const vLiteral: "1" | "1";
|
||||
type R = {
|
||||
foo: string;
|
||||
};
|
||||
export declare class C {
|
||||
tsResolve?: R | R;
|
||||
tsResolve2?: R | R | string;
|
||||
reuseType?: ((p: R) => void) | string | string;
|
||||
reuseType2?: (new (p: R) => R) | string | string;
|
||||
reuseType3?: string | number | bigint | symbol | unknown | any | never | symbol;
|
||||
reuseType4?: [R, R, R] | [R, R, R];
|
||||
reuseType5?: R[] | R[];
|
||||
reuseType6?: 1 | "2" | 1n | 1n;
|
||||
reuseType7?: `A` | `A`;
|
||||
reuseType8?: `${string}-ok` | `${string}-ok`;
|
||||
reuseType9?: this | this;
|
||||
}
|
||||
export {};
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
=== defaultValueInFunctionTypes.ts ===
|
||||
type Foo = ({ first = 0 }: { first?: number }) => unknown;
|
||||
>Foo : ({ first }: { first?: number; }) => unknown
|
||||
>Foo : ({ first }: { first?: number;}) => unknown
|
||||
>first : number
|
||||
>0 : 0
|
||||
>first : number
|
||||
|
||||
@@ -29,7 +29,7 @@ type T2 = ObjectHasKey<{ a: string }, 'b'>; // 'false'
|
||||
// Verify that mapped type isn't eagerly resolved in type-to-string operation
|
||||
|
||||
declare function f1<A extends string, B extends string>(a: A, b: B): { [P in A | B]: any };
|
||||
>f1 : <A extends string, B extends string>(a: A, b: B) => { [P in A | B]: any; }
|
||||
>f1 : <A extends string, B extends string>(a: A, b: B) => { [P in A | B]: any;}
|
||||
>a : A
|
||||
>b : B
|
||||
|
||||
|
||||
@@ -749,10 +749,10 @@ reducer("concat", { firstArr: [1, 2], secondArr: [3, 4] });
|
||||
// repro from https://github.com/microsoft/TypeScript/pull/47190#issuecomment-1057603588
|
||||
|
||||
type FooMethod = {
|
||||
>FooMethod : { method(...args: [type: "str", cb: (e: string) => void] | [type: "num", cb: (e: number) => void]): void; }
|
||||
>FooMethod : { method(...args: [ type: "str", cb: (e: string) => void] | [ type: "num", cb: (e: number) => void]): void; }
|
||||
|
||||
method(...args:
|
||||
>method : (...args: [type: "str", cb: (e: string) => void] | [type: "num", cb: (e: number) => void]) => void
|
||||
>method : (...args: [ type: "str", cb: (e: string) => void] | [ type: "num", cb: (e: number) => void]) => void
|
||||
>args : [type: "str", cb: (e: string) => void] | [type: "num", cb: (e: number) => void]
|
||||
|
||||
[type: "str", cb: (e: string) => void] |
|
||||
@@ -793,10 +793,10 @@ let fooM: FooMethod = {
|
||||
};
|
||||
|
||||
type FooAsyncMethod = {
|
||||
>FooAsyncMethod : { method(...args: [type: "str", cb: (e: string) => void] | [type: "num", cb: (e: number) => void]): Promise<any>; }
|
||||
>FooAsyncMethod : { method(...args: [ type: "str", cb: (e: string) => void] | [ type: "num", cb: (e: number) => void]): Promise<any>; }
|
||||
|
||||
method(...args:
|
||||
>method : (...args: [type: "str", cb: (e: string) => void] | [type: "num", cb: (e: number) => void]) => Promise<any>
|
||||
>method : (...args: [ type: "str", cb: (e: string) => void] | [ type: "num", cb: (e: number) => void]) => Promise<any>
|
||||
>args : [type: "str", cb: (e: string) => void] | [type: "num", cb: (e: number) => void]
|
||||
|
||||
[type: "str", cb: (e: string) => void] |
|
||||
@@ -837,10 +837,10 @@ let fooAsyncM: FooAsyncMethod = {
|
||||
};
|
||||
|
||||
type FooGenMethod = {
|
||||
>FooGenMethod : { method(...args: [type: "str", cb: (e: string) => void] | [type: "num", cb: (e: number) => void]): Generator<any, any, any>; }
|
||||
>FooGenMethod : { method(...args: [ type: "str", cb: (e: string) => void] | [ type: "num", cb: (e: number) => void]): Generator<any, any, any>; }
|
||||
|
||||
method(...args:
|
||||
>method : (...args: [type: "str", cb: (e: string) => void] | [type: "num", cb: (e: number) => void]) => Generator<any, any, any>
|
||||
>method : (...args: [ type: "str", cb: (e: string) => void] | [ type: "num", cb: (e: number) => void]) => Generator<any, any, any>
|
||||
>args : [type: "str", cb: (e: string) => void] | [type: "num", cb: (e: number) => void]
|
||||
|
||||
[type: "str", cb: (e: string) => void] |
|
||||
@@ -881,10 +881,10 @@ let fooGenM: FooGenMethod = {
|
||||
};
|
||||
|
||||
type FooAsyncGenMethod = {
|
||||
>FooAsyncGenMethod : { method(...args: [type: "str", cb: (e: string) => void] | [type: "num", cb: (e: number) => void]): AsyncGenerator<any, any, any>; }
|
||||
>FooAsyncGenMethod : { method(...args: [ type: "str", cb: (e: string) => void] | [ type: "num", cb: (e: number) => void]): AsyncGenerator<any, any, any>; }
|
||||
|
||||
method(...args:
|
||||
>method : (...args: [type: "str", cb: (e: string) => void] | [type: "num", cb: (e: number) => void]) => AsyncGenerator<any, any, any>
|
||||
>method : (...args: [ type: "str", cb: (e: string) => void] | [ type: "num", cb: (e: number) => void]) => AsyncGenerator<any, any, any>
|
||||
>args : [type: "str", cb: (e: string) => void] | [type: "num", cb: (e: number) => void]
|
||||
|
||||
[type: "str", cb: (e: string) => void] |
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
=== destructuredMaappedTypeIsNotImplicitlyAny.ts ===
|
||||
function foo<T extends string>(key: T, obj: { [_ in T]: number }) {
|
||||
>foo : <T extends string>(key: T, obj: { [_ in T]: number; }) => void
|
||||
>foo : <T extends string>(key: T, obj: { [_ in T]: number;}) => void
|
||||
>key : T
|
||||
>obj : { [_ in T]: number; }
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ let x = 0;
|
||||
// Repro from #26235
|
||||
|
||||
function f1(options?: { color?: string, width?: number }) {
|
||||
>f1 : (options?: { color?: string | undefined; width?: number | undefined; } | undefined) => void
|
||||
>f1 : (options?: { color?: string; width?: number;}) => void
|
||||
>options : { color?: string | undefined; width?: number | undefined; } | undefined
|
||||
>color : string | undefined
|
||||
>width : number | undefined
|
||||
@@ -93,7 +93,7 @@ function f2(options?: [string?, number?]) {
|
||||
}
|
||||
|
||||
function f3(options?: { color: string, width: number }) {
|
||||
>f3 : (options?: { color: string; width: number; } | undefined) => void
|
||||
>f3 : (options?: { color: string; width: number;}) => void
|
||||
>options : { color: string; width: number; } | undefined
|
||||
>color : string
|
||||
>width : number
|
||||
|
||||
+2
-2
@@ -27,7 +27,7 @@ interface ExecutionContext {
|
||||
}
|
||||
|
||||
type CoercedVariableValues =
|
||||
>CoercedVariableValues : { errors: ReadonlyArray<GraphQLError>; coerced?: undefined; } | { coerced: { [variable: string]: unknown; }; errors?: undefined; }
|
||||
>CoercedVariableValues : { errors: ReadonlyArray<GraphQLError>; coerced?: undefined; } | { coerced: { [variable: string]: unknown;}; errors?: undefined; }
|
||||
|
||||
| { errors: ReadonlyArray<GraphQLError>; coerced?: never }
|
||||
>errors : readonly GraphQLError[]
|
||||
@@ -39,7 +39,7 @@ type CoercedVariableValues =
|
||||
>errors : undefined
|
||||
|
||||
declare function getVariableValues(inputs: {
|
||||
>getVariableValues : (inputs: { readonly [variable: string]: unknown; }) => CoercedVariableValues
|
||||
>getVariableValues : (inputs: { readonly [variable: string]: unknown;}) => CoercedVariableValues
|
||||
>inputs : { readonly [variable: string]: unknown; }
|
||||
|
||||
readonly [variable: string]: unknown;
|
||||
|
||||
+2
-2
@@ -27,7 +27,7 @@ interface ExecutionContext {
|
||||
}
|
||||
|
||||
type CoercedVariableValues =
|
||||
>CoercedVariableValues : { errors: ReadonlyArray<GraphQLError>; coerced?: never; } | { coerced: { [variable: string]: unknown; }; errors?: never; }
|
||||
>CoercedVariableValues : { errors: ReadonlyArray<GraphQLError>; coerced?: never; } | { coerced: { [variable: string]: unknown;}; errors?: never; }
|
||||
|
||||
| { errors: ReadonlyArray<GraphQLError>; coerced?: never }
|
||||
>errors : readonly GraphQLError[]
|
||||
@@ -39,7 +39,7 @@ type CoercedVariableValues =
|
||||
>errors : undefined
|
||||
|
||||
declare function getVariableValues(inputs: {
|
||||
>getVariableValues : (inputs: { readonly [variable: string]: unknown; }) => CoercedVariableValues
|
||||
>getVariableValues : (inputs: { readonly [variable: string]: unknown;}) => CoercedVariableValues
|
||||
>inputs : { readonly [variable: string]: unknown; }
|
||||
|
||||
readonly [variable: string]: unknown;
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
// repro from https://github.com/microsoft/TypeScript/issues/56341
|
||||
|
||||
function bar(props: { x?: string; y?: string }) {
|
||||
>bar : (props: { x?: string | undefined; y?: string | undefined; }) => { [x: string]: number; }
|
||||
>bar : (props: { x?: string; y?: string;}) => { [x: string]: number; }
|
||||
>props : { x?: string | undefined; y?: string | undefined; }
|
||||
>x : string | undefined
|
||||
>y : string | undefined
|
||||
|
||||
@@ -10,4 +10,5 @@ var x = {};
|
||||
//// [duplicatePropertiesInTypeAssertions01.d.ts]
|
||||
declare let x: {
|
||||
a: number;
|
||||
a: number;
|
||||
};
|
||||
|
||||
@@ -10,4 +10,5 @@ var x = {};
|
||||
//// [duplicatePropertiesInTypeAssertions02.d.ts]
|
||||
declare let x: {
|
||||
a: number;
|
||||
a: number;
|
||||
};
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
=== duplicateTypeParameters3.ts ===
|
||||
interface X {
|
||||
x: () => <A, A>() => void;
|
||||
>x : () => <A>() => void
|
||||
>x : () => <A, A>() => void
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
=== emitRestParametersFunctionProperty.ts ===
|
||||
var obj: {
|
||||
>obj : { func1: (...rest: any[]) => void; }
|
||||
>obj : { func1: (...rest: any) => void; }
|
||||
|
||||
func1: (...rest) => void
|
||||
>func1 : (...rest: any[]) => void
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
=== emitRestParametersFunctionPropertyES6.ts ===
|
||||
var obj: {
|
||||
>obj : { func1: (...rest: any[]) => void; }
|
||||
>obj : { func1: (...rest: any) => void; }
|
||||
|
||||
func1: (...rest) => void
|
||||
>func1 : (...rest: any[]) => void
|
||||
|
||||
@@ -35,14 +35,14 @@ export { C };
|
||||
>C : typeof C
|
||||
|
||||
function boundMethodLogger<This, Args extends any[], Return>(source: string, bound = true) {
|
||||
>boundMethodLogger : <This, Args extends any[], Return>(source: string, bound?: boolean) => (target: (this: This, ...args: Args) => Return, context: ClassMethodDecoratorContext<This, (this: This, ...args: Args) => Return>) => (this: This, ...args: Args) => Return
|
||||
>boundMethodLogger : <This, Args extends any[], Return>(source: string, bound?: boolean) => (target: (this: This, ...args: Args) => Return, context: ClassMethodDecoratorContext<This, (this: This, ...args: Args) => Return>) => ((this: This, ...args: Args) => Return)
|
||||
>source : string
|
||||
>bound : boolean
|
||||
>true : true
|
||||
|
||||
return function loggedDecorator(
|
||||
>function loggedDecorator( target: (this: This, ...args: Args) => Return, context: ClassMethodDecoratorContext<This, (this: This, ...args: Args) => Return> ): ((this: This, ...args: Args) => Return) { if (bound) { context.addInitializer(function () { (this as any)[context.name] = (this as any)[context.name].bind(this); }); } return function (this, ...args) { console.log(`<${source}>: I'm logging stuff from ${context.name.toString()}!`); return target.apply(this, args); } } : (target: (this: This, ...args: Args) => Return, context: ClassMethodDecoratorContext<This, (this: This, ...args: Args) => Return>) => (this: This, ...args: Args) => Return
|
||||
>loggedDecorator : (target: (this: This, ...args: Args) => Return, context: ClassMethodDecoratorContext<This, (this: This, ...args: Args) => Return>) => (this: This, ...args: Args) => Return
|
||||
>function loggedDecorator( target: (this: This, ...args: Args) => Return, context: ClassMethodDecoratorContext<This, (this: This, ...args: Args) => Return> ): ((this: This, ...args: Args) => Return) { if (bound) { context.addInitializer(function () { (this as any)[context.name] = (this as any)[context.name].bind(this); }); } return function (this, ...args) { console.log(`<${source}>: I'm logging stuff from ${context.name.toString()}!`); return target.apply(this, args); } } : (target: (this: This, ...args: Args) => Return, context: ClassMethodDecoratorContext<This, (this: This, ...args: Args) => Return>) => ((this: This, ...args: Args) => Return)
|
||||
>loggedDecorator : (target: (this: This, ...args: Args) => Return, context: ClassMethodDecoratorContext<This, (this: This, ...args: Args) => Return>) => ((this: This, ...args: Args) => Return)
|
||||
|
||||
target: (this: This, ...args: Args) => Return,
|
||||
>target : (this: This, ...args: Args) => Return
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
=== esNextWeakRefs_IterableWeakMap.ts ===
|
||||
/** `static #cleanup` */
|
||||
const IterableWeakMap_cleanup = ({ ref, set }: {
|
||||
>IterableWeakMap_cleanup : ({ ref, set }: { readonly ref: WeakRef<object>; readonly set: Set<WeakRef<object>>; }) => void
|
||||
>({ ref, set }: { readonly ref: WeakRef<object>; readonly set: Set<WeakRef<object>>;}) => { set.delete(ref);} : ({ ref, set }: { readonly ref: WeakRef<object>; readonly set: Set<WeakRef<object>>; }) => void
|
||||
>IterableWeakMap_cleanup : ({ ref, set }: { readonly ref: WeakRef<object>; readonly set: Set<WeakRef<object>>;}) => void
|
||||
>({ ref, set }: { readonly ref: WeakRef<object>; readonly set: Set<WeakRef<object>>;}) => { set.delete(ref);} : ({ ref, set }: { readonly ref: WeakRef<object>; readonly set: Set<WeakRef<object>>;}) => void
|
||||
>ref : WeakRef<object>
|
||||
>set : Set<WeakRef<object>>
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@ type Foo<K> = K extends unknown ? { a: number } : unknown
|
||||
>a : number
|
||||
|
||||
const createDefaultExample = <K,>(x: K): Foo<K> & { x: K; } => {
|
||||
>createDefaultExample : <K>(x: K) => Foo<K> & { x: K; }
|
||||
><K,>(x: K): Foo<K> & { x: K; } => { return { a: 1, x: x }; // okay in TS 4.7.4, error in TS 4.8.2} : <K>(x: K) => Foo<K> & { x: K; }
|
||||
>createDefaultExample : <K>(x: K) => Foo<K> & { x: K;}
|
||||
><K,>(x: K): Foo<K> & { x: K; } => { return { a: 1, x: x }; // okay in TS 4.7.4, error in TS 4.8.2} : <K>(x: K) => Foo<K> & { x: K;}
|
||||
>x : K
|
||||
>x : K
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
=== forInStrictNullChecksNoError.ts ===
|
||||
function f(x: { [key: string]: number; } | null | undefined) {
|
||||
>f : (x: { [key: string]: number; } | null | undefined) => void
|
||||
>f : (x: { [key: string]: number;} | null | undefined) => void
|
||||
>x : { [key: string]: number; } | null | undefined
|
||||
>key : string
|
||||
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
=== functionDeclarationWithArgumentOfTypeFunctionTypeArray.ts ===
|
||||
function foo(args: { (x): number }[]) {
|
||||
>foo : (args: ((x: any) => number)[]) => number
|
||||
>foo : (args: { (x: any): number;}[]) => number
|
||||
>args : ((x: any) => number)[]
|
||||
>x : any
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// PropName<TypeParamList>(ParamList):ReturnType is equivalent to PropName: { <TypeParamList>(ParamList): ReturnType }
|
||||
|
||||
var b: {
|
||||
>b : { func1(x: number): number; func2: (x: number) => number; func3: (x: number) => number; }
|
||||
>b : { func1(x: number): number; func2: (x: number) => number; func3: { (x: number): number;}; }
|
||||
|
||||
func1(x: number): number; // Method signature
|
||||
>func1 : (x: number) => number
|
||||
@@ -75,7 +75,7 @@ b.func3 = b.func2;
|
||||
>func2 : (x: number) => number
|
||||
|
||||
var c: {
|
||||
>c : { func4(x: number): number; func4(s: string): string; func5: { (x: number): number; (s: string): string; }; }
|
||||
>c : { func4(x: number): number; func4(s: string): string; func5: { (x: number): number; (s: string): string;}; }
|
||||
|
||||
func4(x: number): number;
|
||||
>func4 : { (x: number): number; (s: string): string; }
|
||||
|
||||
@@ -1098,7 +1098,7 @@ function x128(parm: Array<Base> = [d1, d2]) { }
|
||||
>d2 : Derived2
|
||||
|
||||
function x129(parm: { [n: number]: Base; } = [d1, d2]) { }
|
||||
>x129 : (parm?: { [n: number]: Base; }) => void
|
||||
>x129 : (parm?: { [n: number]: Base;}) => void
|
||||
>parm : { [n: number]: Base; }
|
||||
>n : number
|
||||
>[d1, d2] : (Derived1 | Derived2)[]
|
||||
@@ -1191,7 +1191,7 @@ function x140(): Array<Base> { return [d1, d2]; }
|
||||
>d2 : Derived2
|
||||
|
||||
function x141(): { [n: number]: Base; } { return [d1, d2]; }
|
||||
>x141 : () => { [n: number]: Base; }
|
||||
>x141 : () => { [n: number]: Base;}
|
||||
>n : number
|
||||
>[d1, d2] : (Derived1 | Derived2)[]
|
||||
>d1 : Derived1
|
||||
@@ -1312,7 +1312,7 @@ function x152(): Array<Base> { return [d1, d2]; return [d1, d2]; }
|
||||
>d2 : Derived2
|
||||
|
||||
function x153(): { [n: number]: Base; } { return [d1, d2]; return [d1, d2]; }
|
||||
>x153 : () => { [n: number]: Base; }
|
||||
>x153 : () => { [n: number]: Base;}
|
||||
>n : number
|
||||
>[d1, d2] : (Derived1 | Derived2)[]
|
||||
>d1 : Derived1
|
||||
@@ -1427,7 +1427,7 @@ var x164: () => Array<Base> = () => { return [d1, d2]; };
|
||||
>d2 : Derived2
|
||||
|
||||
var x165: () => { [n: number]: Base; } = () => { return [d1, d2]; };
|
||||
>x165 : () => { [n: number]: Base; }
|
||||
>x165 : () => { [n: number]: Base;}
|
||||
>n : number
|
||||
>() => { return [d1, d2]; } : () => (Derived1 | Derived2)[]
|
||||
>[d1, d2] : (Derived1 | Derived2)[]
|
||||
@@ -1528,7 +1528,7 @@ var x176: () => Array<Base> = function() { return [d1, d2]; };
|
||||
>d2 : Derived2
|
||||
|
||||
var x177: () => { [n: number]: Base; } = function() { return [d1, d2]; };
|
||||
>x177 : () => { [n: number]: Base; }
|
||||
>x177 : () => { [n: number]: Base;}
|
||||
>n : number
|
||||
>function() { return [d1, d2]; } : () => (Derived1 | Derived2)[]
|
||||
>[d1, d2] : (Derived1 | Derived2)[]
|
||||
@@ -2127,7 +2127,7 @@ var x244: { n: Array<Base>; } = { n: [d1, d2] };
|
||||
>d2 : Derived2
|
||||
|
||||
var x245: { n: { [n: number]: Base; }; } = { n: [d1, d2] };
|
||||
>x245 : { n: { [n: number]: Base; }; }
|
||||
>x245 : { n: { [n: number]: Base;}; }
|
||||
>n : { [n: number]: Base; }
|
||||
>n : number
|
||||
>{ n: [d1, d2] } : { n: (Derived1 | Derived2)[]; }
|
||||
@@ -2979,7 +2979,7 @@ function x328(n: Array<Base>) { }; x328([d1, d2]);
|
||||
>d2 : Derived2
|
||||
|
||||
function x329(n: { [n: number]: Base; }) { }; x329([d1, d2]);
|
||||
>x329 : (n: { [n: number]: Base; }) => void
|
||||
>x329 : (n: { [n: number]: Base;}) => void
|
||||
>n : { [n: number]: Base; }
|
||||
>n : number
|
||||
>x329([d1, d2]) : void
|
||||
@@ -3120,8 +3120,8 @@ var x340 = (n: Array<Base>) => n; x340([d1, d2]);
|
||||
>d2 : Derived2
|
||||
|
||||
var x341 = (n: { [n: number]: Base; }) => n; x341([d1, d2]);
|
||||
>x341 : (n: { [n: number]: Base; }) => { [n: number]: Base; }
|
||||
>(n: { [n: number]: Base; }) => n : (n: { [n: number]: Base; }) => { [n: number]: Base; }
|
||||
>x341 : (n: { [n: number]: Base;}) => { [n: number]: Base; }
|
||||
>(n: { [n: number]: Base; }) => n : (n: { [n: number]: Base;}) => { [n: number]: Base; }
|
||||
>n : { [n: number]: Base; }
|
||||
>n : number
|
||||
>n : { [n: number]: Base; }
|
||||
@@ -3132,8 +3132,8 @@ var x341 = (n: { [n: number]: Base; }) => n; x341([d1, d2]);
|
||||
>d2 : Derived2
|
||||
|
||||
var x342 = (n: {n: Base[]; } ) => n; x342({ n: [d1, d2] });
|
||||
>x342 : (n: { n: Base[]; }) => { n: Base[]; }
|
||||
>(n: {n: Base[]; } ) => n : (n: { n: Base[]; }) => { n: Base[]; }
|
||||
>x342 : (n: { n: Base[];}) => { n: Base[]; }
|
||||
>(n: {n: Base[]; } ) => n : (n: { n: Base[];}) => { n: Base[]; }
|
||||
>n : { n: Base[]; }
|
||||
>n : Base[]
|
||||
>n : { n: Base[]; }
|
||||
@@ -3261,8 +3261,8 @@ var x352 = function(n: Array<Base>) { }; x352([d1, d2]);
|
||||
>d2 : Derived2
|
||||
|
||||
var x353 = function(n: { [n: number]: Base; }) { }; x353([d1, d2]);
|
||||
>x353 : (n: { [n: number]: Base; }) => void
|
||||
>function(n: { [n: number]: Base; }) { } : (n: { [n: number]: Base; }) => void
|
||||
>x353 : (n: { [n: number]: Base;}) => void
|
||||
>function(n: { [n: number]: Base; }) { } : (n: { [n: number]: Base;}) => void
|
||||
>n : { [n: number]: Base; }
|
||||
>n : number
|
||||
>x353([d1, d2]) : void
|
||||
@@ -3272,8 +3272,8 @@ var x353 = function(n: { [n: number]: Base; }) { }; x353([d1, d2]);
|
||||
>d2 : Derived2
|
||||
|
||||
var x354 = function(n: {n: Base[]; } ) { }; x354({ n: [d1, d2] });
|
||||
>x354 : (n: { n: Base[]; }) => void
|
||||
>function(n: {n: Base[]; } ) { } : (n: { n: Base[]; }) => void
|
||||
>x354 : (n: { n: Base[];}) => void
|
||||
>function(n: {n: Base[]; } ) { } : (n: { n: Base[];}) => void
|
||||
>n : { n: Base[]; }
|
||||
>n : Base[]
|
||||
>x354({ n: [d1, d2] }) : void
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
=== generatorTypeCheck29.ts ===
|
||||
function* g2(): Iterator<Iterable<(x: string) => number>> {
|
||||
>g2 : () => Iterator<Iterable<(x: string) => number>, any, undefined>
|
||||
>g2 : () => Iterator<Iterable<(x: string) => number>>
|
||||
>x : string
|
||||
|
||||
yield function* () {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
=== generatorTypeCheck30.ts ===
|
||||
function* g2(): Iterator<Iterable<(x: string) => number>> {
|
||||
>g2 : () => Iterator<Iterable<(x: string) => number>, any, undefined>
|
||||
>g2 : () => Iterator<Iterable<(x: string) => number>>
|
||||
>x : string
|
||||
|
||||
yield function* () {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
=== generatorTypeCheck31.ts ===
|
||||
function* g2(): Iterator<() => Iterable<(x: string) => number>> {
|
||||
>g2 : () => Iterator<() => Iterable<(x: string) => number>, any, undefined>
|
||||
>g2 : () => Iterator<() => Iterable<(x: string) => number>>
|
||||
>x : string
|
||||
|
||||
yield function* () {
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
=== generatorTypeCheck45.ts ===
|
||||
declare function foo<T, U>(x: T, fun: () => Iterator<(x: T) => U>, fun2: (y: U) => T): T;
|
||||
>foo : <T, U>(x: T, fun: () => Iterator<(x: T) => U, any, undefined>, fun2: (y: U) => T) => T
|
||||
>foo : <T, U>(x: T, fun: () => Iterator<(x: T) => U>, fun2: (y: U) => T) => T
|
||||
>x : T
|
||||
>fun : () => Iterator<(x: T) => U, any, undefined>
|
||||
>fun : () => Iterator<(x: T) => U>
|
||||
>x : T
|
||||
>fun2 : (y: U) => T
|
||||
>y : U
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// Generic call with parameter of object type with member of function type of n args passed object whose associated member is call signature with n+1 args
|
||||
|
||||
function foo<T, U>(arg: { cb: new(t: T) => U }) {
|
||||
>foo : <T, U>(arg: { cb: new (t: T) => U; }) => U
|
||||
>foo : <T, U>(arg: { cb: new (t: T) => U;}) => U
|
||||
>arg : { cb: new (t: T) => U; }
|
||||
>cb : new (t: T) => U
|
||||
>t : T
|
||||
@@ -53,7 +53,7 @@ var r3 = foo(arg3); // error
|
||||
>arg3 : { cb: new (x: string, y: number) => string; }
|
||||
|
||||
function foo2<T, U>(arg: { cb: new(t: T, t2: T) => U }) {
|
||||
>foo2 : <T, U>(arg: { cb: new (t: T, t2: T) => U; }) => U
|
||||
>foo2 : <T, U>(arg: { cb: new (t: T, t2: T) => U;}) => U
|
||||
>arg : { cb: new (t: T, t2: T) => U; }
|
||||
>cb : new (t: T, t2: T) => U
|
||||
>t : T
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// Generic call with parameter of object type with member of function type of n args passed object whose associated member is call signature with n+1 args
|
||||
|
||||
function foo<T, U>(arg: { cb: (t: T) => U }) {
|
||||
>foo : <T, U>(arg: { cb: (t: T) => U; }) => U
|
||||
>foo : <T, U>(arg: { cb: (t: T) => U;}) => U
|
||||
>arg : { cb: (t: T) => U; }
|
||||
>cb : (t: T) => U
|
||||
>t : T
|
||||
@@ -54,7 +54,7 @@ var r3 = foo({ cb: (x: string, y: number) => '' }); // error
|
||||
>'' : ""
|
||||
|
||||
function foo2<T, U>(arg: { cb: (t: T, t2: T) => U }) {
|
||||
>foo2 : <T, U>(arg: { cb: (t: T, t2: T) => U; }) => U
|
||||
>foo2 : <T, U>(arg: { cb: (t: T, t2: T) => U;}) => U
|
||||
>arg : { cb: (t: T, t2: T) => U; }
|
||||
>cb : (t: T, t2: T) => U
|
||||
>t : T
|
||||
|
||||
@@ -48,7 +48,7 @@ module GenericParameter {
|
||||
>GenericParameter : typeof GenericParameter
|
||||
|
||||
function foo5<T>(cb: { new(x: T): string; new(x: number): T }) {
|
||||
>foo5 : <T>(cb: { new (x: T): string; new (x: number): T; }) => { new (x: T): string; new (x: number): T; }
|
||||
>foo5 : <T>(cb: { new (x: T): string; new (x: number): T;}) => { new (x: T): string; new (x: number): T; }
|
||||
>cb : { new (x: T): string; new (x: number): T; }
|
||||
>x : T
|
||||
>x : number
|
||||
@@ -84,7 +84,7 @@ module GenericParameter {
|
||||
>b : { new <T>(x: T): string; new <T_1>(x: number): T_1; }
|
||||
|
||||
function foo6<T>(cb: { new(x: T): string; new(x: T, y?: T): string }) {
|
||||
>foo6 : <T>(cb: { new (x: T): string; new (x: T, y?: T): string; }) => { new (x: T): string; new (x: T, y?: T): string; }
|
||||
>foo6 : <T>(cb: { new (x: T): string; new (x: T, y?: T): string;}) => { new (x: T): string; new (x: T, y?: T): string; }
|
||||
>cb : { new (x: T): string; new (x: T, y?: T): string; }
|
||||
>x : T
|
||||
>x : T
|
||||
@@ -107,7 +107,7 @@ module GenericParameter {
|
||||
>b : { new <T>(x: T): string; new <T_1>(x: number): T_1; }
|
||||
|
||||
function foo7<T>(x:T, cb: { new(x: T): string; new(x: T, y?: T): string }) {
|
||||
>foo7 : <T>(x: T, cb: { new (x: T): string; new (x: T, y?: T): string; }) => { new (x: T): string; new (x: T, y?: T): string; }
|
||||
>foo7 : <T>(x: T, cb: { new (x: T): string; new (x: T, y?: T): string;}) => { new (x: T): string; new (x: T, y?: T): string; }
|
||||
>x : T
|
||||
>cb : { new (x: T): string; new (x: T, y?: T): string; }
|
||||
>x : T
|
||||
|
||||
@@ -41,7 +41,7 @@ module GenericParameter {
|
||||
>GenericParameter : typeof GenericParameter
|
||||
|
||||
function foo5<T>(cb: { new(x: T): string; new(x: number): T }) {
|
||||
>foo5 : <T>(cb: { new (x: T): string; new (x: number): T; }) => { new (x: T): string; new (x: number): T; }
|
||||
>foo5 : <T>(cb: { new (x: T): string; new (x: number): T;}) => { new (x: T): string; new (x: number): T; }
|
||||
>cb : { new (x: T): string; new (x: number): T; }
|
||||
>x : T
|
||||
>x : number
|
||||
@@ -61,7 +61,7 @@ module GenericParameter {
|
||||
>a : new <T>(x: T) => T
|
||||
|
||||
function foo6<T>(cb: { new(x: T): string; new(x: T, y?: T): string }) {
|
||||
>foo6 : <T>(cb: { new (x: T): string; new (x: T, y?: T): string; }) => { new (x: T): string; new (x: T, y?: T): string; }
|
||||
>foo6 : <T>(cb: { new (x: T): string; new (x: T, y?: T): string;}) => { new (x: T): string; new (x: T, y?: T): string; }
|
||||
>cb : { new (x: T): string; new (x: T, y?: T): string; }
|
||||
>x : T
|
||||
>x : T
|
||||
@@ -83,7 +83,7 @@ module GenericParameter {
|
||||
>b : new <T>(x: T, y: T) => string
|
||||
|
||||
function foo7<T>(x:T, cb: { new(x: T): string; new(x: T, y?: T): string }) {
|
||||
>foo7 : <T>(x: T, cb: { new (x: T): string; new (x: T, y?: T): string; }) => { new (x: T): string; new (x: T, y?: T): string; }
|
||||
>foo7 : <T>(x: T, cb: { new (x: T): string; new (x: T, y?: T): string;}) => { new (x: T): string; new (x: T, y?: T): string; }
|
||||
>x : T
|
||||
>cb : { new (x: T): string; new (x: T, y?: T): string; }
|
||||
>x : T
|
||||
|
||||
@@ -53,7 +53,7 @@ module GenericParameter {
|
||||
>GenericParameter : typeof GenericParameter
|
||||
|
||||
function foo5<T>(cb: { (x: T): string; (x: number): T }) {
|
||||
>foo5 : <T>(cb: { (x: T): string; (x: number): T; }) => { (x: T): string; (x: number): T; }
|
||||
>foo5 : <T>(cb: { (x: T): string; (x: number): T;}) => { (x: T): string; (x: number): T; }
|
||||
>cb : { (x: T): string; (x: number): T; }
|
||||
>x : T
|
||||
>x : number
|
||||
@@ -82,7 +82,7 @@ module GenericParameter {
|
||||
>a : { <T>(x: T): string; <T_1>(x: number): T_1; }
|
||||
|
||||
function foo6<T>(cb: { (x: T): string; (x: T, y?: T): string }) {
|
||||
>foo6 : <T>(cb: { (x: T): string; (x: T, y?: T): string; }) => { (x: T): string; (x: T, y?: T): string; }
|
||||
>foo6 : <T>(cb: { (x: T): string; (x: T, y?: T): string;}) => { (x: T): string; (x: T, y?: T): string; }
|
||||
>cb : { (x: T): string; (x: T, y?: T): string; }
|
||||
>x : T
|
||||
>x : T
|
||||
@@ -118,7 +118,7 @@ module GenericParameter {
|
||||
>'' : ""
|
||||
|
||||
function foo7<T>(x:T, cb: { (x: T): string; (x: T, y?: T): string }) {
|
||||
>foo7 : <T>(x: T, cb: { (x: T): string; (x: T, y?: T): string; }) => { (x: T): string; (x: T, y?: T): string; }
|
||||
>foo7 : <T>(x: T, cb: { (x: T): string; (x: T, y?: T): string;}) => { (x: T): string; (x: T, y?: T): string; }
|
||||
>x : T
|
||||
>cb : { (x: T): string; (x: T, y?: T): string; }
|
||||
>x : T
|
||||
|
||||
@@ -40,7 +40,7 @@ module GenericParameter {
|
||||
>GenericParameter : typeof GenericParameter
|
||||
|
||||
function foo5<T>(cb: { (x: T): string; (x: number): T }) {
|
||||
>foo5 : <T>(cb: { (x: T): string; (x: number): T; }) => { (x: T): string; (x: number): T; }
|
||||
>foo5 : <T>(cb: { (x: T): string; (x: number): T;}) => { (x: T): string; (x: number): T; }
|
||||
>cb : { (x: T): string; (x: number): T; }
|
||||
>x : T
|
||||
>x : number
|
||||
@@ -58,7 +58,7 @@ module GenericParameter {
|
||||
>x : T
|
||||
|
||||
function foo6<T>(cb: { (x: T): string; (x: T, y?: T): string }) {
|
||||
>foo6 : <T>(cb: { (x: T): string; (x: T, y?: T): string; }) => { (x: T): string; (x: T, y?: T): string; }
|
||||
>foo6 : <T>(cb: { (x: T): string; (x: T, y?: T): string;}) => { (x: T): string; (x: T, y?: T): string; }
|
||||
>cb : { (x: T): string; (x: T, y?: T): string; }
|
||||
>x : T
|
||||
>x : T
|
||||
@@ -78,7 +78,7 @@ module GenericParameter {
|
||||
>'' : ""
|
||||
|
||||
function foo7<T>(x:T, cb: { (x: T): string; (x: T, y?: T): string }) {
|
||||
>foo7 : <T>(x: T, cb: { (x: T): string; (x: T, y?: T): string; }) => { (x: T): string; (x: T, y?: T): string; }
|
||||
>foo7 : <T>(x: T, cb: { (x: T): string; (x: T, y?: T): string;}) => { (x: T): string; (x: T, y?: T): string; }
|
||||
>x : T
|
||||
>cb : { (x: T): string; (x: T, y?: T): string; }
|
||||
>x : T
|
||||
|
||||
@@ -418,7 +418,7 @@ const f41 = pipe4([box, list]);
|
||||
>list : <T>(a: T) => T[]
|
||||
|
||||
declare function pipe5<A, B>(f: (a: A) => B): { f: (a: A) => B };
|
||||
>pipe5 : <A, B>(f: (a: A) => B) => { f: (a: A) => B; }
|
||||
>pipe5 : <A, B>(f: (a: A) => B) => { f: (a: A) => B;}
|
||||
>f : (a: A) => B
|
||||
>a : A
|
||||
>f : (a: A) => B
|
||||
|
||||
@@ -16,7 +16,7 @@ interface bar<T> {
|
||||
>arg : T
|
||||
|
||||
fail2(func2: { (arg: T): void; }): void;
|
||||
>fail2 : (func2: (arg: T) => void) => void
|
||||
>fail2 : (func2: { (arg: T): void;}) => void
|
||||
>func2 : (arg: T) => void
|
||||
>arg : T
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ declare function cases(tester: Tester): void;
|
||||
>tester : Tester
|
||||
|
||||
declare function fn<Y extends any[]>(implementation?: (...args: Y) => any): Mock<Y>;
|
||||
>fn : <Y extends any[]>(implementation?: ((...args: Y) => any) | undefined) => Mock<Y>
|
||||
>fn : <Y extends any[]>(implementation?: (...args: Y) => any) => Mock<Y>
|
||||
>implementation : ((...args: Y) => any) | undefined
|
||||
>args : Y
|
||||
|
||||
|
||||
@@ -30,8 +30,8 @@ type PostBody<PATH extends PostPath> = Extract<ApiPost, { path: PATH }>["body"];
|
||||
>path : PATH
|
||||
|
||||
const post = <PATH extends PostPath>(
|
||||
>post : <PATH extends "/login" | "/user">(path: PATH, { body, ...options }: Omit<RequestInit, "body"> & { body: PostBody<PATH>; }) => void
|
||||
><PATH extends PostPath>( path: PATH, {body, ...options}: Omit<RequestInit, 'body'> & {body: PostBody<PATH>}) => {} : <PATH extends "/login" | "/user">(path: PATH, { body, ...options }: Omit<RequestInit, "body"> & { body: PostBody<PATH>; }) => void
|
||||
>post : <PATH extends "/login" | "/user">(path: PATH, { body, ...options }: Omit<RequestInit, 'body'> & { body: PostBody<PATH>;}) => void
|
||||
><PATH extends PostPath>( path: PATH, {body, ...options}: Omit<RequestInit, 'body'> & {body: PostBody<PATH>}) => {} : <PATH extends "/login" | "/user">(path: PATH, { body, ...options }: Omit<RequestInit, 'body'> & { body: PostBody<PATH>;}) => void
|
||||
|
||||
path: PATH,
|
||||
>path : PATH
|
||||
|
||||
@@ -58,12 +58,12 @@ map = names2;
|
||||
>names2 : { a: string; b: string; }
|
||||
|
||||
declare function getStringIndexValue<T>(map: { [x: string]: T }): T;
|
||||
>getStringIndexValue : <T>(map: { [x: string]: T; }) => T
|
||||
>getStringIndexValue : <T>(map: { [x: string]: T;}) => T
|
||||
>map : { [x: string]: T; }
|
||||
>x : string
|
||||
|
||||
declare function getNumberIndexValue<T>(map: { [x: number]: T }): T;
|
||||
>getNumberIndexValue : <T>(map: { [x: number]: T; }) => T
|
||||
>getNumberIndexValue : <T>(map: { [x: number]: T;}) => T
|
||||
>map : { [x: number]: T; }
|
||||
>x : number
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
// { [key: string]: Y } if X is related to Y.
|
||||
|
||||
function f1<T, K extends string>(x: { [key: string]: T }, y: Record<K, T>) {
|
||||
>f1 : <T, K extends string>(x: { [key: string]: T; }, y: Record<K, T>) => void
|
||||
>f1 : <T, K extends string>(x: { [key: string]: T;}, y: Record<K, T>) => void
|
||||
>x : { [key: string]: T; }
|
||||
>key : string
|
||||
>y : Record<K, T>
|
||||
@@ -22,7 +22,7 @@ function f1<T, K extends string>(x: { [key: string]: T }, y: Record<K, T>) {
|
||||
}
|
||||
|
||||
function f2<T>(x: { [key: string]: T }, y: Record<string, T>) {
|
||||
>f2 : <T>(x: { [key: string]: T; }, y: Record<string, T>) => void
|
||||
>f2 : <T>(x: { [key: string]: T;}, y: Record<string, T>) => void
|
||||
>x : { [key: string]: T; }
|
||||
>key : string
|
||||
>y : Record<string, T>
|
||||
@@ -39,7 +39,7 @@ function f2<T>(x: { [key: string]: T }, y: Record<string, T>) {
|
||||
}
|
||||
|
||||
function f3<T, U, K extends string>(x: { [key: string]: T }, y: Record<K, U>) {
|
||||
>f3 : <T, U, K extends string>(x: { [key: string]: T; }, y: Record<K, U>) => void
|
||||
>f3 : <T, U, K extends string>(x: { [key: string]: T;}, y: Record<K, U>) => void
|
||||
>x : { [key: string]: T; }
|
||||
>key : string
|
||||
>y : Record<K, U>
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
=== indexSignatureOfTypeUnknownStillRequiresIndexSignature.ts ===
|
||||
declare function f<T extends unknown = unknown>(x: { [x: string]: T }): T;
|
||||
>f : <T extends unknown = unknown>(x: { [x: string]: T; }) => T
|
||||
>f : <T extends unknown = unknown>(x: { [x: string]: T;}) => T
|
||||
>x : { [x: string]: T; }
|
||||
>x : string
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ const sym = Symbol();
|
||||
>Symbol : SymbolConstructor
|
||||
|
||||
function gg3(x: { [key: string]: string }, y: { [key: symbol]: string }, z: { [sym]: number }) {
|
||||
>gg3 : (x: { [key: string]: string; }, y: { [key: symbol]: string; }, z: { [sym]: number;}) => void
|
||||
>gg3 : (x: { [key: string]: string;}, y: { [key: symbol]: string;}, z: { [sym]: number;}) => void
|
||||
>x : { [key: string]: string; }
|
||||
>key : string
|
||||
>y : { [key: symbol]: string; }
|
||||
@@ -32,7 +32,7 @@ function gg3(x: { [key: string]: string }, y: { [key: symbol]: string }, z: { [s
|
||||
// Overlapping index signatures
|
||||
|
||||
function gg1(x: { [key: `a${string}`]: string, [key: `${string}a`]: string }, y: { [key: `a${string}a`]: string }) {
|
||||
>gg1 : (x: { [key: `a${string}`]: string; [key: `${string}a`]: string; }, y: { [key: `a${string}a`]: string; }) => void
|
||||
>gg1 : (x: { [key: `a${string}`]: string; [key: `${string}a`]: string;}, y: { [key: `a${string}a`]: string;}) => void
|
||||
>x : { [key: `a${string}`]: string; [key: `${string}a`]: string; }
|
||||
>key : `a${string}`
|
||||
>key : `${string}a`
|
||||
@@ -849,7 +849,7 @@ const directive = Symbol('directive');
|
||||
>'directive' : "directive"
|
||||
|
||||
declare function foo<TArg, TRet, TDir>(options: { [x in string]: (arg: TArg) => TRet } & { [directive]?: TDir }): void;
|
||||
>foo : <TArg, TRet, TDir>(options: { [x: string]: (arg: TArg) => TRet; } & { [directive]?: TDir | undefined; }) => void
|
||||
>foo : <TArg, TRet, TDir>(options: { [x in string]: (arg: TArg) => TRet;} & { [directive]?: TDir;}) => void
|
||||
>options : { [x: string]: (arg: TArg) => TRet; } & { [directive]?: TDir | undefined; }
|
||||
>arg : TArg
|
||||
>[directive] : TDir | undefined
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
|
||||
=== indexSignaturesInferentialTyping.ts ===
|
||||
function foo<T>(items: { [index: number]: T }): T { return undefined; }
|
||||
>foo : <T>(items: { [index: number]: T; }) => T
|
||||
>foo : <T>(items: { [index: number]: T;}) => T
|
||||
>items : { [index: number]: T; }
|
||||
>index : number
|
||||
>undefined : undefined
|
||||
|
||||
function bar<T>(items: { [index: string]: T }): T { return undefined; }
|
||||
>bar : <T>(items: { [index: string]: T; }) => T
|
||||
>bar : <T>(items: { [index: string]: T;}) => T
|
||||
>items : { [index: string]: T; }
|
||||
>index : string
|
||||
>undefined : undefined
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
=== indexerReturningTypeParameter1.ts ===
|
||||
interface f {
|
||||
groupBy<T>(): { [key: string]: T[]; };
|
||||
>groupBy : <T>() => { [key: string]: T[]; }
|
||||
>groupBy : <T>() => { [key: string]: T[];}
|
||||
>key : string
|
||||
}
|
||||
var a: f;
|
||||
@@ -20,7 +20,7 @@ class c {
|
||||
>c : c
|
||||
|
||||
groupBy<T>(): { [key: string]: T[]; } {
|
||||
>groupBy : <T>() => { [key: string]: T[]; }
|
||||
>groupBy : <T>() => { [key: string]: T[];}
|
||||
>key : string
|
||||
|
||||
return null;
|
||||
|
||||
@@ -522,7 +522,7 @@ class ClassWithConvert<T> {
|
||||
>val : T
|
||||
|
||||
convert(converter: { to: (v: T) => T; }) { }
|
||||
>convert : (converter: { to: (v: T) => T; }) => void
|
||||
>convert : (converter: { to: (v: T) => T;}) => void
|
||||
>converter : { to: (v: T) => T; }
|
||||
>to : (v: T) => T
|
||||
>v : T
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// repro #50687
|
||||
|
||||
declare function repro<T>(config: {
|
||||
>repro : <T>(config: { params: T; callback: () => (params: T) => number; }) => void
|
||||
>repro : <T>(config: { params: T; callback: () => (params: T) => number;}) => void
|
||||
>config : { params: T; callback: () => (params: T) => number; }
|
||||
|
||||
params: T;
|
||||
|
||||
@@ -310,7 +310,7 @@ type IfEquals<X, Y, A, B> = (<T>() => T extends X ? 1 : 2) extends <T>() => T ex
|
||||
>IfEquals : IfEquals<X, Y, A, B>
|
||||
|
||||
declare const x1: <T>() => (T extends infer U extends number ? 1 : 0);
|
||||
>x1 : <T>() => T extends infer U extends number ? 1 : 0
|
||||
>x1 : <T>() => (T extends infer U extends number ? 1 : 0)
|
||||
|
||||
function f1() {
|
||||
>f1 : () => <T>() => T extends infer U extends number ? 1 : 0
|
||||
@@ -323,7 +323,7 @@ type ExpectNumber<T extends number> = T;
|
||||
>ExpectNumber : T
|
||||
|
||||
declare const x2: <T>() => (T extends ExpectNumber<infer U> ? 1 : 0);
|
||||
>x2 : <T>() => T extends infer U extends number ? 1 : 0
|
||||
>x2 : <T>() => (T extends ExpectNumber<infer U> ? 1 : 0)
|
||||
|
||||
function f2() {
|
||||
>f2 : () => <T>() => T extends infer U extends number ? 1 : 0
|
||||
|
||||
@@ -5,7 +5,7 @@ interface NodeArray<T extends Node> extends ReadonlyArray<T> {}
|
||||
|
||||
interface Node {
|
||||
forEachChild<T>(cbNode: (node: Node) => T | undefined, cbNodeArray?: (nodes: NodeArray<Node>) => T | undefined): T | undefined;
|
||||
>forEachChild : <T>(cbNode: (node: Node) => T | undefined, cbNodeArray?: ((nodes: NodeArray<Node>) => T | undefined) | undefined) => T | undefined
|
||||
>forEachChild : <T>(cbNode: (node: Node) => T | undefined, cbNodeArray?: (nodes: NodeArray<Node>) => T | undefined) => T | undefined
|
||||
>cbNode : (node: Node) => T | undefined
|
||||
>node : Node
|
||||
>cbNodeArray : ((nodes: NodeArray<Node>) => T | undefined) | undefined
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
=== inferenceOptionalProperties.ts ===
|
||||
declare function test<T>(x: { [key: string]: T }): T;
|
||||
>test : <T>(x: { [key: string]: T; }) => T
|
||||
>test : <T>(x: { [key: string]: T;}) => T
|
||||
>x : { [key: string]: T; }
|
||||
>key : string
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user