Skip to content

Should error when unwrapping an unwrappable variable #8453

@tinganho

Description

@tinganho

s cannot be null or undefined below. So I think it is appropriate to error when trying to unwrap.

let s: string;
id = '';
if (s!) { // should throw an error

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    SuggestionAn idea for TypeScriptWorking as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions