Skip to content

Commit

Permalink
Add test for declare module
Browse files Browse the repository at this point in the history
  • Loading branch information
sosukesuzuki committed Sep 18, 2020
1 parent 3471de1 commit c242660
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
@@ -0,0 +1,3 @@
declare module m {
function foo() {}
}
@@ -0,0 +1,50 @@
{
"type": "File",
"start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
"errors": [
"SyntaxError: An implementation cannot be declared in ambient contexts. (2:2)"
],
"program": {
"type": "Program",
"start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
"sourceType": "module",
"interpreter": null,
"body": [
{
"type": "TSModuleDeclaration",
"start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
"id": {
"type": "Identifier",
"start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"m"},
"name": "m"
},
"body": {
"type": "TSModuleBlock",
"start":17,"end":40,"loc":{"start":{"line":1,"column":17},"end":{"line":3,"column":1}},
"body": [
{
"type": "FunctionDeclaration",
"start":21,"end":38,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":19}},
"id": {
"type": "Identifier",
"start":30,"end":33,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":14},"identifierName":"foo"},
"name": "foo"
},
"generator": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start":36,"end":38,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":19}},
"body": [],
"directives": []
}
}
]
},
"declare": true
}
],
"directives": []
}
}

0 comments on commit c242660

Please sign in to comment.