Skip to content

Type definition for Typescript #86

@sklay-games

Description

@sklay-games

Would it be possible to add type definitions to this project so it is easier to import it as a module?

Below is an example that works for me which lets me import Delaunator as a module (import Delaunator from 'delaunator') in a Typescript project. I am not entirely sure if the type definition is 100% accurate though.

File: delaunator.d.ts

declare module 'delaunator' {
    export default class Delaunator<T extends Record<number, number>> {
        triangles: Uint32Array
        halfedges: Int32Array
        hull: Uint32Array
        coords: Float64Array

        constructor(coords: Float64Array);

        static from(points: T[], getX?: (p: T) => number, getY?: (p: T) => number): Delaunator<T>;
    }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions