Skip to content

The inferred type of 'X' cannot be named without a reference to 'Y' only in typescript-go #1942

@rubnogueira

Description

@rubnogueira

Steps to reproduce

Version: 0.20251023.1

I'm having this issue only in typescript-go. I slimmed the repro:

https://github.com/rubnogueira/typescript-go-repro-inferred-type-difference

How to reproduce:

  1. pnpm install
  2. Go to index.ts
  3. Hover combinedCodec and you should see the following error only in ts-go, not in 5.8:

Behavior with typescript@5.8

OK

Behavior with tsgo

The inferred type of 'combinedCodec' cannot be named without a reference to '.pnpm/moment@2.30.1/node_modules/moment'. This is likely not portable. A type annotation is necessary.ts(2742)
⚠ Error (TS2742)  | 

The inferred type of combinedCodec cannot be named without a reference to .pnpm/moment@2.30.1/node_modules/moment . This is likely not portable. A type annotation is necessary.
const combinedCodec: t.IntersectionC<[t.ExactC<t.TypeC<{ example: t.Type<moment.Moment, string, unknown>; }>>, t.ExactC<t.TypeC<{}>>]>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions