This repository was archived by the owner on Apr 13, 2021. It is now read-only.
File tree 3 files changed +67
-101
lines changed
3 files changed +67
-101
lines changed Original file line number Diff line number Diff line change @@ -361,6 +361,10 @@ module.exports = function convert(config) {
361
361
result . const = true ;
362
362
handledModifierIndices [ i ] = true ;
363
363
break ;
364
+ case SyntaxKind . DeclareKeyword :
365
+ result . declare = true ;
366
+ handledModifierIndices [ i ] = true ;
367
+ break ;
364
368
default :
365
369
}
366
370
}
@@ -2072,6 +2076,18 @@ module.exports = function convert(config) {
2072
2076
break ;
2073
2077
}
2074
2078
2079
+ case SyntaxKind . ModuleDeclaration : {
2080
+ Object . assign ( result , {
2081
+ type : AST_NODE_TYPES . TSModuleDeclaration ,
2082
+ id : convertChild ( node . name )
2083
+ } ) ;
2084
+ applyModifiersToResult ( node . modifiers ) ;
2085
+ if ( node . body ) {
2086
+ result . body = convertChild ( node . body ) ;
2087
+ }
2088
+ break ;
2089
+ }
2090
+
2075
2091
default :
2076
2092
deeplyCopy ( ) ;
2077
2093
}
Original file line number Diff line number Diff line change @@ -549,6 +549,10 @@ const fixturePatternsToTest = [
549
549
// "typescript/namespaces-and-modules/ambient-module-declaration-with-import.src.ts",
550
550
// "typescript/namespaces-and-modules/declare-namespace-with-exported-function.src.ts",
551
551
// "typescript/namespaces-and-modules/module-with-default-exports.src.ts",
552
+
553
+ /**
554
+ * Requires fix in https://github.com/babel/babylon/pull/684
555
+ */
552
556
// "typescript/namespaces-and-modules/shorthand-ambient-module-declaration.src.ts"
553
557
554
558
] ;
Original file line number Diff line number Diff line change @@ -60668,36 +60668,8 @@ Object {
60668
60668
],
60669
60669
"type": "TSModuleBlock",
60670
60670
},
60671
- "loc": Object {
60672
- "end": Object {
60673
- "column": 1,
60674
- "line": 3,
60675
- },
60676
- "start": Object {
60677
- "column": 0,
60678
- "line": 1,
60679
- },
60680
- },
60681
- "modifiers": Array [
60682
- Object {
60683
- "loc": Object {
60684
- "end": Object {
60685
- "column": 7,
60686
- "line": 1,
60687
- },
60688
- "start": Object {
60689
- "column": 0,
60690
- "line": 1,
60691
- },
60692
- },
60693
- "range": Array [
60694
- 0,
60695
- 7,
60696
- ],
60697
- "type": "TSDeclareKeyword",
60698
- },
60699
- ],
60700
- "name": Object {
60671
+ "declare": true,
60672
+ "id": Object {
60701
60673
"loc": Object {
60702
60674
"end": Object {
60703
60675
"column": 29,
@@ -60716,6 +60688,16 @@ Object {
60716
60688
"type": "Literal",
60717
60689
"value": "i-use-things",
60718
60690
},
60691
+ "loc": Object {
60692
+ "end": Object {
60693
+ "column": 1,
60694
+ "line": 3,
60695
+ },
60696
+ "start": Object {
60697
+ "column": 0,
60698
+ "line": 1,
60699
+ },
60700
+ },
60719
60701
"range": Array [
60720
60702
0,
60721
60703
56,
@@ -61165,36 +61147,8 @@ Object {
61165
61147
],
61166
61148
"type": "TSModuleBlock",
61167
61149
},
61168
- "loc": Object {
61169
- "end": Object {
61170
- "column": 1,
61171
- "line": 3,
61172
- },
61173
- "start": Object {
61174
- "column": 0,
61175
- "line": 1,
61176
- },
61177
- },
61178
- "modifiers": Array [
61179
- Object {
61180
- "loc": Object {
61181
- "end": Object {
61182
- "column": 7,
61183
- "line": 1,
61184
- },
61185
- "start": Object {
61186
- "column": 0,
61187
- "line": 1,
61188
- },
61189
- },
61190
- "range": Array [
61191
- 0,
61192
- 7,
61193
- ],
61194
- "type": "TSDeclareKeyword",
61195
- },
61196
- ],
61197
- "name": Object {
61150
+ "declare": true,
61151
+ "id": Object {
61198
61152
"loc": Object {
61199
61153
"end": Object {
61200
61154
"column": 20,
@@ -61212,6 +61166,16 @@ Object {
61212
61166
],
61213
61167
"type": "Identifier",
61214
61168
},
61169
+ "loc": Object {
61170
+ "end": Object {
61171
+ "column": 1,
61172
+ "line": 3,
61173
+ },
61174
+ "start": Object {
61175
+ "column": 0,
61176
+ "line": 1,
61177
+ },
61178
+ },
61215
61179
"range": Array [
61216
61180
0,
61217
61181
84,
@@ -61881,17 +61845,7 @@ Object {
61881
61845
],
61882
61846
"type": "TSModuleBlock",
61883
61847
},
61884
- "loc": Object {
61885
- "end": Object {
61886
- "column": 1,
61887
- "line": 6,
61888
- },
61889
- "start": Object {
61890
- "column": 0,
61891
- "line": 1,
61892
- },
61893
- },
61894
- "name": Object {
61848
+ "id": Object {
61895
61849
"loc": Object {
61896
61850
"end": Object {
61897
61851
"column": 12,
@@ -61910,6 +61864,16 @@ Object {
61910
61864
"type": "Literal",
61911
61865
"value": "foo",
61912
61866
},
61867
+ "loc": Object {
61868
+ "end": Object {
61869
+ "column": 1,
61870
+ "line": 6,
61871
+ },
61872
+ "start": Object {
61873
+ "column": 0,
61874
+ "line": 1,
61875
+ },
61876
+ },
61913
61877
"range": Array [
61914
61878
0,
61915
61879
112,
@@ -62410,36 +62374,8 @@ exports[`typescript fixtures/namespaces-and-modules/shorthand-ambient-module-dec
62410
62374
Object {
62411
62375
"body": Array [
62412
62376
Object {
62413
- "loc": Object {
62414
- "end": Object {
62415
- "column": 32,
62416
- "line": 1,
62417
- },
62418
- "start": Object {
62419
- "column": 0,
62420
- "line": 1,
62421
- },
62422
- },
62423
- "modifiers": Array [
62424
- Object {
62425
- "loc": Object {
62426
- "end": Object {
62427
- "column": 7,
62428
- "line": 1,
62429
- },
62430
- "start": Object {
62431
- "column": 0,
62432
- "line": 1,
62433
- },
62434
- },
62435
- "range": Array [
62436
- 0,
62437
- 7,
62438
- ],
62439
- "type": "TSDeclareKeyword",
62440
- },
62441
- ],
62442
- "name": Object {
62377
+ "declare": true,
62378
+ "id": Object {
62443
62379
"loc": Object {
62444
62380
"end": Object {
62445
62381
"column": 31,
@@ -62458,6 +62394,16 @@ Object {
62458
62394
"type": "Literal",
62459
62395
"value": "hot-new-module",
62460
62396
},
62397
+ "loc": Object {
62398
+ "end": Object {
62399
+ "column": 32,
62400
+ "line": 1,
62401
+ },
62402
+ "start": Object {
62403
+ "column": 0,
62404
+ "line": 1,
62405
+ },
62406
+ },
62461
62407
"range": Array [
62462
62408
0,
62463
62409
32,
You can’t perform that action at this time.
0 commit comments