use assertInternalType for typechecking