Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(types): add unbound property in parser options #5419

Merged
merged 4 commits into from Aug 17, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 21 additions & 0 deletions packages/types/src/parser-options.ts
Expand Up @@ -25,6 +25,26 @@ type EcmaVersion =

type SourceType = 'script' | 'module';

type ecmaFeatures =
| {
globalReturn?: boolean | undefined;
jsx?: boolean | undefined;
}
| undefined;

type ParserOptionsValue =
| ecmaFeatures
| EcmaVersion
| Program
| SourceType
| boolean
| string
| string[]
| (string | RegExp)[]
| null
| undefined
| DebugLevel;

interface ParserOptions {
ecmaFeatures?: {
globalReturn?: boolean;
Expand Down Expand Up @@ -58,6 +78,7 @@ interface ParserOptions {
tsconfigRootDir?: string;
warnOnUnsupportedTypeScriptVersion?: boolean;
moduleResolver?: string;
[additionalProperties: string]: ParserOptionsValue | undefined;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You needn't add a specific type for the index signature because typescript will strictly type the known keys even with an unbounded index signature

Suggested change
[additionalProperties: string]: ParserOptionsValue | undefined;
[additionalProperties: string]: unknown;

}

export { DebugLevel, EcmaVersion, ParserOptions, SourceType };