evergreen icon indicating copy to clipboard operation
evergreen copied to clipboard

SearchHeaderCell Type not accepting flex properties

Open systemizer opened this issue 6 years ago • 8 comments

Evergreen uses flex as a way of defining column width. TextHeaderCell and HeaderCell both accept flexBasis/flex/flexGrow without typescript errors. SearchHeaderCell results in the following error:

Type '{ flexBasis: number; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<SearchTableHeaderCell> & Readonly<SearchTableHeaderCellProps> & Readonly<{ children?: ReactNode; }>'.
  Property 'flexBasis' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<SearchTableHeaderCell> & Readonly<SearchTableHeaderCellProps> & Readonly<{ children?: ReactNode; }>'. [2322]

How to Reproduce

  • Action: compiling code with a flex property on a SearchHeaderCell tag
  • Version: 4.21.2

systemizer avatar Nov 07 '19 17:11 systemizer

Ah, looks like SearchTableHeaderCell props should extend TableHeaderCellProps (omitting own props), and TableHeaderCellProps should extend TableCellProps (omitting own props) and TableCellProps should extend React.ComponentProps<typeof Pane>

mshwery avatar Nov 07 '19 17:11 mshwery

Hmm, im confused. Doesn't it do that? https://github.com/segmentio/evergreen/blob/master/index.d.ts#L1371

It looks like the heredity tree goes: SearchTableHeaderCellProps --> TableHeaderCellProps --> TableCellProps --> PaneProps , which should work.... but it's very possible im missing something

systemizer avatar Nov 07 '19 17:11 systemizer

It might have to do with the way PaneProps is using typeof Box. What version of typescript are you on?

mshwery avatar Nov 07 '19 17:11 mshwery

TypeScript Version 3.4.5

systemizer avatar Nov 07 '19 17:11 systemizer

What typescript version would avoid this issue? I'm experiencing the same on 3.4.5

a-malo avatar Jan 28 '20 19:01 a-malo

Any update on this?

a-malo avatar Feb 24 '20 22:02 a-malo

Still waiting on this

a-malo avatar Mar 13 '20 20:03 a-malo

I'm unable to reproduce the error using latest evergreen or on TypeScript 3.7.5+

mshwery avatar Mar 13 '20 21:03 mshwery