Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/cyan-ants-fail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/acorn-typescript': patch
---

fix: handle decorators after type declarations
6 changes: 5 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,14 @@ export function tsPlugin(options?: {
if (code === 60) {
return this.finishOp(tt.relational, 1);
}
// Handle @ for decorators - can appear after type declarations
if (code === 64) {
++this.pos;
return this.finishToken(tokTypes.at);
}

return super.getTokenFromCode(code);
}

readToken(code: number): any {
if (!this.inType) {
let context = this.curContext();
Expand Down
Loading