Daniel Tschinder d1a5220b89 Add support for declare export + fixes (#224)
* Add support for declare export

* Do not allow declare module inside declare module

* Reallow module exports outside module

* Add handling of `declare export default`

Add check for multiple module.export declarations

* Disallow export let/const/type

Refactor parsing object properties to share more code and add support
for getters and setters

* Rename tests

* Update test fixtures

* Optimize for performance

* disallow declare export interface outside of module

* Refactor code to be more readable and less lookahead

* Add comments

* Add test for export star as

* Test for number literal getter/setter

* Add more tests

* Fix tests

* Allow union types and correctly eat semi after type

* Use non computed keys

* Fix tests
2017-04-21 14:41:59 +02:00

205 lines
4.7 KiB
JSON

{
"type": "File",
"start": 0,
"end": 65,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 65
}
},
"program": {
"type": "Program",
"start": 0,
"end": 65,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 65
}
},
"sourceType": "module",
"body": [
{
"type": "InterfaceDeclaration",
"start": 0,
"end": 65,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 65
}
},
"id": {
"type": "Identifier",
"start": 10,
"end": 20,
"loc": {
"start": {
"line": 1,
"column": 10
},
"end": {
"line": 1,
"column": 20
},
"identifierName": "Dictionary"
},
"name": "Dictionary"
},
"typeParameters": null,
"extends": [],
"mixins": [],
"body": {
"type": "ObjectTypeAnnotation",
"start": 21,
"end": 65,
"loc": {
"start": {
"line": 1,
"column": 21
},
"end": {
"line": 1,
"column": 65
}
},
"callProperties": [],
"properties": [
{
"type": "ObjectTypeProperty",
"start": 48,
"end": 62,
"loc": {
"start": {
"line": 1,
"column": 48
},
"end": {
"line": 1,
"column": 62
}
},
"key": {
"type": "Identifier",
"start": 48,
"end": 54,
"loc": {
"start": {
"line": 1,
"column": 48
},
"end": {
"line": 1,
"column": 54
},
"identifierName": "length"
},
"name": "length"
},
"static": false,
"kind": "init",
"value": {
"type": "NumberTypeAnnotation",
"start": 56,
"end": 62,
"loc": {
"start": {
"line": 1,
"column": 56
},
"end": {
"line": 1,
"column": 62
}
}
},
"variance": null,
"optional": false
}
],
"indexers": [
{
"type": "ObjectTypeIndexer",
"start": 23,
"end": 46,
"loc": {
"start": {
"line": 1,
"column": 23
},
"end": {
"line": 1,
"column": 46
}
},
"static": false,
"id": {
"type": "Identifier",
"start": 24,
"end": 29,
"loc": {
"start": {
"line": 1,
"column": 24
},
"end": {
"line": 1,
"column": 29
},
"identifierName": "index"
},
"name": "index"
},
"key": {
"type": "StringTypeAnnotation",
"start": 31,
"end": 37,
"loc": {
"start": {
"line": 1,
"column": 31
},
"end": {
"line": 1,
"column": 37
}
}
},
"value": {
"type": "StringTypeAnnotation",
"start": 40,
"end": 46,
"loc": {
"start": {
"line": 1,
"column": 40
},
"end": {
"line": 1,
"column": 46
}
}
},
"variance": null
}
],
"exact": false
}
}
],
"directives": []
}
}