TypeScript module augmentation with the "prettier" module is not supported, meaning using JSDoc types for the plugin options are not correctly denoted in IDEs (and presumably when the prettier config are typed-checked with TypeScript).
To Reproduce
Open an IDE with TypeScript support.
See what type is given for any of the plugin options (e.g. importOrder, importOrderTypeScriptVersion, importOrderParserPlugins).
See it is based on what is inferred (usually never[] or string[]) and does not have the corresponding JSDoc comments.
Expected behavior
As shown in the second screenshot, I expect the correct types for the options to be given, but also when using the Config type from prettier (first screenshot). It's a minor quibble, since import("@ianvs/prettier-plugin-sort-imports").PrettierConfig is also provided, but that is a bit long.
I believe the code that would make this possible something like:
but when I attempted the trivial fix, I had some conflicts with the types in src/types.ts. I will take a look further, but I wanted to let you know beforehand.
Your Environment
Describe the bug
TypeScript module augmentation with the
"prettier"
module is not supported, meaning using JSDoc types for the plugin options are not correctly denoted in IDEs (and presumably when the prettier config are typed-checked with TypeScript).To Reproduce
importOrder
,importOrderTypeScriptVersion
,importOrderParserPlugins
).never[]
orstring[]
) and does not have the corresponding JSDoc comments.Expected behavior
As shown in the second screenshot, I expect the correct types for the options to be given, but also when using the
Config
type fromprettier
(first screenshot). It's a minor quibble, sinceimport("@ianvs/prettier-plugin-sort-imports").PrettierConfig
is also provided, but that is a bit long.I believe the code that would make this possible something like:
but when I attempted the trivial fix, I had some conflicts with the types in
src/types.ts
. I will take a look further, but I wanted to let you know beforehand.Screenshots, code sample, etc
Configuration File (cat .prettierrc, prettier.config.js, .prettier.js)
Error log
No errors.
Contribute to @ianvs/prettier-plugin-sort-imports