#How to import the default type from a package?

5 messages · Page 1 of 1 (latest)

main moon
#

I am trying to use the default type from https://www.npmjs.com/package/@types/leaflet - so for example import type leaflet from 'leaflet' but it is not working for some reason, is there a way to use the default export type from a package?

#

I need this because sometimes I use the default export from the package - example leaflet.addTiles()...

#

when I import the package it knows the types - but I also wrote functions in another file that accept leaflet as an arg so I need to type that param as Leaflet

#

but there is no default Leaflet exported from the types package

#

import type leaflet from '@types/leaflet' gets the error Cannot use namespace 'leaflet' as a type.ts(2709)