I am struggling to get a reference to an exported namespace for the leaflet type definitions in my TypeScript project.
After installing the types using npm install --save @types/leaflet
my TS compiler (I am using VS Code) is able to find some of the exported classes and interfaces in the type definition file, e.g. Transformation, Class, but I am unable to access any of the namespaces exported.
I need to be able to reference the L
global so I can make calls to the leaflet API, but the compiler is not picking this up for me.
I did try using an import statement in my TS file I am trying to use leaflet in, e.g.
import * as L from 'leaflet'
But again, I can still only access the classes\interfaces this time on my imported alias, e.g. L.Transformation
I cannot initialise a new map, e.g by using L.map(...)
since L
is not accessible for me - map is an exported function in the type definition file
So I am unsure how to reference and use the L
global for leaflet in my project.
Can anyone assist please?
Thanks