mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Write more useful types in .types test outputs (#48578)
This commit is contained in:
+33
-25
@@ -115,31 +115,39 @@ namespace Harness {
|
||||
// let type = this.checker.getTypeAtLocation(node);
|
||||
let type = ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent) ? this.checker.getTypeAtLocation(node.parent) : undefined;
|
||||
if (!type || type.flags & ts.TypeFlags.Any) type = this.checker.getTypeAtLocation(node);
|
||||
const typeString =
|
||||
// Distinguish `errorType`s from `any`s; but only if the file has no errors.
|
||||
// Additionally,
|
||||
// * the LHS of a qualified name
|
||||
// * a binding pattern name
|
||||
// * labels
|
||||
// * the "global" in "declare global"
|
||||
// * the "target" in "new.target"
|
||||
// * names in import statements
|
||||
// * type-only names in export statements
|
||||
// * and intrinsic jsx tag names
|
||||
// return `error`s via `getTypeAtLocation`
|
||||
// But this is generally expected, so we don't call those out, either
|
||||
(!this.hadErrorBaseline &&
|
||||
type.flags & ts.TypeFlags.Any &&
|
||||
!ts.isBindingElement(node.parent) &&
|
||||
!ts.isPropertyAccessOrQualifiedName(node.parent) &&
|
||||
!ts.isLabelName(node) &&
|
||||
!(ts.isModuleDeclaration(node.parent) && ts.isGlobalScopeAugmentation(node.parent)) &&
|
||||
!ts.isMetaProperty(node.parent) &&
|
||||
!this.isImportStatementName(node) &&
|
||||
!this.isExportStatementName(node) &&
|
||||
!this.isIntrinsicJsxTag(node)) ?
|
||||
(type as ts.IntrinsicType).intrinsicName :
|
||||
this.checker.typeToString(type, node.parent, ts.TypeFormatFlags.NoTruncation | ts.TypeFormatFlags.AllowUniqueESSymbolType);
|
||||
// Distinguish `errorType`s from `any`s; but only if the file has no errors.
|
||||
// Additionally,
|
||||
// * the LHS of a qualified name
|
||||
// * a binding pattern name
|
||||
// * labels
|
||||
// * the "global" in "declare global"
|
||||
// * the "target" in "new.target"
|
||||
// * names in import statements
|
||||
// * type-only names in export statements
|
||||
// * and intrinsic jsx tag names
|
||||
// return `error`s via `getTypeAtLocation`
|
||||
// But this is generally expected, so we don't call those out, either
|
||||
let typeString: string;
|
||||
if (!this.hadErrorBaseline &&
|
||||
type.flags & ts.TypeFlags.Any &&
|
||||
!ts.isBindingElement(node.parent) &&
|
||||
!ts.isPropertyAccessOrQualifiedName(node.parent) &&
|
||||
!ts.isLabelName(node) &&
|
||||
!(ts.isModuleDeclaration(node.parent) && ts.isGlobalScopeAugmentation(node.parent)) &&
|
||||
!ts.isMetaProperty(node.parent) &&
|
||||
!this.isImportStatementName(node) &&
|
||||
!this.isExportStatementName(node) &&
|
||||
!this.isIntrinsicJsxTag(node)) {
|
||||
typeString = (type as ts.IntrinsicType).intrinsicName;
|
||||
}
|
||||
else {
|
||||
typeString = this.checker.typeToString(type, node.parent, ts.TypeFormatFlags.NoTruncation | ts.TypeFormatFlags.AllowUniqueESSymbolType);
|
||||
if (ts.isIdentifier(node) && ts.isTypeAliasDeclaration(node.parent) && node.parent.name === node && typeString === ts.idText(node)) {
|
||||
// for a complex type alias `type T = ...`, showing "T : T" isn't very helpful for type tests. When the type produced is the same as
|
||||
// the name of the type alias, recreate the type string without reusing the alias name
|
||||
typeString = this.checker.typeToString(type, node.parent, ts.TypeFormatFlags.NoTruncation | ts.TypeFormatFlags.AllowUniqueESSymbolType | ts.TypeFormatFlags.InTypeAlias);
|
||||
}
|
||||
}
|
||||
return {
|
||||
line: lineAndCharacter.line,
|
||||
syntaxKind: node.kind,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/compiler/DeclarationErrorsNoEmitOnError.ts ===
|
||||
type T = { x : number }
|
||||
>T : T
|
||||
>T : { x: number; }
|
||||
>x : number
|
||||
|
||||
export interface I {
|
||||
|
||||
@@ -14,17 +14,17 @@ abstract class AbstractB { b: string; }
|
||||
>b : string
|
||||
|
||||
type Abstracts = typeof AbstractA | typeof AbstractB;
|
||||
>Abstracts : Abstracts
|
||||
>Abstracts : typeof AbstractA | typeof AbstractB
|
||||
>AbstractA : typeof AbstractA
|
||||
>AbstractB : typeof AbstractB
|
||||
|
||||
type Concretes = typeof ConcreteA | typeof ConcreteB;
|
||||
>Concretes : Concretes
|
||||
>Concretes : typeof ConcreteA | typeof ConcreteB
|
||||
>ConcreteA : typeof ConcreteA
|
||||
>ConcreteB : typeof ConcreteB
|
||||
|
||||
type ConcretesOrAbstracts = Concretes | Abstracts;
|
||||
>ConcretesOrAbstracts : ConcretesOrAbstracts
|
||||
>ConcretesOrAbstracts : Abstracts | Concretes
|
||||
|
||||
declare const cls1: ConcretesOrAbstracts;
|
||||
>cls1 : ConcretesOrAbstracts
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/compiler/accessorBodyInTypeContext.ts ===
|
||||
type A = {
|
||||
>A : A
|
||||
>A : { readonly foo: number; }
|
||||
|
||||
get foo() { return 0 }
|
||||
>foo : number
|
||||
@@ -9,7 +9,7 @@ type A = {
|
||||
};
|
||||
|
||||
type B = {
|
||||
>B : B
|
||||
>B : { foo: any; }
|
||||
|
||||
set foo(v: any) { }
|
||||
>foo : any
|
||||
|
||||
+8
-8
@@ -8,10 +8,10 @@ type ExtendedMapper<HandledInputT, OutputT, ArgsT extends any[]> = (name : strin
|
||||
>args : ArgsT
|
||||
|
||||
type a = ExtendedMapper<any, any, [any]>;
|
||||
>a : a
|
||||
>a : (name: string, mixed: any, args_0: any) => any
|
||||
|
||||
type b = ExtendedMapper<any, any, any[]>;
|
||||
>b : b
|
||||
>b : (name: string, mixed: any, ...args: any[]) => any
|
||||
|
||||
type test = a extends b ? "y" : "n"
|
||||
>test : "y"
|
||||
@@ -32,10 +32,10 @@ type ExtendedMapper1<HandledInputT, OutputT, ArgsT extends any[]> = (
|
||||
);
|
||||
|
||||
type a1 = ExtendedMapper1<any, any, [any]>;
|
||||
>a1 : a1
|
||||
>a1 : (name: string, mixed: any, args_0: any) => any
|
||||
|
||||
type b1 = ExtendedMapper1<any, any, any[]>;
|
||||
>b1 : b1
|
||||
>b1 : (name: string, mixed: any, ...args: any[]) => any
|
||||
|
||||
type test1 = a1 extends b1 ? "y" : "n"
|
||||
>test1 : "y"
|
||||
@@ -56,10 +56,10 @@ type ExtendedMapper2<HandledInputT, OutputT, ArgsT extends any[]> = (
|
||||
);
|
||||
|
||||
type a2 = ExtendedMapper2<any, any, [any]>;
|
||||
>a2 : a2
|
||||
>a2 : (name: string, mixed: any, args_0: any) => any
|
||||
|
||||
type b2 = ExtendedMapper2<any, any, any[]>;
|
||||
>b2 : b2
|
||||
>b2 : (name: string, mixed: any, ...args: any[]) => any
|
||||
|
||||
type test2 = a2 extends b2 ? "y" : "n"
|
||||
>test2 : "y"
|
||||
@@ -69,13 +69,13 @@ let check2: test2 = "y";
|
||||
>"y" : "y"
|
||||
|
||||
type a3 = (name: string, mixed: any, args_0: any) => any
|
||||
>a3 : a3
|
||||
>a3 : (name: string, mixed: any, args_0: any) => any
|
||||
>name : string
|
||||
>mixed : any
|
||||
>args_0 : any
|
||||
|
||||
type b3 = (name: string, mixed: any, ...args: any[]) => any
|
||||
>b3 : b3
|
||||
>b3 : (name: string, mixed: any, ...args: any[]) => any
|
||||
>name : string
|
||||
>mixed : any
|
||||
>args : any[]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
=== tests/cases/compiler/anyMappedTypesError.ts ===
|
||||
type Foo = {[P in "bar"]};
|
||||
>Foo : Foo
|
||||
>Foo : { bar: any; }
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
=== tests/cases/compiler/argumentsAsPropertyName.ts ===
|
||||
// target: es5
|
||||
type MyType = {
|
||||
>MyType : MyType
|
||||
>MyType : { arguments: Array<string>; }
|
||||
|
||||
arguments: Array<string>
|
||||
>arguments : string[]
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
=== tests/cases/compiler/arrayDestructuringInSwitch1.ts ===
|
||||
export type Expression = BooleanLogicExpression | 'true' | 'false';
|
||||
>Expression : Expression
|
||||
>Expression : BooleanLogicExpression | "true" | "false"
|
||||
|
||||
export type BooleanLogicExpression = ['and', ...Expression[]] | ['not', Expression];
|
||||
>BooleanLogicExpression : BooleanLogicExpression
|
||||
>BooleanLogicExpression : ["and", ...Expression[]] | ["not", Expression]
|
||||
|
||||
export function evaluate(expression: Expression): boolean {
|
||||
>evaluate : (expression: Expression) => boolean
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/compiler/arrayDestructuringInSwitch2.ts ===
|
||||
type X = { kind: "a", a: [1] } | { kind: "b", a: [] }
|
||||
>X : X
|
||||
>X : { kind: "a"; a: [1]; } | { kind: "b"; a: []; }
|
||||
>kind : "a"
|
||||
>a : [1]
|
||||
>kind : "b"
|
||||
|
||||
@@ -18,7 +18,7 @@ interface Dog {
|
||||
}
|
||||
|
||||
type Animal = Cat | Dog;
|
||||
>Animal : Animal
|
||||
>Animal : Cat | Dog
|
||||
|
||||
declare function assertEqual<T>(value: any, type: T): asserts value is T;
|
||||
>assertEqual : <T>(value: any, type: T) => asserts value is T
|
||||
|
||||
@@ -6,12 +6,12 @@ namespace Example1 {
|
||||
>Example1 : typeof Example1
|
||||
|
||||
type S = { done: boolean, value: number };
|
||||
>S : S
|
||||
>S : { done: boolean; value: number; }
|
||||
>done : boolean
|
||||
>value : number
|
||||
|
||||
type T =
|
||||
>T : T
|
||||
>T : { done: true; value: number; } | { done: false; value: number; }
|
||||
|
||||
| { done: true, value: number } // T0
|
||||
>done : true
|
||||
@@ -42,12 +42,12 @@ namespace Example2 {
|
||||
>Example2 : typeof Example2
|
||||
|
||||
type S = { a: 0 | 2, b: 4 };
|
||||
>S : S
|
||||
>S : { a: 0 | 2; b: 4; }
|
||||
>a : 0 | 2
|
||||
>b : 4
|
||||
|
||||
type T = { a: 0, b: 1 | 4 } // T0
|
||||
>T : T
|
||||
>T : { a: 0; b: 1 | 4; } | { a: 1; b: 2; } | { a: 2; b: 3 | 4; }
|
||||
>a : 0
|
||||
>b : 4 | 1
|
||||
|
||||
@@ -78,12 +78,12 @@ namespace Example3 {
|
||||
>Example3 : typeof Example3
|
||||
|
||||
type S = { a: 0 | 2, b: 4 };
|
||||
>S : S
|
||||
>S : { a: 0 | 2; b: 4; }
|
||||
>a : 0 | 2
|
||||
>b : 4
|
||||
|
||||
type T = { a: 0, b: 1 | 4 } // T0
|
||||
>T : T
|
||||
>T : { a: 0; b: 1 | 4; } | { a: 1; b: 2 | 4; } | { a: 2; b: 3; }
|
||||
>a : 0
|
||||
>b : 4 | 1
|
||||
|
||||
@@ -115,12 +115,12 @@ namespace Example4 {
|
||||
>Example4 : typeof Example4
|
||||
|
||||
type S = { a: 0 | 2, b: 4 };
|
||||
>S : S
|
||||
>S : { a: 0 | 2; b: 4; }
|
||||
>a : 0 | 2
|
||||
>b : 4
|
||||
|
||||
type T = { a: 0, b: 1 | 4 } // T0
|
||||
>T : T
|
||||
>T : { a: 0; b: 1 | 4; } | { a: 1; b: 2; } | { a: 2; b: 3 | 4; c: string; }
|
||||
>a : 0
|
||||
>b : 4 | 1
|
||||
|
||||
@@ -155,16 +155,16 @@ namespace Example5 {
|
||||
// 3 discriminant properties with 3 types a piece
|
||||
// is 27 possible combinations.
|
||||
type N = 0 | 1 | 2;
|
||||
>N : N
|
||||
>N : 0 | 2 | 1
|
||||
|
||||
type S = { a: N, b: N, c: N };
|
||||
>S : S
|
||||
>S : { a: N; b: N; c: N; }
|
||||
>a : N
|
||||
>b : N
|
||||
>c : N
|
||||
|
||||
type T = { a: 0, b: N, c: N }
|
||||
>T : T
|
||||
>T : { a: 0; b: N; c: N; } | { a: 1; b: N; c: N; } | { a: 2; b: N; c: N; } | { a: N; b: 0; c: N; } | { a: N; b: 1; c: N; } | { a: N; b: 2; c: N; } | { a: N; b: N; c: 0; } | { a: N; b: N; c: 1; } | { a: N; b: N; c: 2; }
|
||||
>a : 0
|
||||
>b : N
|
||||
>c : N
|
||||
@@ -228,7 +228,7 @@ namespace GH14865 {
|
||||
>GH14865 : typeof GH14865
|
||||
|
||||
type Style1 = {
|
||||
>Style1 : Style1
|
||||
>Style1 : { type: "A"; data: string; } | { type: "B"; data: string; }
|
||||
|
||||
type: "A";
|
||||
>type : "A"
|
||||
@@ -246,7 +246,7 @@ namespace GH14865 {
|
||||
};
|
||||
|
||||
type Style2 = {
|
||||
>Style2 : Style2
|
||||
>Style2 : { type: "A" | "B"; data: string; }
|
||||
|
||||
type: "A" | "B";
|
||||
>type : "A" | "B"
|
||||
@@ -322,10 +322,10 @@ namespace GH12052 {
|
||||
>type : "categorical"
|
||||
|
||||
type IAxis = ILinearAxis | ICategoricalAxis;
|
||||
>IAxis : IAxis
|
||||
>IAxis : ILinearAxis | ICategoricalAxis
|
||||
|
||||
type IAxisType = "linear" | "categorical";
|
||||
>IAxisType : IAxisType
|
||||
>IAxisType : "linear" | "categorical"
|
||||
|
||||
function getAxisType(): IAxisType {
|
||||
>getAxisType : () => IAxisType
|
||||
@@ -381,10 +381,10 @@ namespace GH18421 {
|
||||
}
|
||||
|
||||
type ThingType = 'one' | 'two';
|
||||
>ThingType : ThingType
|
||||
>ThingType : "one" | "two"
|
||||
|
||||
type Thing = ThingTypeOne | ThingTypeTwo;
|
||||
>Thing : Thing
|
||||
>Thing : ThingTypeOne | ThingTypeTwo
|
||||
|
||||
function makeNewThing(thingType: ThingType): Thing {
|
||||
>makeNewThing : (thingType: ThingType) => Thing
|
||||
@@ -406,7 +406,7 @@ namespace GH15907 {
|
||||
>GH15907 : typeof GH15907
|
||||
|
||||
type Action = { type: 'activate' } | { type: 'disactivate' };
|
||||
>Action : Action
|
||||
>Action : { type: 'activate'; } | { type: 'disactivate'; }
|
||||
>type : "activate"
|
||||
>type : "disactivate"
|
||||
|
||||
@@ -445,7 +445,7 @@ namespace GH20889 {
|
||||
>type : "A2"
|
||||
}
|
||||
type AU = A1 | A2;
|
||||
>AU : AU
|
||||
>AU : A1 | A2
|
||||
|
||||
function foo(obj1: AU) {
|
||||
>foo : (obj1: AU) => void
|
||||
@@ -470,10 +470,10 @@ namespace GH39357 {
|
||||
>GH39357 : typeof GH39357
|
||||
|
||||
type A = ["a", number] | ["b", number] | ["c", string];
|
||||
>A : A
|
||||
>A : ["a", number] | ["b", number] | ["c", string]
|
||||
|
||||
type B = "a" | "b" | "c";
|
||||
>B : B
|
||||
>B : "a" | "b" | "c"
|
||||
|
||||
declare const b: B;
|
||||
>b : B
|
||||
|
||||
@@ -64,7 +64,7 @@ g(async v => v ? "contextuallyTypable" : Promise.reject());
|
||||
>reject : <T = never>(reason?: any) => Promise<T>
|
||||
|
||||
type MyCallback = (thing: string) => void;
|
||||
>MyCallback : MyCallback
|
||||
>MyCallback : (thing: string) => void
|
||||
>thing : string
|
||||
|
||||
declare function h(cb: (v: boolean) => MyCallback | PromiseLike<MyCallback>): void;
|
||||
|
||||
@@ -9,7 +9,7 @@ type T3 = Awaited<number | Promise<number>>;
|
||||
>T3 : number
|
||||
|
||||
type T4 = Awaited<number | Promise<string>>;
|
||||
>T4 : T4
|
||||
>T4 : string | number
|
||||
|
||||
type T5 = Awaited<{ then: number }>;
|
||||
>T5 : { then: number; }
|
||||
|
||||
@@ -9,7 +9,7 @@ type T3 = Awaited<number | Promise<number>>;
|
||||
>T3 : number
|
||||
|
||||
type T4 = Awaited<number | Promise<string>>;
|
||||
>T4 : T4
|
||||
>T4 : string | number
|
||||
|
||||
type T5 = Awaited<{ then: number }>;
|
||||
>T5 : { then: number; }
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
=== tests/cases/conformance/types/literal/booleanLiteralTypes1.ts ===
|
||||
type A1 = true | false;
|
||||
>A1 : A1
|
||||
>A1 : boolean
|
||||
>true : true
|
||||
>false : false
|
||||
|
||||
type A2 = false | true;
|
||||
>A2 : A2
|
||||
>A2 : boolean
|
||||
>false : false
|
||||
>true : true
|
||||
|
||||
@@ -244,7 +244,7 @@ function f13(x: true | false) {
|
||||
}
|
||||
|
||||
type Item =
|
||||
>Item : Item
|
||||
>Item : { kind: true; a: string; } | { kind: false; b: string; }
|
||||
|
||||
{ kind: true, a: string } |
|
||||
>kind : true
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
=== tests/cases/conformance/types/literal/booleanLiteralTypes2.ts ===
|
||||
type A1 = true | false;
|
||||
>A1 : A1
|
||||
>A1 : boolean
|
||||
>true : true
|
||||
>false : false
|
||||
|
||||
type A2 = false | true;
|
||||
>A2 : A2
|
||||
>A2 : boolean
|
||||
>false : false
|
||||
>true : true
|
||||
|
||||
@@ -244,7 +244,7 @@ function f13(x: true | false) {
|
||||
}
|
||||
|
||||
type Item =
|
||||
>Item : Item
|
||||
>Item : { kind: true; a: string; } | { kind: false; b: string; }
|
||||
|
||||
{ kind: true, a: string } |
|
||||
>kind : true
|
||||
|
||||
@@ -10,7 +10,7 @@ interface B { isIt: false; value: number; }
|
||||
>value : number
|
||||
|
||||
type C = A | B;
|
||||
>C : C
|
||||
>C : A | B
|
||||
|
||||
const isIt = Math.random() > 0.5;
|
||||
>isIt : boolean
|
||||
@@ -50,7 +50,7 @@ const cc: C = isIt ? { isIt: isIt, text: 'hey' } : { isIt: isIt, value: 123 };
|
||||
>123 : 123
|
||||
|
||||
type ComponentProps =
|
||||
>ComponentProps : ComponentProps
|
||||
>ComponentProps : { optionalBool: true; mandatoryFn: () => void; } | { optionalBool: false; }
|
||||
|
||||
| {
|
||||
optionalBool: true;
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
=== tests/cases/conformance/expressions/functionCalls/callWithSpread4.ts ===
|
||||
type R = { a: number }
|
||||
>R : R
|
||||
>R : { a: number; }
|
||||
>a : number
|
||||
|
||||
type W = { b: number }
|
||||
>W : W
|
||||
>W : { b: number; }
|
||||
>b : number
|
||||
|
||||
type RW = { a: number, b: number }
|
||||
>RW : RW
|
||||
>RW : { a: number; b: number; }
|
||||
>a : number
|
||||
>b : number
|
||||
|
||||
|
||||
+2
-2
@@ -21,7 +21,7 @@ import { TypeA } from './type-a';
|
||||
>TypeA : any
|
||||
|
||||
export type TypeB = Merge<TypeA, {
|
||||
>TypeB : TypeB
|
||||
>TypeB : TypeA & { b: string; }
|
||||
|
||||
b: string;
|
||||
>b : string
|
||||
@@ -29,7 +29,7 @@ export type TypeB = Merge<TypeA, {
|
||||
}>;
|
||||
=== tests/cases/compiler/Uppercased_Dir/src/type-a.ts ===
|
||||
export type TypeA = {
|
||||
>TypeA : TypeA
|
||||
>TypeA : { a: string; }
|
||||
|
||||
a: string;
|
||||
>a : string
|
||||
|
||||
@@ -35,14 +35,14 @@ declare const c3: {
|
||||
}
|
||||
|
||||
type T1 = {
|
||||
>T1 : T1
|
||||
>T1 : { readonly foo: any; }
|
||||
|
||||
get foo(): T1["foo"];
|
||||
>foo : any
|
||||
}
|
||||
|
||||
type T2 = {
|
||||
>T2 : T2
|
||||
>T2 : { foo: any; }
|
||||
|
||||
set foo(value: T2["foo"]);
|
||||
>foo : any
|
||||
@@ -50,7 +50,7 @@ type T2 = {
|
||||
}
|
||||
|
||||
type T3 = {
|
||||
>T3 : T3
|
||||
>T3 : { foo: string; }
|
||||
|
||||
get foo(): string;
|
||||
>foo : string
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts ===
|
||||
type T1 = {
|
||||
>T1 : T1
|
||||
>T1 : { x: any; }
|
||||
|
||||
x: T1["x"]; // Error
|
||||
>x : any
|
||||
|
||||
@@ -3,7 +3,7 @@ var v0: T0;
|
||||
>v0 : T0
|
||||
|
||||
type T0 = string | I0;
|
||||
>T0 : T0
|
||||
>T0 : string | I0
|
||||
|
||||
class I0 {
|
||||
>I0 : I0
|
||||
@@ -16,7 +16,7 @@ var v3: T3;
|
||||
>v3 : T3
|
||||
|
||||
type T3 = string | I3;
|
||||
>T3 : T3
|
||||
>T3 : string | I3
|
||||
|
||||
class I3 {
|
||||
>I3 : I3
|
||||
@@ -29,7 +29,7 @@ var v4: T4;
|
||||
>v4 : T4
|
||||
|
||||
type T4 = string | I4;
|
||||
>T4 : T4
|
||||
>T4 : string | I4
|
||||
|
||||
class I4 {
|
||||
>I4 : I4
|
||||
|
||||
@@ -3,7 +3,7 @@ var v0: T0;
|
||||
>v0 : T0
|
||||
|
||||
type T0 = string | I0;
|
||||
>T0 : T0
|
||||
>T0 : string | I0
|
||||
|
||||
interface I0 {
|
||||
x: T0;
|
||||
@@ -14,7 +14,7 @@ var v1: T1;
|
||||
>v1 : T1
|
||||
|
||||
type T1 = string | I1;
|
||||
>T1 : T1
|
||||
>T1 : string | I1
|
||||
|
||||
interface I1 {
|
||||
(): T1;
|
||||
@@ -24,7 +24,7 @@ var v2: T2;
|
||||
>v2 : T2
|
||||
|
||||
type T2 = string | I2;
|
||||
>T2 : T2
|
||||
>T2 : string | I2
|
||||
|
||||
interface I2 {
|
||||
new (): T2;
|
||||
@@ -34,7 +34,7 @@ var v3: T3;
|
||||
>v3 : T3
|
||||
|
||||
type T3 = string | I3;
|
||||
>T3 : T3
|
||||
>T3 : string | I3
|
||||
|
||||
interface I3 {
|
||||
[x: number]: T3;
|
||||
@@ -45,7 +45,7 @@ var v4: T4;
|
||||
>v4 : T4
|
||||
|
||||
type T4 = string | I4;
|
||||
>T4 : T4
|
||||
>T4 : string | I4
|
||||
|
||||
interface I4 {
|
||||
[x: string]: T4;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/compiler/circularlyReferentialInterfaceAccessNoCrash.ts ===
|
||||
type Mxs = Mx<'list', Mxs['p1']>;
|
||||
>Mxs : Mxs
|
||||
>Mxs : Mx<any, any>
|
||||
|
||||
interface Mx<T, K> {
|
||||
p1: T;
|
||||
@@ -11,8 +11,8 @@ interface Mx<T, K> {
|
||||
}
|
||||
|
||||
type ArrElem = ['list', ArrElem[number][0]][];
|
||||
>ArrElem : ArrElem
|
||||
>ArrElem : [any, any][]
|
||||
|
||||
type TupleElem = [['list', TupleElem[0][0]]];
|
||||
>TupleElem : TupleElem
|
||||
>TupleElem : [[any, any]]
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/conformance/types/typeAliases/classDoesNotDependOnBaseTypes.ts ===
|
||||
type StringTree = string | StringTreeCollection;
|
||||
>StringTree : StringTree
|
||||
>StringTree : string | StringTreeCollection
|
||||
|
||||
class StringTreeCollectionBase {
|
||||
>StringTreeCollectionBase : StringTreeCollectionBase
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
=== tests/cases/compiler/classPropertyErrorOnNameOnly.ts ===
|
||||
type Values = 1 | 2 | 3 | 4 | 5 | 6
|
||||
>Values : Values
|
||||
>Values : 1 | 2 | 3 | 4 | 5 | 6
|
||||
|
||||
type FuncType = (arg: Values) => string
|
||||
>FuncType : FuncType
|
||||
>FuncType : (arg: Values) => string
|
||||
>arg : Values
|
||||
|
||||
// turn on strictNullChecks
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
=== tests/cases/compiler/coAndContraVariantInferences.ts ===
|
||||
type A = { kind: 'a' };
|
||||
>A : A
|
||||
>A : { kind: 'a'; }
|
||||
>kind : "a"
|
||||
|
||||
type B = { kind: 'b' };
|
||||
>B : B
|
||||
>B : { kind: 'b'; }
|
||||
>kind : "b"
|
||||
|
||||
declare const a: A;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNumericLiteral.ts ===
|
||||
type BrandedNum = number & { __numberBrand: any };
|
||||
>BrandedNum : BrandedNum
|
||||
>BrandedNum : number & { __numberBrand: any; }
|
||||
>__numberBrand : any
|
||||
|
||||
var x : BrandedNum;
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ interface EmailChannel {
|
||||
}
|
||||
|
||||
type Channel = TextChannel | EmailChannel;
|
||||
>Channel : Channel
|
||||
>Channel : TextChannel | EmailChannel
|
||||
|
||||
export type ChannelType = Channel extends { type: infer R } ? R : never;
|
||||
>ChannelType : "text" | "email"
|
||||
|
||||
@@ -16,7 +16,7 @@ interface Component {
|
||||
}
|
||||
|
||||
type T = {
|
||||
>T : T
|
||||
>T : { [onInit]: any; }
|
||||
|
||||
[onInit]: any;
|
||||
>[onInit] : any
|
||||
|
||||
@@ -18,11 +18,11 @@ type OmitIndex<T, I extends string | number> = {
|
||||
};
|
||||
|
||||
type IndexObject = { [key: string]: unknown; };
|
||||
>IndexObject : IndexObject
|
||||
>IndexObject : { [key: string]: unknown; }
|
||||
>key : string
|
||||
|
||||
type FooBar = { foo: "hello"; bar: "world"; };
|
||||
>FooBar : FooBar
|
||||
>FooBar : { foo: "hello"; bar: "world"; }
|
||||
>foo : "hello"
|
||||
>bar : "world"
|
||||
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/compiler/conditionalTypeRelaxingConstraintAssignability.ts ===
|
||||
export type ElChildren =
|
||||
>ElChildren : ElChildren
|
||||
>ElChildren : string | undefined
|
||||
|
||||
| ElChildren.Void
|
||||
>ElChildren : any
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
=== tests/cases/conformance/types/conditional/conditionalTypes1.ts ===
|
||||
type T00 = Exclude<"a" | "b" | "c" | "d", "a" | "c" | "f">; // "b" | "d"
|
||||
>T00 : T00
|
||||
>T00 : "b" | "d"
|
||||
|
||||
type T01 = Extract<"a" | "b" | "c" | "d", "a" | "c" | "f">; // "a" | "c"
|
||||
>T01 : T01
|
||||
>T01 : "a" | "c"
|
||||
|
||||
type T02 = Exclude<string | number | (() => void), Function>; // string | number
|
||||
>T02 : T02
|
||||
>T02 : string | number
|
||||
|
||||
type T03 = Extract<string | number | (() => void), Function>; // () => void
|
||||
>T03 : () => void
|
||||
|
||||
type T04 = NonNullable<string | number | undefined>; // string | number
|
||||
>T04 : T04
|
||||
>T04 : string | number
|
||||
|
||||
type T05 = NonNullable<(() => string) | string[] | null | undefined>; // (() => string) | string[]
|
||||
>T05 : T05
|
||||
>T05 : (() => string) | string[]
|
||||
>null : null
|
||||
|
||||
function f1<T>(x: T, y: NonNullable<T>) {
|
||||
@@ -100,7 +100,7 @@ function f4<T extends { x: string | undefined }>(x: T["x"], y: NonNullable<T["x"
|
||||
}
|
||||
|
||||
type Options = { k: "a", a: number } | { k: "b", b: string } | { k: "c", c: boolean };
|
||||
>Options : Options
|
||||
>Options : { k: "a"; a: number; } | { k: "b"; b: string; } | { k: "c"; c: boolean; }
|
||||
>k : "a"
|
||||
>a : number
|
||||
>k : "b"
|
||||
@@ -113,7 +113,7 @@ type T10 = Exclude<Options, { k: "a" | "b" }>; // { k: "c", c: boolean }
|
||||
>k : "a" | "b"
|
||||
|
||||
type T11 = Extract<Options, { k: "a" | "b" }>; // { k: "a", a: number } | { k: "b", b: string }
|
||||
>T11 : T11
|
||||
>T11 : { k: "a"; a: number; } | { k: "b"; b: string; }
|
||||
>k : "a" | "b"
|
||||
|
||||
type T12 = Exclude<Options, { k: "a" } | { k: "b" }>; // { k: "c", c: boolean }
|
||||
@@ -122,12 +122,12 @@ type T12 = Exclude<Options, { k: "a" } | { k: "b" }>; // { k: "c", c: boolean }
|
||||
>k : "b"
|
||||
|
||||
type T13 = Extract<Options, { k: "a" } | { k: "b" }>; // { k: "a", a: number } | { k: "b", b: string }
|
||||
>T13 : T13
|
||||
>T13 : { k: "a"; a: number; } | { k: "b"; b: string; }
|
||||
>k : "a"
|
||||
>k : "b"
|
||||
|
||||
type T14 = Exclude<Options, { q: "a" }>; // Options
|
||||
>T14 : T14
|
||||
>T14 : { k: "a"; a: number; } | { k: "b"; b: string; } | { k: "c"; c: boolean; }
|
||||
>q : "a"
|
||||
|
||||
type T15 = Extract<Options, { q: "a" }>; // never
|
||||
@@ -150,13 +150,13 @@ type OptionsOfKind<K extends Options["k"]> = Extract<Options, { k: K }>;
|
||||
>k : K
|
||||
|
||||
type T16 = OptionsOfKind<"a" | "b">; // { k: "a", a: number } | { k: "b", b: string }
|
||||
>T16 : T16
|
||||
>T16 : { k: "a"; a: number; } | { k: "b"; b: string; }
|
||||
|
||||
type Select<T, K extends keyof T, V extends T[K]> = Extract<T, { [P in K]: V }>;
|
||||
>Select : Select<T, K, V>
|
||||
|
||||
type T17 = Select<Options, "k", "a" | "b">; // // { k: "a", a: number } | { k: "b", b: string }
|
||||
>T17 : T17
|
||||
>T17 : { k: "a"; a: number; } | { k: "b"; b: string; }
|
||||
|
||||
type TypeName<T> =
|
||||
>TypeName : TypeName<T>
|
||||
@@ -169,7 +169,7 @@ type TypeName<T> =
|
||||
"object";
|
||||
|
||||
type T20 = TypeName<string | (() => void)>; // "string" | "function"
|
||||
>T20 : T20
|
||||
>T20 : "string" | "function"
|
||||
|
||||
type T21 = TypeName<any>; // "string" | "number" | "boolean" | "undefined" | "function" | "object"
|
||||
>T21 : "string" | "number" | "boolean" | "undefined" | "object" | "function"
|
||||
@@ -239,10 +239,10 @@ type NonFunctionProperties<T> = Pick<T, NonFunctionPropertyNames<T>>;
|
||||
>NonFunctionProperties : NonFunctionProperties<T>
|
||||
|
||||
type T30 = FunctionProperties<Part>;
|
||||
>T30 : T30
|
||||
>T30 : { updatePart: (newName: string) => void; }
|
||||
|
||||
type T31 = NonFunctionProperties<Part>;
|
||||
>T31 : T31
|
||||
>T31 : { id: number; name: string; subparts: Part[]; }
|
||||
|
||||
function f7<T>(x: T, y: FunctionProperties<T>, z: NonFunctionProperties<T>) {
|
||||
>f7 : <T>(x: T, y: FunctionProperties<T>, z: NonFunctionProperties<T>) => void
|
||||
@@ -559,7 +559,7 @@ type N2 = Not<true>; // false
|
||||
>true : true
|
||||
|
||||
type N3 = Not<boolean>; // boolean
|
||||
>N3 : N3
|
||||
>N3 : boolean
|
||||
|
||||
type A1 = And<false, false>; // false
|
||||
>A1 : false
|
||||
@@ -590,7 +590,7 @@ type A6 = And<false, boolean>; // false
|
||||
>false : false
|
||||
|
||||
type A7 = And<boolean, true>; // boolean
|
||||
>A7 : A7
|
||||
>A7 : boolean
|
||||
>true : true
|
||||
|
||||
type A8 = And<true, boolean>; // boolean
|
||||
@@ -598,7 +598,7 @@ type A8 = And<true, boolean>; // boolean
|
||||
>true : true
|
||||
|
||||
type A9 = And<boolean, boolean>; // boolean
|
||||
>A9 : A9
|
||||
>A9 : boolean
|
||||
|
||||
type O1 = Or<false, false>; // false
|
||||
>O1 : false
|
||||
@@ -621,7 +621,7 @@ type O4 = Or<true, true>; // true
|
||||
>true : true
|
||||
|
||||
type O5 = Or<boolean, false>; // boolean
|
||||
>O5 : O5
|
||||
>O5 : boolean
|
||||
>false : false
|
||||
|
||||
type O6 = Or<false, boolean>; // boolean
|
||||
@@ -637,7 +637,7 @@ type O8 = Or<true, boolean>; // true
|
||||
>true : true
|
||||
|
||||
type O9 = Or<boolean, boolean>; // boolean
|
||||
>O9 : O9
|
||||
>O9 : boolean
|
||||
|
||||
type T40 = never extends never ? true : false; // true
|
||||
>T40 : true
|
||||
@@ -977,13 +977,13 @@ type NonFooKeys2<T extends object> = Exclude<keyof T, 'foo'>;
|
||||
>NonFooKeys2 : NonFooKeys2<T>
|
||||
|
||||
type Test1 = NonFooKeys1<{foo: 1, bar: 2, baz: 3}>; // "bar" | "baz"
|
||||
>Test1 : Test1
|
||||
>Test1 : "bar" | "baz"
|
||||
>foo : 1
|
||||
>bar : 2
|
||||
>baz : 3
|
||||
|
||||
type Test2 = NonFooKeys2<{foo: 1, bar: 2, baz: 3}>; // "bar" | "baz"
|
||||
>Test2 : Test2
|
||||
>Test2 : "bar" | "baz"
|
||||
>foo : 1
|
||||
>bar : 2
|
||||
>baz : 3
|
||||
@@ -997,7 +997,7 @@ interface Bar2 { bar: string; }
|
||||
>bar : string
|
||||
|
||||
type FooBar = Foo2 | Bar2;
|
||||
>FooBar : FooBar
|
||||
>FooBar : Foo2 | Bar2
|
||||
|
||||
declare interface ExtractFooBar<FB extends FooBar> { }
|
||||
|
||||
|
||||
@@ -141,11 +141,11 @@ function f12(x: string | (() => string) | undefined) {
|
||||
}
|
||||
|
||||
type Foo = { foo: string };
|
||||
>Foo : Foo
|
||||
>Foo : { foo: string; }
|
||||
>foo : string
|
||||
|
||||
type Bar = { bar: string };
|
||||
>Bar : Bar
|
||||
>Bar : { bar: string; }
|
||||
>bar : string
|
||||
|
||||
declare function fooBar(x: { foo: string, bar: string }): void;
|
||||
@@ -369,7 +369,7 @@ type T3 = MaybeTrue<{ b: boolean }>; // "yes"
|
||||
// Repro from #28824
|
||||
|
||||
type Union = 'a' | 'b';
|
||||
>Union : Union
|
||||
>Union : "b" | "a"
|
||||
|
||||
type Product<A extends Union, B> = { f1: A, f2: B};
|
||||
>Product : Product<A, B>
|
||||
@@ -377,11 +377,11 @@ type Product<A extends Union, B> = { f1: A, f2: B};
|
||||
>f2 : B
|
||||
|
||||
type ProductUnion = Product<'a', 0> | Product<'b', 1>;
|
||||
>ProductUnion : ProductUnion
|
||||
>ProductUnion : Product<"a", 0> | Product<"b", 1>
|
||||
|
||||
// {a: "b"; b: "a"}
|
||||
type UnionComplement = {
|
||||
>UnionComplement : UnionComplement
|
||||
>UnionComplement : { b: "a"; a: "b"; }
|
||||
|
||||
[K in Union]: Exclude<Union, K>
|
||||
};
|
||||
@@ -393,7 +393,7 @@ type UCB = UnionComplement['b'];
|
||||
|
||||
// {a: "a"; b: "b"}
|
||||
type UnionComplementComplement = {
|
||||
>UnionComplementComplement : UnionComplementComplement
|
||||
>UnionComplementComplement : { b: "b"; a: "a"; }
|
||||
|
||||
[K in Union]: Exclude<Union, Exclude<Union, K>>
|
||||
};
|
||||
@@ -405,7 +405,7 @@ type UCCB = UnionComplementComplement['b'];
|
||||
|
||||
// {a: Product<'b', 1>; b: Product<'a', 0>}
|
||||
type ProductComplement = {
|
||||
>ProductComplement : ProductComplement
|
||||
>ProductComplement : { b: Product<"a", 0>; a: Product<"b", 1>; }
|
||||
|
||||
[K in Union]: Exclude<ProductUnion, { f1: K }>
|
||||
>f1 : K
|
||||
@@ -419,7 +419,7 @@ type PCB = ProductComplement['b'];
|
||||
|
||||
// {a: Product<'a', 0>; b: Product<'b', 1>}
|
||||
type ProductComplementComplement = {
|
||||
>ProductComplementComplement : ProductComplementComplement
|
||||
>ProductComplementComplement : { b: Product<"b", 1>; a: Product<"a", 0>; }
|
||||
|
||||
[K in Union]: Exclude<ProductUnion, Exclude<ProductUnion, { f1: K }>>
|
||||
>f1 : K
|
||||
|
||||
@@ -453,10 +453,10 @@ function ff3(x: 'foo' | 'bar', y: object) {
|
||||
}
|
||||
|
||||
type Action = "verify" | "write";
|
||||
>Action : Action
|
||||
>Action : "verify" | "write"
|
||||
|
||||
type ContentMatch = "match" | "nonMatch";
|
||||
>ContentMatch : ContentMatch
|
||||
>ContentMatch : "match" | "nonMatch"
|
||||
|
||||
type Outcome = `${Action}_${ContentMatch}`;
|
||||
>Outcome : "verify_match" | "verify_nonMatch" | "write_match" | "write_nonMatch"
|
||||
|
||||
+2
-2
@@ -6,7 +6,7 @@ interface Map<K, V> {
|
||||
}
|
||||
|
||||
export type ImmutableTypes = IImmutableMap<any>;
|
||||
>ImmutableTypes : ImmutableTypes
|
||||
>ImmutableTypes : IImmutableMap<any>
|
||||
|
||||
export type ImmutableModel<T> = { [K in keyof T]: T[K] extends ImmutableTypes ? T[K] : never };
|
||||
>ImmutableModel : ImmutableModel<T>
|
||||
@@ -19,7 +19,7 @@ export interface IImmutableMap<T extends ImmutableModel<T>> extends Map<string,
|
||||
}
|
||||
|
||||
export type ImmutableTypes2 = IImmutableMap2<any>;
|
||||
>ImmutableTypes2 : ImmutableTypes2
|
||||
>ImmutableTypes2 : IImmutableMap2<any>
|
||||
|
||||
type isImmutableType<T> = [T] extends [ImmutableTypes2] ? T : never;
|
||||
>isImmutableType : isImmutableType<T>
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
=== tests/cases/compiler/contextualOverloadListFromUnionWithPrimitiveNoImplicitAny.ts ===
|
||||
// must target esnext for `String.normalize` to exist
|
||||
type Validate = (text: string, pos: number, self: Rule) => number | boolean;
|
||||
>Validate : Validate
|
||||
>Validate : (text: string, pos: number, self: Rule) => number | boolean
|
||||
>text : string
|
||||
>pos : number
|
||||
>self : Rule
|
||||
@@ -17,7 +17,7 @@ interface FullRule {
|
||||
}
|
||||
|
||||
type Rule = string | FullRule;
|
||||
>Rule : Rule
|
||||
>Rule : string | FullRule
|
||||
|
||||
const obj: {field: Rule} = {
|
||||
>obj : { field: Rule; }
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
=== tests/cases/compiler/contextualTypeOfIndexedAccessParameter.ts ===
|
||||
type Keys = "a" | "b";
|
||||
>Keys : Keys
|
||||
>Keys : "a" | "b"
|
||||
|
||||
type OptionsForKey = { a: { cb: (p: number) => number } } & { b: {} };
|
||||
>OptionsForKey : OptionsForKey
|
||||
>OptionsForKey : { a: { cb: (p: number) => number; }; } & { b: {}; }
|
||||
>a : { cb: (p: number) => number; }
|
||||
>cb : (p: number) => number
|
||||
>p : number
|
||||
|
||||
@@ -243,7 +243,7 @@ interface TestString {
|
||||
}
|
||||
|
||||
type TestGeneric = (TestString | TestObject) & { [k: string]: any; };
|
||||
>TestGeneric : TestGeneric
|
||||
>TestGeneric : (TestObject | TestString) & { [k: string]: any; }
|
||||
>k : string
|
||||
|
||||
const test: TestGeneric = {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/compiler/contextualTypingArrayDestructuringWithDefaults.ts ===
|
||||
type I = { a: "a" };
|
||||
>I : I
|
||||
>I : { a: "a"; }
|
||||
>a : "a"
|
||||
|
||||
let [ c0 = {a: "a"} ]: [I?] = [];
|
||||
|
||||
@@ -60,10 +60,10 @@ interface IRouterMatcher<T> {
|
||||
}
|
||||
|
||||
type PathParams = string | RegExp | (string | RegExp)[];
|
||||
>PathParams : PathParams
|
||||
>PathParams : string | RegExp | (string | RegExp)[]
|
||||
|
||||
type RequestHandlerParams = RequestHandler | ErrorRequestHandler | (RequestHandler | ErrorRequestHandler)[];
|
||||
>RequestHandlerParams : RequestHandlerParams
|
||||
>RequestHandlerParams : RequestHandler | ErrorRequestHandler | (RequestHandler | ErrorRequestHandler)[]
|
||||
|
||||
interface RequestHandler {
|
||||
(req: Request, res: Response, next: NextFunction): any;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/compiler/contextuallyTypedByDiscriminableUnion.ts ===
|
||||
type ADT = {
|
||||
>ADT : ADT
|
||||
>ADT : { kind: "a"; method(x: string): number; } | { kind: "b"; method(x: number): string; }
|
||||
|
||||
kind: "a",
|
||||
>kind : "a"
|
||||
|
||||
@@ -14,7 +14,7 @@ const B = Symbol("B");
|
||||
>"B" : "B"
|
||||
|
||||
type Action =
|
||||
>Action : Action
|
||||
>Action : { type: typeof A; data: string; } | { type: typeof B; data: number; }
|
||||
|
||||
| {type: typeof A, data: string}
|
||||
>type : unique symbol
|
||||
|
||||
@@ -844,7 +844,7 @@ function f40(obj: { kind: 'foo', foo?: string } | { kind: 'bar', bar?: number })
|
||||
// Unsupported narrowing of destructured payload by destructured discriminant
|
||||
|
||||
type Data = { kind: 'str', payload: string } | { kind: 'num', payload: number };
|
||||
>Data : Data
|
||||
>Data : { kind: 'str'; payload: string; } | { kind: 'num'; payload: number; }
|
||||
>kind : "str"
|
||||
>payload : string
|
||||
>kind : "num"
|
||||
|
||||
@@ -47,7 +47,7 @@ x; // number
|
||||
|
||||
// https://github.com/microsoft/TypeScript/issues/35484
|
||||
type D = { done: true, value: 1 } | { done: false, value: 2 };
|
||||
>D : D
|
||||
>D : { done: true; value: 1; } | { done: false; value: 2; }
|
||||
>done : true
|
||||
>true : true
|
||||
>value : 1
|
||||
|
||||
@@ -54,7 +54,7 @@ declare function isHTMLCollection(sourceObj: any): sourceObj is HTMLCollection;
|
||||
>sourceObj : any
|
||||
|
||||
type EventTargetLike = {a: string} | HTMLCollection | NodeList;
|
||||
>EventTargetLike : EventTargetLike
|
||||
>EventTargetLike : NodeList | HTMLCollection | { a: string; }
|
||||
>a : string
|
||||
|
||||
var sourceObj: EventTargetLike = <any>undefined;
|
||||
|
||||
@@ -8,7 +8,7 @@ interface StrVal { val: string; }
|
||||
>val : string
|
||||
|
||||
type Val = NumVal | StrVal;
|
||||
>Val : Val
|
||||
>Val : NumVal | StrVal
|
||||
|
||||
function isNumVal(x: Val): x is NumVal {
|
||||
>isNumVal : (x: Val) => x is NumVal
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
=== tests/cases/compiler/controlFlowForCatchAndFinally.ts ===
|
||||
type Page = {close(): Promise<void>; content(): Promise<string>};
|
||||
>Page : Page
|
||||
>Page : { close(): Promise<void>; content(): Promise<string>; }
|
||||
>close : () => Promise<void>
|
||||
>content : () => Promise<string>
|
||||
|
||||
type Browser = {close(): Promise<void>};
|
||||
>Browser : Browser
|
||||
>Browser : { close(): Promise<void>; }
|
||||
>close : () => Promise<void>
|
||||
|
||||
declare function test1(): Promise<Browser>;
|
||||
|
||||
@@ -8,12 +8,12 @@ const keywordB = 'b';
|
||||
>'b' : "b"
|
||||
|
||||
type A = { [keywordA]: number };
|
||||
>A : A
|
||||
>A : { a: number; }
|
||||
>[keywordA] : number
|
||||
>keywordA : "a"
|
||||
|
||||
type B = { [keywordB]: string };
|
||||
>B : B
|
||||
>B : { b: string; }
|
||||
>[keywordB] : string
|
||||
>keywordB : "b"
|
||||
|
||||
|
||||
@@ -196,22 +196,22 @@ export function bounceAndTakeIfA<AB extends 'A' | 'B'>(value: AB): AB {
|
||||
// Repro from #13995
|
||||
|
||||
type Common = { id: number };
|
||||
>Common : Common
|
||||
>Common : { id: number; }
|
||||
>id : number
|
||||
|
||||
type AA = { tag: 'A', id: number };
|
||||
>AA : AA
|
||||
>AA : { tag: 'A'; id: number; }
|
||||
>tag : "A"
|
||||
>id : number
|
||||
|
||||
type BB = { tag: 'B', id: number, foo: number };
|
||||
>BB : BB
|
||||
>BB : { tag: 'B'; id: number; foo: number; }
|
||||
>tag : "B"
|
||||
>id : number
|
||||
>foo : number
|
||||
|
||||
type MyUnion = AA | BB;
|
||||
>MyUnion : MyUnion
|
||||
>MyUnion : AA | BB
|
||||
|
||||
const fn = (value: MyUnion) => {
|
||||
>fn : (value: MyUnion) => void
|
||||
@@ -284,7 +284,7 @@ const fn2 = <T extends MyUnion>(value: T): MyUnion => {
|
||||
// Repro from #13995
|
||||
|
||||
type A1 = {
|
||||
>A1 : A1
|
||||
>A1 : { testable: true; doTest: () => void; }
|
||||
|
||||
testable: true
|
||||
>testable : true
|
||||
@@ -294,7 +294,7 @@ type A1 = {
|
||||
>doTest : () => void
|
||||
}
|
||||
type B1 = {
|
||||
>B1 : B1
|
||||
>B1 : { testable: false; }
|
||||
|
||||
testable: false
|
||||
>testable : false
|
||||
@@ -303,7 +303,7 @@ type B1 = {
|
||||
};
|
||||
|
||||
type Union = A1 | B1
|
||||
>Union : Union
|
||||
>Union : A1 | B1
|
||||
|
||||
function notWorking<T extends Union>(object: T) {
|
||||
>notWorking : <T extends Union>(object: T) => void
|
||||
@@ -561,7 +561,7 @@ interface Checkbox {
|
||||
}
|
||||
|
||||
type Control = Button | Checkbox;
|
||||
>Control : Control
|
||||
>Control : Button | Checkbox
|
||||
|
||||
function update<T extends Control, K extends keyof T>(control : T | undefined, key: K, value: T[K]): void {
|
||||
>update : <T extends Control, K extends keyof T>(control: T | undefined, key: K, value: T[K]) => void
|
||||
|
||||
@@ -12,12 +12,12 @@ const d = 'd';
|
||||
>'d' : "d"
|
||||
|
||||
type A = { [a]: number; };
|
||||
>A : A
|
||||
>A : { a: number; }
|
||||
>[a] : number
|
||||
>a : "a"
|
||||
|
||||
type B = { [b]: string; };
|
||||
>B : B
|
||||
>B : { b: string; }
|
||||
>[b] : string
|
||||
>b : "b"
|
||||
|
||||
|
||||
@@ -635,7 +635,7 @@ function f01(x: unknown) {
|
||||
}
|
||||
|
||||
type Thing = { foo: string | number, bar(): number, baz: object };
|
||||
>Thing : Thing
|
||||
>Thing : { foo: string | number; bar(): number; baz: object; }
|
||||
>foo : string | number
|
||||
>bar : () => number
|
||||
>baz : object
|
||||
@@ -1870,7 +1870,7 @@ function f41(o: Thing | undefined) {
|
||||
// Repros from #34570
|
||||
|
||||
type Shape =
|
||||
>Shape : Shape
|
||||
>Shape : { type: 'rectangle'; width: number; height: number; } | { type: 'circle'; radius: number; }
|
||||
|
||||
| { type: 'rectangle', width: number, height: number }
|
||||
>type : "rectangle"
|
||||
@@ -1923,7 +1923,7 @@ function getArea(shape?: Shape) {
|
||||
}
|
||||
|
||||
type Feature = {
|
||||
>Feature : Feature
|
||||
>Feature : { id: string; geometry?: { type: string; coordinates: number[]; } | undefined; }
|
||||
|
||||
id: string;
|
||||
>id : string
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/conformance/controlFlow/controlFlowOptionalChain2.ts ===
|
||||
type A = {
|
||||
>A : A
|
||||
>A : { type: 'A'; name: string; }
|
||||
|
||||
type: 'A';
|
||||
>type : "A"
|
||||
@@ -10,7 +10,7 @@ type A = {
|
||||
}
|
||||
|
||||
type B = {
|
||||
>B : B
|
||||
>B : { type: 'B'; }
|
||||
|
||||
type: 'B';
|
||||
>type : "B"
|
||||
@@ -70,18 +70,18 @@ function funcThree(arg: A | B | null) {
|
||||
}
|
||||
|
||||
type U = { kind: undefined, u: 'u' }
|
||||
>U : U
|
||||
>U : { kind: undefined; u: 'u'; }
|
||||
>kind : undefined
|
||||
>u : "u"
|
||||
|
||||
type N = { kind: null, n: 'n' }
|
||||
>N : N
|
||||
>N : { kind: null; n: 'n'; }
|
||||
>kind : null
|
||||
>null : null
|
||||
>n : "n"
|
||||
|
||||
type X = { kind: 'X', x: 'x' }
|
||||
>X : X
|
||||
>X : { kind: 'X'; x: 'x'; }
|
||||
>kind : "X"
|
||||
>x : "x"
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/conformance/controlFlow/controlFlowStringIndex.ts ===
|
||||
type A = {
|
||||
>A : A
|
||||
>A : { [index: string]: number | null; other: number | null; }
|
||||
|
||||
other: number | null;
|
||||
>other : number | null
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Various repros from #30581
|
||||
|
||||
type RecordMap = { n: number, s: string, b: boolean };
|
||||
>RecordMap : RecordMap
|
||||
>RecordMap : { n: number; s: string; b: boolean; }
|
||||
>n : number
|
||||
>s : string
|
||||
>b : boolean
|
||||
@@ -71,16 +71,16 @@ processRecord({ kind: 'n', v: 42, f: v => v.toExponential() });
|
||||
// --------
|
||||
|
||||
type TextFieldData = { value: string }
|
||||
>TextFieldData : TextFieldData
|
||||
>TextFieldData : { value: string; }
|
||||
>value : string
|
||||
|
||||
type SelectFieldData = { options: string[], selectedValue: string }
|
||||
>SelectFieldData : SelectFieldData
|
||||
>SelectFieldData : { options: string[]; selectedValue: string; }
|
||||
>options : string[]
|
||||
>selectedValue : string
|
||||
|
||||
type FieldMap = {
|
||||
>FieldMap : FieldMap
|
||||
>FieldMap : { text: TextFieldData; select: SelectFieldData; }
|
||||
|
||||
text: TextFieldData;
|
||||
>text : TextFieldData
|
||||
@@ -99,7 +99,7 @@ type RenderFunc<K extends keyof FieldMap> = (props: FieldMap[K]) => void;
|
||||
>props : FieldMap[K]
|
||||
|
||||
type RenderFuncMap = { [K in keyof FieldMap]: RenderFunc<K> };
|
||||
>RenderFuncMap : RenderFuncMap
|
||||
>RenderFuncMap : { text: RenderFunc<"text">; select: RenderFunc<"select">; }
|
||||
|
||||
function renderTextField(props: TextFieldData) {}
|
||||
>renderTextField : (props: TextFieldData) => void
|
||||
@@ -146,7 +146,7 @@ function renderField<K extends keyof FieldMap>(field: FormField<K>) {
|
||||
// --------
|
||||
|
||||
type TypeMap = {
|
||||
>TypeMap : TypeMap
|
||||
>TypeMap : { foo: string; bar: number; }
|
||||
|
||||
foo: string,
|
||||
>foo : string
|
||||
@@ -160,7 +160,7 @@ type Keys = keyof TypeMap;
|
||||
>Keys : keyof TypeMap
|
||||
|
||||
type HandlerMap = { [P in Keys]: (x: TypeMap[P]) => void };
|
||||
>HandlerMap : HandlerMap
|
||||
>HandlerMap : { foo: (x: string) => void; bar: (x: number) => void; }
|
||||
>x : TypeMap[P]
|
||||
|
||||
const handlers: HandlerMap = {
|
||||
@@ -276,7 +276,7 @@ process([{ type: 'foo', data: 'abc' }]);
|
||||
// --------
|
||||
|
||||
type LetterMap = { A: string, B: number }
|
||||
>LetterMap : LetterMap
|
||||
>LetterMap : { A: string; B: number; }
|
||||
>A : string
|
||||
>B : number
|
||||
|
||||
@@ -298,19 +298,19 @@ function call<K extends keyof LetterMap>({ letter, caller }: LetterCaller<K>): v
|
||||
}
|
||||
|
||||
type A = { A: string };
|
||||
>A : A
|
||||
>A : { A: string; }
|
||||
>A : string
|
||||
|
||||
type B = { B: number };
|
||||
>B : B
|
||||
>B : { B: number; }
|
||||
>B : number
|
||||
|
||||
type ACaller = (a: A) => void;
|
||||
>ACaller : ACaller
|
||||
>ACaller : (a: A) => void
|
||||
>a : A
|
||||
|
||||
type BCaller = (b: B) => void;
|
||||
>BCaller : BCaller
|
||||
>BCaller : (b: B) => void
|
||||
>b : B
|
||||
|
||||
declare const xx: { letter: A, caller: ACaller } | { letter: B, caller: BCaller };
|
||||
@@ -552,7 +552,7 @@ function ff1() {
|
||||
// Repro from #47368
|
||||
|
||||
type ArgMap = { a: number, b: string };
|
||||
>ArgMap : ArgMap
|
||||
>ArgMap : { a: number; b: string; }
|
||||
>a : number
|
||||
>b : string
|
||||
|
||||
@@ -561,7 +561,7 @@ type Func<K extends keyof ArgMap> = (x: ArgMap[K]) => void;
|
||||
>x : ArgMap[K]
|
||||
|
||||
type Funcs = { [K in keyof ArgMap]: Func<K> };
|
||||
>Funcs : Funcs
|
||||
>Funcs : { a: Func<"a">; b: Func<"b">; }
|
||||
|
||||
function f1<K extends keyof ArgMap>(funcs: Funcs, key: K, arg: ArgMap[K]) {
|
||||
>f1 : <K extends keyof ArgMap>(funcs: Funcs, key: K, arg: ArgMap[K]) => void
|
||||
@@ -751,5 +751,5 @@ type BarLookup = typeof BAR_LOOKUP;
|
||||
>BAR_LOOKUP : { a: { readonly name: "a"; }; b: { readonly name: "b"; }; }
|
||||
|
||||
type Baz = { [K in keyof BarLookup]: BarLookup[K]['name'] };
|
||||
>Baz : Baz
|
||||
>Baz : { a: "a"; b: "b"; }
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ export interface B { type: 'b' }
|
||||
>type : "b"
|
||||
|
||||
export type AB = A | B
|
||||
>AB : AB
|
||||
>AB : A | B
|
||||
|
||||
const itemId = 'some-id'
|
||||
>itemId : "some-id"
|
||||
|
||||
@@ -3,7 +3,7 @@ module M {
|
||||
>M : typeof M
|
||||
|
||||
export type Value = string | number | boolean;
|
||||
>Value : Value
|
||||
>Value : string | number | boolean
|
||||
|
||||
export var x: Value;
|
||||
>x : Value
|
||||
@@ -28,7 +28,7 @@ module M {
|
||||
>m : any
|
||||
|
||||
export type fc = () => c;
|
||||
>fc : fc
|
||||
>fc : () => c
|
||||
}
|
||||
|
||||
interface Window {
|
||||
@@ -40,7 +40,7 @@ module M {
|
||||
>M : typeof M
|
||||
|
||||
export type W = Window | string;
|
||||
>W : W
|
||||
>W : string | Window
|
||||
|
||||
export module N {
|
||||
>N : typeof N
|
||||
|
||||
@@ -8,7 +8,7 @@ module M {
|
||||
>M : typeof M
|
||||
|
||||
type W = Window | string;
|
||||
>W : W
|
||||
>W : string | Window
|
||||
|
||||
export module N {
|
||||
>N : typeof N
|
||||
@@ -25,7 +25,7 @@ module M1 {
|
||||
>M1 : typeof M1
|
||||
|
||||
export type W = Window | string;
|
||||
>W : W
|
||||
>W : string | Window
|
||||
|
||||
export module N {
|
||||
>N : typeof N
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/compiler/locale.d.ts ===
|
||||
export type Locale = {
|
||||
>Locale : Locale
|
||||
>Locale : { weekdays: { shorthand: [string, string, string, string, string, string, string]; longhand: [string, string, string, string, string, string, string];}; }
|
||||
|
||||
weekdays: {
|
||||
>weekdays : { shorthand: [string, string, string, string, string, string, string]; longhand: [string, string, string, string, string, string, string]; }
|
||||
@@ -14,7 +14,7 @@ export type Locale = {
|
||||
};
|
||||
};
|
||||
export type CustomLocale = {
|
||||
>CustomLocale : CustomLocale
|
||||
>CustomLocale : { weekdays: { shorthand: [string, string, string, string, string, string, string]; longhand: [string, string, string, string, string, string, string];}; }
|
||||
|
||||
weekdays: {
|
||||
>weekdays : { shorthand: [string, string, string, string, string, string, string]; longhand: [string, string, string, string, string, string, string]; }
|
||||
@@ -28,7 +28,7 @@ export type CustomLocale = {
|
||||
};
|
||||
};
|
||||
export type key = "ar" | "bg";
|
||||
>key : key
|
||||
>key : "ar" | "bg"
|
||||
|
||||
=== tests/cases/compiler/instance.d.ts ===
|
||||
import { Locale, CustomLocale, key as LocaleKey } from "./locale";
|
||||
|
||||
@@ -10,7 +10,7 @@ class C1 {
|
||||
}
|
||||
|
||||
type TupleType1 =[string, number, boolean];
|
||||
>TupleType1 : TupleType1
|
||||
>TupleType1 : [string, number, boolean]
|
||||
|
||||
class C2 {
|
||||
>C2 : C2
|
||||
@@ -23,7 +23,7 @@ class C2 {
|
||||
}
|
||||
|
||||
type ObjType1 = { x: number; y: string; z: boolean }
|
||||
>ObjType1 : ObjType1
|
||||
>ObjType1 : { x: number; y: string; z: boolean; }
|
||||
>x : number
|
||||
>y : string
|
||||
>z : boolean
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
=== tests/cases/compiler/Types.ts ===
|
||||
type Suit = 'Hearts' | 'Spades' | 'Clubs' | 'Diamonds';
|
||||
>Suit : Suit
|
||||
>Suit : "Hearts" | "Spades" | "Clubs" | "Diamonds"
|
||||
|
||||
type Rank = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 'Jack' | 'Queen' | 'King';
|
||||
>Rank : Rank
|
||||
>Rank : 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | "Jack" | "Queen" | "King"
|
||||
|
||||
export { Suit, Rank };
|
||||
>Suit : any
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
type AX = { readonly A: unique symbol };
|
||||
>AX : AX
|
||||
>AX : { readonly A: unique symbol; }
|
||||
>A : unique symbol
|
||||
|
||||
export const A: AX = 0 as any;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/compiler/0.ts ===
|
||||
export type Data = string | boolean;
|
||||
>Data : Data
|
||||
>Data : string | boolean
|
||||
|
||||
let obj: Data = true;
|
||||
>obj : Data
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/compiler/0.ts ===
|
||||
export type Data = string | boolean;
|
||||
>Data : Data
|
||||
>Data : string | boolean
|
||||
|
||||
let obj: Data = true;
|
||||
>obj : Data
|
||||
|
||||
@@ -3,7 +3,7 @@ declare module "@ts-bug/a" {
|
||||
>"@ts-bug/a" : typeof import("@ts-bug/a")
|
||||
|
||||
export type AText = {
|
||||
>AText : AText
|
||||
>AText : { value: string; }
|
||||
|
||||
value: string;
|
||||
>value : string
|
||||
|
||||
@@ -24,10 +24,10 @@ export enum E {
|
||||
}
|
||||
|
||||
export type T = G<E>;
|
||||
>T : T
|
||||
>T : { a: string; b: string; }
|
||||
|
||||
export type Q = G<E.A>;
|
||||
>Q : Q
|
||||
>Q : { a: string; }
|
||||
>E : any
|
||||
|
||||
=== tests/cases/compiler/index.ts ===
|
||||
|
||||
@@ -2,21 +2,21 @@
|
||||
export * from './types';
|
||||
No type information for this code.=== tests/cases/compiler/monorepo/pkg1/dist/types.d.ts ===
|
||||
export declare type A = {
|
||||
>A : A
|
||||
>A : { id: string; }
|
||||
|
||||
id: string;
|
||||
>id : string
|
||||
|
||||
};
|
||||
export declare type B = {
|
||||
>B : B
|
||||
>B : { id: number; }
|
||||
|
||||
id: number;
|
||||
>id : number
|
||||
|
||||
};
|
||||
export declare type IdType = A | B;
|
||||
>IdType : IdType
|
||||
>IdType : A | B
|
||||
|
||||
export declare class MetadataAccessor<T, D extends IdType = IdType> {
|
||||
>MetadataAccessor : MetadataAccessor<T, D>
|
||||
|
||||
@@ -2,21 +2,21 @@
|
||||
export * from './types';
|
||||
No type information for this code.=== tests/cases/compiler/monorepo/pkg1/dist/types.d.ts ===
|
||||
export declare type A = {
|
||||
>A : A
|
||||
>A : { id: string; }
|
||||
|
||||
id: string;
|
||||
>id : string
|
||||
|
||||
};
|
||||
export declare type B = {
|
||||
>B : B
|
||||
>B : { id: number; }
|
||||
|
||||
id: number;
|
||||
>id : number
|
||||
|
||||
};
|
||||
export declare type IdType = A | B;
|
||||
>IdType : IdType
|
||||
>IdType : A | B
|
||||
|
||||
export declare class MetadataAccessor<T, D extends IdType = IdType> {
|
||||
>MetadataAccessor : MetadataAccessor<T, D>
|
||||
|
||||
@@ -2,21 +2,21 @@
|
||||
export * from './types';
|
||||
No type information for this code.=== tests/cases/compiler/monorepo/pkg1/dist/types.d.ts ===
|
||||
export declare type A = {
|
||||
>A : A
|
||||
>A : { id: string; }
|
||||
|
||||
id: string;
|
||||
>id : string
|
||||
|
||||
};
|
||||
export declare type B = {
|
||||
>B : B
|
||||
>B : { id: number; }
|
||||
|
||||
id: number;
|
||||
>id : number
|
||||
|
||||
};
|
||||
export declare type IdType = A | B;
|
||||
>IdType : IdType
|
||||
>IdType : A | B
|
||||
|
||||
export declare class MetadataAccessor<T, D extends IdType = IdType> {
|
||||
>MetadataAccessor : MetadataAccessor<T, D>
|
||||
|
||||
@@ -5,10 +5,10 @@ export declare function test<T> (a: () => T): () => T;
|
||||
|
||||
=== /packages/search-prefix/src/API/NotificationAPIUtils.ts ===
|
||||
export type NotificationRequest = {};
|
||||
>NotificationRequest : NotificationRequest
|
||||
>NotificationRequest : {}
|
||||
|
||||
export type NotificationResponse = {};
|
||||
>NotificationResponse : NotificationResponse
|
||||
>NotificationResponse : {}
|
||||
|
||||
export function getNotification(): NotificationResponse {
|
||||
>getNotification : () => NotificationResponse
|
||||
|
||||
@@ -4,7 +4,7 @@ export type DOMNode = Node;
|
||||
|
||||
=== tests/cases/compiler/custom.ts ===
|
||||
export type Node = {};
|
||||
>Node : Node
|
||||
>Node : {}
|
||||
|
||||
=== tests/cases/compiler/index.ts ===
|
||||
import { Node } from './custom'
|
||||
@@ -14,7 +14,7 @@ import { DOMNode } from './dom'
|
||||
>DOMNode : any
|
||||
|
||||
type Constructor = new (...args: any[]) => any
|
||||
>Constructor : Constructor
|
||||
>Constructor : new (...args: any[]) => any
|
||||
>args : any[]
|
||||
|
||||
export const mixin = (Base: Constructor) => {
|
||||
|
||||
@@ -15,7 +15,7 @@ interface Hash<T> {
|
||||
}
|
||||
|
||||
type StringHash = Hash<string>;
|
||||
>StringHash : StringHash
|
||||
>StringHash : Hash<string>
|
||||
|
||||
interface StringHash2 extends Hash<string> {}
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Repro from #41931
|
||||
|
||||
type Enum = Record<string, string | number>;
|
||||
>Enum : Enum
|
||||
>Enum : { [x: string]: string | number; }
|
||||
|
||||
type TypeMap<E extends Enum> = { [key in E[keyof E]]: number | boolean | string | number[] };
|
||||
>TypeMap : TypeMap<E>
|
||||
|
||||
@@ -117,7 +117,7 @@ function foo4(x: string | undefined = undefined, b: number) {
|
||||
}
|
||||
|
||||
type OptionalNullableString = string | null | undefined;
|
||||
>OptionalNullableString : OptionalNullableString
|
||||
>OptionalNullableString : string | null | undefined
|
||||
>null : null
|
||||
|
||||
function allowsNull(val: OptionalNullableString = "") {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/compiler/deferredTypeReferenceWithinArrayWithinTuple.ts ===
|
||||
type TypeStructure =
|
||||
>TypeStructure : TypeStructure
|
||||
>TypeStructure : ["or", TypeStructure[]] | ["string"] | ["number"] | ["list", TypeStructure]
|
||||
|
||||
| ["or", TypeStructure[]] // problem is only here, when using array
|
||||
| ["string"]
|
||||
|
||||
@@ -37,7 +37,7 @@ interface AA {
|
||||
}
|
||||
|
||||
type BB = {
|
||||
>BB : BB
|
||||
>BB : { [x: string]: number; }
|
||||
|
||||
[P in keyof any]: number
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ interface AA {
|
||||
}
|
||||
|
||||
type BB = {
|
||||
>BB : BB
|
||||
>BB : { [x: string]: number; }
|
||||
|
||||
[P in keyof any]: number
|
||||
}
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ interface AA {
|
||||
}
|
||||
|
||||
type BB = {
|
||||
>BB : BB
|
||||
>BB : { [x: string]: number; }
|
||||
|
||||
[P in keyof any]: number
|
||||
}
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ interface AA {
|
||||
}
|
||||
|
||||
type BB = {
|
||||
>BB : BB
|
||||
>BB : { [x: string]: number; }
|
||||
|
||||
[P in keyof any]: number
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/conformance/controlFlow/dependentDestructuredVariables.ts ===
|
||||
type Action =
|
||||
>Action : Action
|
||||
>Action : { kind: 'A'; payload: number; } | { kind: 'B'; payload: string; }
|
||||
|
||||
| { kind: 'A', payload: number }
|
||||
>kind : "A"
|
||||
@@ -107,7 +107,7 @@ function f12({ kind, payload }: Action) {
|
||||
}
|
||||
|
||||
type Action2 =
|
||||
>Action2 : Action2
|
||||
>Action2 : { kind: 'A'; payload: number | undefined; } | { kind: 'B'; payload: string | undefined; }
|
||||
|
||||
| { kind: 'A', payload: number | undefined }
|
||||
>kind : "A"
|
||||
@@ -265,7 +265,7 @@ function f23({ kind, payload }: Action2) {
|
||||
}
|
||||
|
||||
type Foo =
|
||||
>Foo : Foo
|
||||
>Foo : { kind: 'A'; isA: true; } | { kind: 'B'; isA: false; } | { kind: 'C'; isA: false; }
|
||||
|
||||
| { kind: 'A', isA: true }
|
||||
>kind : "A"
|
||||
@@ -324,7 +324,7 @@ function f30({ kind, isA }: Foo) {
|
||||
}
|
||||
|
||||
type Args = ['A', number] | ['B', string]
|
||||
>Args : Args
|
||||
>Args : ["A", number] | ["B", string]
|
||||
|
||||
function f40(...[kind, data]: Args) {
|
||||
>f40 : (...[kind, data]: Args) => void
|
||||
@@ -406,7 +406,7 @@ function unrefined1<T>(ab: AB<T>): void {
|
||||
// Repro from #38020
|
||||
|
||||
type Action3 =
|
||||
>Action3 : Action3
|
||||
>Action3 : { type: 'add'; payload: { toAdd: number;}; } | { type: 'remove'; payload: { toRemove: number;}; }
|
||||
|
||||
| {type: 'add', payload: { toAdd: number } }
|
||||
>type : "add"
|
||||
@@ -598,7 +598,7 @@ readFile('hello', (err, data) => {
|
||||
});
|
||||
|
||||
type ReducerArgs = ["add", { a: number, b: number }] | ["concat", { firstArr: any[], secondArr: any[] }];
|
||||
>ReducerArgs : ReducerArgs
|
||||
>ReducerArgs : ["add", { a: number; b: number; }] | ["concat", { firstArr: any[]; secondArr: any[]; }]
|
||||
>a : number
|
||||
>b : number
|
||||
>firstArr : any[]
|
||||
@@ -680,7 +680,7 @@ reducer("concat", { firstArr: [1, 2], secondArr: [3, 4] });
|
||||
// repro from https://github.com/microsoft/TypeScript/pull/47190#issuecomment-1057603588
|
||||
|
||||
type FooMethod = {
|
||||
>FooMethod : FooMethod
|
||||
>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
|
||||
@@ -724,7 +724,7 @@ let fooM: FooMethod = {
|
||||
};
|
||||
|
||||
type FooAsyncMethod = {
|
||||
>FooAsyncMethod : FooAsyncMethod
|
||||
>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>
|
||||
@@ -768,7 +768,7 @@ let fooAsyncM: FooAsyncMethod = {
|
||||
};
|
||||
|
||||
type FooGenMethod = {
|
||||
>FooGenMethod : FooGenMethod
|
||||
>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>
|
||||
@@ -812,7 +812,7 @@ let fooGenM: FooGenMethod = {
|
||||
};
|
||||
|
||||
type FooAsyncGenMethod = {
|
||||
>FooAsyncGenMethod : FooAsyncGenMethod
|
||||
>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>
|
||||
@@ -858,7 +858,7 @@ let fooAsyncGenM: FooAsyncGenMethod = {
|
||||
// Repro from #48345
|
||||
|
||||
type Func = <T extends ["a", number] | ["b", string]>(...args: T) => void;
|
||||
>Func : Func
|
||||
>Func : <T extends ["a", number] | ["b", string]>(...args: T) => void
|
||||
>args : T
|
||||
|
||||
const f60: Func = (kind, payload) => {
|
||||
|
||||
@@ -161,7 +161,7 @@ function f4() {
|
||||
// Repro from #31770
|
||||
|
||||
type KeyValue = [string, string?];
|
||||
>KeyValue : KeyValue
|
||||
>KeyValue : [string, (string | undefined)?]
|
||||
|
||||
let [key, value]: KeyValue = ["foo"];
|
||||
>key : string
|
||||
|
||||
@@ -9,46 +9,46 @@ interface c { c }
|
||||
>c : any
|
||||
|
||||
type T1 = ([a, b, c]);
|
||||
>T1 : T1
|
||||
>T1 : [a, b, c]
|
||||
|
||||
type F1 = ([a, b, c]) => void;
|
||||
>F1 : F1
|
||||
>F1 : ([a, b, c]: [any, any, any]) => void
|
||||
>a : any
|
||||
>b : any
|
||||
>c : any
|
||||
|
||||
type T2 = ({ a });
|
||||
>T2 : T2
|
||||
>T2 : { a: any; }
|
||||
>a : any
|
||||
|
||||
type F2 = ({ a }) => void;
|
||||
>F2 : F2
|
||||
>F2 : ({ a }: { a: any; }) => void
|
||||
>a : any
|
||||
|
||||
type T3 = ([{ a: b }, { b: a }]);
|
||||
>T3 : T3
|
||||
>T3 : [{ a: b; }, { b: a; }]
|
||||
>a : b
|
||||
>b : a
|
||||
|
||||
type F3 = ([{ a: b }, { b: a }]) => void;
|
||||
>F3 : F3
|
||||
>F3 : ([{ a: b }, { b: a }]: [{ a: any; }, { b: any; }]) => void
|
||||
>a : any
|
||||
>b : any
|
||||
>b : any
|
||||
>a : any
|
||||
|
||||
type T4 = ([{ a: [b, c] }]);
|
||||
>T4 : T4
|
||||
>T4 : [{ a: [b, c]; }]
|
||||
>a : [b, c]
|
||||
|
||||
type F4 = ([{ a: [b, c] }]) => void;
|
||||
>F4 : F4
|
||||
>F4 : ([{ a: [b, c] }]: [{ a: [any, any]; }]) => void
|
||||
>a : any
|
||||
>b : any
|
||||
>c : any
|
||||
|
||||
type C1 = new ([{ a: [b, c] }]) => void;
|
||||
>C1 : C1
|
||||
>C1 : new ([{ a: [b, c] }]: [{ a: [any, any]; }]) => void
|
||||
>a : any
|
||||
>b : any
|
||||
>c : any
|
||||
|
||||
@@ -6,13 +6,13 @@
|
||||
// ... Identifier TypeAnnotation(opt)
|
||||
|
||||
type arrayString = Array<String>
|
||||
>arrayString : arrayString
|
||||
>arrayString : String[]
|
||||
|
||||
type someArray = Array<String> | number[];
|
||||
>someArray : someArray
|
||||
>someArray : String[] | number[]
|
||||
|
||||
type stringOrNumArray = Array<String|Number>;
|
||||
>stringOrNumArray : stringOrNumArray
|
||||
>stringOrNumArray : (String | Number)[]
|
||||
|
||||
function a1(...x: (number|string)[]) { }
|
||||
>a1 : (...x: (number | string)[]) => void
|
||||
|
||||
@@ -6,13 +6,13 @@
|
||||
// ... Identifier TypeAnnotation(opt)
|
||||
|
||||
type arrayString = Array<String>
|
||||
>arrayString : arrayString
|
||||
>arrayString : String[]
|
||||
|
||||
type someArray = Array<String> | number[];
|
||||
>someArray : someArray
|
||||
>someArray : String[] | number[]
|
||||
|
||||
type stringOrNumArray = Array<String|Number>;
|
||||
>stringOrNumArray : stringOrNumArray
|
||||
>stringOrNumArray : (String | Number)[]
|
||||
|
||||
function a1(...x: (number|string)[]) { }
|
||||
>a1 : (...x: (number | string)[]) => void
|
||||
|
||||
@@ -6,13 +6,13 @@
|
||||
// ... Identifier TypeAnnotation(opt)
|
||||
|
||||
type arrayString = Array<String>
|
||||
>arrayString : arrayString
|
||||
>arrayString : String[]
|
||||
|
||||
type someArray = Array<String> | number[];
|
||||
>someArray : someArray
|
||||
>someArray : String[] | number[]
|
||||
|
||||
type stringOrNumArray = Array<String|Number>;
|
||||
>stringOrNumArray : stringOrNumArray
|
||||
>stringOrNumArray : (String | Number)[]
|
||||
|
||||
function a1(...x: (number|string)[]) { }
|
||||
>a1 : (...x: (number | string)[]) => void
|
||||
|
||||
@@ -6,13 +6,13 @@
|
||||
// ... Identifier TypeAnnotation(opt)
|
||||
|
||||
type arrayString = Array<String>
|
||||
>arrayString : arrayString
|
||||
>arrayString : String[]
|
||||
|
||||
type someArray = Array<String> | number[];
|
||||
>someArray : someArray
|
||||
>someArray : String[] | number[]
|
||||
|
||||
type stringOrNumArray = Array<String|Number>;
|
||||
>stringOrNumArray : stringOrNumArray
|
||||
>stringOrNumArray : (String | Number)[]
|
||||
|
||||
function a0(...x: [number, number, string]) { } // Error, rest parameter must be array type
|
||||
>a0 : (x_0: number, x_1: number, x_2: string) => void
|
||||
|
||||
@@ -10,7 +10,7 @@ class C1 {
|
||||
}
|
||||
|
||||
type TupleType1 = [string, number, boolean];
|
||||
>TupleType1 : TupleType1
|
||||
>TupleType1 : [string, number, boolean]
|
||||
|
||||
class C2 {
|
||||
>C2 : C2
|
||||
@@ -23,7 +23,7 @@ class C2 {
|
||||
}
|
||||
|
||||
type ObjType1 = { x: number; y: string; z: boolean }
|
||||
>ObjType1 : ObjType1
|
||||
>ObjType1 : { x: number; y: string; z: boolean; }
|
||||
>x : number
|
||||
>y : string
|
||||
>z : boolean
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
=== tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts ===
|
||||
type ObjType1 = { x: number; y: string; z: boolean }
|
||||
>ObjType1 : ObjType1
|
||||
>ObjType1 : { x: number; y: string; z: boolean; }
|
||||
>x : number
|
||||
>y : string
|
||||
>z : boolean
|
||||
|
||||
type TupleType1 = [ObjType1, number, string]
|
||||
>TupleType1 : TupleType1
|
||||
>TupleType1 : [ObjType1, number, string]
|
||||
|
||||
class C1 {
|
||||
>C1 : C1
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/compiler/destructuringTypeGuardFlow.ts ===
|
||||
type foo = {
|
||||
>foo : foo
|
||||
>foo : { bar: number | null; baz: string; nested: { a: number; b: string | null;}; }
|
||||
|
||||
bar: number | null;
|
||||
>bar : number | null
|
||||
@@ -79,7 +79,7 @@ if (aFoo.bar && aFoo.nested.b) {
|
||||
}
|
||||
|
||||
type bar = {
|
||||
>bar : bar
|
||||
>bar : { elem1: number | null; elem2: foo | null; }
|
||||
|
||||
elem1: number | null;
|
||||
>elem1 : number | null
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/compiler/didYouMeanStringLiteral.ts ===
|
||||
type T1 = "string" | "number" | "boolean";
|
||||
>T1 : T1
|
||||
>T1 : "string" | "number" | "boolean"
|
||||
|
||||
type T2 = T1 & ("number" | "boolean"); // "number" | "boolean"
|
||||
>T2 : "number" | "boolean"
|
||||
|
||||
@@ -17,7 +17,7 @@ type T0_3 = T0_1
|
||||
// A type reference directly depends on the referenced type and each of the type arguments, if any.
|
||||
interface I<T> {}
|
||||
type T1 = I<T1>
|
||||
>T1 : T1
|
||||
>T1 : I<T1>
|
||||
|
||||
// A union type directly depends on each of the constituent types.
|
||||
type T2 = T2 | string
|
||||
@@ -27,15 +27,15 @@ class C<T> {}
|
||||
>C : C<T>
|
||||
|
||||
type T2_1 = T2_1[] | number
|
||||
>T2_1 : T2_1
|
||||
>T2_1 : number | T2_1[]
|
||||
|
||||
// An array type directly depends on its element type.
|
||||
type T3 = T3[]
|
||||
>T3 : T3
|
||||
>T3 : T3[]
|
||||
|
||||
// A tuple type directly depends on each of its element types.
|
||||
type T4 = [number, T4]
|
||||
>T4 : T4
|
||||
>T4 : [number, T4]
|
||||
|
||||
// A type query directly depends on the type of the referenced entity.
|
||||
var x: T5[] = []
|
||||
@@ -50,7 +50,7 @@ class C1<T> {}
|
||||
>C1 : C1<T>
|
||||
|
||||
type T6 = T7 | number
|
||||
>T6 : T6
|
||||
>T6 : number | [string, T8[]]
|
||||
|
||||
type T7 = typeof yy
|
||||
>T7 : [string, T8[]]
|
||||
@@ -60,22 +60,22 @@ var yy: [string, T8[]];
|
||||
>yy : [string, T8[]]
|
||||
|
||||
type T8 = C<T6>
|
||||
>T8 : T8
|
||||
>T8 : C<T6>
|
||||
|
||||
// legal cases
|
||||
type T9 = () => T9
|
||||
>T9 : T9
|
||||
>T9 : () => T9
|
||||
|
||||
type T10 = { x: T10 } | { new(v: T10): string }
|
||||
>T10 : T10
|
||||
>T10 : { x: T10; } | (new (v: T10) => string)
|
||||
>x : T10
|
||||
>v : T10
|
||||
|
||||
type T11 = T12[]
|
||||
>T11 : T11
|
||||
>T11 : T12[]
|
||||
|
||||
type T12 = [T13, string]
|
||||
>T12 : T12
|
||||
>T12 : [{ x: T11; }, string]
|
||||
|
||||
type T13 = typeof zz
|
||||
>T13 : { x: T11; }
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
=== tests/cases/compiler/discriminableUnionWithIntersectedMembers.ts ===
|
||||
// regression test for https://github.com/microsoft/TypeScript/issues/33243
|
||||
type X =
|
||||
>X : X
|
||||
>X : ({ x: 'x'; y: number; } & { y: number; }) | ({ x: 'y'; y: number; z?: boolean; } & { y: number; })
|
||||
|
||||
| { x: 'x', y: number } & { y: number }
|
||||
>x : "x"
|
||||
@@ -24,7 +24,7 @@ const x: X = 4 as any as { x: 'x' | 'y', y: number };
|
||||
>y : number
|
||||
|
||||
type Y =
|
||||
>Y : Y
|
||||
>Y : { x: 'x'; y: number; } | { x: 'y'; y: number; z?: boolean; }
|
||||
|
||||
| { x: 'x', y: number }
|
||||
>x : "x"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/compiler/discriminantElementAccessCheck.ts ===
|
||||
type U = TypeA | TypeB;
|
||||
>U : U
|
||||
>U : TypeA | TypeB
|
||||
|
||||
interface TypeA {
|
||||
kind: 'A';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/compiler/discriminantPropertyCheck.ts ===
|
||||
type Item = Item1 | Item2;
|
||||
>Item : Item
|
||||
>Item : Item1 | Item2
|
||||
|
||||
interface Base {
|
||||
bar: boolean;
|
||||
@@ -243,7 +243,7 @@ enum Types { Str = 1, Num = 2 }
|
||||
>2 : 2
|
||||
|
||||
type Instance = StrType | NumType;
|
||||
>Instance : Instance
|
||||
>Instance : StrType | NumType
|
||||
|
||||
interface StrType {
|
||||
type: Types.Str;
|
||||
@@ -335,7 +335,7 @@ interface B {
|
||||
}
|
||||
|
||||
type U = A | B;
|
||||
>U : U
|
||||
>U : A | B
|
||||
|
||||
const u: U = {} as any;
|
||||
>u : U
|
||||
@@ -381,10 +381,10 @@ u.b && u.a && f(u.a, u.b);
|
||||
// Repro from #29012
|
||||
|
||||
type Additive = '+' | '-';
|
||||
>Additive : Additive
|
||||
>Additive : "+" | "-"
|
||||
|
||||
type Multiplicative = '*' | '/';
|
||||
>Multiplicative : Multiplicative
|
||||
>Multiplicative : "*" | "/"
|
||||
|
||||
interface AdditiveObj {
|
||||
key: Additive
|
||||
@@ -397,7 +397,7 @@ interface MultiplicativeObj {
|
||||
}
|
||||
|
||||
type Obj = AdditiveObj | MultiplicativeObj
|
||||
>Obj : Obj
|
||||
>Obj : AdditiveObj | MultiplicativeObj
|
||||
|
||||
export function foo(obj: Obj) {
|
||||
>foo : (obj: Obj) => void
|
||||
@@ -450,15 +450,15 @@ const enum BarEnum {
|
||||
}
|
||||
|
||||
type UnionOfBar = TypeBar1 | TypeBar2;
|
||||
>UnionOfBar : UnionOfBar
|
||||
>UnionOfBar : TypeBar1 | TypeBar2
|
||||
|
||||
type TypeBar1 = { type: BarEnum.bar1 };
|
||||
>TypeBar1 : TypeBar1
|
||||
>TypeBar1 : { type: BarEnum.bar1; }
|
||||
>type : BarEnum.bar1
|
||||
>BarEnum : any
|
||||
|
||||
type TypeBar2 = { type: BarEnum.bar2 };
|
||||
>TypeBar2 : TypeBar2
|
||||
>TypeBar2 : { type: BarEnum.bar2; }
|
||||
>type : BarEnum.bar2
|
||||
>BarEnum : any
|
||||
|
||||
@@ -520,7 +520,7 @@ interface TypeB {
|
||||
}
|
||||
|
||||
type Type = TypeA | TypeB;
|
||||
>Type : Type
|
||||
>Type : TypeA | TypeB
|
||||
|
||||
declare function isType(x: unknown): x is Type;
|
||||
>isType : (x: unknown) => x is Type
|
||||
@@ -573,7 +573,7 @@ function DoesNotWork(data: unknown) {
|
||||
// Repro from #36777
|
||||
|
||||
type TestA = {
|
||||
>TestA : TestA
|
||||
>TestA : { type: 'testA'; bananas: 3; }
|
||||
|
||||
type: 'testA';
|
||||
>type : "testA"
|
||||
@@ -583,7 +583,7 @@ type TestA = {
|
||||
}
|
||||
|
||||
type TestB = {
|
||||
>TestB : TestB
|
||||
>TestB : { type: 'testB'; apples: 5; }
|
||||
|
||||
type: 'testB';
|
||||
>type : "testB"
|
||||
@@ -593,10 +593,10 @@ type TestB = {
|
||||
}
|
||||
|
||||
type AllTests = TestA | TestB;
|
||||
>AllTests : AllTests
|
||||
>AllTests : TestA | TestB
|
||||
|
||||
type MapOfAllTests = Record<string, AllTests>;
|
||||
>MapOfAllTests : MapOfAllTests
|
||||
>MapOfAllTests : { [x: string]: AllTests; }
|
||||
|
||||
const doTestingStuff = (mapOfTests: MapOfAllTests, ids: string[]) => {
|
||||
>doTestingStuff : (mapOfTests: MapOfAllTests, ids: string[]) => void
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Repro from #41759
|
||||
|
||||
type DiscriminatorTrue = {
|
||||
>DiscriminatorTrue : DiscriminatorTrue
|
||||
>DiscriminatorTrue : { disc: true; cb: (x: string) => void; }
|
||||
|
||||
disc: true;
|
||||
>disc : true
|
||||
@@ -14,7 +14,7 @@ type DiscriminatorTrue = {
|
||||
}
|
||||
|
||||
type DiscriminatorFalse = {
|
||||
>DiscriminatorFalse : DiscriminatorFalse
|
||||
>DiscriminatorFalse : { disc?: false | undefined; cb: (x: number) => void; }
|
||||
|
||||
disc?: false;
|
||||
>disc : false | undefined
|
||||
@@ -26,7 +26,7 @@ type DiscriminatorFalse = {
|
||||
}
|
||||
|
||||
type Props = DiscriminatorTrue | DiscriminatorFalse;
|
||||
>Props : Props
|
||||
>Props : DiscriminatorTrue | DiscriminatorFalse
|
||||
|
||||
declare function f(options: DiscriminatorTrue | DiscriminatorFalse): any;
|
||||
>f : (options: DiscriminatorTrue | DiscriminatorFalse) => any
|
||||
|
||||
@@ -8,7 +8,7 @@ interface B { kind: 'B'; }
|
||||
>kind : "B"
|
||||
|
||||
type C = A | B | undefined;
|
||||
>C : C
|
||||
>C : A | B | undefined
|
||||
|
||||
function never(_: never): never {
|
||||
>never : (_: never) => never
|
||||
|
||||
@@ -142,7 +142,7 @@ const enum EnumTypeNode {
|
||||
}
|
||||
|
||||
type NodeA = Disjunction | Pattern;
|
||||
>NodeA : NodeA
|
||||
>NodeA : Disjunction | Pattern
|
||||
|
||||
interface NodeBase {
|
||||
type: NodeA["type"]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/compiler/discriminateObjectTypesOnly.ts ===
|
||||
type Thing = number | object;
|
||||
>Thing : Thing
|
||||
>Thing : number | object
|
||||
|
||||
const k: Thing = { toFixed: null }; // OK, satisfies object
|
||||
>k : Thing
|
||||
@@ -9,7 +9,7 @@ const k: Thing = { toFixed: null }; // OK, satisfies object
|
||||
>null : null
|
||||
|
||||
type Thing2 = number | { toFixed: null } | object;
|
||||
>Thing2 : Thing2
|
||||
>Thing2 : number | object | { toFixed: null; }
|
||||
>toFixed : null
|
||||
>null : null
|
||||
|
||||
@@ -26,7 +26,7 @@ const h: Thing2 = { toString: null }; // OK, satisfies object
|
||||
>null : null
|
||||
|
||||
type Thing3 = number | { toFixed: null, toString: undefined } | object;
|
||||
>Thing3 : Thing3
|
||||
>Thing3 : number | object | { toFixed: null; toString: undefined; }
|
||||
>toFixed : null
|
||||
>null : null
|
||||
>toString : undefined
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
=== tests/cases/compiler/discriminatedUnionErrorMessage.ts ===
|
||||
type Square = { kind: "sq", size: number }
|
||||
>Square : Square
|
||||
>Square : { kind: "sq"; size: number; }
|
||||
>kind : "sq"
|
||||
>size : number
|
||||
|
||||
type Rectangle = { kind: "rt", x: number, y: number }
|
||||
>Rectangle : Rectangle
|
||||
>Rectangle : { kind: "rt"; x: number; y: number; }
|
||||
>kind : "rt"
|
||||
>x : number
|
||||
>y : number
|
||||
|
||||
type Circle = { kind: "cr", radius: number }
|
||||
>Circle : Circle
|
||||
>Circle : { kind: "cr"; radius: number; }
|
||||
>kind : "cr"
|
||||
>radius : number
|
||||
|
||||
type Shape =
|
||||
>Shape : Shape
|
||||
>Shape : Square | Rectangle | Circle
|
||||
|
||||
| Square
|
||||
| Rectangle
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user