Skip to content

小纠错 #124

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

Closed
bigcake008 opened this issue Oct 11, 2024 · 1 comment
Closed

小纠错 #124

bigcake008 opened this issue Oct 11, 2024 · 1 comment

Comments

@bigcake008
Copy link

https://github.com/wangdoc/javascript-tutorial/issues/url

上面示例中,{}代表了 Object 类型,不打开strictNullChecks时,它包括了undefined和null,就相当于包括了所有类型的值,所以这时unknown类型可以赋值给{}类型,类型A就为number。打开strictNullChecks时,{}就排除掉了undefined和null,这时unknown类型就不能赋值给{}类型后,类型A就为string。

阮老师,这里类型A的判定写反了。

@ruanyf ruanyf closed this as completed in 635a5fa Oct 12, 2024
@ruanyf
Copy link
Contributor

ruanyf commented Oct 12, 2024

谢谢指出,已经更正。

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

No branches or pull requests

2 participants