//类型推论 就是未定义类型的变量会根据赋值情况推断一个类型
let strx = 'test' //如果没有定义类型, 鼠标移上str会判断为string类型
let aax //如果没有 赋值就是any类型
//类型别名
type s = string | number
let sxj:s = 'test'
let sxp:s = 123
//函数式类型别名
type cb = () => string
const fnx:cb = () => 'test'
//值得类型别名
type T = 'on' | 'off'
let strt:T = 'on'
12-ts类型推论-类型别名
于 2022-08-17 16:34:03 首次发布