-
Notifications
You must be signed in to change notification settings - Fork 12.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
97cb818
commit 1dcf4ab
Showing
4 changed files
with
153 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
//// [circularContextualMappedType.ts] | ||
type Func<T> = () => T; | ||
|
||
type Mapped<T> = { [K in keyof T]: Func<T[K]> }; | ||
|
||
declare function reproduce(options: number): void; | ||
declare function reproduce<T>(options: Mapped<T>): T | ||
|
||
reproduce({ | ||
name: () => { return 123 } | ||
}); | ||
|
||
reproduce({ | ||
name() { return 123 } | ||
}); | ||
|
||
reproduce({ | ||
name: function () { return 123 } | ||
}); | ||
|
||
|
||
//// [circularContextualMappedType.js] | ||
"use strict"; | ||
reproduce({ | ||
name: function () { return 123; } | ||
}); | ||
reproduce({ | ||
name: function () { return 123; } | ||
}); | ||
reproduce({ | ||
name: function () { return 123; } | ||
}); |
51 changes: 51 additions & 0 deletions
51
tests/baselines/reference/circularContextualMappedType.symbols
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
=== tests/cases/compiler/circularContextualMappedType.ts === | ||
type Func<T> = () => T; | ||
>Func : Symbol(Func, Decl(circularContextualMappedType.ts, 0, 0)) | ||
>T : Symbol(T, Decl(circularContextualMappedType.ts, 0, 10)) | ||
>T : Symbol(T, Decl(circularContextualMappedType.ts, 0, 10)) | ||
|
||
type Mapped<T> = { [K in keyof T]: Func<T[K]> }; | ||
>Mapped : Symbol(Mapped, Decl(circularContextualMappedType.ts, 0, 23)) | ||
>T : Symbol(T, Decl(circularContextualMappedType.ts, 2, 12)) | ||
>K : Symbol(K, Decl(circularContextualMappedType.ts, 2, 20)) | ||
>T : Symbol(T, Decl(circularContextualMappedType.ts, 2, 12)) | ||
>Func : Symbol(Func, Decl(circularContextualMappedType.ts, 0, 0)) | ||
>T : Symbol(T, Decl(circularContextualMappedType.ts, 2, 12)) | ||
>K : Symbol(K, Decl(circularContextualMappedType.ts, 2, 20)) | ||
|
||
declare function reproduce(options: number): void; | ||
>reproduce : Symbol(reproduce, Decl(circularContextualMappedType.ts, 2, 48), Decl(circularContextualMappedType.ts, 4, 50)) | ||
>options : Symbol(options, Decl(circularContextualMappedType.ts, 4, 27)) | ||
|
||
declare function reproduce<T>(options: Mapped<T>): T | ||
>reproduce : Symbol(reproduce, Decl(circularContextualMappedType.ts, 2, 48), Decl(circularContextualMappedType.ts, 4, 50)) | ||
>T : Symbol(T, Decl(circularContextualMappedType.ts, 5, 27)) | ||
>options : Symbol(options, Decl(circularContextualMappedType.ts, 5, 30)) | ||
>Mapped : Symbol(Mapped, Decl(circularContextualMappedType.ts, 0, 23)) | ||
>T : Symbol(T, Decl(circularContextualMappedType.ts, 5, 27)) | ||
>T : Symbol(T, Decl(circularContextualMappedType.ts, 5, 27)) | ||
|
||
reproduce({ | ||
>reproduce : Symbol(reproduce, Decl(circularContextualMappedType.ts, 2, 48), Decl(circularContextualMappedType.ts, 4, 50)) | ||
|
||
name: () => { return 123 } | ||
>name : Symbol(name, Decl(circularContextualMappedType.ts, 7, 11)) | ||
|
||
}); | ||
|
||
reproduce({ | ||
>reproduce : Symbol(reproduce, Decl(circularContextualMappedType.ts, 2, 48), Decl(circularContextualMappedType.ts, 4, 50)) | ||
|
||
name() { return 123 } | ||
>name : Symbol(name, Decl(circularContextualMappedType.ts, 11, 11)) | ||
|
||
}); | ||
|
||
reproduce({ | ||
>reproduce : Symbol(reproduce, Decl(circularContextualMappedType.ts, 2, 48), Decl(circularContextualMappedType.ts, 4, 50)) | ||
|
||
name: function () { return 123 } | ||
>name : Symbol(name, Decl(circularContextualMappedType.ts, 15, 11)) | ||
|
||
}); | ||
|
50 changes: 50 additions & 0 deletions
50
tests/baselines/reference/circularContextualMappedType.types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
=== tests/cases/compiler/circularContextualMappedType.ts === | ||
type Func<T> = () => T; | ||
>Func : Func<T> | ||
|
||
type Mapped<T> = { [K in keyof T]: Func<T[K]> }; | ||
>Mapped : Mapped<T> | ||
|
||
declare function reproduce(options: number): void; | ||
>reproduce : { (options: number): void; <T>(options: Mapped<T>): T; } | ||
>options : number | ||
|
||
declare function reproduce<T>(options: Mapped<T>): T | ||
>reproduce : { (options: number): void; <T>(options: Mapped<T>): T; } | ||
>options : Mapped<T> | ||
|
||
reproduce({ | ||
>reproduce({ name: () => { return 123 }}) : { name: number; } | ||
>reproduce : { (options: number): void; <T>(options: Mapped<T>): T; } | ||
>{ name: () => { return 123 }} : { name: () => number; } | ||
|
||
name: () => { return 123 } | ||
>name : () => number | ||
>() => { return 123 } : () => number | ||
>123 : 123 | ||
|
||
}); | ||
|
||
reproduce({ | ||
>reproduce({ name() { return 123 }}) : { name: number; } | ||
>reproduce : { (options: number): void; <T>(options: Mapped<T>): T; } | ||
>{ name() { return 123 }} : { name(): number; } | ||
|
||
name() { return 123 } | ||
>name : () => number | ||
>123 : 123 | ||
|
||
}); | ||
|
||
reproduce({ | ||
>reproduce({ name: function () { return 123 }}) : { name: number; } | ||
>reproduce : { (options: number): void; <T>(options: Mapped<T>): T; } | ||
>{ name: function () { return 123 }} : { name: () => number; } | ||
|
||
name: function () { return 123 } | ||
>name : () => number | ||
>function () { return 123 } : () => number | ||
>123 : 123 | ||
|
||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// @strict: true | ||
|
||
type Func<T> = () => T; | ||
|
||
type Mapped<T> = { [K in keyof T]: Func<T[K]> }; | ||
|
||
declare function reproduce(options: number): void; | ||
declare function reproduce<T>(options: Mapped<T>): T | ||
|
||
reproduce({ | ||
name: () => { return 123 } | ||
}); | ||
|
||
reproduce({ | ||
name() { return 123 } | ||
}); | ||
|
||
reproduce({ | ||
name: function () { return 123 } | ||
}); |