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
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions type-system/typeguard.md
Original file line number Diff line number Diff line change
@@ -197,7 +197,7 @@ doStuff({ bar: 123, common: '123' });

## Type Guardsとコールバック

TypeScriptは、コールバック内でタイプガードがアクティブのままであることは危険なため、これを想定していません。例えば、
TypeScriptは、コールバック内でタイプガードがアクティブのままであることと仮定することは危険なため、そのような仮定はしません。例えば以下のようになります:

```typescript
// Example Setup
@@ -216,7 +216,7 @@ if (foo.bar) {
}
```

この修正は、推測された安全な値をローカル変数に格納し、自動的に外部から変更されないようにするのと同じくらい簡単で、TypeScript はそれを簡単に理解することができます。
これを修正するには推測された安全な値をローカル変数に格納するのみでよく、その値が外部から変更されないと自動的に保障できます。TypeScript はそれを簡単に理解することができます。


```javascript