Rhino3dm.js issues in the TypeScript declaration file

Hi there!

I am part of the ShapeDiver team and we are currently working on a TypeScript SDK for our Structured Data Transfer Format (sdTF). It’s basically an API-neutral exchange and storage format for trees of data items as used by parametric 3D modeling software like Grasshopper and works neatly with our Grasshopper output components.
And, for obvious reasons, we would like to integrate the rhino3dm-library as well. However, we encountered the following problems in the rhino3dm.d.ts TypeScript declaration file (version 7.14.0), which prevents us from actually typing Rhino components:

  • BasepointZero should be BasePointZero (line 1648)
  • byte is not declared (lines 1953 and 1957).
  • double is not declared (line 4835).

Here is a small example to recreate these issues:

// script.ts
import { RhinoModule, Sphere } from "rhino3dm"

const rhino3dm = require('rhino3dm')

rhino3dm().then((rhino: RhinoModule) => {
  const sphere: Sphere = new rhino.Sphere([1,2,3,], 12)
  console.log(sphere.radius)
})

It would be great if you could fix these issues.

Many thanks!

1 Like

Logged as Missing and wrong Typescript definitions · Issue #470 · mcneel/rhino3dm · GitHub

@Matt24 you can also log bugs there yourself. And if you have fixes in your own fork then don’t hesitate to create pull requests.

I’ve updated our docgen project which is responsible for updating the typescript definitions.

These have all been fixed. Please check the d.ts file attached to the comment: Missing and wrong Typescript definitions · Issue #470 · mcneel/rhino3dm · GitHub

Let me know if there are other issues you find!