mourner / rbush

RBush — a high-performance JavaScript R-tree-based 2D spatial index for points and rectangles

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Typescript attempts to use missing default constructor

YarekTyshchenko opened this issue · comments

Are typescript typings up to date?

new rbush_1.default();
^

TypeError: rbush_1.default is not a constructor

on file:

import RBush from "rbush";
new RBush()

with tsconfig settings:

{
    "compilerOptions": {
        "lib": ["es2018"],
        "module": "commonjs",
        "target": "es2018"
    }
}

This is just installing with yarn add rbush @types/rbush which gives me @types/rbush 3.0.0, and rbush 3.0.1

I'm afraid I don't have a clue how to update the typings. Playing around with versions, it seems the current typings seem to work with 2.0.2 release of Rbush, so that must be it

I suggest closing as a duplicate of DefinitelyTyped/DefinitelyTyped#39315

Yeah, I don't use TypeScript and the typings are third-party so I can't really help here. My guess is that it has to do with module": "commonjs" in TS options.