Skip to content

chore: fixed InternalTreeSelect's generic signature#41386

Merged
li-jia-nan merged 1 commit intoant-design:masterfrom
Andarist:fix/InternalTreeSelect-type
Mar 22, 2023
Merged

chore: fixed InternalTreeSelect's generic signature#41386
li-jia-nan merged 1 commit intoant-design:masterfrom
Andarist:fix/InternalTreeSelect-type

Conversation

@Andarist
Copy link
Copy Markdown
Contributor

@Andarist Andarist commented Mar 21, 2023

The declared signature doesn't match the one to which it is casted later on:

const TreeSelectRef = React.forwardRef(InternalTreeSelect) as <
ValueType = any,
OptionType extends BaseOptionType | DefaultOptionType = DefaultOptionType,
>(
props: React.PropsWithChildren<TreeSelectProps<ValueType, OptionType>> & {
ref?: React.Ref<BaseSelectRef>;
},
) => React.ReactElement;

This should be a type error but currently, it's accidentally swallowed by TS. Notice how the problem is reported in this TS playground and how it goes away when you include the commented out property.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 21, 2023

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 21, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (f7fd474) 100.00% compared to head (cb3ddca) 100.00%.

Additional details and impacted files
@@            Coverage Diff            @@
##            master    #41386   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          610       610           
  Lines        10453     10453           
  Branches      2851      2851           
=========================================
  Hits         10453     10453           
Impacted Files Coverage Δ
components/tree-select/index.tsx 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@li-jia-nan li-jia-nan merged commit 676a170 into ant-design:master Mar 22, 2023
RedJue pushed a commit to RedJue/ant-design that referenced this pull request Apr 25, 2023
RedJue pushed a commit to RedJue/ant-design that referenced this pull request Apr 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants