|
| 1 | +//// [tests/cases/compiler/indexAccessCombinedInference2.ts] //// |
| 2 | + |
| 3 | +=== indexAccessCombinedInference2.ts === |
| 4 | +type TLArrowShape = { |
| 5 | +>TLArrowShape : Symbol(TLArrowShape, Decl(indexAccessCombinedInference2.ts, 0, 0)) |
| 6 | + |
| 7 | + type: "arrow"; |
| 8 | +>type : Symbol(type, Decl(indexAccessCombinedInference2.ts, 0, 21)) |
| 9 | + |
| 10 | + id: string; |
| 11 | +>id : Symbol(id, Decl(indexAccessCombinedInference2.ts, 1, 16)) |
| 12 | + |
| 13 | + x: number; |
| 14 | +>x : Symbol(x, Decl(indexAccessCombinedInference2.ts, 2, 13)) |
| 15 | + |
| 16 | + y: number; |
| 17 | +>y : Symbol(y, Decl(indexAccessCombinedInference2.ts, 3, 12)) |
| 18 | + |
| 19 | + props: { |
| 20 | +>props : Symbol(props, Decl(indexAccessCombinedInference2.ts, 4, 12)) |
| 21 | + |
| 22 | + dir: 1 | -1; |
| 23 | +>dir : Symbol(dir, Decl(indexAccessCombinedInference2.ts, 5, 10)) |
| 24 | + |
| 25 | + }; |
| 26 | +}; |
| 27 | + |
| 28 | +type NodeShape = { |
| 29 | +>NodeShape : Symbol(NodeShape, Decl(indexAccessCombinedInference2.ts, 8, 2)) |
| 30 | + |
| 31 | + type: "node"; |
| 32 | +>type : Symbol(type, Decl(indexAccessCombinedInference2.ts, 10, 18)) |
| 33 | + |
| 34 | + id: string; |
| 35 | +>id : Symbol(id, Decl(indexAccessCombinedInference2.ts, 11, 15)) |
| 36 | + |
| 37 | + x: number; |
| 38 | +>x : Symbol(x, Decl(indexAccessCombinedInference2.ts, 12, 13)) |
| 39 | + |
| 40 | + y: number; |
| 41 | +>y : Symbol(y, Decl(indexAccessCombinedInference2.ts, 13, 12)) |
| 42 | + |
| 43 | + props: { |
| 44 | +>props : Symbol(props, Decl(indexAccessCombinedInference2.ts, 14, 12)) |
| 45 | + |
| 46 | + nodeType: string; |
| 47 | +>nodeType : Symbol(nodeType, Decl(indexAccessCombinedInference2.ts, 15, 10)) |
| 48 | + |
| 49 | + }; |
| 50 | +}; |
| 51 | + |
| 52 | +type TLShape = TLArrowShape | NodeShape; |
| 53 | +>TLShape : Symbol(TLShape, Decl(indexAccessCombinedInference2.ts, 18, 2)) |
| 54 | +>TLArrowShape : Symbol(TLArrowShape, Decl(indexAccessCombinedInference2.ts, 0, 0)) |
| 55 | +>NodeShape : Symbol(NodeShape, Decl(indexAccessCombinedInference2.ts, 8, 2)) |
| 56 | + |
| 57 | +export type TLShapePartial<T extends TLShape = TLShape> = T extends T |
| 58 | +>TLShapePartial : Symbol(TLShapePartial, Decl(indexAccessCombinedInference2.ts, 20, 40)) |
| 59 | +>T : Symbol(T, Decl(indexAccessCombinedInference2.ts, 22, 27)) |
| 60 | +>TLShape : Symbol(TLShape, Decl(indexAccessCombinedInference2.ts, 18, 2)) |
| 61 | +>TLShape : Symbol(TLShape, Decl(indexAccessCombinedInference2.ts, 18, 2)) |
| 62 | +>T : Symbol(T, Decl(indexAccessCombinedInference2.ts, 22, 27)) |
| 63 | +>T : Symbol(T, Decl(indexAccessCombinedInference2.ts, 22, 27)) |
| 64 | + |
| 65 | + ? { |
| 66 | + id: string; |
| 67 | +>id : Symbol(id, Decl(indexAccessCombinedInference2.ts, 23, 5)) |
| 68 | + |
| 69 | + type: T["type"]; |
| 70 | +>type : Symbol(type, Decl(indexAccessCombinedInference2.ts, 24, 17)) |
| 71 | +>T : Symbol(T, Decl(indexAccessCombinedInference2.ts, 22, 27)) |
| 72 | + |
| 73 | + props?: Partial<T["props"]>; |
| 74 | +>props : Symbol(props, Decl(indexAccessCombinedInference2.ts, 25, 22)) |
| 75 | +>Partial : Symbol(Partial, Decl(lib.es5.d.ts, --, --)) |
| 76 | +>T : Symbol(T, Decl(indexAccessCombinedInference2.ts, 22, 27)) |
| 77 | + |
| 78 | + } & Partial<Omit<T, "type" | "id" | "props">> |
| 79 | +>Partial : Symbol(Partial, Decl(lib.es5.d.ts, --, --)) |
| 80 | +>Omit : Symbol(Omit, Decl(lib.es5.d.ts, --, --)) |
| 81 | +>T : Symbol(T, Decl(indexAccessCombinedInference2.ts, 22, 27)) |
| 82 | + |
| 83 | + : never; |
| 84 | + |
| 85 | +declare class Editor { |
| 86 | +>Editor : Symbol(Editor, Decl(indexAccessCombinedInference2.ts, 28, 10)) |
| 87 | + |
| 88 | + updateShape<T extends TLShape = TLShape>( |
| 89 | +>updateShape : Symbol(Editor.updateShape, Decl(indexAccessCombinedInference2.ts, 30, 22)) |
| 90 | +>T : Symbol(T, Decl(indexAccessCombinedInference2.ts, 31, 14)) |
| 91 | +>TLShape : Symbol(TLShape, Decl(indexAccessCombinedInference2.ts, 18, 2)) |
| 92 | +>TLShape : Symbol(TLShape, Decl(indexAccessCombinedInference2.ts, 18, 2)) |
| 93 | + |
| 94 | + partial: TLShapePartial<T> | null | undefined, |
| 95 | +>partial : Symbol(partial, Decl(indexAccessCombinedInference2.ts, 31, 43)) |
| 96 | +>TLShapePartial : Symbol(TLShapePartial, Decl(indexAccessCombinedInference2.ts, 20, 40)) |
| 97 | +>T : Symbol(T, Decl(indexAccessCombinedInference2.ts, 31, 14)) |
| 98 | + |
| 99 | + ): T; |
| 100 | +>T : Symbol(T, Decl(indexAccessCombinedInference2.ts, 31, 14)) |
| 101 | +} |
| 102 | + |
| 103 | +declare const x: number; |
| 104 | +>x : Symbol(x, Decl(indexAccessCombinedInference2.ts, 36, 13)) |
| 105 | + |
| 106 | +declare const y: number; |
| 107 | +>y : Symbol(y, Decl(indexAccessCombinedInference2.ts, 37, 13)) |
| 108 | + |
| 109 | +declare const editor: Editor; |
| 110 | +>editor : Symbol(editor, Decl(indexAccessCombinedInference2.ts, 38, 13)) |
| 111 | +>Editor : Symbol(Editor, Decl(indexAccessCombinedInference2.ts, 28, 10)) |
| 112 | + |
| 113 | +declare const node1: NodeShape; |
| 114 | +>node1 : Symbol(node1, Decl(indexAccessCombinedInference2.ts, 40, 13)) |
| 115 | +>NodeShape : Symbol(NodeShape, Decl(indexAccessCombinedInference2.ts, 8, 2)) |
| 116 | + |
| 117 | +const node2 = editor.updateShape({ ...node1, x, y }); |
| 118 | +>node2 : Symbol(node2, Decl(indexAccessCombinedInference2.ts, 41, 5)) |
| 119 | +>editor.updateShape : Symbol(Editor.updateShape, Decl(indexAccessCombinedInference2.ts, 30, 22)) |
| 120 | +>editor : Symbol(editor, Decl(indexAccessCombinedInference2.ts, 38, 13)) |
| 121 | +>updateShape : Symbol(Editor.updateShape, Decl(indexAccessCombinedInference2.ts, 30, 22)) |
| 122 | +>node1 : Symbol(node1, Decl(indexAccessCombinedInference2.ts, 40, 13)) |
| 123 | +>x : Symbol(x, Decl(indexAccessCombinedInference2.ts, 41, 44)) |
| 124 | +>y : Symbol(y, Decl(indexAccessCombinedInference2.ts, 41, 47)) |
| 125 | + |
| 126 | +declare const shape1: TLShape; |
| 127 | +>shape1 : Symbol(shape1, Decl(indexAccessCombinedInference2.ts, 43, 13)) |
| 128 | +>TLShape : Symbol(TLShape, Decl(indexAccessCombinedInference2.ts, 18, 2)) |
| 129 | + |
| 130 | +const shape2 = editor.updateShape({ ...shape1, x, y }); |
| 131 | +>shape2 : Symbol(shape2, Decl(indexAccessCombinedInference2.ts, 44, 5)) |
| 132 | +>editor.updateShape : Symbol(Editor.updateShape, Decl(indexAccessCombinedInference2.ts, 30, 22)) |
| 133 | +>editor : Symbol(editor, Decl(indexAccessCombinedInference2.ts, 38, 13)) |
| 134 | +>updateShape : Symbol(Editor.updateShape, Decl(indexAccessCombinedInference2.ts, 30, 22)) |
| 135 | +>shape1 : Symbol(shape1, Decl(indexAccessCombinedInference2.ts, 43, 13)) |
| 136 | +>x : Symbol(x, Decl(indexAccessCombinedInference2.ts, 44, 46)) |
| 137 | +>y : Symbol(y, Decl(indexAccessCombinedInference2.ts, 44, 49)) |
| 138 | + |
0 commit comments