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

Use unknown instead of any as the value to fallback to when the type is not known #30

Merged
merged 1 commit into from
Mar 26, 2023

Conversation

kylemilloy
Copy link
Contributor

@kylemilloy kylemilloy commented Mar 10, 2023

Resolves #29

unknown was introduced in TypeScript v3. You can read more on the PR here

Lots to read but the main part is that any is too permissive and should be avoided or you can get some fun stuff like:

const anyVar: any = 'foo'
myVar.method() // does not trigger the linter, it should.

const unknownVar: unknown = 'bar'
unknownVar.method() // triggers the linter

@kylemilloy kylemilloy marked this pull request as ready for review March 11, 2023 15:54
@kylemilloy
Copy link
Contributor Author

@adenh93 hey just wondering if you've had a chance to take a look at this yet,

@adenh93
Copy link
Owner

adenh93 commented Mar 26, 2023

Very sorry, @kylemilloy, I'd been without internet for a month 💀

I'll put out a release today with this change!

@adenh93 adenh93 merged commit 862bbb8 into adenh93:master Mar 26, 2023
@kylemilloy
Copy link
Contributor Author

Hey hey no sweat. Thank you very much.

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.

Unknown types should be marked as unknown and not any
2 participants