π Search Terms
"verbatimModuleSyntax", "curly brackets", "empty brackets"
π Version & Regression Information
- This is the behavior in every 5.x version I tried, and I reviewed the FAQ for entries about
verbatimModuleSyntax
β― Playground Link
https://www.typescriptlang.org/play/?jsx=4&verbatimModuleSyntax=true&ts=5.9.2#code/JYWwDg9gTgLgBASRAQwOYFMA0cDeMCeY6iKGAClBGAM4C+cAZpSHAEQB26AHjAPShp0AOgBW1VgG4AUFO6RYcACboGyAK4AbeAzXsAxjGAR2JQQHUoyMESgAKMJRoAuU+UfUAlLilxfcKOgwalAmADxIgrhC0Q5UdLwAfFK0UkA
π» Code
import Image, {type ImageProps} from "next/image.js";
export default function ImageWrapper(props: ImageProps) {
return <Image {...props}/>
}
π Actual behavior
TS produces the following JS output when verbatimModuleSyntax is set to true:
import { jsx as _jsx } from "react/jsx-runtime";
import Image, {} from "next/image.js";
export default function ImageWrapper(props) {
return _jsx(Image, Object.assign({}, props));
}
Notice the empty curly brackets in the import statement that were left off after removing type-only named imports.
π Expected behavior
The empty curly brackets are unnecessary in this case. It is precisely the output TS produces when verbatimModuleSyntax is not enabled:
import { jsx as _jsx } from "react/jsx-runtime";
import Image from "next/image.js";
export default function ImageWrapper(props) {
return _jsx(Image, Object.assign({}, props));
}
https://www.typescriptlang.org/play/?jsx=4&verbatimModuleSyntax=false&ts=5.9.2#code/JYWwDg9gTgLgBASRAQwOYFMA0cDeMCeY6iKGAClBGAM4C+cAZpSHAEQB26AHjAPShp0AOgBW1VgG4AUFO6RYcACboGyAK4AbeAzXsAxjGAR2JQQHUoyMESgAKMJRoAuU+UfUAlLilxfcKOgwalAmADxIgrhC0Q5UdLwAfFK0UkA
Additional information about the issue
No response
π Search Terms
"verbatimModuleSyntax", "curly brackets", "empty brackets"
π Version & Regression Information
verbatimModuleSyntaxβ― Playground Link
https://www.typescriptlang.org/play/?jsx=4&verbatimModuleSyntax=true&ts=5.9.2#code/JYWwDg9gTgLgBASRAQwOYFMA0cDeMCeY6iKGAClBGAM4C+cAZpSHAEQB26AHjAPShp0AOgBW1VgG4AUFO6RYcACboGyAK4AbeAzXsAxjGAR2JQQHUoyMESgAKMJRoAuU+UfUAlLilxfcKOgwalAmADxIgrhC0Q5UdLwAfFK0UkA
π» Code
π Actual behavior
TS produces the following JS output when
verbatimModuleSyntaxis set totrue:Notice the empty curly brackets in the import statement that were left off after removing type-only named imports.
π Expected behavior
The empty curly brackets are unnecessary in this case. It is precisely the output TS produces when
verbatimModuleSyntaxis not enabled:https://www.typescriptlang.org/play/?jsx=4&verbatimModuleSyntax=false&ts=5.9.2#code/JYWwDg9gTgLgBASRAQwOYFMA0cDeMCeY6iKGAClBGAM4C+cAZpSHAEQB26AHjAPShp0AOgBW1VgG4AUFO6RYcACboGyAK4AbeAzXsAxjGAR2JQQHUoyMESgAKMJRoAuU+UfUAlLilxfcKOgwalAmADxIgrhC0Q5UdLwAfFK0UkA
Additional information about the issue
No response