Microsoft/TypeScript
Voir sur GitHubUnexpected declaration error when using symbols and intersections
Open
#59 541 ouverte le 6 août 2024
BugDomain: Declaration EmitHelp Wanted
Métriques du dépôt
- Stars
- (48 455 stars)
- Métriques de merge PR
- (Merge moyen 6j 17h) (9 PRs mergées en 30 j)
Description
🔎 Search Terms
- declarations
🕗 Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about generating declarations.
⏯ Playground Link
💻 Code
// @filename: logger.ts
export const LoggerURI = Symbol("Logger");
export type LoggerService = { foo: string } & {
[LoggerURI]: { bar: string };
};
// @filename: api.ts
import * as Logger from "./logger";
export declare const fnW: <A, B>(a: A) => (b: B) => A & B;
export declare const fn: <A>(a: A) => (b: A) => A;
declare const x: Logger.LoggerService;
// ❌🤯
// Exported variable 'a' has or is using name 'LoggerURI' from external module "file:///logger" but cannot be named.(4023)
export const a = fnW(x);
// ✅
export const b = fn(x);
🙁 Actual behavior
Unexpected type error:
Exported variable 'a' has or is using name 'LoggerURI' from external module "file:///logger" but cannot be named.(4023)
🙂 Expected behavior
No type error. LoggerURI is exported so it can be named.
Additional information about the issue
No response