Skip to content

Conversation

@suin
Copy link
Contributor

@suin suin commented Jan 16, 2026

Summary

  • 「型ガード関数」ページのコード例で使っていた declare const input: number | string; をやめました。
  • 初期値による推論の影響を避けるため、input: number | string を関数引数として受け取る形に変更しました。
  • これにより、初心者が declare に未遭遇でもコード例を読み進められます。

Test plan

  • task check

Close #1068


Note

Updates the type guard docs example to avoid declare and show narrowing within a scoped function example(input: number | string).

  • Replaces declare const input: number | string; with an example function that takes input: number | string
  • Keeps demonstrations of typeGuard vs notTypeGuard narrowing behavior unchanged, now scoped inside example

Written by Cursor Bugbot for commit dcb26a7. This will update automatically on new commits. Configure here.

## Summary
- 「型ガード関数」ページのコード例で使っていた `declare const input: number | string;` をやめました。
- 初期値による推論の影響を避けるため、`input: number | string` を関数引数として受け取る形に変更しました。
- これにより、初心者が `declare` に未遭遇でもコード例を読み進められます。

## Test plan
- [x] `task check`

Close #1068
@vercel
Copy link

vercel bot commented Jan 16, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
book Ready Ready Preview, Comment Jan 16, 2026 11:02am

Review with Vercel Agent

@suin suin merged commit 6e8b883 into master Jan 16, 2026
7 checks passed
@suin suin deleted the fix/1068-remove-declare-type-guard-example branch January 16, 2026 11:17
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