angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

'L' has no exported member 'control'. error after running ng test

Open mahmoud-nb opened this issue 9 years ago • 3 comments

i use leaflet plugin in my angluar/cli projet.

Versions.

@angular/cli: 1.0.1 node: 6.9.5 os: win32 x64 @angular/common: 4.0.3 @angular/compiler: 4.0.3 @angular/core: 4.0.3 @angular/forms: 4.0.3 @angular/http: 4.0.3 @angular/platform-browser: 4.0.3 @angular/platform-browser-dynamic: 4.0.3 @angular/router: 4.0.3 @angular/cli: 1.0.1 @angular/compiler-cli: 4.0.3

Repro steps.

i have impted some plugins in my componeent, for example leaflet like leaflet, Everything works fine. But when I run the test with ng test, I have errors like

ERROR in MY_COMPONENET.component.ts (14,19): Namespace 'L' has no exported member 'control'.

any idea plz. thx

mahmoud-nb avatar May 03 '17 10:05 mahmoud-nb

npm install @types/leaflet?

ddimaria avatar May 05 '17 08:05 ddimaria

thx @ddimaria, so i found a solution that I must define the types to export in tsconfig.ts file like

"types": [ "leaflet", "nvd3", ... ],
"typeRoots": [ "leaflet",  "dhtmlxscheduler",  "nvd3", ... ]

mahmoud-nb avatar May 05 '17 08:05 mahmoud-nb

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.