typescript 这种写法是什么意思?

查看:175
本文介绍了typescript 这种写法是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问 题


export function simpleComponentWrap<P>(Comp: React.ComponentClass<P> | React.StatelessComponent<P>): React.ComponentClass<P> {

  interface statisticsProps extends P {
    callback?: any;
  }  


  return class WrappedComponent extends React.Component<, {}> {
    render() {
      return <Comp {...this.props} />;
    }
  };
}

这个里面的simpleComponentWrap<P> ,P 代表什么意思呢?

解决方案

泛型

这篇关于typescript 这种写法是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆