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
{{ message }}
This repository was archived by the owner on Mar 25, 2026. It is now read-only.
In the original thread at WICG/webcomponents#839, there are several suggestions of syntax which includes a single string, rather than key-value syntax. Let's discuss the advantages and disadvantages of this option in this thread.
For example, the syntax for an import statement could be:
importjsonfrom"./foo.json"as "json";
Advantages of a single string
Less to type: save 6 characters of "type: ". Including the type will be annoying enough as is!
Less overall complexity for the syntax and semantics
Generalizes to other use cases (c.f., Use cases for module attributes besides module type #8). Additional module parameters was an idea tossed around from even before this issue, so even if we don't find one of those use cases persuading now, we have some circumstantial evidence that it may come up in the future.
The as keyword is likely to be pretty confusing, as it's also a keyword with completely different meaning in other parts of an import statement
My opinion is that the advantages of a general key-value syntax outweigh the advantages for a single string. It's circumstantial evidence (since this proposal doesn't suggest acting on any of them yet), but the relatively high number of other possible use cases points to a k/v syntax to me. This would be analogous to the decision to make import.meta an object, rather than just adding a syntax for import.meta.url.
In the original thread at WICG/webcomponents#839, there are several suggestions of syntax which includes a single string, rather than key-value syntax. Let's discuss the advantages and disadvantages of this option in this thread.
For example, the syntax for an import statement could be:
Advantages of a single string
type:". Including the type will be annoying enough as is!Advantages of key-value syntax
askeyword is likely to be pretty confusing, as it's also a keyword with completely different meaning in other parts of an import statementMy opinion is that the advantages of a general key-value syntax outweigh the advantages for a single string. It's circumstantial evidence (since this proposal doesn't suggest acting on any of them yet), but the relatively high number of other possible use cases points to a k/v syntax to me. This would be analogous to the decision to make
import.metaan object, rather than just adding a syntax forimport.meta.url.