[OpenLayers-Users] OL 4.2 with TypeScript:How to extend index.d.ts?

Olivier Guyot olivier.guyot at camptocamp.com
Mon Aug 7 08:46:00 PDT 2017


Hi,

This function is not part of the public API, hence the fact it is not
exposed in Typescript definitions. You could still use it without errors by
casting the ol.tilegrid.Tilegrid object to `any`, like so:
*(tilegridObj as any).getFullTileRange()*
Although that is obviously not the recommended way to go.

As for the execution error, Typescript would have nothing to do with that
so there's probably a problem with how the tilegrid object is created.

-- 
*camptocamp*
INNOVATIVE SOLUTIONS
BY OPEN SOURCE EXPERTS


*Olivier Guyot*
Geospatial Developer
+33 4 58 48 20 28

On Mon, Aug 7, 2017 at 4:49 PM, Ignacio Talavera <ignacio.talavera at gmail.com
> wrote:

> I'm using Openlayers v4.2.0 with typescript so I installed the
> typesDefinition with npm install --save @types/openlayers
> I need to execute the method *getFullTileRange()* from
> ol.tilegrid.TileGrid type  but is not defined in the type definition from
> @types/openlayers (index.d.ts).
> First I get a compilation error because getFullTileRange method is not
> declared in index.d.ts. I try to modify index.d.ts adding this method
> (inside my IDE to skip compilation errors) but running my app I  get this
> exection error
>
> *TypeError*: *tileGrid.getFullTileRange is not a function*.
>
> How can I extend index.d.ts to execute that function?
>
> Thanks!
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/openlayers-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20170807/e5f86dbd/attachment.html>


More information about the Users mailing list