galacean / engine

A typescript interactive engine, support 2D, 3D, animation, physics, built on WebGL and glTF.
https://www.galacean.com/engine
MIT License
4.29k stars 307 forks source link

galacean package missing some types #1574

Open MrKou47 opened 1 year ago

MrKou47 commented 1 year ago

Describe the bug When building a TypeScript project with emitDeclarationOnly=true in tsconfig.json, some type errors occurred and indicated that the galacean package was missing some type declarations.

To Reproduce Steps to reproduce the behavior:

  1. Create a ts config
  2. import some galacean api
  3. setup tsconfig with "declaration": true and "emitDeclarationOnly": true
  4. run tsc

Expected behavior No errors occurred during build processing.

Screenshots

> tsc -p tsconfig.dts.json

node_modules/_@galacean_engine-core@0.9.11@@galacean/engine-core/types/2d/sprite/SpriteMask.d.ts:2:10 - error TS2305: Module '"../../RenderPipeline/RenderContext"' has no exported member 'RenderContext'.

2 import { RenderContext } from "../../RenderPipeline/RenderContext";
           ~~~~~~~~~~~~~

node_modules/_@galacean_engine-core@0.9.11@@galacean/engine-core/types/2d/sprite/SpriteRenderer.d.ts:2:10 - error TS2305: Module '"../../RenderPipeline/RenderContext"' has no exported member 'RenderContext'.

2 import { RenderContext } from "../../RenderPipeline/RenderContext";
           ~~~~~~~~~~~~~

node_modules/_@galacean_engine-core@0.9.11@@galacean/engine-core/types/2d/text/TextRenderer.d.ts:3:10 - error TS2305: Module '"../../RenderPipeline/RenderContext"' has no exported member 'RenderContext'.

3 import { RenderContext } from "../../RenderPipeline/RenderContext";
           ~~~~~~~~~~~~~

node_modules/_@galacean_engine-core@0.9.11@@galacean/engine-core/types/2d/text/TextRenderer.d.ts:5:10 - error TS2305: Module '"../../Transform"' has no exported member 'TransformModifyFlags'.

5 import { TransformModifyFlags } from "../../Transform";
           ~~~~~~~~~~~~~~~~~~~~

node_modules/_@galacean_engine-core@0.9.11@@galacean/engine-core/types/Engine.d.ts:15:10 - error TS2305: Module '"./RenderPipeline/RenderContext"' has no exported member 'RenderContext'.

15 import { RenderContext } from "./RenderPipeline/RenderContext";
            ~~~~~~~~~~~~~

node_modules/_@galacean_engine-core@0.9.11@@galacean/engine-core/types/material/Material.d.ts:1:24 - error TS2307: Cannot find module '@galacean/engine-design' or its corresponding type declarations.

1 import { IClone } from "@galacean/engine-design";
                         ~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/_@galacean_engine-core@0.9.11@@galacean/engine-core/types/mesh/MeshRenderer.d.ts:2:10 - error TS2305: Module '"../RenderPipeline/RenderContext"' has no exported member 'RenderContext'.

2 import { RenderContext } from "../RenderPipeline/RenderContext";
           ~~~~~~~~~~~~~

node_modules/_@galacean_engine-core@0.9.11@@galacean/engine-core/types/mesh/SkinnedMeshRenderer.d.ts:3:10 - error TS2305: Module '"../RenderPipeline/RenderContext"' has no exported member 'RenderContext'.

3 import { RenderContext } from "../RenderPipeline/RenderContext";
           ~~~~~~~~~~~~~

node_modules/_@galacean_engine-core@0.9.11@@galacean/engine-core/types/physics/joint/Joint.d.ts:1:24 - error TS2307: Cannot find module '@galacean/engine-design' or its corresponding type declarations.

1 import { IJoint } from "@galacean/engine-design";
                         ~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/_@galacean_engine-core@0.9.11@@galacean/engine-core/types/physics/joint/Joint.d.ts:11:35 - error TS2304: Cannot find name 'JointCollider'.

11     protected _connectedCollider: JointCollider;
                                     ~~~~~~~~~~~~~

node_modules/_@galacean_engine-core@0.9.11@@galacean/engine-core/types/physics/joint/Joint.d.ts:12:26 - error TS2304: Cannot find name 'JointCollider'.

12     protected _collider: JointCollider;
                            ~~~~~~~~~~~~~

node_modules/_@galacean_engine-core@0.9.11@@galacean/engine-core/types/physics/PhysicsManager.d.ts:1:26 - error TS2307: Cannot find module '@galacean/engine-design' or its corresponding type declarations.

1 import { IPhysics } from "@galacean/engine-design";
                           ~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/_@galacean_engine-core@0.9.11@@galacean/engine-core/types/Renderer.d.ts:3:10 - error TS2305: Module '"./RenderPipeline/RenderContext"' has no exported member 'RenderContext'.

3 import { RenderContext } from "./RenderPipeline/RenderContext";
           ~~~~~~~~~~~~~

node_modules/_@galacean_engine-core@0.9.11@@galacean/engine-core/types/Renderer.d.ts:4:10 - error TS2305: Module '"./Transform"' has no exported member 'TransformModifyFlags'.

4 import { TransformModifyFlags } from "./Transform";
           ~~~~~~~~~~~~~~~~~~~~

node_modules/_@galacean_engine-core@0.9.11@@galacean/engine-core/types/RenderPipeline/BasicRenderPipeline.d.ts:5:10 - error TS2305: Module '"./RenderContext"' has no exported member 'RenderContext'.

5 import { RenderContext } from "./RenderContext";
           ~~~~~~~~~~~~~

node_modules/_@galacean_engine-core@0.9.11@@galacean/engine-core/types/RenderPipeline/SpriteElement.d.ts:1:10 - error TS2305: Module '"../2d/data/RenderData2D"' has no exported member 'RenderData2D'.

1 import { RenderData2D } from "../2d/data/RenderData2D";
           ~~~~~~~~~~~~

node_modules/_@galacean_engine-core@0.9.11@@galacean/engine-core/types/RenderPipeline/SpriteMaskElement.d.ts:1:10 - error TS2305: Module '"../2d/data/RenderData2D"' has no exported member 'RenderData2D'.

1 import { RenderData2D } from "../2d/data/RenderData2D";
           ~~~~~~~~~~~~

node_modules/_@galacean_engine-core@0.9.11@@galacean/engine-core/types/shader/ShaderData.d.ts:1:24 - error TS2307: Cannot find module '@galacean/engine-design' or its corresponding type declarations.

1 import { IClone } from "@galacean/engine-design";
                         ~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/_@galacean_engine-core@0.9.11@@galacean/engine-core/types/trail/TrailRenderer.d.ts:3:10 - error TS2305: Module '"../RenderPipeline/RenderContext"' has no exported member 'RenderContext'.

3 import { RenderContext } from "../RenderPipeline/RenderContext";
           ~~~~~~~~~~~~~

node_modules/_@galacean_engine-loader@0.9.11@@galacean/engine-loader/types/resource-deserialize/index.d.ts:7:33 - error TS2307: Cannot find module './resources/mesh/IModelMesh' or its corresponding type declarations.

7 export type { IModelMesh } from "./resources/mesh/IModelMesh";
                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/_@galacean_engine-loader@0.9.11@@galacean/engine-loader/types/resource-deserialize/resources/prefab/PrefabDesign.d.ts:3:24 - error TS2307: Cannot find module '../mesh/IModelMesh' or its corresponding type declarations.

3 import { IColor } from "../mesh/IModelMesh";
                         ~~~~~~~~~~~~~~~~~~~~

node_modules/_@galacean_engine-rhi-webgl@0.9.11@@galacean/engine-rhi-webgl/types/GLTexture.d.ts:6:22 - error TS2420: Class 'GLTexture' incorrectly implements interface 'IPlatformTexture'.
  Property 'setUseDepthCompareMode' is missing in type 'GLTexture' but required in type 'IPlatformTexture'.

6 export declare class GLTexture implements IPlatformTexture {
                       ~~~~~~~~~

  node_modules/_@galacean_engine-core@0.9.11@@galacean/engine-core/types/renderingHardwareInterface/IPlatformTexture.d.ts:35:5
    35     setUseDepthCompareMode(value: boolean): any;
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    'setUseDepthCompareMode' is declared here.

node_modules/_@galacean_engine-rhi-webgl@0.9.11@@galacean/engine-rhi-webgl/types/GLTexture2DArray.d.ts:7:22 - error TS2420: Class 'GLTexture2DArray' incorrectly implements interface 'IPlatformTexture2DArray'.
  Property 'setUseDepthCompareMode' is missing in type 'GLTexture2DArray' but required in type 'IPlatformTexture2DArray'.

7 export declare class GLTexture2DArray extends GLTexture implements IPlatformTexture2DArray {
                       ~~~~~~~~~~~~~~~~

  node_modules/_@galacean_engine-core@0.9.11@@galacean/engine-core/types/renderingHardwareInterface/IPlatformTexture.d.ts:35:5
    35     setUseDepthCompareMode(value: boolean): any;
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    'setUseDepthCompareMode' is declared here.

node_modules/_@galacean_engine-rhi-webgl@0.9.11@@galacean/engine-rhi-webgl/types/WebGLRenderer.d.ts:2:36 - error TS2307: Cannot find module '@galacean/engine-design' or its corresponding type declarations.

2 import { IPlatformPrimitive } from "@galacean/engine-design";
                                     ~~~~~~~~~~~~~~~~~~~~~~~~~

src/materials/ToonEyeMat.ts:169:46 - error TS2339: Property '_directLights' does not exist on type 'LightManager'.

169     let lightIndex = engine["_lightManager"]._directLights._elements.findIndex(
                                                 ~~~~~~~~~~~~~

src/materials/ToonEyeMat.ts:173:48 - error TS2339: Property '_getSunLightIndex' does not exist on type 'LightManager'.

173       lightIndex < 0 ? engine["_lightManager"]._getSunLightIndex() : lightIndex;
                                                   ~~~~~~~~~~~~~~~~~

Found 26 errors in 21 files.

Errors  Files
     1  node_modules/_@galacean_engine-core@0.9.11@@galacean/engine-core/types/2d/sprite/SpriteMask.d.ts:2
     1  node_modules/_@galacean_engine-core@0.9.11@@galacean/engine-core/types/2d/sprite/SpriteRenderer.d.ts:2
     2  node_modules/_@galacean_engine-core@0.9.11@@galacean/engine-core/types/2d/text/TextRenderer.d.ts:3
     1  node_modules/_@galacean_engine-core@0.9.11@@galacean/engine-core/types/Engine.d.ts:15
     1  node_modules/_@galacean_engine-core@0.9.11@@galacean/engine-core/types/material/Material.d.ts:1
     1  node_modules/_@galacean_engine-core@0.9.11@@galacean/engine-core/types/mesh/MeshRenderer.d.ts:2
     1  node_modules/_@galacean_engine-core@0.9.11@@galacean/engine-core/types/mesh/SkinnedMeshRenderer.d.ts:3
     3  node_modules/_@galacean_engine-core@0.9.11@@galacean/engine-core/types/physics/joint/Joint.d.ts:1
     1  node_modules/_@galacean_engine-core@0.9.11@@galacean/engine-core/types/physics/PhysicsManager.d.ts:1
     2  node_modules/_@galacean_engine-core@0.9.11@@galacean/engine-core/types/Renderer.d.ts:3
     1  node_modules/_@galacean_engine-core@0.9.11@@galacean/engine-core/types/RenderPipeline/BasicRenderPipeline.d.ts:5
     1  node_modules/_@galacean_engine-core@0.9.11@@galacean/engine-core/types/RenderPipeline/SpriteElement.d.ts:1
     1  node_modules/_@galacean_engine-core@0.9.11@@galacean/engine-core/types/RenderPipeline/SpriteMaskElement.d.ts:1
     1  node_modules/_@galacean_engine-core@0.9.11@@galacean/engine-core/types/shader/ShaderData.d.ts:1
     1  node_modules/_@galacean_engine-core@0.9.11@@galacean/engine-core/types/trail/TrailRenderer.d.ts:3
     1  node_modules/_@galacean_engine-loader@0.9.11@@galacean/engine-loader/types/resource-deserialize/index.d.ts:7
     1  node_modules/_@galacean_engine-loader@0.9.11@@galacean/engine-loader/types/resource-deserialize/resources/prefab/PrefabDesign.d.ts:3
     1  node_modules/_@galacean_engine-rhi-webgl@0.9.11@@galacean/engine-rhi-webgl/types/GLTexture.d.ts:6
     1  node_modules/_@galacean_engine-rhi-webgl@0.9.11@@galacean/engine-rhi-webgl/types/GLTexture2DArray.d.ts:7
     1  node_modules/_@galacean_engine-rhi-webgl@0.9.11@@galacean/engine-rhi-webgl/types/WebGLRenderer.d.ts:2
     2  src/materials/ToonEyeMat.ts:169

Env (please complete the following information):

gz65555 commented 1 year ago

Use skipLibCheck to ignore the problem