Add type check to Environment::overrideCoreByPackage