Closed keijokapp closed 2 months ago
Looks good. However, it looks like you've manually edited opts.d.ts - and that file should be autogenerated from one of the scripts. Any manual changes will be lost like this. Do you mind updating the generation script in scripts/gentsopts.ts while you're at it?
Forgot about that. Done.
TypeScript 4.4 introduced
exactOptionalPropertyTypes
compiler option. This fixed one of the major issues I had with TypeScript and, I think, should be the default in all new projects. It avoids unnecessary checks and type assertions/casts, improving type safety. But it also means that all optional object field types in the project, including those from third-party libraries, have to explicitly includeundefined
to preserve the old behavior.This PR is mostly just convenience, so I could do
instead of
This PR:
undefined
to optional object field types where applicable (which is most of them).exactOptionalPropertyTypes: true
to TypeScript configuration.tsconfig.json
because it's weird to add options with the boilerplate in the way.While I'm at it, would that be ok to do some maintenance tasks too? Like: