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 Aug 13, 2020
commit fed0e8c71b505a73ae536d68a60d61edf6445a47
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ tests/cases/compiler/recursiveConditionalTypes.ts(89,9): error TS2345: Argument
T;

type MyPromise<T> = {
then<U>(f: ((value: T) => U | MyPromise<U>) | null | undefined): MyPromise<U>;
then<U>(f: ((value: T) => U | PromiseLike<U>) | null | undefined): MyPromise<U>;
}

type InfinitePromise<T> = Promise<InfinitePromise<T>>;
Expand Down Expand Up @@ -129,7 +129,7 @@ tests/cases/compiler/recursiveConditionalTypes.ts(89,9): error TS2345: Argument

declare let z: Box2<Box2<string>>;

foo(z); // string
foo(z); // unknown, but ideally would be string (requires unique recursion ID for each type reference)

// Intersect tuple element types

Expand Down
8 changes: 4 additions & 4 deletions tests/baselines/reference/recursiveConditionalTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ type Awaited<T> =
T;

type MyPromise<T> = {
then<U>(f: ((value: T) => U | MyPromise<U>) | null | undefined): MyPromise<U>;
then<U>(f: ((value: T) => U | PromiseLike<U>) | null | undefined): MyPromise<U>;
}

type InfinitePromise<T> = Promise<InfinitePromise<T>>;
Expand Down Expand Up @@ -64,7 +64,7 @@ declare function foo<T>(x: Box1<Box1<T>>): T;

declare let z: Box2<Box2<string>>;

foo(z); // string
foo(z); // unknown, but ideally would be string (requires unique recursion ID for each type reference)

// Intersect tuple element types

Expand Down Expand Up @@ -105,7 +105,7 @@ function f22(tn, tm) {
tm = tn;
}
f23(['a', 'b', 'c']); // string
foo(z); // string
foo(z); // unknown, but ideally would be string (requires unique recursion ID for each type reference)
function f20(x, y) {
x = y;
y = x;
Expand All @@ -119,7 +119,7 @@ function f21(x, y) {
//// [recursiveConditionalTypes.d.ts]
declare type Awaited<T> = T extends null | undefined ? T : T extends PromiseLike<infer U> ? Awaited<U> : T;
declare type MyPromise<T> = {
then<U>(f: ((value: T) => U | MyPromise<U>) | null | undefined): MyPromise<U>;
then<U>(f: ((value: T) => U | PromiseLike<U>) | null | undefined): MyPromise<U>;
};
declare type InfinitePromise<T> = Promise<InfinitePromise<T>>;
declare type P0 = Awaited<Promise<string | Promise<MyPromise<number> | null> | undefined>>;
Expand Down
6 changes: 3 additions & 3 deletions tests/baselines/reference/recursiveConditionalTypes.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ type MyPromise<T> = {
>MyPromise : Symbol(MyPromise, Decl(recursiveConditionalTypes.ts, 5, 6))
>T : Symbol(T, Decl(recursiveConditionalTypes.ts, 7, 15))

then<U>(f: ((value: T) => U | MyPromise<U>) | null | undefined): MyPromise<U>;
then<U>(f: ((value: T) => U | PromiseLike<U>) | null | undefined): MyPromise<U>;
>then : Symbol(then, Decl(recursiveConditionalTypes.ts, 7, 21))
>U : Symbol(U, Decl(recursiveConditionalTypes.ts, 8, 9))
>f : Symbol(f, Decl(recursiveConditionalTypes.ts, 8, 12))
>value : Symbol(value, Decl(recursiveConditionalTypes.ts, 8, 17))
>T : Symbol(T, Decl(recursiveConditionalTypes.ts, 7, 15))
>U : Symbol(U, Decl(recursiveConditionalTypes.ts, 8, 9))
>MyPromise : Symbol(MyPromise, Decl(recursiveConditionalTypes.ts, 5, 6))
>PromiseLike : Symbol(PromiseLike, Decl(lib.es5.d.ts, --, --))
>U : Symbol(U, Decl(recursiveConditionalTypes.ts, 8, 9))
>MyPromise : Symbol(MyPromise, Decl(recursiveConditionalTypes.ts, 5, 6))
>U : Symbol(U, Decl(recursiveConditionalTypes.ts, 8, 9))
Expand Down Expand Up @@ -243,7 +243,7 @@ declare let z: Box2<Box2<string>>;
>Box2 : Symbol(Box2, Decl(recursiveConditionalTypes.ts, 58, 28))
>Box2 : Symbol(Box2, Decl(recursiveConditionalTypes.ts, 58, 28))

foo(z); // string
foo(z); // unknown, but ideally would be string (requires unique recursion ID for each type reference)
>foo : Symbol(foo, Decl(recursiveConditionalTypes.ts, 59, 28))
>z : Symbol(z, Decl(recursiveConditionalTypes.ts, 63, 11))

Expand Down
10 changes: 5 additions & 5 deletions tests/baselines/reference/recursiveConditionalTypes.types
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ type Awaited<T> =
type MyPromise<T> = {
>MyPromise : MyPromise<T>

then<U>(f: ((value: T) => U | MyPromise<U>) | null | undefined): MyPromise<U>;
>then : <U>(f: ((value: T) => U | MyPromise<U>) | null | undefined) => MyPromise<U>
>f : ((value: T) => U | MyPromise<U>) | null | undefined
then<U>(f: ((value: T) => U | PromiseLike<U>) | null | undefined): MyPromise<U>;
>then : <U>(f: ((value: T) => U | PromiseLike<U>) | null | undefined) => MyPromise<U>
>f : ((value: T) => U | PromiseLike<U>) | null | undefined
>value : T
>null : null
}
Expand Down Expand Up @@ -152,8 +152,8 @@ declare function foo<T>(x: Box1<Box1<T>>): T;
declare let z: Box2<Box2<string>>;
>z : Box2<Box2<string>>

foo(z); // string
>foo(z) : string
foo(z); // unknown, but ideally would be string (requires unique recursion ID for each type reference)
>foo(z) : unknown
>foo : <T>(x: Box1<Box1<T>>) => T
>z : Box2<Box2<string>>

Expand Down