跳到文章內容
← 返回宇宙
中EN
RSS

Frontend

TypeScript|satisfies

2022.10.19·約 1 分鐘

  • TypeScript

satisfies 相關筆記與範例整理。

type Type = {
amount: number | string
}
const record= {
amount: 123.11,
} satisfies Type
console.log(Math.floor(record.amount)) // amount 的型別會是 number
← 較舊一篇HTML attribute|hidden較新一篇 →JS|closest
James Universe — 在宇宙裡探索所有文章 ·瀏覽標籤