quentinlampin / ngx-openlayers

Angular2+ components for Openlayers 4.x
Mozilla Public License 2.0
137 stars 98 forks source link

Developing #6

Closed FallenRiteMonk closed 7 years ago

FallenRiteMonk commented 7 years ago

Running npm install on a clean clone of the project results in the following error once reaching prepublish tsc command. The exact message that is outputted is;

> angular2-openlayers@0.1.4 prepublish /home/fallenritemonk/dev/angular2-openlayers
> tsc

src/components/coordinate.component.ts(45,73): error TS2339: Property 'getCode' does not exist on type 'Projection'.
src/components/coordinate.component.ts(94,73): error TS2339: Property 'getCode' does not exist on type 'Projection'.
src/components/feature.component.ts(21,17): error TS2339: Property 'removeFeature' does not exist on type 'SourceVectorComponent'.
quentin-ol commented 7 years ago

The type definitions for openlayers 3.18.2 are incomplete. The ol.proj.Projection objects do have a getCode method (http://openlayers.org/en/latest/apidoc/ol.proj.Projection.html) as removeFeature is a legit method of the ol.source.Vector objects (http://openlayers.org/en/latest/apidoc/ol.source.Vector.html). I added them manually to my typings and forgot to prepare a PR. I will get one ready soon. In the meantime, add those methods to index.d.ts of openlayers, e.g.

Class Projection {
            constructor(options: olx.Projection);

            getCode(): string;
            getExtent(): Extent;

            /**
             * Set the validity extent for this projection.
             * @param extent The new extent of the projection.
             */
            setExtent(extent: Extent): void;
        }

Sorry for the inconvenience.

quentin-ol commented 7 years ago

Hey @FallenRiteMonk,

Sorry for the delay. I've finally found the time to look into this issue: 68fad72264ece33cc90b2f65fe7f12f517105692 should fix it.

quentin-ol commented 7 years ago

Closing, feel free to re-open if problem still occurs for you.

FallenRiteMonk commented 7 years ago

That problem seems to be fixed, but now I'm missing some files. Here the error I get:

src/components.ts(10,72): error TS2307: Cannot find module './components/style.components'.
src/components.ts(20,15): error TS2307: Cannot find module './components/style.components'.

either you they were just not commited, or the line importing them should have stayed commented out!