我是靠谱客的博主 稳重彩虹,这篇文章主要介绍ts中箭头函数用泛型表示,6种方法,现在分享给大家,希望可以做个参考。

直接上代码

const foo = <T,>(x: T): T => x;

const foo = <T extends {}>(x: T): T => x;

const foo = <T extends Record<string, unknown>>(x: T): T => x;

const foo: <T>(x: T) => T = x => x;

const identity = <T,>(arg: T): T => {
    console.log(arg);
    return arg;
};

const renderAuthorize = <T>(Authorized: T): ((currentAuthority: CurrentAuthorityType) => T) => (
    currentAuthority: CurrentAuthorityType,
  ): T => {
     return
 };

最后

以上就是稳重彩虹最近收集整理的关于ts中箭头函数用泛型表示,6种方法的全部内容,更多相关ts中箭头函数用泛型表示内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(103)

评论列表共有 0 条评论

立即
投稿
返回
顶部