Open brian6932 opened 9 months ago
Last typescript version in playground that does not report error is 3.6.2 so I don't think this changed in the linked PR.
In the linked issue https://github.com/microsoft/TypeScript/issues/55172, weswigham notes that versions 3.6.6 do not show error that the code there is creating, so this probably is not working earlier versions either.
I'm not sure if this is meant to compile successfully but, if I'm reading this correctly, it shows an extra thing that is a bug. If you comment out the nested assignment to the this.c
property then you might see this emit:
declare function a(): void;
declare class a {
b: any;
}
This doesn't seem right because a
is not a class - it's an instance of a class. Extra TS playground that shows the difference between anonymous and named functions here: TS playground
And an extra thing that I observed here, private name for #prop
can leak in the declaration emit - this shouldn't happen (TS playground):
// input
// @target: esnext
function test() {
return class A {
#prop = 10;
};
}
export const a = new (test())();
// dts
export declare const a: {
"__#12@#prop": number;
};
@Andarist Re: Private name leakage - https://github.com/microsoft/TypeScript/issues/56145 -> https://github.com/microsoft/TypeScript/issues/36548
Hello, any update on this ?
Using yarn4 and prisma, we get stuck as :
This makes me totally blocked and forced to downgrade yarn :(.
Any workaround exisiting ?
Can someone tell what is this problem?
🔎 Search Terms
TS9005: Declaration emit for this file requires using private name '(Anonymous function)'. An explicit type annotation may unblock declaration emit.
🕗 Version & Regression Information
Related to #55172 When 2 separate nested
this
bindings are used within constructor functions, the following error's returned always at the top of the file (this was really annoying to debug 😅)⏯ Playground Link
https://tsplay.dev/NV57Gw
💻 Code
🙁 Actual behavior
Complains
🙂 Expected behavior
Shouldn't complain
Additional information about the issue
No response