Skip to content

Fix: Type instantiation is excessively deep and possibly infinite. TS2589 (TS3.4)#1251

Merged
xaviergonz merged 9 commits intomasterfrom
fix-ts34-nesting
Apr 9, 2019
Merged

Fix: Type instantiation is excessively deep and possibly infinite. TS2589 (TS3.4)#1251
xaviergonz merged 9 commits intomasterfrom
fix-ts34-nesting

Conversation

@xaviergonz
Copy link
Copy Markdown
Contributor

@xaviergonz xaviergonz commented Apr 6, 2019

Fixes #1247

Due to a new check for type nesting in TS3.4 (capped at 50 iterations) that only applies to .d.ts files (AFAIK), generated type definitions were giving this error with relatively small models.
This PR reduces the type nesting (from around 51 from the provided test case to around 12) by refactoring a bit the type system.

The only con is that the smarter "create" function, which was able to magically infer if create can or cannot take a snapshot has to be gone for this change to work. (Though anyway that feature seems to give some users some problems, see #1208 )

The good thing is that since the type nesting is greatly reduced IDE auto-completion should be even faster now.

I also checked type definition generation, now they are slightly smaller.

@xaviergonz xaviergonz requested a review from mweststrate April 6, 2019 15:06
@xaviergonz xaviergonz changed the title Fix ts34 nesting Fix: Type instantiation is excessively deep and possibly infinite. TS2589 (TS3.4) Apr 6, 2019
@coveralls
Copy link
Copy Markdown

coveralls commented Apr 6, 2019

Coverage Status

Coverage remained the same at 92.358% when pulling 688bdd9 on fix-ts34-nesting into 87e020e on master.

@xaviergonz xaviergonz requested a review from k-g-a April 6, 2019 21:33
@mweststrate
Copy link
Copy Markdown
Member

Great stuff @xaviergonz !

@xaviergonz xaviergonz deleted the fix-ts34-nesting branch May 4, 2019 08:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants