|
| 1 | +//// [tests/cases/compiler/genericFunctionInference3.ts] //// |
| 2 | + |
| 3 | +=== genericFunctionInference3.ts === |
| 4 | +// https://github.com/microsoft/TypeScript/issues/56931 |
| 5 | + |
| 6 | +declare function defineComponent<Props extends Record<string, any>>( |
| 7 | +>defineComponent : Symbol(defineComponent, Decl(genericFunctionInference3.ts, 0, 0)) |
| 8 | +>Props : Symbol(Props, Decl(genericFunctionInference3.ts, 2, 33)) |
| 9 | +>Record : Symbol(Record, Decl(lib.es5.d.ts, --, --)) |
| 10 | + |
| 11 | + setup: (props: Props) => void, |
| 12 | +>setup : Symbol(setup, Decl(genericFunctionInference3.ts, 2, 68)) |
| 13 | +>props : Symbol(props, Decl(genericFunctionInference3.ts, 3, 10)) |
| 14 | +>Props : Symbol(Props, Decl(genericFunctionInference3.ts, 2, 33)) |
| 15 | + |
| 16 | + options?: { |
| 17 | +>options : Symbol(options, Decl(genericFunctionInference3.ts, 3, 32)) |
| 18 | + |
| 19 | + props?: (keyof Props)[]; |
| 20 | +>props : Symbol(props, Decl(genericFunctionInference3.ts, 4, 13)) |
| 21 | +>Props : Symbol(Props, Decl(genericFunctionInference3.ts, 2, 33)) |
| 22 | + |
| 23 | + }, |
| 24 | +): (props: Props) => unknown; |
| 25 | +>props : Symbol(props, Decl(genericFunctionInference3.ts, 7, 4)) |
| 26 | +>Props : Symbol(Props, Decl(genericFunctionInference3.ts, 2, 33)) |
| 27 | + |
| 28 | +const res1 = defineComponent( |
| 29 | +>res1 : Symbol(res1, Decl(genericFunctionInference3.ts, 9, 5)) |
| 30 | +>defineComponent : Symbol(defineComponent, Decl(genericFunctionInference3.ts, 0, 0)) |
| 31 | + |
| 32 | + <T extends string>(_props: { msg: T }) => { |
| 33 | +>T : Symbol(T, Decl(genericFunctionInference3.ts, 10, 3)) |
| 34 | +>_props : Symbol(_props, Decl(genericFunctionInference3.ts, 10, 21)) |
| 35 | +>msg : Symbol(msg, Decl(genericFunctionInference3.ts, 10, 30)) |
| 36 | +>T : Symbol(T, Decl(genericFunctionInference3.ts, 10, 3)) |
| 37 | + |
| 38 | + return () => {}; |
| 39 | + } |
| 40 | +); |
| 41 | + |
| 42 | +const res2 = defineComponent( |
| 43 | +>res2 : Symbol(res2, Decl(genericFunctionInference3.ts, 15, 5)) |
| 44 | +>defineComponent : Symbol(defineComponent, Decl(genericFunctionInference3.ts, 0, 0)) |
| 45 | + |
| 46 | + <T extends string>(_props: { msg: T }) => { |
| 47 | +>T : Symbol(T, Decl(genericFunctionInference3.ts, 16, 3)) |
| 48 | +>_props : Symbol(_props, Decl(genericFunctionInference3.ts, 16, 21)) |
| 49 | +>msg : Symbol(msg, Decl(genericFunctionInference3.ts, 16, 30)) |
| 50 | +>T : Symbol(T, Decl(genericFunctionInference3.ts, 16, 3)) |
| 51 | + |
| 52 | + return () => {}; |
| 53 | + }, |
| 54 | + { |
| 55 | + props: ["msg"], |
| 56 | +>props : Symbol(props, Decl(genericFunctionInference3.ts, 19, 3)) |
| 57 | + |
| 58 | + }, |
| 59 | +); |
| 60 | + |
0 commit comments