Skip to content

example/jsm TS typings #17409

@MichaelBuerge

Description

@MichaelBuerge
Description of the problem

There is no checking whatsoever of the TS-typings for the code in examples/jsm.
The last few releases suffered from some broken typings. These were small things (e.g. typo, reference to non-existent file, ...), but prevented me from just updating to the release version, having to maintain an own patched up version.

For example, errors seen in a project that uses some code from example/jsm upon updating to v108:

ERROR in ../node_modules/three/examples/jsm/nodes/misc/TextureCubeUVNode.d.ts:6:46 - error TS2307: Cannot find module '../bsdfs/BlinnExponentToRoughnessNode'.

6 import { BlinnExponentToRoughnessNode } from '../bsdfs/BlinnExponentToRoughnessNode';
                                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../node_modules/three/examples/jsm/nodes/utils/SpecularMIPLevelNode.d..ts:7:3 - error TS2390: Constructor implementation is missing.
7   constructor(texture: Node);
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~
../node_modules/three/examples/jsm/nodes/utils/SpecularMIPLevelNode.d..ts:13:3 - error TS2391: Function implementation is missing or not immediately following the declaration.
13   generate(builder: NodeBuilder, output: string): string;
     ~~~~~~~~
../node_modules/three/examples/jsm/nodes/utils/SpecularMIPLevelNode.d..ts:14:3 - error TS2391: Function implementation is missing or not immediately following the declaration.
14   copy(source: SpecularMIPLevelNode): this;
     ~~~~

The lint-task in package.json already has tsc src/Three.d.ts --noEmit in it to do some basic checking of typings for the main library.
My thought was to add an equivalent call to also check all .d.ts-files in examples/jsm.

Any objections to that?

Three.js version
  • Dev
  • r108
  • ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions