Microsoft/TypeScript
GitHub ã§èŠãUnexpected declaration error when using symbols and intersections
Open
#59,541 opened on 2024幎8æ6æ¥
BugDomain: Declaration EmitHelp Wanted
Repository metrics
- Stars
- Â (48,455 stars)
- PR merge metrics
-  (å¹³åããŒãž 6d 17h) (30d ã§ 9 merged PRs)
説æ
ð 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