You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
13 lines
301 B
13 lines
301 B
// js 中的 typeof
|
|
// console.log(typeof 'hello TS')
|
|
|
|
// TS 中的 typeof
|
|
let p = { x: 1, y: 2 }
|
|
// function formatPoint(point: {x: number; y: number }) {}
|
|
// 使用 typeof
|
|
function formatPoint(point: typeof p ) {}
|
|
|
|
formatPoint({ x: 1, y: 100 })
|
|
|
|
// 查看 p对象中属性 x
|
|
let num: typeof p.x
|