add support for export types

This commit is contained in:
Sebastian McKenzie
2015-07-31 23:34:45 +01:00
parent c050722611
commit a0f9d5fbc8
8 changed files with 372 additions and 14 deletions

View File

@@ -0,0 +1 @@
export type a = number;

View File

@@ -0,0 +1,98 @@
{
"type": "File",
"start": 0,
"end": 23,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 23
}
},
"program": {
"type": "Program",
"start": 0,
"end": 23,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 23
}
},
"sourceType": "module",
"body": [
{
"type": "ExportNamedDeclaration",
"start": 0,
"end": 23,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 23
}
},
"exportKind": "type",
"specifiers": [],
"source": null,
"declaration": {
"type": "TypeAlias",
"start": 7,
"end": 23,
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 23
}
},
"id": {
"type": "Identifier",
"start": 12,
"end": 13,
"loc": {
"start": {
"line": 1,
"column": 12
},
"end": {
"line": 1,
"column": 13
}
},
"name": "a"
},
"typeParameters": null,
"right": {
"type": "NumberTypeAnnotation",
"start": 16,
"end": 22,
"loc": {
"start": {
"line": 1,
"column": 16
},
"end": {
"line": 1,
"column": 22
}
}
}
}
}
]
}
}

View File

@@ -0,0 +1 @@
export type { foo } from "foobar";

View File

@@ -0,0 +1,117 @@
{
"type": "File",
"start": 0,
"end": 34,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 34
}
},
"program": {
"type": "Program",
"start": 0,
"end": 34,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 34
}
},
"sourceType": "module",
"body": [
{
"type": "ExportNamedDeclaration",
"start": 0,
"end": 34,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 34
}
},
"exportKind": "type",
"specifiers": [
{
"type": "ExportSpecifier",
"start": 14,
"end": 17,
"loc": {
"start": {
"line": 1,
"column": 14
},
"end": {
"line": 1,
"column": 17
}
},
"local": {
"type": "Identifier",
"start": 14,
"end": 17,
"loc": {
"start": {
"line": 1,
"column": 14
},
"end": {
"line": 1,
"column": 17
}
},
"name": "foo"
},
"exported": {
"type": "Identifier",
"start": 14,
"end": 17,
"loc": {
"start": {
"line": 1,
"column": 14
},
"end": {
"line": 1,
"column": 17
}
},
"name": "foo"
}
}
],
"source": {
"type": "Literal",
"start": 25,
"end": 33,
"loc": {
"start": {
"line": 1,
"column": 25
},
"end": {
"line": 1,
"column": 33
}
},
"value": "foobar",
"rawValue": "foobar",
"raw": "\"foobar\""
},
"declaration": null
}
]
}
}

View File

@@ -0,0 +1 @@
export type { foo };

View File

@@ -0,0 +1,100 @@
{
"type": "File",
"start": 0,
"end": 20,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 20
}
},
"program": {
"type": "Program",
"start": 0,
"end": 20,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 20
}
},
"sourceType": "module",
"body": [
{
"type": "ExportNamedDeclaration",
"start": 0,
"end": 20,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 20
}
},
"exportKind": "type",
"specifiers": [
{
"type": "ExportSpecifier",
"start": 14,
"end": 17,
"loc": {
"start": {
"line": 1,
"column": 14
},
"end": {
"line": 1,
"column": 17
}
},
"local": {
"type": "Identifier",
"start": 14,
"end": 17,
"loc": {
"start": {
"line": 1,
"column": 14
},
"end": {
"line": 1,
"column": 17
}
},
"name": "foo"
},
"exported": {
"type": "Identifier",
"start": 14,
"end": 17,
"loc": {
"start": {
"line": 1,
"column": 14
},
"end": {
"line": 1,
"column": 17
}
},
"name": "foo"
}
}
],
"source": null,
"declaration": null
}
]
}
}