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

Add types to JS files #125

Closed
Tracked by #169
jfmengels opened this issue May 5, 2023 · 7 comments · Fixed by #301
Closed
Tracked by #169

Add types to JS files #125

jfmengels opened this issue May 5, 2023 · 7 comments · Fixed by #301
Labels
help wanted We could use your help

Comments

@jfmengels
Copy link
Owner

I have added TypeScript to the project to help out with finding bugs during development.

Unfortunately, because without type annotations it determines that the arguments of pretty much every function is any, it doesn't report many problems in practice.

The idea is to add more types, so that there are none of these implicits any.

I have added TypeScript configuration that enables that setting for a few files, and have added all the necessary annotations for them, but I'm still missing a lot of the files. You can run it using

npx tsc --project tsconfig.no-implicit-any.json --watch

The idea is to update the tsconfig.no-implicit-any.json by adding a new file in the include list one and adding types until there are no more issues, and repeating until all files are done and we can enable the noImplicitAny setting in the regular tsconfig.json file.
I recommend adding new files that only import files that are already in the include list. (To do that, just add an arbitrary file, and if TS reports issues for other files, then choose one of those files instead, and so on).

Note that adding type annotations and fixing issues can result in the "main" tsconfig.json starting to report new issues.

If you'd like to work on this, great! And thank you!
Feel free to do as much or as little as you wish, I recommend to do small steps in this work, and to do for instance one PR per file added.

@lishaduck
Copy link
Contributor

For the sake of future reference: #165, #166, #177, #179, #180, #181, #182, & #183.

@lishaduck
Copy link
Contributor

lishaduck commented Jul 7, 2024

Status: 30/51 production JS files (59%)
(Not including tests, generated files, vendor, all of which are fully typed)

@lishaduck
Copy link
Contributor

lishaduck commented Nov 4, 2024

Making progress in #301!

Status: 41/53 files (77%)

@lishaduck
Copy link
Contributor

lishaduck commented Nov 4, 2024

I have an essay I don't wanna write, grinding these out:
48/53 (91%)!

@jfmengels
Copy link
Owner Author

I highly appreciate the work and excitement, but go write your essay! 😅
(as much as I understand why you prefer doing something else)

@lishaduck
Copy link
Contributor

lishaduck commented Nov 4, 2024

I highly appreciate the work and excitement, but go write your essay! 😅
(as much as I understand why you prefer doing something else)

I know, I know. I'm gonna go finish it now 🙃
I do like writing, and I like the topic, this is just a lot more fun...
Oh, to clarify, I only spent ~45 minutes not writing an essay. The rest of the day was mostly free (and I didn't spend the whole day doing this, either).

Well, off to write another couple hundred words... 😅

@lishaduck lishaduck mentioned this issue Nov 4, 2024
@lishaduck
Copy link
Contributor

Oh, can you close #132 as superseded, @jfmengels?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted We could use your help
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants