Skip to content
This repository has been archived by the owner on Aug 19, 2023. It is now read-only.

Nullable is always Falsey #161

Merged
merged 1 commit into from
Sep 28, 2021

Conversation

snorfalorpagus
Copy link
Contributor

This PR allows mypy to understand that the Nullable type is always false-y, so that mypy finds this valid:

@dataclass
class Example:
    name: Nullable[str | None] = None

example = Example("sienna")

assert example.name  # If this assert passes we know `name` is a string (because it isn't None or Nullable)

name_upper = example.name.upper()

@s-knibbs s-knibbs merged commit ef3af27 into s-knibbs:master Sep 28, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants