Open
Description
π Search Terms
widening return unique symbol
π Version & Regression Information
- This is the behavior in every version I tried
β― Playground Link
π» Code
export const test = Symbol()
export function fn() {
const alias: typeof test = test;
return alias
}
π Actual behavior
this declaration file is emitted:
export declare const test: unique symbol;
export declare function fn(): symbol;
π Expected behavior
this declaration file to be emitted:
export declare const test: unique symbol;
export declare function fn(): typeof test;
Additional information
getWidenedLiteralLikeTypeForContextualReturnTypeIfNeeded
calls getWidenedLiteralLikeTypeForContextualType
and that calls getWidenedUniqueESSymbolType
when there is no contextual type provided.
some issues that are (partially~) related:
#32242
#35896 (comment)
#36876