Prettier 3.6.0
Playground link
Input:
export const version: string;
Output:
SyntaxError: Missing initializer in const declaration. (1:29)
> 1 | export const version: string;
| ^
Second Output:
SyntaxError: Unexpected token (1:37)
> 1 | SyntaxError: Missing initializer in const declaration. (1:29)
| ^
2 | > 1 | export const version: string;
3 | | ^
Expected output:
export const version: string;
Why?
It's valid in .d.ts file.
For babel-ts, add {dts:true} to typescript plugin can fix it. https://babeljs.io/docs/babel-parser#plugins-options
For oxc-ts, I'll look into it.
Prettier 3.6.0
Playground link
Input:
Output:
Second Output:
Expected output:
Why?
It's valid in
.d.tsfile.For
babel-ts, add{dts:true}to typescript plugin can fix it. https://babeljs.io/docs/babel-parser#plugins-optionsFor
oxc-ts, I'll look into it.