Open
Description
The Map.setStyle()
function's options
param has a type of SetStyleOptions
, which is defined in src/ui/map.ts as follows:
export type SetStyleOptions = {
diff?: boolean;
config?: {
[key: string]: ConfigSpecification;
};
localFontFamily: StyleOptions['localFontFamily'];
localIdeographFontFamily: StyleOptions['localIdeographFontFamily'];
};
However, the documentation (https://docs.mapbox.com/mapbox-gl-js/api/map/#map#setstyle) doesn't specify a required localFontFamily
field. The documentation also states that localIdeographFontFamily
has a default value, which seems to suggest that it shouldn't be a required field.
mapbox-gl-js version: 3.7.0
browser: N/A
Steps to Trigger Behavior
- Create a new Node project and include mapbox-gl 3.7.0 in package.json
- In a Typescript file, import mapboxgl and create a new Map object
- Call
setStyle()
on the map object and pass it an empty object for the options param
Expected Behavior
Typescript should not show any errors.
Actual Behavior
Typescript shows the following error:
Argument of type '{}' is not assignable to parameter of type 'SetStyleOptions'.
Type '{}' is missing the following properties from type 'SetStyleOptions': localFontFamily, localIdeographFontFamily