fix(factories): add types to createShorthandFactory() methods#1875
fix(factories): add types to createShorthandFactory() methods#1875
Conversation
packages/react/src/lib/factories.ts
Outdated
| } | ||
| export type CreateShorthandFactoryConfig = CreateShorthandFactoryConfigInner | ||
| export type CreateShorthandFactoryResult = ( | ||
| a: ShorthandValue<UIComponentProps>, |
There was a problem hiding this comment.
| a: ShorthandValue<UIComponentProps>, | |
| value: ShorthandValue<UIComponentProps>, |
There was a problem hiding this comment.
| a: ShorthandValue<UIComponentProps>, | |
| a: ShorthandValue<P>, |
Actually, let's make it generic and accept component props there. Hope that it will work
Codecov Report
@@ Coverage Diff @@
## master #1875 +/- ##
======================================
Coverage 69.7% 69.7%
======================================
Files 886 886
Lines 7797 7797
Branches 2258 2258
======================================
Hits 5435 5435
Misses 2352 2352
Partials 10 10
Continue to review full report at Codecov.
|
…o "value, options", avoid cirtular reference in factories.ts
|
|
||
| const indicatorWithDefaults = indicator === undefined ? {} : indicator | ||
| const defaultIndicator = { name: vertical ? 'stardust-arrow-end' : 'stardust-arrow-down' } | ||
| const indicatorWithDefaults = indicator === undefined ? defaultIndicator : indicator |
There was a problem hiding this comment.
Are these changes required? Can we revert them?
There was a problem hiding this comment.
It is required, because Type {} is not assignable to type Props<IconProps>.
| const { contentRef, children, content, indicator, active } = this.props | ||
| const indicatorWithDefaults = indicator === undefined ? {} : indicator | ||
| const defaultIndicator = { name: active ? 'stardust-arrow-down' : 'stardust-arrow-end' } | ||
| const indicatorWithDefaults = indicator === undefined ? defaultIndicator : indicator |
There was a problem hiding this comment.
|
Another PR: |
Fixes #1865
The new type is
Won't compile
Will compile
And this will unfortunately also compile