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

🚀 Feature: Add (back) type aliasing #1223

Open
JoshuaKGoldberg opened this issue May 26, 2023 · 0 comments
Open

🚀 Feature: Add (back) type aliasing #1223

JoshuaKGoldberg opened this issue May 26, 2023 · 0 comments
Labels
area: fixers Around how TypeStat fixes code. area: options Reading, parsing, and manipulating CLI and/or Cosmiconfig-read options status: accepting prs Please, send a pull request to resolve this! 🙏 type: enhancement New feature or request

Comments

@JoshuaKGoldberg
Copy link
Owner

JoshuaKGoldberg commented May 26, 2023

🚀 Feature Request

It's sometimes useful to replace added TypeScript types with other strings. Most commonly, some conversions use a type like type $AnyTodoFixMeTS49 = any; instead of any to make it clear that the any should be fixed up eventually.

Existing Behavior

TypeStat does not support these kinds of aliases.

Change Proposal

Let's add in a new option with a name like ... typeAliases, perhaps? Maybe it could be a Record<string, string> keying aliases (strings, allowing for stringified regular expressions) to their replacement?

{
  "typeAliases": {
    "any": "$AnyTodoFixMeTS49",
    "/Promise.+/": "Promise$1 /* todo: just use a Promise? */"
  }
}

Additional Information

TypeStat actually used to have this! I'd removed the feature in #793 (and docs in eedded4) #765 easier. But now that #765 is done, it'd be useful to add this option back.

Thanks @tannerlinsley for reminding me of this!

@JoshuaKGoldberg JoshuaKGoldberg added type: enhancement New feature or request status: accepting prs Please, send a pull request to resolve this! 🙏 area: options Reading, parsing, and manipulating CLI and/or Cosmiconfig-read options area: fixers Around how TypeStat fixes code. labels May 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: fixers Around how TypeStat fixes code. area: options Reading, parsing, and manipulating CLI and/or Cosmiconfig-read options status: accepting prs Please, send a pull request to resolve this! 🙏 type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant