• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1{
2  "type": "Program",
3  "statements": [
4    {
5      "type": "VariableDeclaration",
6      "declarations": [
7        {
8          "type": "VariableDeclarator",
9          "id": {
10            "type": "Identifier",
11            "name": "a",
12            "typeAnnotation": {
13              "type": "TSUnionType",
14              "types": [
15                {
16                  "type": "TSTypeLiteral",
17                  "members": [
18                    {
19                      "type": "TSPropertySignature",
20                      "computed": false,
21                      "optional": false,
22                      "readonly": false,
23                      "key": {
24                        "type": "Identifier",
25                        "name": "a",
26                        "decorators": [],
27                        "loc": {
28                          "start": {
29                            "line": 17,
30                            "column": 10
31                          },
32                          "end": {
33                            "line": 17,
34                            "column": 11
35                          }
36                        }
37                      },
38                      "typeAnnotation": {
39                        "type": "TSNumberKeyword",
40                        "loc": {
41                          "start": {
42                            "line": 17,
43                            "column": 13
44                          },
45                          "end": {
46                            "line": 17,
47                            "column": 19
48                          }
49                        }
50                      },
51                      "loc": {
52                        "start": {
53                          "line": 17,
54                          "column": 10
55                        },
56                        "end": {
57                          "line": 17,
58                          "column": 21
59                        }
60                      }
61                    }
62                  ],
63                  "loc": {
64                    "start": {
65                      "line": 17,
66                      "column": 8
67                    },
68                    "end": {
69                      "line": 17,
70                      "column": 21
71                    }
72                  }
73                },
74                {
75                  "type": "TSTypeLiteral",
76                  "members": [
77                    {
78                      "type": "TSPropertySignature",
79                      "computed": false,
80                      "optional": false,
81                      "readonly": false,
82                      "key": {
83                        "type": "Identifier",
84                        "name": "b",
85                        "decorators": [],
86                        "loc": {
87                          "start": {
88                            "line": 17,
89                            "column": 26
90                          },
91                          "end": {
92                            "line": 17,
93                            "column": 27
94                          }
95                        }
96                      },
97                      "typeAnnotation": {
98                        "type": "TSStringKeyword",
99                        "loc": {
100                          "start": {
101                            "line": 17,
102                            "column": 29
103                          },
104                          "end": {
105                            "line": 17,
106                            "column": 35
107                          }
108                        }
109                      },
110                      "loc": {
111                        "start": {
112                          "line": 17,
113                          "column": 26
114                        },
115                        "end": {
116                          "line": 17,
117                          "column": 37
118                        }
119                      }
120                    }
121                  ],
122                  "loc": {
123                    "start": {
124                      "line": 17,
125                      "column": 24
126                    },
127                    "end": {
128                      "line": 17,
129                      "column": 37
130                    }
131                  }
132                }
133              ],
134              "loc": {
135                "start": {
136                  "line": 17,
137                  "column": 8
138                },
139                "end": {
140                  "line": 17,
141                  "column": 37
142                }
143              }
144            },
145            "decorators": [],
146            "loc": {
147              "start": {
148                "line": 17,
149                "column": 5
150              },
151              "end": {
152                "line": 17,
153                "column": 6
154              }
155            }
156          },
157          "init": {
158            "type": "ObjectExpression",
159            "properties": [
160              {
161                "type": "Property",
162                "method": false,
163                "shorthand": false,
164                "computed": false,
165                "key": {
166                  "type": "Identifier",
167                  "name": "c",
168                  "decorators": [],
169                  "loc": {
170                    "start": {
171                      "line": 17,
172                      "column": 42
173                    },
174                    "end": {
175                      "line": 17,
176                      "column": 43
177                    }
178                  }
179                },
180                "value": {
181                  "type": "BooleanLiteral",
182                  "value": true,
183                  "loc": {
184                    "start": {
185                      "line": 17,
186                      "column": 45
187                    },
188                    "end": {
189                      "line": 17,
190                      "column": 49
191                    }
192                  }
193                },
194                "kind": "init",
195                "loc": {
196                  "start": {
197                    "line": 17,
198                    "column": 42
199                  },
200                  "end": {
201                    "line": 17,
202                    "column": 49
203                  }
204                }
205              }
206            ],
207            "loc": {
208              "start": {
209                "line": 17,
210                "column": 40
211              },
212              "end": {
213                "line": 17,
214                "column": 51
215              }
216            }
217          },
218          "loc": {
219            "start": {
220              "line": 17,
221              "column": 5
222            },
223            "end": {
224              "line": 17,
225              "column": 51
226            }
227          }
228        }
229      ],
230      "kind": "var",
231      "loc": {
232        "start": {
233          "line": 17,
234          "column": 1
235        },
236        "end": {
237          "line": 17,
238          "column": 52
239        }
240      }
241    }
242  ],
243  "loc": {
244    "start": {
245      "line": 1,
246      "column": 1
247    },
248    "end": {
249      "line": 17,
250      "column": 52
251    }
252  }
253}
254TypeError: Object literal may only specify known properties, and "c" does not exist in type '{ a: number; } | { b: string; }'. [objectLiteralAssignability3.ts:17:42]
255