connor-makowski / type_enforced

A pure python type enforcer for annotations. Enforce types in python functions and methods.
MIT License
45 stars 2 forks source link

Add support for iterable types that are ands and not ors #45

Open connor-makowski opened 2 days ago

connor-makowski commented 2 days ago
import type_enforced

@type_enforced.Enforcer
def test(
    x: [list[str]|list[int]]
) -> None:
    pass

test([1, 2, 3])  # Passes
test(["a", "b", "c"])  # Passes
test(["a",2,3] # Passes but should fail

Related to #44