'TypeScript: Declare external dependency class typings missing in DefinitelyTyped package
I'm trying to declare class types that are missing from a DefinitelyTyped package by using a d.ts file within my project.
The external dependency in question is matter-js, a dependency whose typings in DefinitelyTyped are a few versions out of date.
There is a class called Detector that exists in the matter-js package but is missing from the type package.
When I try to add the type definition:
declare module 'matter-js' {
export class Detector {
static create(): Detector
static collisions(detector: Detector): ICollision[]
static setBodies(detector: Detector, bodies: Body[]): void
bodies: Body[]
}
}
...it basically just replaces the type for the whole module, and I get "no exported member" errors for every other export of 'matter-js' besides Detector.
If I try to add the definition to the '@types/matter-js' module, "no exported member" comes back for the Detector import.
There are many similar questions but many of them just extend an interface with an additional attribute, which doesn't seem to the same "no exported member" issue. I'm just looking to add some missing type information until the typings package can be updated, is there some straightforward way to do this?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
