Skip to content

Instantly share code, notes, and snippets.

@gwillz gwillz/react-leaflet.d.ts
Last active Aug 23, 2018

What would you like to do?
React-Leaflet type definitions for v2.0 (extension for existing @types/react-leaflet)
import * as React from 'react'
import * as L from 'leaflet'
import 'react-leaflet'
declare module 'react-leaflet' {
export interface LeafletContext {
map?: L.Map,
pane?: string,
layerContainer?: LayerContainer,
popupContainer?: L.Layer,
export class LeafletConsumer extends React.Component<React.ConsumerProps<LeafletContext>> {}
export class LeafletProvider extends React.Component<React.ProviderProps<LeafletContext>> {}
export type WrappedProps = {
leaflet: LeafletContext;
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
export function withLeaflet<T extends WrappedProps>(WrappedComponent: React.ComponentType<T>): React.ComponentType<Omit<T, 'leaflet'>>;
export interface MapLayer {
contextValue?: LeafletContext;
export interface Map {
contextValue?: LeafletContext;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.