# TypeScript 常用型別 - 物件 (Object)  * 型別註釋寫法 ``` let product:{ name:string, price:number, isStock: number } = { name:'Mac', price:999.99, isStock: 150 } ``` * 型別自動推斷,因此會出錯 ``` // 型別自動推斷,因此會出錯 product.price = 'hello' ``` * 定義沒有該key,一樣會報錯誤 ``` // 如定義沒有該key,一樣會報錯誤 product.id= 'No2424' ``` 
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up