ant-design: tsc error with typescript@2.1

antd-tools run compile
components/modal/confirm.tsx(92,7): error TS2531: Object is possibly 'null'.
components/tooltip/index.tsx(127,40): error TS2345: Argument of type 'ReactElement<any> | (undefined & ReactElement<any>) | (null & undefined) | (null & ReactElement<a...' is not assignable to parameter of type '{}'.
  Type 'undefined' is not assignable to type '{}'.
components/tooltip/index.tsx(128,24): error TS2532: Object is possibly 'undefined'.
components/tooltip/index.tsx(128,30): error TS2339: Property 'props' does not exist on type 'ReactElement<any> | (undefined & ReactElement<any>) | (null & ReactElement<any>) | (string & unde...'.
  Property 'props' does not exist on type 'string & undefined'.
components/tooltip/index.tsx(143,33): error TS2345: Argument of type 'ReactElement<any> | (undefined & ReactElement<any>) | (null & undefined) | (null & ReactElement<a...' is not assignable to parameter of type 'ReactElement<any>'.
  Type 'undefined' is not assignable to type 'ReactElement<any>'.
[14:08:49] TypeScript: 5 semantic errors
[14:08:49] TypeScript: emit succeeded (with errors)

And travis is ok.

$ tsc -v
2.0.10

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 19 (18 by maintainers)

Most upvoted comments

配置jsxpreserve可以不经过TypeScript处理React. 编译出来的 js 跟我们写es6一样.