Skip to content

Commit 9daf5dd

Browse files
authored
fix: correct indentation of TSModuleBlock (#54)
* fix: correct indentation of `TSModuleBlock` * fix test * fix tests again
1 parent 1caf836 commit 9daf5dd

File tree

5 files changed

+12
-5
lines changed

5 files changed

+12
-5
lines changed

.changeset/rude-jeans-cough.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'esrap': patch
3+
---
4+
5+
fix: correct indentation of `TSModuleBlock`

src/handlers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1518,7 +1518,7 @@ const handlers = {
15181518

15191519
TSModuleBlock(node, state) {
15201520
state.commands.push(' {', indent, newline);
1521-
sequence(node.body, state, false, handle);
1521+
handle_body(node.body, state);
15221522
state.commands.push(dedent, newline, '}');
15231523
},
15241524

test/samples/ts-module-declaration/expected.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
declare global {
22
namespace App {
3-
interface Error {}
3+
interface Error { foo: string }
44
}
55
}
66

test/samples/ts-module-declaration/expected.ts.map

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"input.js"
66
],
77
"sourcesContent": [
8-
"declare global {\n\tnamespace App {\n\t\tinterface Error {}\n\t}\n}\n\nexport {};\n"
8+
"declare global {\n\tnamespace App {\n\t\tinterface Error {\n\t\t\tfoo: string;\n\t\t}\n\t}\n}\n\nexport {};\n"
99
],
10-
"mappings": "QAAQ,MAAM;WACH,GAAG;YACF,KAAK;;;;"
10+
"mappings": "QAAQ,MAAM;WACH,GAAG;YACF,KAAK,GACd,GAAG;;;;"
1111
}

test/samples/ts-module-declaration/input.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
declare global {
22
namespace App {
3-
interface Error {}
3+
interface Error {
4+
foo: string;
5+
}
46
}
57
}
68

0 commit comments

Comments
 (0)