1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

「Property 'toaster' is missing in type '{ children: any; }' but required in type 'CustomToastTitleProps'.」の解決方法

1
Posted at

はじめに

typescript勉強中に警告がでた

問題

【警告内容】

Property 'toaster' is missing in type '{ children: any; }' but required in type 'CustomToastTitleProps'.

型ではtoasterというプロパティが定義されてるのに渡されていないという内容でした。

【実際のコード】

<ToastTitleWithType>{toast.title}</ToastTitleWithType>

解決方法

以下のようにpropsを渡したら解決しました。

【修正後のコード】

<ToastTitleWithType toaster={toaster}>{toast.title}</ToastTitleWithType>

おわりに

今までエラーはAIで修正して適当に解決してきたので、同じエラーに出会っても毎回自分の力では解決できていませんでした。
必ず調べるようにしてから同じエラーはすぐ修正できるようになったし、知識が蓄積されていく感じがとても楽しいです!

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?