Fix wrong typing of TabAction prop #1497
Merged
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
Self Checklist
[Component] I wrote a unit test about the implementation.[Component] I wrote a storybook document about the implementation.[Component] I tested the implementation in various browsers.[New Component] I added my username to the correct directory in theCODEOWNERSfile.Related Issue
Fixes #1126
Summary
TabAction은href를 받으면a로, 그렇지 않으면button으로 동작하지만 event handler 에 대한 타입은 항상button에 대한 event handler 로 정의되어 있습니다. 이것을 수정합니다.Details
typescript 에서는 higher order function에 대해 제네릭 타입의 추론이 가능하지만,
forwardRef처럼 반환타입이 추가로 속성(displayName,defaultProps)을 가지게 되면 이것이 제대로 동작하지 않습니다. 참고: https://stackoverflow.com/a/58473012/22224797위에서 제시한 assertion 을 하지 않고
myRef같이 custom 한 ref prop 을 열거나 글로벌하게forwardRef타입을 변경하는 것은 베지어에 적용할 수 없다고 생각하여, assertion 을 해서 아래처럼 타입이 제대로 잡히게 했습니다.As-is
[href 있을 때]
[href 없을 때]
[href 있을 때]
[href 없을 때]
Breaking change or not (Yes/No)
References