phaser icon indicating copy to clipboard operation
phaser copied to clipboard

typescript type declaration error

Open actionmoon opened this issue 4 years ago • 2 comments

Version

  • Phaser Version: 3.52.0+
  • Operating system:
  • Browser:

Description

I found some problems when customizing the rendering pipeline.

type RenderConfig = {
    pipline?: Phaser.Types.Core.PipelineConfig; 
}

typescript type declaration error, must be pipeline ?

type PipelineConfig = {
    /**
     * The name of the pipeline. Must be unique within the Pipeline Manager.
     */
    name: string;
    /**
     * The pipeline class. This should be a constructable object, **not** an instance of a class.
     */
    pipeline: Phaser.Renderer.WebGL.WebGLPipeline;
};
type PipelineConfig = { [key:string]: Phaser.Renderer.WebGL.WebGLPipeline }

actionmoon avatar Jun 21 '21 07:06 actionmoon

Maybe use typeof?

sgtrusty avatar Jun 28 '21 09:06 sgtrusty

Or an array of WebGLPipeline, i.e.

type PipelineConfig = Phaser.Renderer.WebGL.WebGLPipeline[];

seems working, too.

For example, in this demo, line 43.

pipeline: { 'ColorPostFX': ColorPostFX, 'BendPostFX': BendPostFX, 'HueRotate': HueRotate }

and this works too.

pipeline: [ColorPostFX, BendPostFX, HueRotate ]

rexrainbow avatar May 12 '22 17:05 rexrainbow