You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
error: is not assignable to parameter of type 'Attrs<FastOmit<DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> #4088
FAIL src/App.test.tsx
● Test suite failed to run
src/components/builtin/common/ImageCarousel/content.tsx:27:46 - error TS2345: Argument of type '(props: ImageCarouselProps) => ImageCarouselProps' is not assignable to parameter of type 'Attrs<FastOmit<DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>'.
Type '(props: ImageCarouselProps) => ImageCarouselProps' is not assignable to type '(props: ExecutionContext & FastOmit<DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>) => ExecutionProps & Partial<...>'.
Types of parameters 'props' and 'props' are incompatible.
Type 'ExecutionContext & FastOmit<DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>' is missing the following properties from type 'ImageCarouselProps': name, mode, is_borderless
27 const StyledImageCarousel = styled.div.attrs((props: ImageCarouselProps) => props)`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/components/builtin/common/ImageCarousel/content.tsx:29:11 - error TS2339: Property 'is_borderless' does not exist on type 'ExecutionContext & FastOmit<FastOmit<Substitute<DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, Omit<...> & { ...; }>, never>, never>'.
29 props.is_borderless === true
~~~~~~~~~~~~~
Test Suites: 1 failed, 1 total
Tests: 0 total
Snapshots: 0 total
Time: 5.683 s
Ran all test suites.
Here is what I get in the browser logs. Not sure how to address it.
styled-components: it looks like an unknown prop "urls" is being sent through to the DOM, which will likely trigger a React console error. If you would like automatic filtering of unknown props, you can opt-into that behavior via `<StyleSheetManager shouldForwardProp={...}>` (connect an API like `@emotion/is-prop-valid`) or consider using transient props (`$` prefix for automatic filtering.)
Hey @greenpau , a fellow consumer of the library like you but in the absence of a reply from a maintainer I can give my two cents / solution.
The issue seems to stem from the newly-type-conscious library's effort to only pass "known HTML attributes" to underlying components. So because is_borderless is not a standard attribute for HTML elements or a div in particular, the TS error shows.
You can use transient props (just a dollar sign $ before the prop name) to signify that you don't intend on using this prop as an actual HTML attribute.
I tested out the below and didn't see any TypeScript errors on my end.
Activity
ziolekjj commentedon Jul 14, 2023
you could fix this err by passing props this way:
greenpau commentedon Jul 14, 2023
@ziolekjj , thank you for the pointer.
Here is what I get in the browser logs. Not sure how to address it.
jeffgore00 commentedon Jul 30, 2023
Hey @greenpau , a fellow consumer of the library like you but in the absence of a reply from a maintainer I can give my two cents / solution.
The issue seems to stem from the newly-type-conscious library's effort to only pass "known HTML attributes" to underlying components. So because
is_borderlessis not a standard attribute for HTML elements or adivin particular, the TS error shows.You can use transient props (just a dollar sign
$before the prop name) to signify that you don't intend on using this prop as an actual HTML attribute.I tested out the below and didn't see any TypeScript errors on my end.
greenpau commentedon Jul 31, 2023
@jeffgore00 , thank you! This is super helpful!