Replies: 4 comments
|
Up. Supporting readonly TypeScript objects would be nice. My use-case is that I get GraphQL data from Relay, which provides auto-generated TypeScript types with |
0 replies
|
This would be particularly helpful when using import { useReactTable } from '@tanstack/react-table';
import { FragmentOf, graphql, readFragment } from '@/graphql';
const myFragment = graphql(`
fragment MyFragment on Order {
id
}
`);
const MyReactComponent = (props: { orders: FragmentOf<typeof myFragment>[]) => {
const items = readFragment(myFragment, props.orders);
const table = useReactTable({
data: items,
// ^ the type (...) is 'readonly' and cannot be assigned to the mutable type (...)
});
} |
0 replies
|
Just adding to the chorus - my ORM also returns read only types, which works everywhere except when using react-table, when I am forced to either typecast or copy the data. Making the argument a readonly type would mean that both mutable and readonly data can be used; in its current state it supports mutable only. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Seems like the table data prop is forced to be mutable. is it required to be mutable or is there a way around this?
results in
All reactions