You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I prefer to check for a defined object using Boolean(object) rather than !!object, which I consider bad style. Typescript linter recognizes !! as a check for undefined but does not recognize Boolean() as a check for undefined.
I could not find a tsconfig or tslint configuration setting related to this behavior.
2.9.0-dev.20180511 (typescript@next)
"Boolean" "Boolean(" "function Boolean"
Code
This is not production code but a simple demonstration only to satisfy the expression tree.
Actual behavior:
Typescript linter in VS Code displays an error "[ts] Object is possibly 'undefined'." with a red squiggly on the final reference to variable "value".
Playground Link:
The text was updated successfully, but these errors were encountered:
I followed the submission guidelines.
I prefer to check for a defined object using Boolean(object) rather than !!object, which I consider bad style. Typescript linter recognizes !! as a check for undefined but does not recognize Boolean() as a check for undefined.
I could not find a tsconfig or tslint configuration setting related to this behavior.
2.9.0-dev.20180511 (typescript@next)
"Boolean" "Boolean(" "function Boolean"
Code
This is not production code but a simple demonstration only to satisfy the expression tree.
Expected behavior:
No Typescript linter errors
Actual behavior:
Typescript linter in VS Code displays an error "[ts] Object is possibly 'undefined'." with a red squiggly on the final reference to variable "value".
Playground Link:
The text was updated successfully, but these errors were encountered: