Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Functions return any instead of unknown #10

Open
RA80533 opened this issue May 27, 2021 · 0 comments · May be fixed by #11
Open

Functions return any instead of unknown #10

RA80533 opened this issue May 27, 2021 · 0 comments · May be fixed by #11

Comments

@RA80533
Copy link

RA80533 commented May 27, 2021

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.

@RA80533 RA80533 linked a pull request May 27, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant