DEV Community


Discussion on: The "any" type in Typescript - simple and short explanation

tkudlinski profile image
Tomasz Kudlinski • Edited

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.

docs about it

arikaturika profile image
Arika O Author

True. This is the subject of my next actually :). Thx for mentioning it.