Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors with types when installing ngx-three #38

Open
allicen opened this issue Jun 2, 2023 · 0 comments
Open

Errors with types when installing ngx-three #38

allicen opened this issue Jun 2, 2023 · 0 comments

Comments

@allicen
Copy link

allicen commented Jun 2, 2023

When I try to import the library into the project, I get errors:

Error: node_modules/ngx-three/lib/generated/ThDataTexture2DArray.d.ts:2:10 - error TS2305: Module '"three"' has no exported member 'DataTexture2DArray'.
2 import { DataTexture2DArray } from 'three';
           ~~~~~~~~~~~~~~~~~~
Error: node_modules/ngx-three/lib/generated/ThDataTexture3D.d.ts:2:10 - error TS2724: '"three"' has no exported member named 'DataTexture3D'. Did you mean 'DataTexture'?
2 import { DataTexture3D } from 'three';
           ~~~~~~~~~~~~~
  node_modules/@types/three/src/textures/DataTexture.d.ts:40:14
    40 export class DataTexture extends Texture {
                    ~~~~~~~~~~~
    'DataTexture' is declared here.
Error: node_modules/ngx-three/lib/generated/ThMapControls.d.ts:3:10 - error TS2305: Module '"three/examples/jsm/controls/OrbitControls"' has no exported member 'MapControls'.
3 import { MapControls } from 'three/examples/jsm/controls/OrbitControls';
           ~~~~~~~~~~~
Error: node_modules/ngx-three/lib/loaders/ThAsyncLoaderBase.d.ts:10:30 - error TS2344: Type 'T["loadAsync"]' does not satisfy the constraint '(...args: any) => any'.
10     load(...args: Parameters<T['loadAsync']>): ReturnType<T['loadAsync']>;
                                ~~~~~~~~~~~~~~
Error: node_modules/ngx-three/lib/loaders/ThAsyncLoaderBase.d.ts:10:30 - error TS2536: Type '"loadAsync"' cannot be used to index type 'T'.
10     load(...args: Parameters<T['loadAsync']>): ReturnType<T['loadAsync']>;
                                ~~~~~~~~~~~~~~
Error: node_modules/ngx-three/lib/loaders/ThAsyncLoaderBase.d.ts:10:59 - error TS2344: Type 'T["loadAsync"]' does not satisfy the constraint '(...args: any) => any'.
10     load(...args: Parameters<T['loadAsync']>): ReturnType<T['loadAsync']>;
                                                             ~~~~~~~~~~~~~~
Error: node_modules/ngx-three/lib/loaders/ThAsyncLoaderBase.d.ts:10:59 - error TS2536: Type '"loadAsync"' cannot be used to index type 'T'.
10     load(...args: Parameters<T['loadAsync']>): ReturnType<T['loadAsync']>;
                                                             ~~~~~~~~~~~~~~
Error: node_modules/ngx-three/lib/loaders/ThAsyncLoaderBase.d.ts:18:5 - error TS2416: Property 'transform' in type 'ThAsyncLoaderBasePipe<T>' is not assignable to the same property in base type 'PipeTransform'.
  Type '(...args: Parameters<T["loadAsync"]>) => Promise<any>' is not assignable to type '(value: any, ...args: any[]) => any'.
    Types of parameters 'args' and 'value' are incompatible.
      Type '[value: any, ...args: any[]]' is not assignable to type 'Parameters<T["loadAsync"]>'.

18     transform(...args: Parameters<T['loadAsync']>): Promise<any>;
       ~~~~~~~~~
Error: node_modules/ngx-three/lib/loaders/ThAsyncLoaderBase.d.ts:18:35 - error TS2344: Type 'T["loadAsync"]' does not satisfy the constraint '(...args: any) => any'.

18     transform(...args: Parameters<T['loadAsync']>): Promise<any>;
                                     ~~~~~~~~~~~~~~
Error: node_modules/ngx-three/lib/loaders/ThAsyncLoaderBase.d.ts:18:35 - error TS2536: Type '"loadAsync"' cannot be used to index type 'T'.

18     transform(...args: Parameters<T['loadAsync']>): Promise<any>;
                                     ~~~~~~~~~~~~~~
Error: node_modules/ngx-three/lib/loaders/ThAsyncLoaderBase.d.ts:26:72 - error TS2344: Type 'T["loadAsync"]' does not satisfy the constraint '(...args: any) => any'.

26     protected abstract getRefFromResponse(response: Awaited<ReturnType<T['loadAsync']>>): any;
                                                                          ~~~~~~~~~~~~~~
Error: node_modules/ngx-three/lib/loaders/ThAsyncLoaderBase.d.ts:26:72 - error TS2536: Type '"loadAsync"' cannot be used to index type 'T'.
26     protected abstract getRefFromResponse(response: Awaited<ReturnType<T['loadAsync']>>): any;
                                                                          ~~~~~~~~~~~~~~
Error: node_modules/ngx-three/lib/loaders/ThAsyncLoaderBase.d.ts:28:33 - error TS2344: Type 'T["loadAsync"]' does not satisfy the constraint '(...args: any) => any'.
28     protected _url?: Parameters<T['loadAsync']>[0];
                                   ~~~~~~~~~~~~~~
Error: node_modules/ngx-three/lib/loaders/ThAsyncLoaderBase.d.ts:28:33 - error TS2536: Type '"loadAsync"' cannot be used to index type 'T'.
28     protected _url?: Parameters<T['loadAsync']>[0];

Package.json:

"dependencies": {
    "@angular/animations": "^15.1.1",
    "@angular/cdk": "^15.1.1",
    "@angular/common": "^15.1.1",
    "@angular/compiler": "^15.1.1",
    "@angular/core": "^15.1.1",
    "@angular/forms": "^15.1.1",
    "@angular/material": "^15.1.1",
    "@angular/platform-browser": "^15.1.1",
    "@angular/platform-browser-dynamic": "^15.1.1",
    "@angular/router": "^15.1.1",
    "@ngneat/until-destroy": "^9.2.3",
    "ng-mesh-viewer": "0.0.7",
    "ngx-roslib": "^1.0.2",
    "ngx-three": "0.26.0",
    "rxjs": "~7.8.0",
    "three": "~0.151.0",
    "tslib": "^2.3.1",
    "zone.js": "~0.12.0"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^15.1.1",
    "@angular/cli": "^15.1.1",
    "@angular/compiler-cli": "^15.1.1",
    "@types/jasmine": "~4.3.0",
    "@types/three": "~0.151.0",
    "jasmine-core": "~4.5.0",
    "karma": "~6.4.0",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage": "~2.2.0",
    "karma-jasmine": "~5.1.0",
    "karma-jasmine-html-reporter": "~2.0.0",
    "typescript": "~4.9.4"
  }

npm info ngx-three peerDependencies:

{
  '@angular/common': '^15.1.1',
  '@angular/core': '^15.1.1',
  three: '~0.151.0'
}

Is there any way to fix this? Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant