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

@swc/wasm-typescript does throw object in transform mode #10087

Open
marco-ippolito opened this issue Feb 24, 2025 · 0 comments
Open

@swc/wasm-typescript does throw object in transform mode #10087

marco-ippolito opened this issue Feb 24, 2025 · 0 comments
Assignees
Labels
Milestone

Comments

@marco-ippolito
Copy link
Contributor

marco-ippolito commented Feb 24, 2025

Describe the bug

Swc typescript does not throw an object error in transform mode when deprecatedTsModuleAsError is true

Input code

const inputCode = "module F { export type x = number }";
try {
	transformSync(inputCode, {
		mode: "transform",
	});
} catch (error) {
	assert.strictEqual(error.code, "UnsupportedSyntax");
}

Config

const DEFAULT_OPTIONS = {
	mode: "strip-only",
	deprecatedTsModuleAsError: true,
	// default transform will only work when mode is "transform"
	transform: {
		verbatimModuleSyntax: true,
		nativeClassProperties: true,
		noEmptyExport: true,
		importNotUsedAsValues: "preserve",
	},
};

Playground link (or link to the minimal reproduction)

https://play.swc.rs/?version=1.10.18&code=H4sIAAAAAAAAA8vNTynNSVVwU6hWSK0oyC8qUSipLEhVqFCwVcgrzU1KLVKoBQBGDE3yIwAAAA%3D%3D&config=H4sIAAAAAAAAA1WPSw7DIAwF9zkF8rrbdtE79BAWdSIifrKJVBTl7iUE0maH3xsz8jooBbNoeKq1PMsQkYX4nEsi2Sf8lARIOxTNJia49XaWvRrRCtVoOxpIyBOluiX3hoMNQajjLXPGmzH%2FC3VwkUnkCu4o%2BsnSVTc0JbjwXmrZDkk50qF%2FwA%2FqsvNjMPLqm4kXGrYvhlQioBQBAAA%3D

SWC Info output

No response

Expected behavior

it should throw an object with code "UnsupportedSyntax"

Actual behavior

No response

Version

1.10.18

Additional context

No response

@kdy1 kdy1 self-assigned this Feb 25, 2025
@kdy1 kdy1 added this to the Planned milestone Feb 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants