🐛 Does not support resolution-mode
for typeof import
#2115
Labels
A-Parser
Area: parser
L-JavaScript
Language: JavaScript and super languages
S-Bug-confirmed
Status: report has been confirmed as a valid bug
S-Help-wanted
Status: you're familiar with the code base and want to help the project
Environment information
What happened?
resolution-mode
. See example playground: https://www.typescriptlang.org/play?target=99&moduleResolution=99&ts=5.4.2#code/KYDwDg9gTgLgBDAnmYcBiBnOBeBzgQBmcAlgLaSwAUA5IRjQDRwDecA7iTABYBcrcGlGAYIAGwCuMEhAB2AWjIQAJsBr8a5SjBpwAvvoCUQAbiome format .
, and receive a failure that there is no expected extra parameter to import. See playground https://biomejs.dev/playground/?code=ZQB4AHAAbwByAHQAIAB0AHkAcABlACAARgBzACAAPQAgAHQAeQBwAGUAbwBmACAAaQBtAHAAbwByAHQAKAAnAGYAcwAnACwAIAB7ACAAdwBpAHQAaAA6ACAAewAgACcAcgBlAHMAbwBsAHUAdABpAG8AbgAtAG0AbwBkAGUAJwA6ACAAJwBpAG0AcABvAHIAdAAnACAAfQAgAH0AKQA%3D&jsx=falseExpected result
Biome is able to successfully parse the
resolution-mode
part ofimport()
and format as usual.Note
resolution-mode
is now considered stable in typescript:https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-3.html#stable-support-resolution-mode-in-import-types
Note that prettier also appears to be wrong in this handling, but I think this would count as one of the few cases where biome should diverge from prettier.
This type handling is actually necessary in some cases as well. It is hard to show on playground, but when writing types for a commonjs file that will dynamically import an ESM file, Typescript encourages using the
resolution-mode
.my-cjs-file.cts
works!
But
fails with:
Code of Conduct
The text was updated successfully, but these errors were encountered: