Skip to content

Regression: Type using conditional and mapped types is no longer assignable in 4.3Β #44092

Closed
@dragomirtitian

Description

@dragomirtitian

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

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFix AvailableA PR has been opened for this issueNeeds InvestigationThis issue needs a team member to investigate its status.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions