umbrella icon indicating copy to clipboard operation
umbrella copied to clipboard

[atom] TS4.3 compile error "type instantiation excessively deep and possibly infinite"

Open postspectacular opened this issue 3 years ago • 0 comments

Due to some regression in the TS compiler, @thi.ng/atom (and maybe other packages too) won't compile anymore w/ TS 4.3.2 and is throwing this dreaded error now:

src/atom.ts(32,14): error TS2589: Type instantiation is excessively deep and possibly infinite.
src/cursor.ts(114,14): error TS2589: Type instantiation is excessively deep and possibly infinite.
src/history.ts(44,14): error TS2589: Type instantiation is excessively deep and possibly infinite.
src/transacted.ts(39,14): error TS2589: Type instantiation is excessively deep and possibly infinite.

It's v. likely the culprit is not in that package itself, but caused by the recursive PathVal typedef (and related others) in @thi.ng/api. Likely, but not confirmed! OTOH the @thi.ng/paths package too makes use of those type aliases and does compile...

If I'm not mistaken, some of these recursive helper types used could likely be simplified, now that variadic tuple types are available since TS4.0... let's enquire more and maybe start there...

Relevant TS issues:

  • https://github.com/Microsoft/TypeScript/issues/34933
  • https://github.com/Microsoft/TypeScript/issues/12290#issuecomment-751221502
  • https://github.com/microsoft/TypeScript/issues/35156

postspectacular avatar Jun 07 '21 21:06 postspectacular