初級 › Property does not exist on type の原因と直し方 › パターン3
Property does not exist on type の原因と直し方
型に定義されていないプロパティ名でアクセスしようとしたときに出るエラーです。
1 interface Item { 2 price: number; 3 } 4 const item: Item = { price: 500 }; 5 console.log(item._____); ^
main.ts(5,18): error TS2551: Property 'prise' does not exist on type 'Item'. Did you mean 'price'?
空欄を埋めてコンパイルを通す
priceのタイプミスです。Itemにpriseというプロパティはありません。
次の問題