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