diff --git a/types/mapbox-gl/index.d.ts b/types/mapbox-gl/index.d.ts index 26b37616f7..fc78b68361 100644 --- a/types/mapbox-gl/index.d.ts +++ b/types/mapbox-gl/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Mapbox GL JS v0.53.0 +// Type definitions for Mapbox GL JS v0.54.0 // Project: https://github.com/mapbox/mapbox-gl-js // Definitions by: Dominik Bruderer // Patrick Reames @@ -658,6 +658,10 @@ declare namespace mapboxgl { setHTML(html: string): this; setDOMContent(htmlNode: Node): this; + + getMaxWidth(): string; + + setMaxWidth(maxWidth: string): this; } export interface PopupOptions { @@ -670,6 +674,8 @@ declare namespace mapboxgl { offset?: number | PointLike | { [key: string]: PointLike; }; className?: string; + + maxWidth?: string; } export interface Style { diff --git a/types/mapbox-gl/mapbox-gl-tests.ts b/types/mapbox-gl/mapbox-gl-tests.ts index 2db8e2855f..875b0720d6 100644 --- a/types/mapbox-gl/mapbox-gl-tests.ts +++ b/types/mapbox-gl/mapbox-gl-tests.ts @@ -289,10 +289,24 @@ map.removeFeatureState(featureIdentifier); /** * Popup */ -var popup = new mapboxgl.Popup({closeOnClick: false, closeButton: true, anchor: 'top-right', offset: {'top': [0,0], 'bottom': [25,-50]}, className: 'custom-class' }) +const popupOptions = { + closeOnClick: false, + closeButton: true, + anchor: 'top-right' as mapboxgl.Anchor, + offset: { + 'top': [0,0] as [number, number], + 'bottom': [25,-50] as [number, number] + }, + className: 'custom-class', + maxWidth: '400px' +}; +expectType(popupOptions); +const popup = new mapboxgl.Popup(popupOptions) .setLngLat([-50, 50]) .setHTML('

Hello World!

') + .setMaxWidth('none') .addTo(map); +popup.getMaxWidth(); /** * Add an image