You should decalre data type for type when you declare skyLayer. Because the default type will be string and can' be pass into Layer. You can use as to do it:

  const skyLayer = {
    id: 'sky',
    type: 'sky' as 'sky',
    paint: {
      'sky-type': 'atmosphere',
      'sky-atmosphere-sun': [0.0, 0.0],
      'sky-atmosphere-sun-intensity': 15
    }
  };
Answer from Viet on Stack Overflow
🌐
npm
npmjs.com › package › @types › react-map-gl
@types/react-map-gl - npm
February 21, 2026 - TypeScript definitions for react-map-gl. Latest version: 6.1.8, last published: 13 days ago. Start using @types/react-map-gl in your project by running `npm i @types/react-map-gl`. There are 36 other projects in the npm registry using @types/react-map-gl.
      » npm install @types/react-map-gl
    
🌐
GitHub
github.com › zackhsi › react-map-gl-typescript
GitHub - zackhsi/react-map-gl-typescript: :bomb: react-map-gl + create-react-app + typescript
This repository renders a full screen Mapbox map, powered by a Typescript create-react-app—without ejecting! $ git clone git@github.com:zackhsi/react-map-gl-typescript.git
Starred by 15 users
Forked by 5 users
Languages   TypeScript 77.4% | HTML 17.7% | CSS 4.9% | TypeScript 77.4% | HTML 17.7% | CSS 4.9%
🌐
React Map GL
visgl.github.io › react-map-gl
Home | react-map-gl
Comes with additional React interfaces such as context and hooks to support custom components. Use together with e.g. deck.gl to render performant and compelling 2D and 3D WebGL visualizations on top of your MapLibre GL JS and Mapbox GL JS based maps.
🌐
React Map GL
visgl.github.io › introduction
Introduction | react-map-gl
We sometimes render two maps side by side, and when the user interacts with one, update both cameras. We draw React UI outside of the map container, that moves with the camera. We also render WebGL graphic overlays on top of the map, most notably with deck.gl.
🌐
React Map GL
visgl.github.io › what's new
What's new | react-map-gl
Almost all imperative APIs (flyTo, ... use mapbox-gl-draw, mapbox-gl-geocoder, to name a few. TypeScript compliant: the code base is now entirely written in TypeScript, and all types can be imported....
🌐
GitHub
github.com › DefinitelyTyped › DefinitelyTyped › blob › master › types › react-map-gl › index.d.ts
DefinitelyTyped/types/react-map-gl/index.d.ts at master · DefinitelyTyped/DefinitelyTyped
zoom(input: PositionInput & { scale: number; startPos?: [number, number] | undefined }): MapState; ... export class BaseControl<T extends BaseControlProps, S extends Element> extends React.PureComponent<T> {
Author   DefinitelyTyped
🌐
GitHub
github.com › visgl › react-map-gl
GitHub - visgl/react-map-gl: React friendly API wrapper around MapboxGL JS · GitHub
react-map-gl is a suite of React components designed to provide a React API for mapbox-gl or maplibre-gl.
Starred by 8.4K users
Forked by 1.4K users
Languages   TypeScript 65.5% | JavaScript 32.2%
🌐
xjavascript
xjavascript.com › blog › reactmapgl-typescript
ReactMapGL with TypeScript: A Comprehensive Guide — xjavascript.com
When using ReactMapGL with TypeScript, we can define types for props, state, and function parameters, which makes the code more self-documenting and less error-prone. Mapbox GL JS is a JavaScript library for building interactive maps.
Find elsewhere
🌐
React Map GL
visgl.github.io › upgrade guide
Upgrade Guide | react-map-gl
If using with mapbox-gl@<3.5.0: import from react-map-gl/mapbox-legacy · maplibre-gl@<=3 is no longer supported. Some TypeScript types have been renamed to align with the official types from the base map libraries: The default RTLTextPlugin loaded from mapbox.com has been removed to align with the default behavior of MapLibre.
🌐
GitHub
github.com › visgl › react-map-gl › issues › 2150
[Bug] TypeScript error after upgrading react-map-gl from 5.2.8 to 7.0.21 · Issue #2150 · visgl/react-map-gl
April 4, 2023 - I expect to be able to use the react-map-gl library in my Create React App project without encountering any errors in the node_modules/react-map-gl/ directory. ... Create a new Create React App project with TypeScript template.
Author   harurinn1
🌐
npm
npmjs.com › package › react-map-gl
react-map-gl - npm
3 weeks ago - React components for MapLibre GL JS and Mapbox GL JS. Latest version: 8.1.1, last published: 19 days ago. Start using react-map-gl in your project by running `npm i react-map-gl`. There are 482 other projects in the npm registry using react-map-gl.
      » npm install react-map-gl
    
Published   Apr 11, 2026
Version   8.1.1
🌐
CodeSandbox
codesandbox.io › s › 2hzzp
typescript-react-map-gl - CodeSandbox
October 21, 2020 - typescript-react-map-gl by jaspervercnocke using @material-ui/core, @material-ui/icons, @types/geojson, @types/react, @types/react-dom, mobx, mobx-react-lite, react, react-app-rewired
Published   Apr 07, 2020
Author   jaspervercnocke
🌐
DEV Community
dev.to › dqunbp › using-mapbox-gl-in-react-with-next-js-2glg
Using mapbox-gl in React with Next.js - DEV Community
July 6, 2021 - I prefer to import React as import * as React from "react" you can read more about this in great article by Kent C. Dodds · If // ... is encountered in the code, it must be read as places with missing duplicate code · First of all, let's create a new project in Next.js using the Typescript template. ... We also need accessToken for mapbox-gl, from environment variable so as not to store it directly in the source code
🌐
DEV Community
dev.to › franklin030601 › showing-mapbox-map-with-react-55g
Showing MapBox map with React. 🗺️ - DEV Community
July 1, 2022 - The purpose of this post is to teach how to use the MapBox GL JS library to display interactive maps in React JS applications. In this case we are going to display a map, and add an event to it, which is executed at the moment of double clicking a marker is placed at that position that was just double clicked. 🚨 Note: This post requires you to know the basics of React with TypeScript (basic hooks and fetch requests).
🌐
GitHub
github.com › urbica › react-map-gl
GitHub - urbica/react-map-gl: React Component Library for Mapbox GL JS · GitHub
Custom layers allow a user to render directly into the map's GL context using the map's camera. Here is an Uber deck.gl usage example. import React from 'react'; import MapGL, { CustomLayer } from '@urbica/react-map-gl'; import { MapboxLayer } from '@deck.gl/mapbox'; import { ScatterplotLayer } from '@deck.gl/layers'; import 'mapbox-gl/dist/mapbox-gl.css'; const myDeckLayer = new MapboxLayer({ id: 'my-scatterplot', type: ScatterplotLayer, data: [{ position: [-74.5, 40], size: 1000 }], getPosition: (d) => d.position, getRadius: (d) => d.size, getColor: [255, 0, 0] }); <MapGL style={{ width: '100%', height: '400px' }} mapStyle='mapbox://styles/mapbox/light-v9' accessToken={MAPBOX_ACCESS_TOKEN} latitude={40} longitude={-74.5} zoom={9} > <CustomLayer layer={myDeckLayer} /> </MapGL>;
Starred by 424 users
Forked by 49 users
Languages   JavaScript
🌐
CodeSandbox
codesandbox.io › examples › package › @types › react-map-gl
@types/react-map-gl examples - CodeSandbox
Use this online @types/react-map-gl playground to view and fork @types/react-map-gl example apps and templates on CodeSandbox.