rexrainbow / phaser3-rex-notes

Notes of phaser3 engine
MIT License
1.22k stars 263 forks source link

Missing type definition in OutlinePipelinePlugin's config #291

Closed johnedvard closed 2 years ago

johnedvard commented 2 years ago

First of all. Thanks for providing an outline shader.

I'm using Phaser 3.55.2 with Typescript. I'm using the outline pipeline, and noticed I wasn't allowed to set thickness in my config because it's not a known property in the type definition

I followed the example here: https://github.com/rexrainbow/phaser3-rex-notes/blob/master/examples/shader-outline/gameobject-postfx.js#L27 to add thickness to my outline.

In my code. I do the following:

import OutlinePipelinePlugin from 'phaser3-rex-plugins/plugins/outlinepipeline-plugin';

create() {
    this.outlinePlugin = <OutlinePipelinePlugin>(
      this.plugins.get('rexOutlinePipeline')
    );
    this.outlinePlugin.add(gameobject, {
      thickness: 8, // cannot set this property. Argument of type '{ thickness: number; outlineColor: number; }' is not assignable to parameter of type 'IConfig'.
      outlineColor: 0x72ac31,
   });
}

If I cast the outlinePlugin to any, I can add thickness which it works in my game. I thought it was either a matter of me using the wrong type, or the type definition missing one property in it's IConfig.

rexrainbow commented 2 years ago

d.ts file updated. NPM package will upgrade at end of this month.