problems getting Typescript bindings @types/jsts to work with jsts

547 views
Skip to first unread message

Menelaos Perdikeas

unread,
Feb 10, 2021, 11:39:10 AM2/10/21
to JSTS devs
Hi,

I am developing for the browser using webpack.

I did the following to install the package and its Typescript bindings for the browser:

npm i --S jsts
npm i --D @types/jsts

After that, I can do:

import OL3Parser from 'jsts/org/locationtech/jts/io/OL3Parser';

... but I get a Typescript type-checking error:

TS7016: Could not find a declaration file for module 'jsts/org/locationtech/jts/io/OL3Parser'. '/home/some/path/node_modules/jsts/org/locationtech/jts/io/OL3Parser.js' implicitly has an 'any' type.

Any ideas?


Menelaos Perdikeas

unread,
Feb 11, 2021, 7:03:21 AM2/11/21
to JSTS devs
In the end I managed to get it to work with:

    const jsts = require('jsts');
    const parser: jsts.io.OL3Parser = new jsts.io.OL3Parser();

But I don't understand why and whether this is the suggested / idiomatic way.
Full story is here:

Reply all
Reply to author
Forward
0 new messages