From a7a71f2be36a37bac063bed8f21fda4f744284ac Mon Sep 17 00:00:00 2001 From: Alexandre Date: Mon, 16 Oct 2017 19:57:48 +0100 Subject: [PATCH] Fix some mapbox-gl mismatching typings (#20472) * Fix some mapbox-gl mismatching typings * Increase version and fix ts options * Remove flag * Add back strictFunctionTypes: true flag * More types fix * Make fill-outline-color optional --- types/mapbox-gl/index.d.ts | 12 ++++++------ types/mapbox-gl/mapbox-gl-tests.ts | 22 +++++++++++----------- types/mapbox-gl/tsconfig.json | 4 ++-- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/types/mapbox-gl/index.d.ts b/types/mapbox-gl/index.d.ts index ec154e4ab1..43921b1593 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.39.1 +// Type definitions for Mapbox GL JS v0.40.1 // Project: https://github.com/mapbox/mapbox-gl-js // Definitions by: Dominik Bruderer , Patrick Reames // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -87,7 +87,7 @@ declare namespace mapboxgl { getLayer(id: string): mapboxgl.Layer; - setFilter(layer: string, filter: any[]): this; + setFilter(layer: string, filter?: any[]): this; setLayerZoomRange(layerId: string, minzoom: number, maxzoom: number): this; @@ -224,7 +224,7 @@ declare namespace mapboxgl { /** If true, enable keyboard shortcuts (see KeyboardHandler). */ keyboard?: boolean; - logoPosition?: boolean; + logoPosition?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'; /** If set, the map is constrained to the given bounds. */ maxBounds?: LngLatBoundsLike; @@ -944,7 +944,7 @@ declare namespace mapboxgl { "fill-antialias"?: boolean; "fill-opacity"?: number | StyleFunction; "fill-color"?: string | StyleFunction; - "fill-outline-color": string | StyleFunction; + "fill-outline-color"?: string | StyleFunction; "fill-translate"?: number[]; "fill-translate-anchor"?: "map" | "viewport"; "fill-pattern"?: "string"; @@ -958,9 +958,9 @@ declare namespace mapboxgl { "fill-extrusion-color"?: string | StyleFunction; "fill-extrusion-translate"?: number[]; "fill-extrusion-translate-anchor"?: "map" | "viewport"; - "fill-extrusion-pattern": string; + "fill-extrusion-pattern"?: string; "fill-extrusion-height"?: number | StyleFunction; - "fill-extrusion-base"?: number; + "fill-extrusion-base"?: number | StyleFunction; } export interface LineLayout { diff --git a/types/mapbox-gl/mapbox-gl-tests.ts b/types/mapbox-gl/mapbox-gl-tests.ts index 12fbac9010..10768549ca 100644 --- a/types/mapbox-gl/mapbox-gl-tests.ts +++ b/types/mapbox-gl/mapbox-gl-tests.ts @@ -303,16 +303,6 @@ var mapStyle = { ] }; -map = new mapboxgl.Map({ - container: 'map', - minZoom: 14, - zoom: 17, - center: [-122.514426, 37.562984], - bearing: -96, - style: videoStyle, - hash: false -}); - /** * Add video */ @@ -362,10 +352,20 @@ map = new mapboxgl.Map({ hash: false }); +map = new mapboxgl.Map({ + container: 'map', + minZoom: 14, + zoom: 17, + center: [-122.514426, 37.562984], + bearing: -96, + style: videoStyle, + hash: false +}); + /** * Marker */ -let marker = new mapboxgl.Marker(null,{offset: [10, 0]}) +let marker = new mapboxgl.Marker(undefined, {offset: [10, 0]}) .setLngLat([-50,50]) .addTo(map); diff --git a/types/mapbox-gl/tsconfig.json b/types/mapbox-gl/tsconfig.json index 2d80f414a1..4c4228132e 100644 --- a/types/mapbox-gl/tsconfig.json +++ b/types/mapbox-gl/tsconfig.json @@ -5,9 +5,9 @@ "es6", "dom" ], + "strictNullChecks": true, "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ @@ -21,4 +21,4 @@ "index.d.ts", "mapbox-gl-tests.ts" ] -} \ No newline at end of file +}