0

I am using https://www.npmjs.com/package/recompose in my project

I need to pass a generic "T" to Table, how to change the type signature so compose<Props<T>, CompProps<T>> will be satisfied?

I have tried with no success:

export const Table<T> = ...

export const Table = compose<Props<T>, CompProps<T>>(
  setDisplayName('Grid'),
  injectSheet(styles)
)(TableComp);

Error I am receving is:

"Cannot find name 'T'
Radex
  • 7,815
  • 23
  • 54
  • 86

1 Answers1

0

Since you have no type use any:

export const Table = compose<Props<any>, CompProps<any>>(
  setDisplayName('Grid'),
  injectSheet(styles)
)(TableComp);

Edit: Ok with keeping type safety

export const Table<T> = compose<Props<T>, CompProps<T>>(
  setDisplayName('Grid'),
  injectSheet(styles)
)(TableComp);
jcroll
  • 6,875
  • 9
  • 52
  • 66