not operator (anything but)
See original GitHub issuetl;dr:
(param: Any) => not String
// shorthand
(param: Any) => !String
// union case
(param: Any) => not(String | Array)
// short hand
(param: Any) => !(String | Array)
Sometimes it’s way easier and convenient to define the type by discarding one or several.
There’s also the possibility to define it as a substraction—e.g. Any - String
—but that would not be very conventional.
TypeScript approaches
Issue Analytics
- State:
- Created 5 years ago
- Reactions:4
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Logical NOT (!) - JavaScript - MDN Web Docs - Mozilla
The logical NOT (!) (logical complement, negation) operator takes truth to falsity and vice versa. It is typically used with boolean (logical) values....
Read more >*AND, *OR, and *NOT operators in CL logical expressions - IBM
The logical operators *AND and *OR specify the relationship between operands in a logical expression. The logical operator *NOT is used to negate...
Read more >Using the Not Operator in If Conditions in Java - Baeldung
The not operator is a logical operator, represented in Java by the ! symbol. It's a unary operator that takes a boolean value...
Read more >What is the !! (not not) operator in JavaScript? - Stack Overflow
It converts Object to boolean . If it was falsey (e.g., 0 , null , undefined , etc.), it would be false ,...
Read more >Using the "not" Boolean Operator in Python
Python's not operator allows you to invert the truth value of Boolean expressions and objects. You can use this operator in Boolean contexts, ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I like it.
That’s to be expected. Let’s say you had
!Array
before typed arrays were introduced and it doesn’t coverInt16Array
, I wouldn’t blame rtype. The type will have to be updated to!Array & !TypedArray
; it’s such a rare occurence that I don’t mind.