We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
switch undefined
6.4 ~ 4.7.4 (latest)
Playground link with relevant code
type State = { foo: string } let state: State | undefined; let result: boolean = false; if (state) { state.foo === "sdfdsf" switch (true) { case state.foo === 'test': case state.foo === 'test': result = true; break; // Object is possibly 'undefined'.ts(2532) case state.foo === 'test': case state.foo === 'test': result = true; break; // Object is possibly 'undefined'.ts(2532) case state && state.foo === 'test': case state.foo === 'test': result = true; break; // Object is possibly 'undefined'.ts(2532) case state ? state.foo === 'test' : false: case state.foo === 'test': result = true; break; } }
Error Object is possibly 'undefined'.ts(2532)
No error
The text was updated successfully, but these errors were encountered:
Duplicate of #37178.
Sorry, something went wrong.
This issue has been marked as a 'Duplicate' and has seen no recent activity. It has been automatically closed for house-keeping purposes.
switch (true) { case {}: }
No branches or pull requests
Bug Report
π Search Terms
switch undefined
π Version & Regression Information
6.4 ~ 4.7.4 (latest)
β― Playground Link
Playground link with relevant code
π» Code
π Actual behavior
Error Object is possibly 'undefined'.ts(2532)
π Expected behavior
No error
The text was updated successfully, but these errors were encountered: