fisheva / Eva-Theme

A comfortable and semantic theme.
https://marketplace.visualstudio.com/items?itemName=fisheva.eva-theme
MIT License
451 stars 38 forks source link

使用ts声明类型,颜色异常 #12

Closed archiewx closed 6 years ago

archiewx commented 6 years ago

image

import { ComponentType } from 'react'
import { getDisplayName } from '../utils/getDisplayName'

export const withDefaultProps = <P extends object, DP extends Partial<P> = Partial<P>>(
  defaultProps: DP,
  Cmp: ComponentType<P>,
) => {
  type RequiredProps = Omit<P, keyof DP>
  type Props = Partial<DP> & Required<RequiredProps>
  Cmp.defaultProps = defaultProps
  return (Cmp as ComponentType<any>) as ComponentType<Props>
}
archiewx commented 6 years ago

就不用英文了

fisheva commented 6 years ago

更新到0.5.1,修正结果如下,如果我对您这段代码语义理解不对 导致颜色分配有误,可以继续指出。

qq20180828-234453 2x
archiewx commented 6 years ago

谢谢。持续关注中