File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change 1+ /* eslint-disable @typescript-eslint/require-await */
2+ import type { Expect , Equal } from "type-testing" ;
3+
4+ type PerfReview < T > =
5+ T extends AsyncGenerator < infer Y , unknown , never > ? Y : never ;
6+
7+ // ------------------- Test section ---------------------
8+
9+ async function * numberAsyncGenerator ( ) {
10+ yield 1 ;
11+ yield 2 ;
12+ yield 3 ;
13+ }
14+ type t0_type = typeof numberAsyncGenerator ;
15+ type t0_actual = PerfReview < ReturnType < t0_type > > ;
16+ type t0_expected = 1 | 2 | 3 ;
17+ type t0 = Expect < Equal < t0_actual , t0_expected > > ;
18+
19+ async function * stringAsyncGenerator ( ) {
20+ yield "1%" ;
21+ yield "2%" ;
22+ }
23+ type t1_type = typeof stringAsyncGenerator ;
24+ type t1_actual = PerfReview < ReturnType < t1_type > > ;
25+ type t1_expected = "1%" | "2%" ;
26+ type t1 = Expect < Equal < t1_actual , t1_expected > > ;
You can’t perform that action at this time.
0 commit comments