Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add typescript table row generics #1077

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

johanninos
Copy link

@johanninos johanninos commented Jul 27, 2020

In current version the following code with typescript would get error

 const columns = {
    props: 'amount',
    title: 'amount',
    render: (row?: SymbolWithQuotation) => (
      //blablabla
    )
  }

const data: SymbolWithQuotation[] = [...some data];

<Table columns={columns} data={data} />

ts error:

    属性“render”的类型不兼容。
            不能将类型“(row?: SymbolWithQuotation | undefined) => JSX.Element”分配给类型“(data?: Object | undefined, column?: Object | undefined, index?: number | undefined) => void”。
              参数“row”和“data” 的类型不兼容。
                不能将类型“Object | undefined”分配给类型“SymbolWithQuotation | undefined”。

.........others details

Add a generics to replace the data?: Object | undefined to fix it

Please makes sure these boxes are checked before submitting your PR, thank you!

  • Make sure you are merging your commits to master branch.
  • Add some descriptions and refer relative issues for you PR.
  • Rebase your commits to make your pull request meaningful.
  • Make sure that your changes pass npm test, npm run lint and npm run build.

Changes in this pull request

  • add typescript table row generics

@johanninos johanninos force-pushed the master branch 2 times, most recently from d6eeaab to 6f7114b Compare July 27, 2020 09:23
@johanninos johanninos force-pushed the master branch 2 times, most recently from 2c321fb to dab03cd Compare July 28, 2020 03:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant