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
A common mistake in TypeScript code is the use of any in places where it should actually be unknown. From a linguistic perspective, any implies that something has the potential to be anything. In effect, however, the TypeScript sees this as sort of a wildcard which, linguistically, would make any more of an everything type.
This is an important distinction to make when dealing with TypeScript because any will break the type safety ensured by the TypeScript compiler for the end user.
This excellent Gist has a great chart that explains the type system and where any and unknown fall into it.
The text was updated successfully, but these errors were encountered:
A common mistake in TypeScript code is the use of
any
in places where it should actually beunknown
. From a linguistic perspective,any
implies that something has the potential to be anything. In effect, however, the TypeScript sees this as sort of a wildcard which, linguistically, would makeany
more of an everything type.This is an important distinction to make when dealing with TypeScript because
any
will break the type safety ensured by the TypeScript compiler for the end user.This excellent Gist has a great chart that explains the type system and where
any
andunknown
fall into it.The text was updated successfully, but these errors were encountered: