JoshuaKGoldberg / TypeStat

Converts JavaScript to TypeScript and TypeScript to better TypeScript. 🧫
MIT License
2.08k stars 40 forks source link

🐛 Bug: When selecting option "Remove type annotations that don't change the meaning of code", it will turn into "Add missing property declarations to classe" #1486

Open rubiesonthesky opened 8 months ago

rubiesonthesky commented 8 months ago

Bug Report Checklist

Expected

Selecting option "Remove type annotations that don't change the meaning of code" for "Which improvements would you like to make?" would stay as "Remove type annotations"

Actual

Selecting option "Remove type annotations that don't change the meaning of code" for "Which improvements would you like to make?", turns into "Add missing property declarations to classes". I'm not sure if this is what is supposed to happen?

✔ What are you trying to accomplish? · Improve typings in my TypeScript files
✔ Where is your tsconfig.json? · tsconfig.json
✔ Which improvements would you like to make? · Add missing property declarations to classes
? Which glob matches files you'd like to convert? … 
  everything in my tsconfig.json
  lib/**/*.{ts,tsx}
  src/**/*.{ts,tsx}
❯ other

Additional Info

Typestat: v0.7.3 node: v20.12.0'

I'm running the tool in this repository

rubiesonthesky commented 8 months ago

This is user error... I realized when reading the code and what is different. This question is multi select where other questions are not. It's not indicated in any way. For me it was logical that I move with arrow keys and select with enter like in other question. But here, you actually need to use space to toggle the option on / off.

I wonder would it help, that nothing would be selected by default. Then you would not just press enter and expect the same thing happen. Also, it would be nice to have some other indication in text that you can select multiple!

JoshuaKGoldberg commented 8 months ago

Yeah that CLI is pretty old. It'd be great to clean it up! I like your suggestions. 🙂

rubiesonthesky commented 8 months ago

@JoshuaKGoldberg If I would look into bigger improvements to cli area, do you have some preference what libraries should be used? I noticed that many are using parseArgs from node:utils now. Or is it preferable continue using commander?

I do not have much experience with node cli libraries, but I really enjoy creating them with Rust. :D

That said, it may be better to hold bigger changes until #1341 has been done? I wonder, would it play nicely if cli was it's own "package", though there is not much code for it.

JoshuaKGoldberg commented 8 months ago

For parsing libraries: I'd say node:utils yeah. No need to dip into userland libraries when the platform does it for us!

+1 to waiting until #1341 is done.

rubiesonthesky commented 8 months ago

I'll look into fixing that one prompt to be better in some point. I’m having difficulties with every time I try to run the tool :D

further cli changes are blocked by the other task. ✅