|
| 1 | +=== tests/cases/compiler/contextualTypeInObjectProperty.ts === |
| 2 | +type Shape = { |
| 3 | +>Shape : Symbol(Shape, Decl(contextualTypeInObjectProperty.ts, 0, 0)) |
| 4 | + |
| 5 | + "a"?: (a: "a") => "a"; |
| 6 | +>"a" : Symbol("a", Decl(contextualTypeInObjectProperty.ts, 0, 14)) |
| 7 | +>a : Symbol(a, Decl(contextualTypeInObjectProperty.ts, 1, 11)) |
| 8 | + |
| 9 | + "b"?: (b: "b") => "b"; |
| 10 | +>"b" : Symbol("b", Decl(contextualTypeInObjectProperty.ts, 1, 26)) |
| 11 | +>b : Symbol(b, Decl(contextualTypeInObjectProperty.ts, 2, 11)) |
| 12 | + |
| 13 | + "c"?: (c: "c") => "c"; |
| 14 | +>"c" : Symbol("c", Decl(contextualTypeInObjectProperty.ts, 2, 26)) |
| 15 | +>c : Symbol(c, Decl(contextualTypeInObjectProperty.ts, 3, 11)) |
| 16 | + |
| 17 | +}; |
| 18 | + |
| 19 | +const getC = () => "c" as const; |
| 20 | +>getC : Symbol(getC, Decl(contextualTypeInObjectProperty.ts, 6, 5)) |
| 21 | + |
| 22 | +export const obj: Shape = { |
| 23 | +>obj : Symbol(obj, Decl(contextualTypeInObjectProperty.ts, 8, 12)) |
| 24 | +>Shape : Symbol(Shape, Decl(contextualTypeInObjectProperty.ts, 0, 0)) |
| 25 | + |
| 26 | + ["a"]: keyA => keyA, |
| 27 | +>["a"] : Symbol(["a"], Decl(contextualTypeInObjectProperty.ts, 8, 27)) |
| 28 | +>"a" : Symbol(["a"], Decl(contextualTypeInObjectProperty.ts, 8, 27)) |
| 29 | +>keyA : Symbol(keyA, Decl(contextualTypeInObjectProperty.ts, 9, 8)) |
| 30 | +>keyA : Symbol(keyA, Decl(contextualTypeInObjectProperty.ts, 9, 8)) |
| 31 | + |
| 32 | + ["b" as "b"]: keyB => keyB, |
| 33 | +>["b" as "b"] : Symbol(["b" as "b"], Decl(contextualTypeInObjectProperty.ts, 9, 22)) |
| 34 | +>keyB : Symbol(keyB, Decl(contextualTypeInObjectProperty.ts, 10, 15)) |
| 35 | +>keyB : Symbol(keyB, Decl(contextualTypeInObjectProperty.ts, 10, 15)) |
| 36 | + |
| 37 | + [getC()]: keyC => keyC, |
| 38 | +>[getC()] : Symbol([getC()], Decl(contextualTypeInObjectProperty.ts, 10, 29)) |
| 39 | +>getC : Symbol(getC, Decl(contextualTypeInObjectProperty.ts, 6, 5)) |
| 40 | +>keyC : Symbol(keyC, Decl(contextualTypeInObjectProperty.ts, 11, 11)) |
| 41 | +>keyC : Symbol(keyC, Decl(contextualTypeInObjectProperty.ts, 11, 11)) |
| 42 | + |
| 43 | +}; |
| 44 | + |
| 45 | + |
| 46 | +const getUnion = () => "b" as "b" | "c"; |
| 47 | +>getUnion : Symbol(getUnion, Decl(contextualTypeInObjectProperty.ts, 15, 5)) |
| 48 | + |
| 49 | +export const unionType: Shape = { |
| 50 | +>unionType : Symbol(unionType, Decl(contextualTypeInObjectProperty.ts, 17, 12)) |
| 51 | +>Shape : Symbol(Shape, Decl(contextualTypeInObjectProperty.ts, 0, 0)) |
| 52 | + |
| 53 | + [getUnion()]: keyC => keyC, |
| 54 | +>[getUnion()] : Symbol([getUnion()], Decl(contextualTypeInObjectProperty.ts, 17, 33)) |
| 55 | +>getUnion : Symbol(getUnion, Decl(contextualTypeInObjectProperty.ts, 15, 5)) |
| 56 | +>keyC : Symbol(keyC, Decl(contextualTypeInObjectProperty.ts, 18, 15)) |
| 57 | +>keyC : Symbol(keyC, Decl(contextualTypeInObjectProperty.ts, 18, 15)) |
| 58 | + |
| 59 | +}; |
| 60 | + |
| 61 | + |
| 62 | +export const func: Shape = { |
| 63 | +>func : Symbol(func, Decl(contextualTypeInObjectProperty.ts, 22, 12)) |
| 64 | +>Shape : Symbol(Shape, Decl(contextualTypeInObjectProperty.ts, 0, 0)) |
| 65 | + |
| 66 | + [getC]: keyC => keyC, |
| 67 | +>[getC] : Symbol([getC], Decl(contextualTypeInObjectProperty.ts, 22, 28)) |
| 68 | +>getC : Symbol(getC, Decl(contextualTypeInObjectProperty.ts, 6, 5)) |
| 69 | +>keyC : Symbol(keyC, Decl(contextualTypeInObjectProperty.ts, 23, 9)) |
| 70 | +>keyC : Symbol(keyC, Decl(contextualTypeInObjectProperty.ts, 23, 9)) |
| 71 | + |
| 72 | +}; |
| 73 | + |
| 74 | +const generic: { |
| 75 | +>generic : Symbol(generic, Decl(contextualTypeInObjectProperty.ts, 26, 5)) |
| 76 | + |
| 77 | + c: <T>(arg: T) => T; |
| 78 | +>c : Symbol(c, Decl(contextualTypeInObjectProperty.ts, 26, 16)) |
| 79 | +>T : Symbol(T, Decl(contextualTypeInObjectProperty.ts, 27, 6)) |
| 80 | +>arg : Symbol(arg, Decl(contextualTypeInObjectProperty.ts, 27, 9)) |
| 81 | +>T : Symbol(T, Decl(contextualTypeInObjectProperty.ts, 27, 6)) |
| 82 | +>T : Symbol(T, Decl(contextualTypeInObjectProperty.ts, 27, 6)) |
| 83 | + |
| 84 | +} = { |
| 85 | + [getC()]: keyC => keyC, |
| 86 | +>[getC()] : Symbol([getC()], Decl(contextualTypeInObjectProperty.ts, 28, 5)) |
| 87 | +>getC : Symbol(getC, Decl(contextualTypeInObjectProperty.ts, 6, 5)) |
| 88 | +>keyC : Symbol(keyC, Decl(contextualTypeInObjectProperty.ts, 29, 11)) |
| 89 | +>keyC : Symbol(keyC, Decl(contextualTypeInObjectProperty.ts, 29, 11)) |
| 90 | + |
| 91 | +}; |
| 92 | + |
0 commit comments