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
One thing that would be great to include in the design here is a way for assertions to inform the module interface, similar to wildcard module declarations.
For instance, with CSS modules, you might match on the .css file extension right now:
If you have comments about the design, much better to bring them up with TC39 in the proposal: https://github.com/tc39/proposal-import-assertions. This really isn't the forum to debate ECMAScript syntax semantics.
For the short term, we will likely parse (but not enforce) import assertions. As far as whether/how that syntax should be applied to ambient module declarations, that's something the team will need to discuss in a future design meeting.
Reacted by Kagami Sascha Rosylight, Teppei Sato, Noriyuki Shinpuku, Dan Vanderkam, Tim Reichen, Isabella Skořepová, Dj, Michael Lowe, Steven, Caleb Williams and 1 more
I’m working on a Rollup plugin for this feature (afterwards will move in to Webpack), but each file that uses the assert syntax is now throwing despite the fact that the functionality is working. Would love to see this prioritized so developers can feel confident using import assertions.
With something similar in the built-in lib for assert {type: 'json'}
Reacted by ZHAO Jin-Xiang, Tyler Brostrom, Wilco Kruijer, Kagami Sascha Rosylight, Roy Ivy III, Kirill Groshkov, Peter Lejeck, Konstantin Vyatkin, Brandon Bennett and mdh
Activity
[-]Implement Import Assertions [/-][+]Implement Import Assertions (stage 3)[/+]justinfagnani commentedon Sep 23, 2020
One thing that would be great to include in the design here is a way for assertions to inform the module interface, similar to wildcard module declarations.
For instance, with CSS modules, you might match on the
.cssfile extension right now:but with CSS modules and import assertions, we'd want to match on the
type: 'css'assertion. Some completely made up syntax:And then include this declaration with the DOM typings when CSS modules are standardized.
kitsonk commentedon Sep 23, 2020
If you have comments about the design, much better to bring them up with TC39 in the proposal: https://github.com/tc39/proposal-import-assertions. This really isn't the forum to debate ECMAScript syntax semantics.
justinfagnani commentedon Sep 23, 2020
Kitson Kelly (@kitsonk) Please note I'm only talking about TypeScript syntax here. I'm well aware of the proposal and TC39's process.
rbuckton commentedon Dec 17, 2020
For the short term, we will likely parse (but not enforce) import assertions. As far as whether/how that syntax should be applied to ambient module declarations, that's something the team will need to discuss in a future design meeting.
/cc Daniel Rosenwasser (@DanielRosenwasser)
Kingwl commentedon Jan 27, 2021
https://github.com/tc39/proposal-json-modules is stage 3 too.
2 remaining items
justinfagnani commentedon Jun 11, 2021
An update here: import assertions and JSON modules have shipped in Chrome and Edge 91. CSS Modules are up next.
calebdwilliams commentedon Jul 4, 2021
I’m working on a Rollup plugin for this feature (afterwards will move in to Webpack), but each file that uses the
assertsyntax is now throwing despite the fact that the functionality is working. Would love to see this prioritized so developers can feel confident using import assertions.Kingwl commentedon Jul 5, 2021
Sadly 4.4 has already released. We cannot add new syntax features after beta.
justinfagnani commentedon Jul 30, 2021
Wenlu Wang (@Kingwl) any chance for 4.5?
Another update: Chrome and Edge are shipping CSS module scripts in 93. You can try it in beta now.
Kingwl commentedon Aug 16, 2021
As with 4.2, 4.3 and 4.4. No.
IanVS commentedon Sep 9, 2021
It's in the 4.5 iteration plan, though. 😕
I'm just curious, what is the reason it won't be considered for 4.5?
Kingwl commentedon Sep 10, 2021
Oh, sorry. I misread chance as change.
justinfagnani commentedon Sep 13, 2021
Wenlu Wang (@Kingwl) Ron Buckton (@rbuckton) since #40698 is closing this issue, should we open another for ambient module definitions?
It think adding asserts to
declare moduleis a pretty logical way to define how import assertions work.Ideally this would be in the DOM lib:
With something similar in the built-in lib for
assert {type: 'json'}haoqunjiang commentedon Sep 30, 2021
FYI I opened a follow-up issue at #46135