Skip to content

TS7056 for exported generic arrow function with return type (arrow-only) #3040

@rubenferreira97

Description

@rubenferreira97

Exporting a generic arrow function that returns a type triggers TS7056: The inferred type of this node exceeds the maximum length the compiler will serialize. An explicit type annotation is needed. This only occurs when the function is exported as an arrow function. An equivalent function declaration does not error. Compiling directly with typescript@6.0 does not reproduce the issue.

Steps to reproduce

Repo link

Behavior with typescript@6.0

No error.

Behavior with tsgo

src/example.ts:5:14 - error TS7056: The inferred type of this node exceeds the maximum length the compiler will serialize. An explicit type annotation is needed.

5 export const SortableQuery = <S extends TEnum>({
               ~~~~~~~~~~~~~


Found 1 error in src/example.ts:5

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions