Skip to content

The type of query is wrong and may be undefined. #3878

@lzy1960

Description

@lzy1960

Version

3.6.5

Reproduction link

lzy1960/vue-router-query-ts-error

Steps to reproduce

run npx eslint src/views/HomeView.vue, then throw two eslint warning

What is expected?

  1. getElementsByClassName maybe return undefined, so secondPart is not always falsy
  2. this.$route.query.xxx maybe undefined, but the type is not contain undefined

In short, neither warning should appear.

What is actually happening?

Two no-autofix/@typescript-eslint/no-unnecessary-condition appeared that should not appear

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