Online3DViewer icon indicating copy to clipboard operation
Online3DViewer copied to clipboard

module.d.ts bad typings create error when using on typescript projects

Open raffaeldp opened this issue 1 year ago • 0 comments

In the color.js file, some functions are typed like this :

/**
     * @param {integer} r Red component.
     * @param {integer} g Green component.
     * @param {integer} b Blue component.
     * @param {integer} a Alpha component.
     */

When the o3dv.module.d.ts is generated, the integer is used to type the function parameters :

Set(r: integer, g: integer, b: integer, a: integer): void;

The issue is that typescript can't find what 'integer' is. Here is an example of the error while using angular : image

The only solution for the moment is to skip the typescript libcheck by changing the skipLibCheck option to true in the project who use o3dv :

// tsconfig.json
{
    "compilerOptions": {
        ...
        "skipLibCheck": true,
    }
}

But it was not turned on since then and it would be nice that it stays on false.

Is there a specific reason for theses to be typed with "integer" instead of "number" ? Maybe we can replace it by "number" and the problem will be gone ? I will try to provide a Pull Request very soon to do this. Any other idea to fix this issue ?

Ty

raffaeldp avatar Oct 07 '24 12:10 raffaeldp