Skip to content

Return type of exported function has or is using name X from external module Y but cannot be named.Β #61567

@icopp

Description

@icopp

πŸ”Ž Search Terms

"cannot be named", "has or is using name", "return type of exported function"

πŸ•— Version & Regression Information

  • This changed between versions 5.7.0 and 5.8.2

⏯ Playground Link

n/a (this requires 2+ files)

πŸ’» Code

// file 1
declare const emptyObjectSymbol: unique symbol;

export interface EmptyObject {
  [emptyObjectSymbol]?: never;
}
// file 2
import type { EmptyObject } from 'file1';

function a() {
  return {} as EmptyObject;
}
// file 3
import { a } from 'file2';

function b() { // error here
  return a()
}

πŸ™ Actual behavior

error TS4058: Return type of exported function has or is using name 'emptyObjectSymbol' from external module "file1" but cannot be named.

Additional information about the issue

πŸ™‚ Expected behavior

The code compiles as expected.

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    UnactionableThere isn't something we can do with this issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions