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