Summary
This code passes type checking but throws a type error at runtime. In this code, func needs to be called as func(*P.args, **P.kwargs).
from typing import Callable
def call_function[**P, R](func: Callable[P, R]) -> None:
func()
def foo(param: int) -> None:
pass
call_function(foo) # fails at runtime: TypeError: foo() missing 1 required positional argument: 'param'
https://play.ty.dev/115c6e3e-2946-43ad-9fab-b8e4c1a1e29c
Version
ty 0.0.7