Incorrect type inference for prototype
Opened this issue · 1 comments
niuheshui commented
⏯ Playground Link
💻 Code
interface I1 {
num: number
}
declare interface I2 {
prop: I1
}
class C1 {
a: I2 = {
prop: {
num: 10
}
}
}
const b: I2 = C1.prototype.a
function somefun(bar: I2) {
console.log(bar.prop.num)
}
somefun(C1.prototype.a)
// node_modules/typescript/lib/lib.dom.d.ts
declare var Window: {
prototype: Window;
new(): Window;
};MartinJohns commented
You forgot to fill out the issue template.
Duplicate of #55904.