Git Product home page Git Product logo

Comments (4)

Pinpickle avatar Pinpickle commented on September 26, 2024 1

I think I'm running into the same issue, just with a different error (the commonality being never).

From what I can tell, this is caused here:

const Table = React.forwardRef(<Row extends RowDataType, Key>(props: TableProps<Row, Key>, ref) => {

The constraint for Row is RowDataType. RowDataType's default type argument is never:

export interface RowDataType<T = never> {

So this means, the constraint expands to Row extends RowDataType<never>, which expands to

Row extends {
  dataKey?: string;
  children?: never[];
  [key: string]: any;
}

Nothing extends never[] | undefined other than never[] or undefined (as it's the bottom type). Any type that has a children value set will not work.

Changing this to unknown should work:

- const Table = React.forwardRef(<Row extends RowDataType, Key>(props: TableProps<Row, Key>, ref) => {
+ const Table = React.forwardRef(<Row extends RowDataType<unknown>, Key>(props: TableProps<Row, Key>, ref) => {

from rsuite-table.

AdrienFromToulouse avatar AdrienFromToulouse commented on September 26, 2024

@simonguo would you agree on this 👆 ?

from rsuite-table.

simonguo avatar simonguo commented on September 26, 2024

Hi, all

Could you provide a minimal example where the above problem occurs?

In addition, the latest version v5.18.1 supports getting the type-inferred Cell from children. Can this solve your problem?

https://github.com/rsuite/rsuite-table#type-safety

from rsuite-table.

simonguo avatar simonguo commented on September 26, 2024

Fixed in v5.18.2

from rsuite-table.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.