Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Accept new baselines
  • Loading branch information
ahejlsberg committed Mar 10, 2021
commit 13cf64e581075f6fbf6fc3e6afd2709196cc35f7
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function bar<T extends A | B>(x: T) {

var y: A | B = x; // Ok
>y : A | B
>x : T
>x : A | B
}

bar(new A);
Expand Down
16 changes: 1 addition & 15 deletions tests/baselines/reference/conditionalTypes1.errors.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,11 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(12,5): error TS23
tests/cases/conformance/types/conditional/conditionalTypes1.ts(17,5): error TS2322: Type 'T' is not assignable to type 'NonNullable<T>'.
Type 'string | undefined' is not assignable to type 'NonNullable<T>'.
Type 'undefined' is not assignable to type 'NonNullable<T>'.
tests/cases/conformance/types/conditional/conditionalTypes1.ts(18,9): error TS2322: Type 'T' is not assignable to type 'string'.
Type 'string | undefined' is not assignable to type 'string'.
Type 'undefined' is not assignable to type 'string'.
tests/cases/conformance/types/conditional/conditionalTypes1.ts(24,5): error TS2322: Type 'T[keyof T] | undefined' is not assignable to type 'NonNullable<Partial<T>[keyof T]>'.
Type 'undefined' is not assignable to type 'NonNullable<Partial<T>[keyof T]>'.
tests/cases/conformance/types/conditional/conditionalTypes1.ts(29,5): error TS2322: Type 'T["x"]' is not assignable to type 'NonNullable<T["x"]>'.
Type 'string | undefined' is not assignable to type 'NonNullable<T["x"]>'.
Type 'undefined' is not assignable to type 'NonNullable<T["x"]>'.
tests/cases/conformance/types/conditional/conditionalTypes1.ts(30,9): error TS2322: Type 'T["x"]' is not assignable to type 'string'.
Type 'string | undefined' is not assignable to type 'string'.
Type 'undefined' is not assignable to type 'string'.
tests/cases/conformance/types/conditional/conditionalTypes1.ts(103,5): error TS2322: Type 'FunctionProperties<T>' is not assignable to type 'T'.
'T' could be instantiated with an arbitrary type which could be unrelated to 'FunctionProperties<T>'.
tests/cases/conformance/types/conditional/conditionalTypes1.ts(104,5): error TS2322: Type 'NonFunctionProperties<T>' is not assignable to type 'T'.
Expand Down Expand Up @@ -63,7 +57,7 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(288,43): error TS
Type 'boolean' is not assignable to type 'true'.


==== tests/cases/conformance/types/conditional/conditionalTypes1.ts (22 errors) ====
==== tests/cases/conformance/types/conditional/conditionalTypes1.ts (20 errors) ====
type T00 = Exclude<"a" | "b" | "c" | "d", "a" | "c" | "f">; // "b" | "d"
type T01 = Extract<"a" | "b" | "c" | "d", "a" | "c" | "f">; // "a" | "c"

Expand All @@ -88,10 +82,6 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(288,43): error TS
!!! error TS2322: Type 'string | undefined' is not assignable to type 'NonNullable<T>'.
!!! error TS2322: Type 'undefined' is not assignable to type 'NonNullable<T>'.
let s1: string = x; // Error
~~
!!! error TS2322: Type 'T' is not assignable to type 'string'.
!!! error TS2322: Type 'string | undefined' is not assignable to type 'string'.
!!! error TS2322: Type 'undefined' is not assignable to type 'string'.
let s2: string = y;
}

Expand All @@ -111,10 +101,6 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(288,43): error TS
!!! error TS2322: Type 'string | undefined' is not assignable to type 'NonNullable<T["x"]>'.
!!! error TS2322: Type 'undefined' is not assignable to type 'NonNullable<T["x"]>'.
let s1: string = x; // Error
~~
!!! error TS2322: Type 'T["x"]' is not assignable to type 'string'.
!!! error TS2322: Type 'string | undefined' is not assignable to type 'string'.
!!! error TS2322: Type 'undefined' is not assignable to type 'string'.
let s2: string = y;
}

Expand Down
8 changes: 4 additions & 4 deletions tests/baselines/reference/conditionalTypes1.types
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function f2<T extends string | undefined>(x: T, y: NonNullable<T>) {

let s1: string = x; // Error
>s1 : string
>x : T
>x : string

let s2: string = y;
>s2 : string
Expand Down Expand Up @@ -92,7 +92,7 @@ function f4<T extends { x: string | undefined }>(x: T["x"], y: NonNullable<T["x"

let s1: string = x; // Error
>s1 : string
>x : T["x"]
>x : string

let s2: string = y;
>s2 : string
Expand Down Expand Up @@ -476,11 +476,11 @@ function f21<T extends number | string>(x: T, y: ZeroOf<T>) {

let z1: number | string = y;
>z1 : string | number
>y : ZeroOf<T>
>y : "" | 0

let z2: 0 | "" = y;
>z2 : "" | 0
>y : ZeroOf<T>
>y : "" | 0

x = y; // Error
>x = y : ZeroOf<T>
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/deeplyNestedConstraints.types
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class BufferPool<E extends Enum, M extends TypeMap<E>> {

array.length; // Requires exploration of >5 levels of constraints
>array.length : number
>array : Extract<M[K], ArrayLike<any>>
>array : string | number[]
>length : number
}
}
Expand Down
4 changes: 2 additions & 2 deletions tests/baselines/reference/enumPropertyAccess.errors.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
tests/cases/compiler/enumPropertyAccess.ts(7,11): error TS2339: Property 'Green' does not exist on type 'Colors.Red'.
tests/cases/compiler/enumPropertyAccess.ts(12,7): error TS2339: Property 'Green' does not exist on type 'B'.
tests/cases/compiler/enumPropertyAccess.ts(12,7): error TS2339: Property 'Green' does not exist on type 'Colors'.


==== tests/cases/compiler/enumPropertyAccess.ts (2 errors) ====
Expand All @@ -18,6 +18,6 @@ tests/cases/compiler/enumPropertyAccess.ts(12,7): error TS2339: Property 'Green'
function fill<B extends Colors>(f: B) {
f.Green; // error
~~~~~
!!! error TS2339: Property 'Green' does not exist on type 'B'.
!!! error TS2339: Property 'Green' does not exist on type 'Colors'.
f.toFixed(); // ok
}
4 changes: 2 additions & 2 deletions tests/baselines/reference/enumPropertyAccess.types
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ function fill<B extends Colors>(f: B) {

f.Green; // error
>f.Green : any
>f : B
>f : Colors
>Green : any

f.toFixed(); // ok
>f.toFixed() : string
>f.toFixed : (fractionDigits?: number) => string
>f : B
>f : Colors
>toFixed : (fractionDigits?: number) => string
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,24 +37,24 @@ function callN<T extends A | B>(p: T) {
p.a("s"); // Error
>p.a("s") : string
>p.a : ((x: number) => string) | ((x: boolean) => string)
>p : T
>p : A | B
>a : ((x: number) => string) | ((x: boolean) => string)
>"s" : "s"

var a: T["a"] = p.a;
>a : T["a"]
>p.a : ((x: number) => string) | ((x: boolean) => string)
>p : T
>p : A | B
>a : ((x: number) => string) | ((x: boolean) => string)

a(""); // Error
>a("") : string
>a : T["a"]
>a : ((x: number) => string) | ((x: boolean) => string)
>"" : ""

a("", "", "", ""); // Error
>a("", "", "", "") : string
>a : T["a"]
>a : ((x: number) => string) | ((x: boolean) => string)
>"" : ""
>"" : ""
>"" : ""
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/intrinsicTypes.types
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ function foo2<T extends 'foo' | 'bar'>(x: Uppercase<T>) {

let s: 'FOO' | 'BAR' = x;
>s : "FOO" | "BAR"
>x : Uppercase<T>
>x : "FOO" | "BAR"
}

declare function foo3<T extends string>(x: Uppercase<T>): T;
Expand Down
4 changes: 2 additions & 2 deletions tests/baselines/reference/keyofAndIndexedAccess.types
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ function f50<T>(k: keyof T, s: string) {
const x2 = k as string;
>x2 : string
>k as string : string
>k : keyof T
>k : string | number | symbol
}

function f51<T, K extends keyof T>(k: K, s: string) {
Expand All @@ -646,7 +646,7 @@ function f51<T, K extends keyof T>(k: K, s: string) {
const x2 = k as string;
>x2 : string
>k as string : string
>k : K
>k : string | number | symbol
}

function f52<T>(obj: { [x: string]: boolean }, k: Exclude<keyof T, symbol>, s: string, n: number) {
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/keyofAndIndexedAccess2.types
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ function fn<T extends {elements: Array<string>} | {elements: Array<number>}>(par
>cb : (element: T["elements"][number]) => void
>param.elements[0] : string | number
>param.elements : string[] | number[]
>param : T
>param : { elements: string[]; } | { elements: number[]; }
>elements : string[] | number[]
>0 : 0
}
Expand Down
4 changes: 2 additions & 2 deletions tests/baselines/reference/narrowingByTypeofInSwitch.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -404,9 +404,9 @@ function exhaustiveChecksGenerics<T extends L | R | number | string>(x: T): stri
>x : Symbol(x, Decl(narrowingByTypeofInSwitch.ts, 146, 69))

case 'number': return x.toString(2);
>x.toString : Symbol(Number.toString, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 2 more)
>x.toString : Symbol(Number.toString, Decl(lib.es5.d.ts, --, --))
>x : Symbol(x, Decl(narrowingByTypeofInSwitch.ts, 146, 69))
>toString : Symbol(Number.toString, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 2 more)
>toString : Symbol(Number.toString, Decl(lib.es5.d.ts, --, --))

case 'string': return x;
>x : Symbol(x, Decl(narrowingByTypeofInSwitch.ts, 146, 69))
Expand Down
Loading