Skip to content

unique symbol type imported in declaration files used as computed property key can not be named #38516

Closed
@mohsen1

Description

@mohsen1

TypeScript Version: 3.8 and 3.9.2

This is a regression from 3.7.

Search Terms:
unique symbol, index signature

Code
This is a distilled code from a bigger codebase. The Op is imported from Sequelize

import Op from './op';

export default function foo() {
  return {
    [Op.or]: [],
  };
}
// op.ts
declare const Op: {
  readonly or: unique symbol;
};

export default Op;

tsconfig.json

{
  "compilerOptions": {
    "outDir": "dist",
    "target": "es5",
    "module": "commonjs",
    "declaration": true,
    "strict": true,
    "esModuleInterop": true
  }
}

Expected behavior:
No Error
Actual behavior:

index.ts:3:25 - error TS4058: Return type of exported function has or is using name 'or' from external module "/Users/mohsen_azimi/Desktop/3.9-regression/op" but cannot be named.

3 export default function foo() {
                          ~~~

Related Issues:
#9944

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFix AvailableA PR has been opened for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions