You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't rule out user-error so I apologize if this is the wrong forum, but I'm building a CLI and I want to append a new item to an array in a decorator object. When I parse the below code, it produces an output that places the export keyword in front of the decorator instead of in front of the class keyword.
import{parse,print}from"https://x.nest.land/swc@0.0.6/mod.ts";constast=parse(`import { MvModule } from "./deps.ts";class Test {}@MvModule({ providers: []})export class TestModule {}`,{syntax: "typescript",decorators: true,});const{ code }=print(ast,{jsc: {parser: {syntax: 'typescript',decorators: true,}}});Deno.writeTextFileSync('test.ts',code);/* Outputsimport { MvModule } from "./deps.ts";class Test {}export @MvModule({ providers: [ Test ]})class TestModule {}*/
The text was updated successfully, but these errors were encountered:
Hi @KerryRitter Sorry for the late reply! This is likely to be an old swc bug. We are still locked to an older version of SWC at the moment. Should be fixed after updating 👍
@KerryRitter The code you are trying to parse is valid TS but in JS export must be before the decorator (export @dec class) and so the transformed source is correct.
Hi there!
I don't rule out user-error so I apologize if this is the wrong forum, but I'm building a CLI and I want to append a new item to an array in a decorator object. When I parse the below code, it produces an output that places the
export
keyword in front of the decorator instead of in front of theclass
keyword.The text was updated successfully, but these errors were encountered: