You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
"unique symbol" is generated to multiple .d.ts files #40786
Hm. I suppose we should issue an error here? The local type from a isn't reachable in b, so we print the type anonymously; however it contains a unique symbol which, by rights, refers to a symbol in a different file; so we can't really serialize it. The only thing you could write out is something like export declare const A1: typeof A, like you propose, but our declaration emit generally doesn't write out typeof queries on its own (simply because it doesn't generalize - it'd only work for exactly declarations of the form var x = some.dotted.name, which is an odd syntactic carve-out to make for TS code), which is why it's more in-line with our normal behavior to report an error on the attempted usage of a private symbol, and require an annotation.
Activity
weswigham commentedon Oct 1, 2020
Hm. I suppose we should issue an error here? The local type from
aisn't reachable inb, so we print the type anonymously; however it contains aunique symbolwhich, by rights, refers to a symbol in a different file; so we can't really serialize it. The only thing you could write out is something likeexport declare const A1: typeof A, like you propose, but our declaration emit generally doesn't write outtypeofqueries on its own (simply because it doesn't generalize - it'd only work for exactly declarations of the formvar x = some.dotted.name, which is an odd syntactic carve-out to make for TS code), which is why it's more in-line with our normal behavior to report an error on the attempted usage of a private symbol, and require an annotation.weswigham commentedon Oct 1, 2020
In fact, the error already exists, and is simply failing to trigger due to an unfortunate bug.