Skip to content

Use assert_never #55

@JPHutchins

Description

@JPHutchins

Now that TypeIs is in use, exhaustive type checking can be asserted at compile time instead of run time; for example, here:

if success(response):
print(f"Received response: {response}")
elif error(response):
print(f"Received error: {response}")
else:
raise Exception(f"Unknown response: {response}")

The examples should demonstrate this approach.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationgood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions