Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add correct defaults #71

Merged
merged 1 commit into from
Aug 23, 2024
Merged

chore: add correct defaults #71

merged 1 commit into from
Aug 23, 2024

Conversation

marco-ippolito
Copy link
Member

@marco-ippolito marco-ippolito commented Aug 23, 2024

cc @nodejs/typescript
I also wonder which other options we should set by default during transformation

interface TransformConfig {
    /**
     * @see https://www.typescriptlang.org/tsconfig#verbatimModuleSyntax
     */
    verbatimModuleSyntax?: boolean;
    /**
     * Native class properties support
     */
    nativeClassProperties?: boolean;
    importNotUsedAsValues?: "remove" | "preserve";
    /**
     * Don't create `export {}`.
     * By default, strip creates `export {}` for modules to preserve module
     * context.
     * 
     * @see https://github.com/swc-project/swc/issues/1698
     */
    noEmptyExport?: boolean;
    importExportAssignConfig?: "Classic" | "Preserve" | "NodeNext" | "EsNext";
    /**
     * Disables an optimization that inlines TS enum member values
     * within the same module that assumes the enum member values
     * are never modified.
     * 
     * Defaults to false.
     */
    tsEnumIsMutable?: boolean;
}

I think importNotUsedAsValues: "preserve" others idk which are defaults

nativeClassProperties: true,
noEmptyExport: true,
importNotUsedAsValues: "preserve",
},

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

I think the only behavioral change this PR will achieve on Node is to fix nodejs/node#54514 via the addition of noEmptyExport: true

The rest is just codifying existing usage. Similarly you could add:

Suggested change
},
useDefineForClassFields: true,
},

In TypeScript, VMS replaces that need to set INUAV. But I don't know if that's the case in SWC so keeping it fully explicit (as you have now) until we hear otherwise from SWC folk seems good.

Copy link
Member Author

@marco-ippolito marco-ippolito Aug 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

apparently useDefineForClassFields does not exist in configuration

@marco-ippolito marco-ippolito merged commit bfa4de9 into main Aug 23, 2024
8 checks passed
@marco-ippolito marco-ippolito deleted the fix/defaults branch August 23, 2024 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants