Skip to content

@typescript-eslint/no-unnecessary-condition false positive when property is defined anywhere other than the last line of script tag #191

@DetachHead

Description

@DetachHead
<script>
    let foo = undefined
    1 // remove this line and the error goes away
</script>

<button on:click={() => (foo = 'asdf')}>asdf</button>
{#if foo !== undefined}
    <p>clicked</p>
{/if}
7:6  error  Unnecessary conditional, both sides of the expression are literal values  @typescript-eslint/no-unnecessary-condition

✖ 1 problem (1 error, 0 warnings)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions