mirror of
https://github.com/erg-lang/erg.git
synced 2025-07-07 13:15:21 +00:00
19 lines
307 B
TypeScript
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))
|