erg/examples/slot.ts
Shunsuke Shibayama 96132b20f6 initial commit
2022-08-10 23:02:27 +09:00

19 lines
307 B
TypeScript

const assert = console.assert
const john = {
name: "John Smith",
age: 27,
}
assert(john.name == "John Smith")
type Person = {
readonly name: String,
readonly age: number,
}
// assert(Person['age'] == String)
function isPerson(arg): arg is Person { return true }
assert(isPerson(john))