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

[typescript] Turn on all of the recommended config options #213

Closed
rbalicki2 opened this issue Oct 25, 2024 · 3 comments · Fixed by #281
Closed

[typescript] Turn on all of the recommended config options #213

rbalicki2 opened this issue Oct 25, 2024 · 3 comments · Fixed by #281
Assignees
Labels
good first issue Good for newcomers

Comments

@rbalicki2
Copy link
Collaborator

rbalicki2 commented Oct 25, 2024

  • The stricter the better
@rbalicki2 rbalicki2 added the good first issue Good for newcomers label Oct 25, 2024
@lanesawyer
Copy link
Collaborator

I could take a look at this soon. What do you think about applying all of the TS config options marked as "recommended"? I'm not sure how many items there would be to fix with that turned on, but I could take a look at that while I'm in there.

@rbalicki2
Copy link
Collaborator Author

Hell yeah! Yes, 100%, the stricter the TS, the better. I'll modify the task to turn on all the recommended items.

Feel free to fix the ones that are obvious (ideally in separate PRs that land before we turn on the rule), but also feel free to just ts-expect-error anything that isn't obvious. Or we can touch base and figure out how to change the code to turn on the various rules.

@rbalicki2 rbalicki2 changed the title Enable noUncheckedIndexedAccess [typescript] Turn on all of the recommended config options Oct 25, 2024
@lanesawyer
Copy link
Collaborator

I've got a PR to turn on the recommended settings. There was only one to add, and no violations in the codebase 😁

I'll do a separate PR for noUncheckedIndexAccess, as that will require some code changes. It's not one of the recommended settings, but the original intent of this issue was to turn that on, so I'll try to get to that this week.

rbalicki2 pushed a commit that referenced this issue Nov 3, 2024
 - Adds exactOptionalPropertyTypes, the only "recommended" setting not already turned on
PatrykWalach pushed a commit to PatrykWalach/isograph that referenced this issue Dec 21, 2024
# fix: Add noUncheckedIndexAccess to tsconfig

## What
- Adds the `noUncheckedIndexAccess` option to the base `tsconfig.json` file
- Fixes the errors that appeared
- Resolves isographlabs#213 

## How
- Added line to the file
- Fixed issues primarily by throwing errors, as each area of the code expects it to exist and something is very wrong if it doesn't
- Loosened equality checks in some places so all falsey values are caught
- Changed a few `null`s to `undefined`s because accessing an index that doesn't exist (or accessing an array with `undefined` as an index value returns `undefined`)
PatrykWalach pushed a commit to PatrykWalach/isograph that referenced this issue Jan 6, 2025
# fix: Add noUncheckedIndexAccess to tsconfig

## What
- Adds the `noUncheckedIndexAccess` option to the base `tsconfig.json` file
- Fixes the errors that appeared
- Resolves isographlabs#213 

## How
- Added line to the file
- Fixed issues primarily by throwing errors, as each area of the code expects it to exist and something is very wrong if it doesn't
- Loosened equality checks in some places so all falsey values are caught
- Changed a few `null`s to `undefined`s because accessing an index that doesn't exist (or accessing an array with `undefined` as an index value returns `undefined`)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants