Skip to content

Expression produces a union type that is too complex to represent #33130

Closed
@mjbvz

Description

@mjbvz

TypeScript Version: 3.6.2

Search Terms:

  • union type
  • partial

Repo

  1. git clone https://github.com/Microsoft/typescript-template-language-service-decorator

  2. npm install

  3. Open src/template-language-service-decorator.ts

  4. On line 44, remove the any cast on the line:

        for (const { name, wrapper } of this._wrappers) {
            (intercept[name] as any) = wrapper(languageService[name]!.bind(languageService));
        }
  5. Try compiling the project

Expected behavior:
This compiles with TS 3.4

Actual behavior:
Compile fails with TS 3.5+

src/template-language-service-decorator.ts:44:13 - error TS2590: Expression produces a union type that is too complex to represent.

44             intercept[name] = wrapper(languageService[name]!.bind(languageService));
               ~~~~~~~~~~~~~~~

The code likely needs to be rewritten here but I'm opening this issue to make sure the error is expected

Playground Link:

Related Issues:

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptDomain: PerformanceReports of unusually slow behavior

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions