// 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