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

Set strict settings to true in tsconfig.json #401

Open
MilesBHuff opened this issue Apr 11, 2022 · 6 comments
Open

Set strict settings to true in tsconfig.json #401

MilesBHuff opened this issue Apr 11, 2022 · 6 comments

Comments

@MilesBHuff
Copy link
Contributor

Setting strictMode to true in tsconfig.json would make entire classes of bugs impossible, including (but not limited to) #382, #392, and #393.
https://github.com/jjppof/goldensun_html5/blob/master/tsconfig.json

@MilesBHuff
Copy link
Contributor Author

MilesBHuff commented Apr 11, 2022

If you wait long-enough, I'll do this one for you. ;)
Typing is a bit different than you're used to when this setting is enabled: null and undefined become completely separate types from string, number, etc -- so let foo: number = null becomes impossible. And that's a big part of how this avoids so many bugs.

@jjppof
Copy link
Owner

jjppof commented Apr 11, 2022

#382 was a logic problem because it was set with rare_item along with carry_up_to_30.
I still need to write types for dbs and, in the best scenario, do some sanity checks...

And that's a big part of how this avoids so many bugs.

But yeah, for many other cases, I agree.

I'll do this one for you. ;)

Looking forward ☺

@MilesBHuff
Copy link
Contributor Author

MilesBHuff commented Apr 12, 2022

Whoo boy, this is not something I'll be able to do 100% by myself, most-likely. Look how many errors there are when strict-mode is enabled: gshtml5_strictmode.log
That's a grand total of 3069 errors.

@MilesBHuff
Copy link
Contributor Author

MilesBHuff commented Apr 12, 2022

Okay, perhaps the best way to go about this, is to do it one setting at a time.
First would be "noImplicitReturns". Then, we could go setting-by-setting within strict mode (strict mode is actually a collection of settings, rather than its own truly separate thing). And finally, the hardest one of all: "noImplicitAny".

@jjppof
Copy link
Owner

jjppof commented Apr 13, 2022

Sounds good. And yeah, maybe noImplicitAny can wait for a next release.

@MilesBHuff MilesBHuff changed the title Set strictMode to true in tsconfig.json Set strict settings to true in tsconfig.json Apr 17, 2022
@MilesBHuff
Copy link
Contributor Author

MilesBHuff commented Apr 17, 2022

The following have been enabled:

        "forceConsistentCasingInFileNames",
        "noImplicitReturns",
        "strictBindCallApply",
        "alwaysStrict",
        "useUnknownInCatchVariables",
        "noImplicitThis",
        "strict",

The following have not:

        "strictFunctionTypes",
        "strictNullChecks",
        "strictPropertyInitialization",
        "noImplicitAny",

(The above are all in the order they were enabled, or the order in which they will be enabled.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants