rhino3dm icon indicating copy to clipboard operation
rhino3dm copied to clipboard

Missing and wrong Typescript definitions

Open jesterKing opened this issue 2 years ago • 1 comments

https://discourse.mcneel.com/t/rhino3dm-js-issues-in-the-typescript-declaration-file/141504

  • BasepointZero -> BasePointZero
  • double missing
  • byte missing

Relates to #433

jesterKing avatar Apr 22 '22 10:04 jesterKing

I am having the same issue. Additionally, rhino3dm.d.ts is not included in the most recent version, 7.15.0

opdich avatar Aug 11 '22 20:08 opdich

you need to add a declaration file to convert js modules to typescript. A declaration file (with the .d.ts extension) is a TypeScript file that contains type declarations for a module, library, or API. These declarations provide type information for JavaScript code, allowing the TypeScript compiler to type-check and provide type-safe access to the code.

declare module 'rhino3dm' 
 // Declare the types and interfaces for therhino3dmmodule here. 

// For example: 
export interface Point { x: number; y: number; z: number; } 

ghaaflan avatar Jan 05 '23 17:01 ghaaflan

Dusting off this issue.

  • [x] BasepointZero -> BasePointZero - the js bindings were using BasePointZero (p capitalized) where in the rest of the codebase it is BasepointZero.
  • [x] double missing - double doesn't exist in js, and the real issue is that we are not returning the appropriate type for an internal class that we use to create tuples. In the particular case where the ts defs are wrong, we should probably be returning a number[].
  • [x] byte missing - here we return a Uint8Array, but we are not picking that up in the ts definitions

fraguada avatar Feb 06 '23 15:02 fraguada

The issues above have been fixed in docgen. Here is an example of what this produces (zipped to for GitHub): rhino3dm.d.ts.zip

fraguada avatar Feb 07 '23 10:02 fraguada

Closing. Tracking additional issues in #431

fraguada avatar Feb 09 '23 14:02 fraguada

There still seems to be an issue with the d.ts files. 8.4.0 went out with a poor d.ts file. Reopening to see if I can get a better system in place.

fraguada avatar Mar 07 '24 11:03 fraguada

Updated definitions are in the dev branch: https://github.com/mcneel/rhino3dm/blob/dev/src/js/rhino3dm.d.ts

fraguada avatar Mar 14 '24 15:03 fraguada