aframevr / aframevr/aframe

Not usable with Angular 9

Open
#4,454 2 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
17.6k
Forks
4.4k
PR merge metrics
No merged PRs in 30d

Description

Description:

  • A-Frame Version: 1.0.4
  • Platform / Device: Angular/Web

With Angular 9, aframe is not working. The three.js dependency throws an error:

ERROR in node_modules/three/src/geometries/ExtrudeGeometry.d.ts:2:10 - error TS2440: Import declaration conflicts with local declaration of 'UVGenerator'.

      2 import { UVGenerator } from './ExtrudeGeometry';
                 ~~~~~~~~~~~
      node_modules/three/src/materials/ShaderMaterial.d.ts:1:10 - error TS2440: Import declaration conflicts with local declaration of 'ShaderMaterialParameters'.

      1 import { ShaderMaterialParameters } from './ShaderMaterial';
                 ~~~~~~~~~~~~~~~~~~~~~~~~

I think the cause is this: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#local-and-imported-type-declarations-now-conflict

I noticed, that with aframe three 0.103 gets installed (i don't get it why the latest version 0.113 gets ignored from npm). Now i installed the latest three package (0.113.2) by hand, but since that i get another error:

ERROR in src/app/shared/glb-viewer/glb-viewer.component.ts:50:62 - error TS2345: Argument of type 'THREE.Object3D' is not assignable to parameter of type 'import("--snip--/ClientApp/node_modules/@types/aframe/node_modules/three/src/core/Object3D").Object3D'.
        Property 'applyMatrix' is missing in type 'THREE.Object3D' but required in type 'import("--snip--/ClientApp/node_modules/@types/aframe/node_modules/three/src/core/Object3D").Object3D'.

      50           const bbox = new AFRAME.THREE.Box3().setFromObject(mesh);
                                                                      ~~~~

        node_modules/@types/aframe/node_modules/three/src/core/Object3D.d.ts:169:3
          169   applyMatrix(matrix: Matrix4): void;
                ~~~~~~~~~~~
          'applyMatrix' is declared here.
      src/app/modules/ar/component/ar/ar.component.ts:166:64 - error TS2345: Argument of type 'THREE.Object3D' is not assignable to parameter of type 'import("--snip--/ClientApp/node_modules/@types/aframe/node_modules/three/src/core/Object3D").Object3D'.

      166             const bbox = new AFRAME.THREE.Box3().setFromObject(mesh);
                                                                         ~~~~
      src/app/modules/ar/component/ar/ar.component.ts:188:34 - error TS2345: Argument of type 'Mesh' is not assignable to parameter of type 'Object3D'.
        Type 'Mesh' is missing the following properties from type 'Object3D': customDepthMaterial, customDistanceMaterial, applyMatrix4, attach

      188       aimage.setObject3D('mesh', new AFRAME.THREE.Mesh(geometry, materials));

Any ideas?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the Angular 9 TypeScript errors in the reported three/src/geometries/ExtrudeGeometry.d.ts and three/src/materials/ShaderMaterial.d.ts files, then inspect the conflicting three.js versions under node_modules and @types/aframe. Check the reported glb-viewer.component.ts and ar.component.ts call sites; done means the project builds without the declaration conflicts or incompatible Object3D types.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, javascript, three.js, typescript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.