#MOC
[[🗃️TypeScript]]の演算子。
`!`を使うことで、非nullでかつ非undefinedであることをアサートすることができる。
```ts
const articles = [
{
id: "hoge",
title: "記事1"
},
{
id: "fuga",
title: "記事2"
}
]
const fetchArticle = (id: string): { id: string, title: string } | undefined => {
return articles.find((article) => article.id === id)
}
console.log(fetchArticle("hoge").id) // Error Object is possibly 'undefined'.(2532)
console.log(fetchArticle("hoge")!.id) // エラーにならない
```
## 📚ドキュメント
- [strictNullChecks - TypeScript Deep Dive 日本語版](https://typescript-jp.gitbook.io/deep-dive/intro/strictnullchecks#nullasshonnon-null-assertion-operator)
## 📖ノウハウ
## 💁トラブルシューティング