Closed
Description
TypeScript Version: 2.3.3
See also playground
Code
interface I {
p: string;
}
class C implements I {
p: string;
pp: number;
}
// no error
const c: Partial<C> = { p: "" };
function ff<T extends I>(v: Partial<T>) {
// no error
return v.p;
}
function f<T extends I>() {
// error TS2322: Type '{ p: string; }' is not assignable to type 'Partial<T>'
// why?
const t: Partial<T> = { p: "" };
}
Expected behavior:
No error
Actual behavior:
Error at line: const t: Partial<T> = { p: "" };