TanStack / table

🤖 Headless UI for building powerful tables & datagrids for TS/JS - React-Table, Vue-Table, Solid-Table, Svelte-Table
https://tanstack.com/table
MIT License
24.51k stars 3.03k forks source link

createColumnHelper's DeepKeys fails to properly resolve keys for accessor #5481

Closed Akkuma closed 1 week ago

Akkuma commented 3 months ago

TanStack Table version

v8.15.3

Framework/Library version

React

Describe the bug and the steps to reproduce it

AccessorFn works, but DeepKeys appears to fail to work as expected. By creating a fake implementation of createColumnHelper I isolated the issue down to however/whatever is happening in there.

Your Minimal, Reproducible Example - (Sandbox Highly Recommended)

https://stackblitz.com/edit/vitejs-vite-feb4sf?file=public%2Fproblem.ts&view=editor

Screenshots or Videos (Optional)

No response

Do you intend to try to help solve this bug with your own PR?

Maybe, I'll investigate and start debugging

Terms & Code of Conduct

KevinVandy commented 1 week ago

I think this is a misunderstanding of how you can use TS generics.

This will never work because the type can be overridden, so TS doesn't guarantee any properties will be available.

image

I know it seems like it should work, it just won't in current TS.