Skip to content

Type 'undefined' is not assignable to type 'string' (reduced from a null-able function parameter) #14425

Closed
@vilicvane

Description

@vilicvane

TypeScript Version: 2.2.1

Code

function foo(bar: string | undefined = '') {
    bar = undefined;
//  ^ Type 'undefined' is not assignable to type 'string'.
}

Possibly related to #13826.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FixedA PR has been merged for this issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions