👽️ lib._type_check_impl sync with upstream
#804
Merged
lib._type_check_impl sync with upstream
#804