Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in Angular 10 #380

Closed
daudihusbands opened this issue Nov 24, 2020 · 5 comments
Closed

Error in Angular 10 #380

daudihusbands opened this issue Nov 24, 2020 · 5 comments

Comments

@daudihusbands
Copy link

Hi,
I've just upgraded from angular 9 to 10. My app compiles and runs ok but I'm seeing the following errors

    ERROR in node_modules/ol-layerswitcher/dist/ol-layerswitcher.d.ts:255:16 - error TS2665: Invalid module name in augmentation. Module 'ol/layer/Base' resolves to an untyped module at 'C:/Users/.../node_modules/ol/layer/Base.js', which cannot be augmented.

    255 declare module 'ol/layer/Base' {
                     
    node_modules/ol-layerswitcher/dist/ol-layerswitcher.d.ts:278:16 - error TS2665: Invalid module name in augmentation. Module 'ol/layer/Group' resolves to an untyped module at 'C:/Users/.../node_modules/ol/layer/Group.js', which cannot be augmented.
    
    278 declare module 'ol/layer/Group' {
@walkermatt
Copy link
Owner

walkermatt commented Nov 24, 2020

Hi, have you installed the @types/ol package?

I think I'm going to simplify how the layer options are defined shortly but I think installing @types/ol alongside the ol package should resolve the issue you have.

If you run into this issue with@types/ol then you should be able to workaround it by updating node_modules/@types/ol/Geolocation.d.ts as per this commit by @JakobVesely.

@walkermatt
Copy link
Owner

I've just released v3.8.1, see the CHANGELOG for details.

@daudihusbands
Copy link
Author

Thanks @walkermatt. I've upgraded to latest ol, @types/ol and ol-layerswitcher. Works ok.

Had to fix quite a few errors caused by adding the @types/ol package.
For example

const layer = new Layer({
title: 'Some title'
})

had to be changed to

const layer = new Layer()
layer.set('title', 'Some title')

@walkermatt
Copy link
Owner

Great, thanks for the update 👍

You can specify layer options including layer switcher specific properties such as title via object literals by importing the extended base and group layer options interfaces as described here: https://github.com/walkermatt/ol-layerswitcher/blob/master/README.md#typescript-type-definition

@daudihusbands
Copy link
Author

Interesting. Will give it a go.
Thanks again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants