Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

strict-boolean-expressions: Allow 'any', and 'true' and 'false' literal types #2758

Merged

Conversation

andy-hanson
Copy link
Contributor

PR checklist

Overview of change:

Starts allowing the types 'any', 'true', or 'false' if they appear exactly.
Will still not allow an always-truthy/falsy union (e.g. true | Date).

CHANGELOG.md entry:

[enhancement] strict-boolean-expression: Allow any, and true and false literal types

@@ -95,12 +95,10 @@ boolType ? strType : undefined;
!enumType;
~~~~~~~~ [This type is not allowed in the operand for the '!' operator because it is an enum. Only booleans are allowed.]
!!classType;
~~~~~~~~~~ [This type is not allowed in the operand for the '!' operator because it is always falsy. Only booleans are allowed.]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!classType is of type false, thus the removed error.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants