* 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
233 lines
6.3 KiB
JSON
233 lines
6.3 KiB
JSON
{
|
|
"type": "File",
|
|
"start": 0,
|
|
"end": 73,
|
|
"loc": {
|
|
"start": {
|
|
"line": 1,
|
|
"column": 0
|
|
},
|
|
"end": {
|
|
"line": 1,
|
|
"column": 73
|
|
}
|
|
},
|
|
"program": {
|
|
"type": "Program",
|
|
"start": 0,
|
|
"end": 73,
|
|
"loc": {
|
|
"start": {
|
|
"line": 1,
|
|
"column": 0
|
|
},
|
|
"end": {
|
|
"line": 1,
|
|
"column": 73
|
|
}
|
|
},
|
|
"sourceType": "module",
|
|
"body": [
|
|
{
|
|
"type": "DeclareModule",
|
|
"start": 0,
|
|
"end": 73,
|
|
"loc": {
|
|
"start": {
|
|
"line": 1,
|
|
"column": 0
|
|
},
|
|
"end": {
|
|
"line": 1,
|
|
"column": 73
|
|
}
|
|
},
|
|
"id": {
|
|
"type": "StringLiteral",
|
|
"start": 15,
|
|
"end": 20,
|
|
"loc": {
|
|
"start": {
|
|
"line": 1,
|
|
"column": 15
|
|
},
|
|
"end": {
|
|
"line": 1,
|
|
"column": 20
|
|
}
|
|
},
|
|
"extra": {
|
|
"rawValue": "foo",
|
|
"raw": "\"foo\""
|
|
},
|
|
"value": "foo"
|
|
},
|
|
"body": {
|
|
"type": "BlockStatement",
|
|
"start": 21,
|
|
"end": 73,
|
|
"loc": {
|
|
"start": {
|
|
"line": 1,
|
|
"column": 21
|
|
},
|
|
"end": {
|
|
"line": 1,
|
|
"column": 73
|
|
}
|
|
},
|
|
"body": [
|
|
{
|
|
"type": "DeclareExportDeclaration",
|
|
"start": 23,
|
|
"end": 71,
|
|
"loc": {
|
|
"start": {
|
|
"line": 1,
|
|
"column": 23
|
|
},
|
|
"end": {
|
|
"line": 1,
|
|
"column": 71
|
|
}
|
|
},
|
|
"declaration": {
|
|
"type": "DeclareFunction",
|
|
"start": 38,
|
|
"end": 71,
|
|
"loc": {
|
|
"start": {
|
|
"line": 1,
|
|
"column": 38
|
|
},
|
|
"end": {
|
|
"line": 1,
|
|
"column": 71
|
|
}
|
|
},
|
|
"id": {
|
|
"type": "Identifier",
|
|
"start": 47,
|
|
"end": 70,
|
|
"loc": {
|
|
"start": {
|
|
"line": 1,
|
|
"column": 47
|
|
},
|
|
"end": {
|
|
"line": 1,
|
|
"column": 70
|
|
},
|
|
"identifierName": "bar"
|
|
},
|
|
"name": "bar",
|
|
"typeAnnotation": {
|
|
"type": "TypeAnnotation",
|
|
"start": 50,
|
|
"end": 70,
|
|
"loc": {
|
|
"start": {
|
|
"line": 1,
|
|
"column": 50
|
|
},
|
|
"end": {
|
|
"line": 1,
|
|
"column": 70
|
|
}
|
|
},
|
|
"typeAnnotation": {
|
|
"type": "FunctionTypeAnnotation",
|
|
"start": 50,
|
|
"end": 70,
|
|
"loc": {
|
|
"start": {
|
|
"line": 1,
|
|
"column": 50
|
|
},
|
|
"end": {
|
|
"line": 1,
|
|
"column": 70
|
|
}
|
|
},
|
|
"typeParameters": null,
|
|
"params": [
|
|
{
|
|
"type": "FunctionTypeParam",
|
|
"start": 51,
|
|
"end": 61,
|
|
"loc": {
|
|
"start": {
|
|
"line": 1,
|
|
"column": 51
|
|
},
|
|
"end": {
|
|
"line": 1,
|
|
"column": 61
|
|
}
|
|
},
|
|
"name": {
|
|
"type": "Identifier",
|
|
"start": 51,
|
|
"end": 53,
|
|
"loc": {
|
|
"start": {
|
|
"line": 1,
|
|
"column": 51
|
|
},
|
|
"end": {
|
|
"line": 1,
|
|
"column": 53
|
|
},
|
|
"identifierName": "p1"
|
|
},
|
|
"name": "p1"
|
|
},
|
|
"optional": false,
|
|
"typeAnnotation": {
|
|
"type": "NumberTypeAnnotation",
|
|
"start": 55,
|
|
"end": 61,
|
|
"loc": {
|
|
"start": {
|
|
"line": 1,
|
|
"column": 55
|
|
},
|
|
"end": {
|
|
"line": 1,
|
|
"column": 61
|
|
}
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"rest": null,
|
|
"returnType": {
|
|
"type": "StringTypeAnnotation",
|
|
"start": 64,
|
|
"end": 70,
|
|
"loc": {
|
|
"start": {
|
|
"line": 1,
|
|
"column": 64
|
|
},
|
|
"end": {
|
|
"line": 1,
|
|
"column": 70
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"predicate": null
|
|
},
|
|
"default": false
|
|
}
|
|
]
|
|
},
|
|
"kind": "ES"
|
|
}
|
|
],
|
|
"directives": []
|
|
}
|
|
} |