Closed
Description
Bug Report
π Search Terms
assignability regression
π Version & Regression Information
- This changed between versions 4.2 and 4.3-beta
β― Playground Link
Playground link with relevant code
π» Code
export type UnrollOnHover<O extends object> = O extends object ?
{ [K in keyof O]: O[K]; } :
never;
export type Schema = Record<string, unknown>;
class Table<S extends Schema> {
__schema!: S;
// Removing this line, removes the error
getRows<C extends keyof S>(): Array<UnrollOnHover<Pick<S, C>>> {
return null!
}
}
class ColumnSelectViewImp<S extends Schema> extends Table<S> { }
const ColumnSelectView1: new <S extends Schema>() => Table<UnrollOnHover<S>> = ColumnSelectViewImp;
const ColumnSelectView2: new <S extends Schema>() => Table<UnrollOnHover<S>> = Table;
π Actual behavior
Assignment to ColumnSelectView1
failed
π Expected behavior
Assignment to ColumnSelectView1
succeeds as it did in 4.2
Workaround
Wrap S
in UnrollOnHover
as well Playground link