Skip to content

Commit

Permalink
fix: augment Prettier Options types with internal PluginConfig
Browse files Browse the repository at this point in the history
- Add TypeScript module augmentation for the `prettier` module in `types/index.d.ts` to add the `PluginConfig` interface to the `Options` interface to support proper typing of plugin options in IDEs and during type-checking
- Update `README.md` to reflect new type definition
  • Loading branch information
jeremy-code committed Jun 7, 2024
1 parent 135b6e5 commit de894e9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ Add your preferred settings in your prettier config file.
```ts
// @ts-check

/** @type {import("@ianvs/prettier-plugin-sort-imports").PrettierConfig} */
/** @type {import("prettier").Config} */
module.exports = {
// Standard prettier options
singleQuote: true,
Expand Down
4 changes: 4 additions & 0 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,7 @@ export interface PluginConfig {
}

export type PrettierConfig = PluginConfig & Config;

declare module 'prettier' {
interface Options extends PluginConfig {}
}

0 comments on commit de894e9

Please sign in to comment.