react-table-library icon indicating copy to clipboard operation
react-table-library copied to clipboard

Using Typescript & Adding Typescript to the docs

Open lm93547 opened this issue 3 years ago • 0 comments

I am trying to strictly type my Node array & while using the sort functionality, I see errors such as Type 'TableNode[]' is not assignable to type 'NodeType[]', any idea how to fix this? I have tried extending my type with TableNode, but when doing this the error Type 'TableNode' is missing the following properties from type 'NodeType': platform, position, openInterest, APY, and 2 more. shows. Any ideas or documentation to support this use case?

NodeType:

interface NodeType extends TableNode {
    id: string;
    platform: string;
    position: string;
    openInterest: string;
    APY: string;
    fixedYield: string;
    variableYield: string;
}

I also believe the docs should include some documentation for using the library with typescript. I can help with this if necessary. Love the library though! Thanks!

lm93547 avatar Oct 07 '22 03:10 lm93547