Skip to content

Type 'string' is not assignable to type '"col1" Typescript error TS2322 #2912

@Paul6552

Description

@Paul6552

Describe the bug (required)
Type 'string' is not assignable to type '"col1"

Provide an example via Codesandbox! (required)
I tried to produce a typescript react-table example without luck. i am really sorry

Steps To Reproduce (required)

`    const data = React.useMemo(
        () => [
            {
                col1: 'Value 1',
            },
        ],
        []
    );
const columns = React.useMemo(
    () => [{
        Header: 'what',
        accessor: 'col1',
    }
    ],
    []
);


const {
    getTableProps,
    getTableBodyProps,
    headerGroups,
    rows,
    prepareRow,
} = useTable( {
    columns,
    data,
} )`

Expected behavior (Recommended)
No typescript error

Screenshots
image

Desktop (please complete the following information):

  • OS: Linux Mint
  • Browser Chrome
  • Version react-table 7.6.2
    "@types/react-table": "^7.0.25",

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions