Skip to content

Recent versions of VS Code are reporting Pylance errors #533

@ataylor32

Description

@ataylor32

Visual Studio Code used to have no issues with the following code:

SOME_SETTING = env("SOME_SETTING", default="fallback")

But in recent versions (1.93.1, for example), "fallback" is underlined in red. Hovering over it shows this:

Argument of type "Literal['fallback']" cannot be assigned to parameter "default" of type "NoValue" in function "__call__"
  "Literal['fallback']" is not assignable to "NoValue" Pylance(reportArgumentType)

Similarly, Visual Studio Code used to have no issues with the following code:

DATABASES = {
    "default": env.db("DATABASE_URL_default", default="sqlite:///db.sqlite3"),
}

But in recent versions, "sqlite:///db.sqlite3" is underlined in red. Hovering over it shows this:

Argument of type "Literal['sqlite:///db.sqlite3']" cannot be assigned to parameter "default" of type "NoValue" in function "db_url"
  "Literal['sqlite:///db.sqlite3']" is not assignable to "NoValue" Pylance(reportArgumentType)

I don't know if the issue is with django-environ or Pylance or Pyright.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions