-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
fix: warn about import assertions when using typescript #25135
fix: warn about import assertions when using typescript #25135
Conversation
dsherret
commented
Aug 21, 2024
- On emit, checks for the prescence of import assertions.
- Warns and doesn't store the parsed source in the emit cache in this case.
for item in &module.body { | ||
match item { | ||
deno_ast::swc::ast::ModuleItem::ModuleDecl(decl) => match decl { | ||
deno_ast::swc::ast::ModuleDecl::Import(n) => { | ||
if n.with.is_some() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also handle import("./data.json", { assert: { type: "json" }})
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, that's annoying. I'll update it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need to do it for that because v8 will warn about it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, cool fix. I guess swc should have an option to preserve import attr syntax?
It's probably not worth the trouble. |