Skip to content

Commit

Permalink
refactor: update typescript type
Browse files Browse the repository at this point in the history
  • Loading branch information
nix6839 committed Dec 8, 2023
1 parent 676e37e commit eaa1432
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions index.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
import type { Config, Options, RequiredOptions } from 'prettier';
import type * as prettier from 'prettier';

type PrettierOptions = Omit<
RequiredOptions,
// Deprecated options.
| 'jsxBracketSameLine' // use bracketSameLine instead
type MustSetOptions = Required<
Omit<
prettier.Options,
// Deprecated options.
| 'jsxBracketSameLine' // use bracketSameLine instead

// Options that don't have default value.
| 'parser'
| 'filepath'
| 'plugins'
| 'pluginSearchDirs'
| 'parentParser'
| '__embeddedInHtml'
// Options that don't have default value.
| 'parser'
| 'filepath'
| 'plugins'
| 'pluginSearchDirs'
| 'parentParser'
| '__embeddedInHtml'
>
>;

type PrettierConfig = PrettierOptions & Omit<Config, keyof Options>;
type Config = MustSetOptions & Omit<prettier.Config, keyof MustSetOptions>;

const config: PrettierConfig = {
const config: Config = {
// Overridden options
singleQuote: true,

Expand Down

0 comments on commit eaa1432

Please sign in to comment.