|
| 1 | +//// [tests/cases/compiler/contextualPropertyOfGenericFilteringMappedType.ts] //// |
| 2 | + |
| 3 | +=== contextualPropertyOfGenericFilteringMappedType.ts === |
| 4 | +declare function f1<T extends object>( |
| 5 | +>f1 : Symbol(f1, Decl(contextualPropertyOfGenericFilteringMappedType.ts, 0, 0)) |
| 6 | +>T : Symbol(T, Decl(contextualPropertyOfGenericFilteringMappedType.ts, 0, 20)) |
| 7 | + |
| 8 | + data: T, |
| 9 | +>data : Symbol(data, Decl(contextualPropertyOfGenericFilteringMappedType.ts, 0, 38)) |
| 10 | +>T : Symbol(T, Decl(contextualPropertyOfGenericFilteringMappedType.ts, 0, 20)) |
| 11 | + |
| 12 | + handlers: { [P in keyof T as P]: (value: T[P], prop: P) => void }, |
| 13 | +>handlers : Symbol(handlers, Decl(contextualPropertyOfGenericFilteringMappedType.ts, 1, 10)) |
| 14 | +>P : Symbol(P, Decl(contextualPropertyOfGenericFilteringMappedType.ts, 2, 15)) |
| 15 | +>T : Symbol(T, Decl(contextualPropertyOfGenericFilteringMappedType.ts, 0, 20)) |
| 16 | +>P : Symbol(P, Decl(contextualPropertyOfGenericFilteringMappedType.ts, 2, 15)) |
| 17 | +>value : Symbol(value, Decl(contextualPropertyOfGenericFilteringMappedType.ts, 2, 36)) |
| 18 | +>T : Symbol(T, Decl(contextualPropertyOfGenericFilteringMappedType.ts, 0, 20)) |
| 19 | +>P : Symbol(P, Decl(contextualPropertyOfGenericFilteringMappedType.ts, 2, 15)) |
| 20 | +>prop : Symbol(prop, Decl(contextualPropertyOfGenericFilteringMappedType.ts, 2, 48)) |
| 21 | +>P : Symbol(P, Decl(contextualPropertyOfGenericFilteringMappedType.ts, 2, 15)) |
| 22 | + |
| 23 | +): void; |
| 24 | + |
| 25 | +f1( |
| 26 | +>f1 : Symbol(f1, Decl(contextualPropertyOfGenericFilteringMappedType.ts, 0, 0)) |
| 27 | + { |
| 28 | + foo: 0, |
| 29 | +>foo : Symbol(foo, Decl(contextualPropertyOfGenericFilteringMappedType.ts, 6, 3)) |
| 30 | + |
| 31 | + bar: "", |
| 32 | +>bar : Symbol(bar, Decl(contextualPropertyOfGenericFilteringMappedType.ts, 7, 11)) |
| 33 | + |
| 34 | + }, |
| 35 | + { |
| 36 | + foo: (value, key) => {}, |
| 37 | +>foo : Symbol(foo, Decl(contextualPropertyOfGenericFilteringMappedType.ts, 10, 3)) |
| 38 | +>value : Symbol(value, Decl(contextualPropertyOfGenericFilteringMappedType.ts, 11, 10)) |
| 39 | +>key : Symbol(key, Decl(contextualPropertyOfGenericFilteringMappedType.ts, 11, 16)) |
| 40 | + |
| 41 | + bar: (value, key) => {}, |
| 42 | +>bar : Symbol(bar, Decl(contextualPropertyOfGenericFilteringMappedType.ts, 11, 28)) |
| 43 | +>value : Symbol(value, Decl(contextualPropertyOfGenericFilteringMappedType.ts, 12, 10)) |
| 44 | +>key : Symbol(key, Decl(contextualPropertyOfGenericFilteringMappedType.ts, 12, 16)) |
| 45 | + |
| 46 | + }, |
| 47 | +); |
| 48 | + |
| 49 | +declare function f2<T extends object>( |
| 50 | +>f2 : Symbol(f2, Decl(contextualPropertyOfGenericFilteringMappedType.ts, 14, 2)) |
| 51 | +>T : Symbol(T, Decl(contextualPropertyOfGenericFilteringMappedType.ts, 16, 20)) |
| 52 | + |
| 53 | + data: T, |
| 54 | +>data : Symbol(data, Decl(contextualPropertyOfGenericFilteringMappedType.ts, 16, 38)) |
| 55 | +>T : Symbol(T, Decl(contextualPropertyOfGenericFilteringMappedType.ts, 16, 20)) |
| 56 | + |
| 57 | + handlers: { [P in keyof T as T[P] extends string ? P : never]: (value: T[P], prop: P) => void }, |
| 58 | +>handlers : Symbol(handlers, Decl(contextualPropertyOfGenericFilteringMappedType.ts, 17, 10)) |
| 59 | +>P : Symbol(P, Decl(contextualPropertyOfGenericFilteringMappedType.ts, 18, 15)) |
| 60 | +>T : Symbol(T, Decl(contextualPropertyOfGenericFilteringMappedType.ts, 16, 20)) |
| 61 | +>T : Symbol(T, Decl(contextualPropertyOfGenericFilteringMappedType.ts, 16, 20)) |
| 62 | +>P : Symbol(P, Decl(contextualPropertyOfGenericFilteringMappedType.ts, 18, 15)) |
| 63 | +>P : Symbol(P, Decl(contextualPropertyOfGenericFilteringMappedType.ts, 18, 15)) |
| 64 | +>value : Symbol(value, Decl(contextualPropertyOfGenericFilteringMappedType.ts, 18, 66)) |
| 65 | +>T : Symbol(T, Decl(contextualPropertyOfGenericFilteringMappedType.ts, 16, 20)) |
| 66 | +>P : Symbol(P, Decl(contextualPropertyOfGenericFilteringMappedType.ts, 18, 15)) |
| 67 | +>prop : Symbol(prop, Decl(contextualPropertyOfGenericFilteringMappedType.ts, 18, 78)) |
| 68 | +>P : Symbol(P, Decl(contextualPropertyOfGenericFilteringMappedType.ts, 18, 15)) |
| 69 | + |
| 70 | +): void; |
| 71 | + |
| 72 | +f2( |
| 73 | +>f2 : Symbol(f2, Decl(contextualPropertyOfGenericFilteringMappedType.ts, 14, 2)) |
| 74 | + { |
| 75 | + foo: 0, |
| 76 | +>foo : Symbol(foo, Decl(contextualPropertyOfGenericFilteringMappedType.ts, 22, 3)) |
| 77 | + |
| 78 | + bar: "", |
| 79 | +>bar : Symbol(bar, Decl(contextualPropertyOfGenericFilteringMappedType.ts, 23, 11)) |
| 80 | + |
| 81 | + }, |
| 82 | + { |
| 83 | + bar: (value, key) => {}, |
| 84 | +>bar : Symbol(bar, Decl(contextualPropertyOfGenericFilteringMappedType.ts, 26, 3)) |
| 85 | +>value : Symbol(value, Decl(contextualPropertyOfGenericFilteringMappedType.ts, 27, 10)) |
| 86 | +>key : Symbol(key, Decl(contextualPropertyOfGenericFilteringMappedType.ts, 27, 16)) |
| 87 | + |
| 88 | + }, |
| 89 | +); |
| 90 | + |
0 commit comments