goldensun_html5
goldensun_html5 copied to clipboard
Set `strict` settings to `true` in `tsconfig.json`
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
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.
#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 ☺
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.
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".
Sounds good. And yeah, maybe noImplicitAny can wait for a next release.
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.)