I just noticed this error after updating to the latest version of babylon.js (5.54.0), using typescript 4.9.3.
ERROR(TypeScript) Cannot find name 'DOMString'. Did you mean 'String'?
FILE node_modules/@babylonjs/core/Engines/engine.d.ts:1600:26
1598 |
1599 | class GPUPipelineError extends DOMException {
> 1600 | constructor(message: DOMString | undefined, options: GPUPipelineErrorInit);
| ^^^^^^^^^
1601 | readonly reason: GPUPipelineErrorReason;
1602 | }
1603 |
Maybe it’s just a typo?
Still doesn’t seem to work after adding the lib compiler option. But why is this needed? As far as I can tell it just maps to a normal string (although I couldn’t find much info about DOMString). The message variable in the DOMException is just a normal string. I also can’t find any info in the documentation of babylonjs or the changelog that we need another setting like this in tsconfig.
Having same problem too just now. Can’t compile due to this, everything has come to a standstill…
Happened when I tried to add gltf exporter from the babylon/serializer package using npm.
Now after I remove it, this problem still stops me from compiling…
I guess it updated babylon.js at the same time.
“outDir”: “./dist/out-tsc”,
“forceConsistentCasingInFileNames”: true,
“strictPropertyInitialization”: false,
“strict”: true,
“noImplicitOverride”: true,
“noPropertyAccessFromIndexSignature”: true,
“noImplicitReturns”: true,
“noFallthroughCasesInSwitch”: true,
“sourceMap”: true,
“declaration”: false,
“downlevelIteration”: true,
“experimentalDecorators”: true,
“moduleResolution”: “node”,
“importHelpers”: true,
“target”: “es2015”,
“module”: “es2020”,
“lib”: [
“es2018”,
“dom”
“useDefineForClassFields”: false,
I tried a lot of different suggestions for “lib” section, but they all give this error;
[ng] Error: node_modules/@babylonjs/core/Engines/engine.d.ts:1600:26 - error TS2552: Cannot find name ‘DOMString’. Did you mean ‘String’?
[ng] 1600 constructor(message: DOMString | undefined, options: GPUPipelineErrorInit);
[ng] ~~~~~~~~~
[ng] node_modules/typescript/lib/lib.es5.d.ts:536:13
[ng] 536 declare var String: StringConstructor;
[ng] ~~~~~~
[ng] ‘String’ is declared here.
[ng] × Failed to compile.
I squeezed a tiny change here Fix asset Container crash with predicate by sebavan · Pull Request #13720 · BabylonJS/Babylon.js · GitHub it should address the issue.
cc @Evgeni_Popov
Same error, can’t build application with the latest BabylonJS
Error: node_modules/@babylonjs/core/Engines/engine.d.ts:1600:26 - error TS2552: Cannot find name 'DOMString'. Did you mean 'String'?
1600 constructor(message: DOMString | undefined, options: GPUPipelineErrorInit);
~~~~~~~~~
node_modules/typescript/lib/lib.es5.d.ts:530:13
530 declare var String: StringConstructor;
~~~~~~
'String' is declared here.
Ok - so I did that and it worked. If anyone is like me here is the workaround;
create a file global.d.ts somewhere that will be imported - in angular this was the ‘src’ folder.
Add in this line;
type DOMString = string;
and rebuild.
Now I am back to my original task - saving GLTF files; unfortunately this is still broken;
[ng] Error: node_modules/@babylonjs/serializers/glTF/2.0/glTFSerializer.d.ts:3:32 - error TS2307: Cannot find module ‘@babylonjs/core/Animations.js’ or its corresponding type declarations.
[ng] 3 import type { Animation } from “@babylonjs/core/Animations.js”;
[ng] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
this seems to be a problem inside the serializer, so I am lost again…
Some fun facts…Angular ships with a hard coded version of typescript. This is because google verifies new tsc versions before they update their internal megarepo and angular’s ts version matches the typescript version used internally at google. So… the real issue is the ts settings shipping with angular i think.
To the op. Do you have “skipLibCheck: true” on? Thats supposed to skip type checking of dependencies, however if you’re in a monorepo that can get messed up. There are other settings that can mess it up for type declaration imports and interop with babel but il skip that for now. For monorepos or non standard folder layouts, You can set the include and exclude properties in your tsconfig . Typically include src and exclude node_modules, dist, build, but if you’re in a mono repo u can do a nested glob for something like packages/*/node_modules