Skip to content

Tabs里面的onEdit方法的参数类型推断错误 #35237

@yanhcao

Description

@yanhcao

Reproduction link

Edit on CodeSandbox

这个是代码链接,把typeof去掉,build即会报错

Steps to reproduce

  1. 项目开启ts
  2. 使用支持编辑的Tabs,以及onEdit方法
  3. onEdit方法中的两个参数(currentKey, action) 中的currentKey的类型推断会存在string和Event两种,其实只需要string一种
  4. build报错
  5. 除非增加cuurentKey的类型判断再使用

What is expected?

currentKey可能为Event的数据格式吗?如果不是的话,类型推断是否可以只给成key对应的类型;

What is actually happening?

currentKey的类型推断会存在string和Event两种

Environment Info
antd undefined
React ^16.8.X
System macOS 10.15.7
Browser chrome 100.X

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedThe suggestion or request has been accepted, we need you to help us by sending a pull request.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions