Test returning an infinite type in an intersection
This commit is contained in:
parent
10beac2c1c
commit
c0b8c217b1
15
tests/baselines/reference/returnInfiniteIntersection.js
Normal file
15
tests/baselines/reference/returnInfiniteIntersection.js
Normal file
|
@ -0,0 +1,15 @@
|
|||
//// [returnInfiniteIntersection.ts]
|
||||
function recursive() {
|
||||
let x = <T>(subkey: T) => recursive();
|
||||
return x as typeof x & { p };
|
||||
}
|
||||
|
||||
let result = recursive()(1)
|
||||
|
||||
|
||||
//// [returnInfiniteIntersection.js]
|
||||
function recursive() {
|
||||
var x = function (subkey) { return recursive(); };
|
||||
return x;
|
||||
}
|
||||
var result = recursive()(1);
|
21
tests/baselines/reference/returnInfiniteIntersection.symbols
Normal file
21
tests/baselines/reference/returnInfiniteIntersection.symbols
Normal file
|
@ -0,0 +1,21 @@
|
|||
=== tests/cases/compiler/returnInfiniteIntersection.ts ===
|
||||
function recursive() {
|
||||
>recursive : Symbol(recursive, Decl(returnInfiniteIntersection.ts, 0, 0))
|
||||
|
||||
let x = <T>(subkey: T) => recursive();
|
||||
>x : Symbol(x, Decl(returnInfiniteIntersection.ts, 1, 7))
|
||||
>T : Symbol(T, Decl(returnInfiniteIntersection.ts, 1, 13))
|
||||
>subkey : Symbol(subkey, Decl(returnInfiniteIntersection.ts, 1, 16))
|
||||
>T : Symbol(T, Decl(returnInfiniteIntersection.ts, 1, 13))
|
||||
>recursive : Symbol(recursive, Decl(returnInfiniteIntersection.ts, 0, 0))
|
||||
|
||||
return x as typeof x & { p };
|
||||
>x : Symbol(x, Decl(returnInfiniteIntersection.ts, 1, 7))
|
||||
>x : Symbol(x, Decl(returnInfiniteIntersection.ts, 1, 7))
|
||||
>p : Symbol(p, Decl(returnInfiniteIntersection.ts, 2, 28))
|
||||
}
|
||||
|
||||
let result = recursive()(1)
|
||||
>result : Symbol(result, Decl(returnInfiniteIntersection.ts, 5, 3))
|
||||
>recursive : Symbol(recursive, Decl(returnInfiniteIntersection.ts, 0, 0))
|
||||
|
27
tests/baselines/reference/returnInfiniteIntersection.types
Normal file
27
tests/baselines/reference/returnInfiniteIntersection.types
Normal file
|
@ -0,0 +1,27 @@
|
|||
=== tests/cases/compiler/returnInfiniteIntersection.ts ===
|
||||
function recursive() {
|
||||
>recursive : () => (<T>(subkey: T) => any & { p: any; }) & { p: any; }
|
||||
|
||||
let x = <T>(subkey: T) => recursive();
|
||||
>x : <T>(subkey: T) => any & { p: any; }
|
||||
><T>(subkey: T) => recursive() : <T>(subkey: T) => any & { p: any; }
|
||||
>T : T
|
||||
>subkey : T
|
||||
>T : T
|
||||
>recursive() : (<T>(subkey: T) => any & { p: any; }) & { p: any; }
|
||||
>recursive : () => (<T>(subkey: T) => any & { p: any; }) & { p: any; }
|
||||
|
||||
return x as typeof x & { p };
|
||||
>x as typeof x & { p } : (<T>(subkey: T) => any & { p: any; }) & { p: any; }
|
||||
>x : <T>(subkey: T) => any & { p: any; }
|
||||
>x : <T>(subkey: T) => any & { p: any; }
|
||||
>p : any
|
||||
}
|
||||
|
||||
let result = recursive()(1)
|
||||
>result : (<T>(subkey: T) => any & { p: any; }) & { p: any; }
|
||||
>recursive()(1) : (<T>(subkey: T) => any & { p: any; }) & { p: any; }
|
||||
>recursive() : (<T>(subkey: T) => any & { p: any; }) & { p: any; }
|
||||
>recursive : () => (<T>(subkey: T) => any & { p: any; }) & { p: any; }
|
||||
>1 : 1
|
||||
|
6
tests/cases/compiler/returnInfiniteIntersection.ts
Normal file
6
tests/cases/compiler/returnInfiniteIntersection.ts
Normal file
|
@ -0,0 +1,6 @@
|
|||
function recursive() {
|
||||
let x = <T>(subkey: T) => recursive();
|
||||
return x as typeof x & { p };
|
||||
}
|
||||
|
||||
let result = recursive()(1)
|
Loading…
Reference in a new issue