Skip to content

Commit 1caf836

Browse files
authored
fix: add missing spaces in interfaces (#53)
1 parent d2cf14a commit 1caf836

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

.changeset/eight-turtles-kneel.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: add missing spaces in interfaces

src/handlers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1538,7 +1538,7 @@ const handlers = {
15381538
},
15391539

15401540
TSInterfaceBody(node, state) {
1541-
sequence(node.body, state, false, handle_type_annotation, ';');
1541+
sequence(node.body, state, true, handle_type_annotation, ';');
15421542
},
15431543

15441544
TSInterfaceDeclaration(node, state) {

test/samples/ts-interfaces/expected.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ interface Test {
55
b: boolean
66
}
77

8-
interface IndexSignature {[key: string]: string}
8+
interface IndexSignature { [key: string]: string }
99

1010
class Control {
1111
private state: any;
1212
}
1313

14-
interface SelectableControl extends Control {select(): void}
14+
interface SelectableControl extends Control { select(): void }
1515

1616
class Button extends Control implements SelectableControl{
1717
select() {}

test/samples/ts-interfaces/expected.ts.map

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@
77
"sourcesContent": [
88
"interface Test {\n\tfunc: (a: string) => Promise<void>;\n\tfunc2: () => Promise<void>;\n\ta: number;\n\tb: boolean;\n}\n\ninterface IndexSignature {\n\t[key: string]: string;\n}\n\nclass Control {\n\tprivate state: any;\n}\n\ninterface SelectableControl extends Control {\n\tselect(): void;\n}\n\nclass Button extends Control implements SelectableControl {\n\tselect() {}\n}\n\nclass TextBox extends Control {\n\tselect() {}\n}\n"
99
],
10-
"mappings": "UAAU,IAAI;CACb,IAAI,GAAG,CAAS,aAAK,OAAO;CAC5B,KAAK,QAAQ,OAAO;CACpB,CAAC;CACD,CAAC;;;UAGQ,cAAc,GACtB,GAAW;;MAGP,OAAO,CAAC,CAAC;SACN,KAAK;AACd,CAAC;;UAES,iBAAiB,SAAS,OAAO,EAC1C,MAAM;;MAGD,MAAM,SAAS,OAAO,YAAY,iBAAiB,AAAC,CAAC;CAC1D,MAAM,GAAG,CAAC,AAAA,CAAC;AACZ,CAAC;;MAEK,OAAO,SAAS,OAAO,CAAC,CAAC;CAC9B,MAAM,GAAG,CAAC,AAAA,CAAC;AACZ,CAAC"
10+
"mappings": "UAAU,IAAI;CACb,IAAI,GAAG,CAAS,aAAK,OAAO;CAC5B,KAAK,QAAQ,OAAO;CACpB,CAAC;CACD,CAAC;;;UAGQ,cAAc,IACtB,GAAW;;MAGP,OAAO,CAAC,CAAC;SACN,KAAK;AACd,CAAC;;UAES,iBAAiB,SAAS,OAAO,GAC1C,MAAM;;MAGD,MAAM,SAAS,OAAO,YAAY,iBAAiB,AAAC,CAAC;CAC1D,MAAM,GAAG,CAAC,AAAA,CAAC;AACZ,CAAC;;MAEK,OAAO,SAAS,OAAO,CAAC,CAAC;CAC9B,MAAM,GAAG,CAAC,AAAA,CAAC;AACZ,CAAC"
1111
}

0 commit comments

Comments
 (0)