Skip to content

TS2742: The inferred type of 'X' cannot be named without a referenceΒ #60624

Closed as not planned
@Aliaksandr-Kasko-JazzTeam

Description

πŸ”Ž Search Terms

ts2742, inferred type, bufbuild, protobuf, es, proto3

πŸ•— Version & Regression Information

  • This changed between versions 5.6.3 and 5.7.x

⏯ Playground Link

No response

πŸ’» Code

πŸ™ Actual behavior

When using proto files with enums generated with @bufbuild/protoc-gen-es we've got this error on project build with typescript 5.7.x.

error TS2742: The inferred type of 'Price' cannot be named without a reference to '../../../../node_modules/@bufbuild/protobuf/dist/esm/private/enum.js'. This is likely not portable. A type annotation is necessary.

58 export const Price = /*@__PURE__*/ proto3.makeEnum(
                ~~~~~

πŸ™‚ Expected behavior

Project builds successfull with TypeScript <= 5.6.3.

Additional information about the issue

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Not a DefectThis behavior is one of several equally-correct options

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions