TypeScript|satisfies

satisfies 相關筆記與範例整理。

This article isn't available in this language yet — showing the original below.

type Type = {
amount: number | string
}
const record= {
amount: 123.11,
} satisfies Type
console.log(Math.floor(record.amount)) // amount 的型別會是 number