Skip to content

型ガードの日本語を修正 #172

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

Merged
merged 1 commit into from
Jun 28, 2024

Conversation

okuramasafumi
Copy link

https://github.com/basarat/typescript-book/blob/master/docs/types/typeGuard.md

TypeScript doesn't assume type guards remain active in callbacks as making this assumption is dangerous. e.g.

ここでは"this assumption is dangerous"なので、危険なのはタイプガードではなくて仮定のほうだと思います。

The fix is as easy as storing the inferred safe value in a local variable, automatically ensuring it doesn't get changed externally, and TypeScript can easily understand that:

"ensuring"の単語が訳出されておらず、また"easy"なのは最初のカンマまでなので、それを踏まえて訳を変更しました。

Copy link
Collaborator

@yottahmd yottahmd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

修正いただき、ありがとうございます!

@yottahmd yottahmd merged commit 54d2b3c into typescript-book-ja:master Jun 28, 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

Successfully merging this pull request may close these issues.

2 participants