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.
26 lines
563 B
26 lines
563 B
// js 中的 typeof
|
|
// console.log(typeof 'hello TS')
|
|
|
|
// TS 中的 typeof
|
|
let p = { x: 1, y: 2 }
|
|
// function formatPoint(point: {x: number; y: number }) {}
|
|
<<<<<<< HEAD
|
|
// 使用 typeof
|
|
=======
|
|
<<<<<<< HEAD
|
|
// 使用 typeof
|
|
=======
|
|
<<<<<<< HEAD
|
|
// 使用 typeof
|
|
=======
|
|
|
|
// 使用 typeof,拿到对象 p 中的类型,实现简化书写的目的
|
|
>>>>>>> ceebe04 (TypeScript)
|
|
>>>>>>> 609bdbe (TypeScript)
|
|
>>>>>>> a25358e (TypeScript)
|
|
function formatPoint(point: typeof p ) {}
|
|
|
|
formatPoint({ x: 1, y: 100 })
|
|
|
|
// 查看 p对象中属性 x
|
|
let num: typeof p.x
|