-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Getting type instantiation error #4224
Comments
Please post the errors you are seeing
…On Jul 26, 2022, 12:50 AM -0600, Ivan Bespalov ***@***.***>, wrote:
Describe the bug
Hi, I'm still getting used to the library and most likely am doing something wrong.
Still, I want to use internationalized strings as headers in some of my columns. The compiler throws TS2589 error: Type instantiation is excessively deep and possibly infinite, pointing to a place where i call my translation function, which return simple string, not a deep literal type.
Curiously, when I replace the call with a simple string, the error moves to accessor function for this column.
ColumnDef for this column looks something like this:
columnHelper.accessor((transaction) => DateTime.fromJSDate(transaction?.created_at).toUTC(), {
cell: (props) => (
<Text title={props.getValue().toRelativeCalendar() ?? ""}>
{props.getValue().toLocaleString(DateTime.DATETIME_SHORT_WITH_SECONDS)}
</Text>
),
id: "created_at",
header: t("sections.main.transactions.items.created_at"),
}),
I'm sorry I can't provide reproducible example, because I feel the problem is really project-dependant. I'm creating this issue asking mostly for answers on how to tame inferrance in tanstack-table, so I can avoid similar problems
Your minimal, reproducible example
no link
Steps to reproduce
1. Define columns in a memo, providing a call to t function from react-18next as a header of a column.
2. Try to compile the app
Expected behavior
I expect the app to compile correctly
How often does this bug happen?
Sometimes
Screenshots or Videos
No response
Platform
Linux
react-table version
v8.3.3
TypeScript version
v4.4.2
Additional context
No response
Terms & Code of Conduct
• I agree to follow this project's Code of Conduct
• I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
I'm facing this as well (I think): TS2589: Type instantiation is excessively deep and possibly infinite. It's on |
I’ll need something reproducible to debug :/ |
It may happen due to some project-specific stuff. Because I tried adding |
This issue began after 8.2.6. 8.2.6 is the latest version we are able to run for the time being. A reduced example below. Prefer the ColumnDef syntax over the newly introduced Helper.
|
We just shipped new column helper types and better underlying column def types. Please give them a try and report? |
My project might face the same error. When I upgrade from |
I think the error comes from in v8.3.0 |
Minimal repro: https://codesandbox.io/s/react-table-repro-s2b796?file=/src/index.ts It indeed started happening on 8.3.0 |
I think the |
This error occurs again in /cc @tannerlinsley |
Example import { ColumnDef, createColumnHelper } from '@tanstack/react-table'
type Room = {
id: string
activated_at: Date
expires_at: Date
userId: string
join_code: string
room: Room
}
const columnHelper = createColumnHelper<Room>()
const defaultColumns: ColumnDef<Room, any>[] = [
columnHelper.accessor('id', {
header: 'ID',
cell: info => info.getValue()
})
] TS2589: Type instantiation is excessively deep and possibly infinite. |
@tannerlinsley I get this error, Im on |
I also get this error on I've tried using my own interface and the same interface in @himself65 example above. |
I think if you apply this patch, the issue will be fixed |
I'm still facing this issue in |
Also facing the same issue in |
Me too, facing the same issue in |
Facing this issue in react-table:8.7.6, wonder if they're going to fix it ... |
I was surprised to see it happen in one of the projects only, but now I think it might be connected to typescript version: I had 4.1.6 fixed in project, bump to latest and error went away 🎉 const columns = [ch.accessor("currency", {})];
and now with 4.9.5
Edit: I forgot to mention that I haven't really had exactly the same case as OP, my data interface don't have circular dependency inside like:
|
import { createColumnHelper } from '@tanstack/react-table';
interface Dog {
name: string;
owner: Owner;
}
interface Owner {
name: string;
dog: Dog;
}
const columnHelper = createColumnHelper<Dog>();
const columns = [
columnHelper.accessor('name', { // ts(2589): Type instantiation is excessively deep and possibly infinite.
header: 'Name',
}
] https://codesandbox.io/s/tanstack-table-issues-4224-u92zmn?file=/src/App.tsx Is it possible to fix it? TS v4.9.3 in CodeSandbox and also I tried the same in VSCode with TS v4.9.5 and error still exists |
I still see this error too on the latest typescript and react-table :( anyone have a good solution? |
Any updates? |
any updates? |
Just wanted to report I sorta naively thought I could add a complex object in to the column helper and it straight up breaks TS across my entire project when I do so. For example, I had a table I wanted to display Stripe Charges on. So I tried to do For now I am just creating temporary DTOs with the props that I actually need |
Also seeing this on
|
Simple objects are working fine. Recursive nested types break. |
@tannerlinsley @KevinVandy Please help |
Please help :) |
Describe the bug
Hi, I'm still getting used to the library and most likely am doing something wrong.
Still, I want to use internationalized strings as headers in some of my columns. The compiler throws TS2589 error: Type instantiation is excessively deep and possibly infinite, pointing to a place where i call my translation function, which return simple string, not a deep literal type.
Curiously, when I replace the call with a simple string, the error moves to accessor function for this column.
ColumnDef for this column looks something like this:
I'm sorry I can't provide reproducible example, because I feel the problem is really project-dependant. I'm creating this issue asking mostly for answers on how to tame inferrance in tanstack-table, so I can avoid similar problems
Your minimal, reproducible example
no link
Steps to reproduce
Expected behavior
I expect the app to compile correctly
How often does this bug happen?
Sometimes
Screenshots or Videos
No response
Platform
Linux
react-table version
v8.3.3
TypeScript version
v4.4.2
Additional context
No response
Terms & Code of Conduct
The text was updated successfully, but these errors were encountered: