basedmypy
basedmypy copied to clipboard
Based Python static type checker with baseline, sane default settings and based typing features
```py t: Truthy = None # error: `None` can't be `True` f: Falsey = 1 # error: `1` can't be `False` ``` maybe also a `helpful-bool` which only accepts types...
like `keyof` in ts: ```py def f[T](t: T, a: AttributeOf[T]): f(1, "real") # ok f(1, "fake") # error ```
- disable based denotations - ban type inference on external apis? that sounds like a different issue entirely @jorenham any suggestions?
```py a: Ellipsis = Ellipsis ``` this should be valid because `Ellipsis` is a single inhabitant type
```py from __future__ import annotations from typing import Callable AnyCallable = Callable[..., object] # type: ignore[no-any-explicit] def wrap[TCallable: AnyCallable, **P, R](fn: TCallable & Callable[P, R]): ... def f() -> int:...
```py a: "list[int] | None" ``` ```py > mypy test.py --tb --python-version 3.8 test.py:1:4: error: "list" is not subscriptable, use "typing.List" instead [misc] a: "list[int] | None" ^ Found 1...