File tree Expand file tree Collapse file tree 4 files changed +65
-1
lines changed Expand file tree Collapse file tree 4 files changed +65
-1
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' @sveltejs/acorn-typescript ' : patch
3+ ---
4+
5+ fix: support ` export type * `
Original file line number Diff line number Diff line change @@ -3116,9 +3116,15 @@ export function tsPlugin(options?: {
31163116 this . importOrExportOuterKind = undefined ;
31173117 return this . finishNode ( decl , 'TSNamespaceExportDeclaration' ) ;
31183118 } else {
3119+ const lookahead2 = this . lookahead ( 2 ) . type ;
3120+
3121+ // Ideally we can just say "ok this is a type export of some kind"
3122+ // but that doesn't work for shouldParseExportStatement() below
3123+ // which wants to handle the `export type Foo = ...` case
31193124 if (
31203125 this . ts_isContextualWithState ( enterHead , tokTypes . type ) &&
3121- this . lookahead ( 2 ) . type === tt . braceL
3126+ ( lookahead2 === tt . braceL || // export type { ... }
3127+ lookahead2 === tt . star ) // export type *
31223128 ) {
31233129 this . next ( ) ;
31243130 this . importOrExportOuterKind = 'type' ;
Original file line number Diff line number Diff line change 1+ {
2+ "body" : [
3+ {
4+ "end" : 27 ,
5+ "exportKind" : " type" ,
6+ "exported" : null ,
7+ "loc" : {
8+ "end" : {
9+ "column" : 27 ,
10+ "line" : 1
11+ },
12+ "start" : {
13+ "column" : 0 ,
14+ "line" : 1
15+ }
16+ },
17+ "source" : {
18+ "end" : 26 ,
19+ "loc" : {
20+ "end" : {
21+ "column" : 26 ,
22+ "line" : 1
23+ },
24+ "start" : {
25+ "column" : 19 ,
26+ "line" : 1
27+ }
28+ },
29+ "raw" : " './foo'" ,
30+ "start" : 19 ,
31+ "type" : " Literal" ,
32+ "value" : " ./foo"
33+ },
34+ "start" : 0 ,
35+ "type" : " ExportAllDeclaration"
36+ }
37+ ],
38+ "end" : 27 ,
39+ "loc" : {
40+ "end" : {
41+ "column" : 27 ,
42+ "line" : 1
43+ },
44+ "start" : {
45+ "column" : 0 ,
46+ "line" : 1
47+ }
48+ },
49+ "sourceType" : " module" ,
50+ "start" : 0 ,
51+ "type" : " Program"
52+ }
Original file line number Diff line number Diff line change 1+ export type * from './foo' ;
You can’t perform that action at this time.
0 commit comments