首页笔记趣玩其他
章节
    All基础进阶组件使用
    JavaScriptTypeScriptReactNpmGitCss小程序面试题
    进阶
    箭头函数写泛型
    // tsx 中需要加多个 , 或者 extends,否则会识别成 react 的标签 const fn = <T>(p: T): T => { return p; }; const fn2 =
    lhh|07/31/2024 14:19
    进阶
    读取对象数组中的对象类型
    type Person = { name: string; age: number; schools: { id: string }[] }; type PersonSchool = Person["
    lhh|07/31/2024 14:19
    进阶
    读取对象的 key 作为 type
    const person = { name: "lhh", age: "18" }; type PersonKey = keyof typeof person; type Person = { [ke
    lhh|07/31/2024 14:19
    进阶
    将类型的所有可选属性转为必选
    /** 将类型的所有可选属性(包括嵌套的,同时移除null)都转化为必选 */ type DeepRequired<T> = { [P in keyof T]-?: T[P] extends ob
    lhh|07/31/2024 14:18
    进阶
    将指定 key 变为必选
    type RequireKey<T, K extends keyof T> = Omit<T, K> & { [P in K]-?: T[P] }; // type RequireKey2<T, K
    lhh|07/31/2024 14:18
    进阶
    将指定 key 变为可选
    type WithPartial<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>; type Person = { id: str
    lhh|07/31/2024 14:18
    博主很懒,就这么多啦~~