use namespace as type in typescript July 24, 2023 by Tarik Try: function mapFactory(api: typeof google.maps) { return new api.Map(); }