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

#313 Add unknown Tyoe #327

Merged
merged 1 commit into from
Aug 16, 2024
Merged

Conversation

theimo1221
Copy link
Contributor

No description provided.

@Apollon77
Copy link
Contributor

hehe, same as #317 just different ... soooo @jens-maus any or unknown your decision gg

@jens-maus
Copy link
Owner

hehe, same as #317 just different ... soooo @jens-maus any or unknown your decision gg

Sorry, I am not an TS expert.. So what are the implications of any vs. unknown here?

@theimo1221
Copy link
Contributor Author

Hello Jens,

'Any' turns off type checking completely, thus increasing risks for bugs at usages, while 'unknown' enforces the developer to implement his own type checks (typeof) or cast's (as ...).

So in this case unknown is more stable until we add a specific definition/interface for those objects.

This might be an interesting article about the topic with some examples:
https://rahuulmiishra.medium.com/typescripts-any-vs-unknown-vs-never-when-and-how-to-use-them-35d81ea57c01

@jens-maus jens-maus merged commit dcfba14 into jens-maus:master Aug 16, 2024
15 checks passed
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 this pull request may close these issues.

3 participants