Getting "Cannot find name 'IGLTFValidationResults'." with Basic .d.ts Setup

Here’s how I setup a minimal example:

  1. I copied these three files distribution files into a directory:
  • /dist/babylon.d.ts
  • /dist/gltf2Interface/babylon.glTF2Interface.d.ts
  • /dist/loaders/babylon.glTF2FileLoader.d.ts
  1. Create an empty test.ts file in the directory. Then create a tsconfig.json with the following contents:
{
	"compilerOptions": {
		"target": "ES2019",
		"outFile": "typescript.js",
	},
	"include": [
		"*.ts",
	],
}
  1. In the directory, run tsc. (I’ve currently got version 3.8.3.) Should see the following output:
babylon.glTF2FileLoader.d.ts:240:52 - error TS2304: Cannot find name 'IGLTFValidationResults'.

240         readonly onValidatedObservable: Observable<IGLTFValidationResults>;
                                                       ~~~~~~~~~~~~~~~~~~~~~~

babylon.glTF2FileLoader.d.ts:245:32 - error TS2304: Cannot find name 'IGLTFValidationResults'.

245         onValidated: (results: IGLTFValidationResults) => void;
                                   ~~~~~~~~~~~~~~~~~~~~~~


Found 2 errors.

Workaround: For the moment I’m around this by making both lines use GLTF2.IGLTFValidationResults rather than just IGLTFValidationResults.

Not sure if this is a sign I’m missing something from the tsconfig.json file or if the code just has a typo.

This is the include to use:
import { IGLTFValidationResults } from "babylonjs-gltf2interface";

So you should be fine with the files you mentioned :frowning:
Pinging @sebavan to see if he has an idea

Could you try with 4.1 ??? and let us know. I agree this sounds strange and should not be the case.

Pulled the /dist files from the 4.1.0 tag, and got the same result.

This is really strange as it seems to work for me on blank projects but there is obviously smthg wrong. Could you share a repro on github ?

Here’s the setup stored in a Git repo: GitHub - aaron-human/BabylonErrorExample: Showing the code that I ran that led to some strange errors.

Ohhhhhhh gotcha you should use https://raw.githubusercontent.com/BabylonJS/Babylon.js/master/dist/preview%20release/loaders/babylonjs.loaders.d.ts or the full loaders one for stable as well.

Actually we are not generated the smaller loaders and basically the file is a left over from earlier version. I will remove them from the dist folder to prevent any further confusion tomorrow.

That worked for me, thanks!