League-of-Foundry-Developers / foundry-vtt-types

Unofficial type declarations for the Foundry Virtual Tabletop API
MIT License
112 stars 52 forks source link

Investigate Why Main is Failing to Build with TypeScript 5.5.4 #2694

Open LukeAbby opened 1 month ago

LukeAbby commented 1 month ago

See this pull request by dependabot https://github.com/League-of-Foundry-Developers/foundry-vtt-types/pull/2686

Updating from TS 5.3.3 to 5.5.4 has caused:

  history: Array<
      CanvasHistory<ConcretePlaceableOrPlaceableObject<InstanceType<ConfiguredObjectClassForName<DocumentName>>>>
  >;

To error with:

Type instantiation is excessively deep and possibly infinite.

All other errors are almost certainly tangential, cascading from an error in CONFIG. It may be a good reproduction for TypeScript itself. The process would involve minimizing down the reproduction to at most 500 lines if at all possible. Realistically 50 is usually doable.

The process to do this by hand can be tedious. It mostly involves deleting irrelevant files and then deleting everything that depended on that over and over. You have to be very careful that the error does NOT go away after deletion though so you have to take it slowly. The issue with errors like Type instantiation is excessively deep and possibly infinite. is that they can be effected by small changes in seemingly unrelated files.

Still making a reproduction is possible for anyone, if time consuming. Some more advanced ways of looking into this would be looking at the traces, debugging the compiler, or trying out something like https://github.com/csmith-project/creduce. I can't speak to the efficacy of creduce myself as I haven't tried it.