edgedb / edgedb-js

The official TypeScript/JS client library and query builder for EdgeDB
https://edgedb.com
Apache License 2.0
511 stars 65 forks source link

Error: Type instantiation is excessively deep and possibly infinite. #919

Closed notramo closed 6 months ago

notramo commented 6 months ago

Generated edgeql-js bindings crash the TS type checker on vanilla config.

Reproduction create an empty TS app, with latest version of everything:

Do not add anything to the schema, start an edgedb watch, then bun run generate edgeql-js.

Then run the TS type checker on the result.

/edgeql-ts/literal.ts:40:16
Error: Type instantiation is excessively deep and possibly infinite.
    __kind__: ExpressionKind.Literal,
    __value__: value,
  }) as any;
scotttrinh commented 6 months ago

Thanks for the report! Looks like TypeScript 5.4 has introduced a pretty big performance regression for conditional types, so we're working on mitigating that now. In the meantime, TypeScript 5.3 seems to work. I'll leave this issue open until we release a new version that fixes the type instantiation issue.

notramo commented 6 months ago

I tested on 5.3 and 5.2, but neither works. Does the type checking depend on system resources or only on complexity?

scotttrinh commented 6 months ago

I believe it depends only on complexity. I know it works on 5.2 because that's the current version that run on CI, so perhaps there is something happening in your compilation pipeline or IDE setup that is getting 5.4 still? Or maybe they backported the regression to the latest patch version of 5.2/5.3? I'll do some further investigation ASAP, but I'm already working on a fix anyway, so I don't want to spend too much time diverted into reproducing.

scotttrinh commented 6 months ago

Fixed in 1.5.x