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

オプショナルプロパティに null を代入できました #859

Open
specialweek1114 opened this issue Apr 5, 2024 · 2 comments

Comments

@specialweek1114
Copy link

https://github.com/yytypescript/book/edit/master/docs/reference/values-types-variables/object/optional-property.md

問題

  • 上記ページ内の説明ではオプショナルプロパティに null は代入できないと記載されていますが、下記環境ではエラーは再現しませんでした。tsconfig.jsonstrictNullChecks": true を追加すると null を代入できなくなったので、これが正しい場合はページの記載内容の変更をお勧めいたします。

環境

  • OS: Windows 10 Pro 22H2 WSL2 Ubuntu 20.04.6 LTS
  • node: v20.11.1

tsconfig.json

{
    "compilerOptions": {
        "target": "es2021"
    }
}
@jamashita
Copy link
Contributor

@specialweek1114 ご指摘ありがとうございます。
こちらですが、 @specialweek1114 さまが修正しPRを出される予定でしょうか?
それとも、我々のほうで修正してしまってもよろしいでしょうか?
お返事いただけますと幸いです

@specialweek1114
Copy link
Author

@jamashita ご返信ありがとうございます。
修正いただいて問題ありません。よろしくお願いいたします。

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