-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Using cockpit with strictNullCheck = true
results in not assignable errors
#21352
Comments
Please try also enabling
in your The issue here is that semantically See https://www.typescriptlang.org/tsconfig/#exactOptionalPropertyTypes Note also that this flag is marked as "Recommended". It's frustrating that it's not enabled by default. :( |
Thanks yeah it does indeed get rid of those errors. Unfortunately OpenAPI codegen doesn't seem to support the flag yet (OpenAPITools/openapi-generator#14793). I might be able to workaround it, will have to look. |
One thing we could address with this issue: documenting what tsconfig options we expect our consumers to use. It might also be worth asking the tsc folks why this option isn't the default by now... |
Thanks, in the end it was okay. I just had a lot of errors to work through but I was able to configure our generated code to generate union undefined types |
Explain what happens
I am importing the
pkg/lib
directory into an existing react/ts project (https://github.com/osbuild/image-builder-frontend).We have
strictNullCheck
set to true in ourtsconfig
. This results in a number of errors in thepkg/lib/cockpit/channel.ts
file, I'll just copy the first error for the sake of brevity.When I check the type for
JSONValue
I see:Which is an issue when
strictNullCheck
is set to true sinceundefined !== null
.Version of Cockpit
main
Where is the problem in Cockpit?
None
Server operating system
Red Hat Enterprise Linux
Server operating system version
No response
What browsers are you using?
Chrome
System log
No response
The text was updated successfully, but these errors were encountered: