-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Labels
Community ToolingThis might be better handled by tooling from the community instead of built into TypeScriptThis might be better handled by tooling from the community instead of built into TypeScriptSuggestionAn idea for TypeScriptAn idea for TypeScript
Milestone
Description
Background
For TypeScript 4.4, we anticipate that users using --strictOptionalProperties
will have fairly mechanical transformations on individual properties. For example
interface Options {
maxRetries?: number;
headers?: KnownHeaders & Record<string, string>;
callback?: (path: string) => void;
}
probably should just get rewritten to
interface Options {
maxRetries?: number | undefined;
headers?: (KnownHeaders & Record<string, string>) | undefined;
callback?: ((path: string) => void) | undefined;
}
We'd like to provide some basic tooling to run through a project's declarations to ensure that properties are "upgraded" appropriately.
Basic constraints
- We should not introduce syntax errors in the generated code.
- We should ensure that the generated code's formatting is reasonable in 90% of cases, and does not drastically change the formatting of the original file.
- We should have an easy way to point the tool at a
tsconfig.json
, or a set of understood files to make this work correctly. - We should not run through
node_modules
,lib.d.ts
, or other files that are outside the control of a user.
Open questions
- What should the tool use? ts-morph? something else?
- How should we distribute this tool? As something standalone, or as a plugin for a broader refactoring tool?
cherryblossom000
Metadata
Metadata
Assignees
Labels
Community ToolingThis might be better handled by tooling from the community instead of built into TypeScriptThis might be better handled by tooling from the community instead of built into TypeScriptSuggestionAn idea for TypeScriptAn idea for TypeScript