This repository was archived by the owner on Jan 14, 2019. It is now read-only.
File tree 4 files changed +158
-0
lines changed
fixtures/typescript/namespaces-and-modules
4 files changed +158
-0
lines changed Original file line number Diff line number Diff line change @@ -2527,6 +2527,9 @@ export default function convert(config: ConvertConfig): ESTreeNode | null {
2527
2527
}
2528
2528
// apply modifiers first...
2529
2529
applyModifiersToResult ( ( node as any ) . modifiers ) ;
2530
+ if ( node . flags & ts . NodeFlags . GlobalAugmentation ) {
2531
+ result . global = true ;
2532
+ }
2530
2533
// ...then check for exports
2531
2534
result = nodeUtils . fixExports ( node , result as any , ast ) ;
2532
2535
break ;
Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ export interface ESTreeNode {
32
32
decorators ?: any ;
33
33
const ?: boolean ;
34
34
declare ?: boolean ;
35
+ global ?: boolean ;
35
36
modifiers ?: any ;
36
37
body ?: any ;
37
38
params ?: any ;
Original file line number Diff line number Diff line change
1
+ declare global {
2
+ }
Original file line number Diff line number Diff line change @@ -66645,6 +66645,158 @@ Object {
66645
66645
}
66646
66646
`;
66647
66647
66648
+ exports[`typescript fixtures/namespaces-and-modules/global-module-declaration.src 1`] = `
66649
+ Object {
66650
+ "body": Array [
66651
+ Object {
66652
+ "body": Object {
66653
+ "body": Array [],
66654
+ "loc": Object {
66655
+ "end": Object {
66656
+ "column": 1,
66657
+ "line": 2,
66658
+ },
66659
+ "start": Object {
66660
+ "column": 15,
66661
+ "line": 1,
66662
+ },
66663
+ },
66664
+ "range": Array [
66665
+ 15,
66666
+ 18,
66667
+ ],
66668
+ "type": "TSModuleBlock",
66669
+ },
66670
+ "declare": true,
66671
+ "global": true,
66672
+ "id": Object {
66673
+ "loc": Object {
66674
+ "end": Object {
66675
+ "column": 14,
66676
+ "line": 1,
66677
+ },
66678
+ "start": Object {
66679
+ "column": 8,
66680
+ "line": 1,
66681
+ },
66682
+ },
66683
+ "name": "global",
66684
+ "range": Array [
66685
+ 8,
66686
+ 14,
66687
+ ],
66688
+ "type": "Identifier",
66689
+ },
66690
+ "loc": Object {
66691
+ "end": Object {
66692
+ "column": 1,
66693
+ "line": 2,
66694
+ },
66695
+ "start": Object {
66696
+ "column": 0,
66697
+ "line": 1,
66698
+ },
66699
+ },
66700
+ "range": Array [
66701
+ 0,
66702
+ 18,
66703
+ ],
66704
+ "type": "TSModuleDeclaration",
66705
+ },
66706
+ ],
66707
+ "loc": Object {
66708
+ "end": Object {
66709
+ "column": 0,
66710
+ "line": 3,
66711
+ },
66712
+ "start": Object {
66713
+ "column": 0,
66714
+ "line": 1,
66715
+ },
66716
+ },
66717
+ "range": Array [
66718
+ 0,
66719
+ 19,
66720
+ ],
66721
+ "sourceType": "script",
66722
+ "tokens": Array [
66723
+ Object {
66724
+ "loc": Object {
66725
+ "end": Object {
66726
+ "column": 7,
66727
+ "line": 1,
66728
+ },
66729
+ "start": Object {
66730
+ "column": 0,
66731
+ "line": 1,
66732
+ },
66733
+ },
66734
+ "range": Array [
66735
+ 0,
66736
+ 7,
66737
+ ],
66738
+ "type": "Identifier",
66739
+ "value": "declare",
66740
+ },
66741
+ Object {
66742
+ "loc": Object {
66743
+ "end": Object {
66744
+ "column": 14,
66745
+ "line": 1,
66746
+ },
66747
+ "start": Object {
66748
+ "column": 8,
66749
+ "line": 1,
66750
+ },
66751
+ },
66752
+ "range": Array [
66753
+ 8,
66754
+ 14,
66755
+ ],
66756
+ "type": "Keyword",
66757
+ "value": "global",
66758
+ },
66759
+ Object {
66760
+ "loc": Object {
66761
+ "end": Object {
66762
+ "column": 16,
66763
+ "line": 1,
66764
+ },
66765
+ "start": Object {
66766
+ "column": 15,
66767
+ "line": 1,
66768
+ },
66769
+ },
66770
+ "range": Array [
66771
+ 15,
66772
+ 16,
66773
+ ],
66774
+ "type": "Punctuator",
66775
+ "value": "{",
66776
+ },
66777
+ Object {
66778
+ "loc": Object {
66779
+ "end": Object {
66780
+ "column": 1,
66781
+ "line": 2,
66782
+ },
66783
+ "start": Object {
66784
+ "column": 0,
66785
+ "line": 2,
66786
+ },
66787
+ },
66788
+ "range": Array [
66789
+ 17,
66790
+ 18,
66791
+ ],
66792
+ "type": "Punctuator",
66793
+ "value": "}",
66794
+ },
66795
+ ],
66796
+ "type": "Program",
66797
+ }
66798
+ `;
66799
+
66648
66800
exports[`typescript fixtures/namespaces-and-modules/module-with-default-exports.src 1`] = `
66649
66801
Object {
66650
66802
"body": Array [
You can’t perform that action at this time.
0 commit comments