Skip to content

never rest type not assignable to complex rest type #33495

@jack-williams

Description

@jack-williams

TypeScript Version: 3.5.1

Search Terms:

Code

function foo<T extends any[]>() {
    const fn1: (x: string, ...rest: T) => unknown = (x, ..._) => x;
    const fn2: (...args: never) => unknown = fn1 // error
}

Expected behavior:

Assignment of fn1 to fn2 should pass.

Actual behavior:

Assignment of fn1 to fn2 should fails.

Playground Link: link

Related Issues:
#33457

Metadata

Metadata

Assignees

No one assigned

    Labels

    In DiscussionNot yet reached consensusSuggestionAn idea for TypeScript

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions