I think it is worth mentioning that where possible, use of any should be avoided. Typescript 3.0 introduced more safe replacement of any called unknown:
unknown is the type-safe counterpart of any. Anything is assignable to unknown, but unknown isn’t assignable to anything but itself and any without a type assertion or a control flow based narrowing. Likewise, no operations are permitted on an unknown without first asserting or narrowing to a more specific type.
I think it is worth mentioning that where possible, use of
any
should be avoided. Typescript 3.0 introduced more safe replacement ofany
calledunknown
:unknown is the type-safe counterpart of any. Anything is assignable to unknown, but unknown isn’t assignable to anything but itself and any without a type assertion or a control flow based narrowing. Likewise, no operations are permitted on an unknown without first asserting or narrowing to a more specific type.
docs about it
True. This is the subject of my next actually :). Thx for mentioning it.