Open
Description
This one's actually new in 3.8. There are some additional errors in 3.9 - I'll post them below.
packages/core/src/stateUtils.ts:157:36 - error TS2589: Type instantiation is excessively deep and possibly infinite.
157 return getValueFromAdj(rootNode, getAdjList(config));
~~~~~~~~~~~~~~~~~~
packages/core/src/State.ts:181:12 - error TS2589: Type instantiation is excessively deep and possibly infinite.
181 return new State(config);
~~~~~~~~~~~~~~~~~
packages/core/src/interpreter.ts:208:5 - error TS2589: Type instantiation is excessively deep and possibly infinite.
208 this.parent = parent;
~~~~~~~~~~~~~~~~~~~~
packages/core/src/interpreter.ts:783:13 - error TS2345: Argument of type '{ type: string; data: any; }' is not assignable to parameter of type 'string | EventObject | Event<EventObject>[] | Event<EventObject>'.
Object literal may only specify known properties, and 'data' does not exist in type 'EventObject'.
783 data: err
~~~~~~~~~
To repro:
yarn
tsc -b -f tsconfig.monorepo.json
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
amcasey commentedon Mar 25, 2020
3.9 errors:
ahejlsberg commentedon Mar 26, 2020
I took a quick look. The excessively depth errors are caused by these two types in
src\types.ts
:The problem appears to be exploration of the conditional type constrains that keep spiraling until we hit the depth limiter. When I change
K extends TEvent['type'] ? Extract<TEvent, { type: K }> : EventObject
to justEventObject
in each of the types, the check time drops by 50% and the type count drops by 60-70%. I'm not exactly sure what these types are doing, but simplifying them definitely has a major effect.DanielRosenwasser commentedon Mar 27, 2020
FYI @davidkpiano
davidkpiano commentedon Mar 29, 2020
Working on a fix for this, but I found some odd type behavior:
This will produce the following error for
event.value
:I would expect
ResolvedEvent
to be narrowed to{ type: 'CHANGE'; value: string }
since{ type: 'SAVE' } & { type: 'CHANGE' }
should benever
.ahejlsberg commentedon Mar 30, 2020
Are you sure you're using the 3.9 compiler? There's no error with the nightly build:
https://www.typescriptlang.org/play/index.html?ts=Nightly#code/C4TwDgpgBAShDOB7ANgNwgEwKLoHbCgF4oAKAbwFgAoKWqUSALigCIBhACQEEA5AcSwsA3NTpRUAQ2QBXCM3jAATgEtcAcxFUAvlABkUSjToM5rTrwHDqWgJRQAPqUNiTzFgGUuANUGad+52NwU3Zufl9rG2pqADNpXABjYGVEXCgJeHhlNVwSCDxgZjgkNEwcCHw7QNpFCGBpRTT8iuAAOkkZCD8gA
davidkpiano commentedon Mar 31, 2020
Ah, no, I was using 3.8.3. Glad to see it's fixed - was that specific issue tracked?
ahejlsberg commentedon Mar 31, 2020
Yes, it was fixed by #36696.
vasilii-kovalev commentedon Jul 9, 2021
I'm facing the error in such a case:
The error appears when the text is longer than or equal to 24 characters.
Playground.
2 remaining items