pixijs/spine

Runtime 4.1 does not play nice with TypeScript strict mode

qtiki opened this issue · 2 comments

Trying to use the runtime 4.1 with strict: enabled causes a bunch of errors like this:

node_modules/@pixi-spine/runtime-4.1/index.d.ts:78:64 - error TS2344: Type 'AnimationStateData' does not satisfy the constraint 'IAnimationStateData<ISkeletonData<IBoneData, ISlotData, ISkin, IAnimation<ITimeline>, IEventData, IIkConstraintData, ITransformConstraintData, IPathConstraintData>, IAnimation<...>>'.
  The types of 'skeletonData.name' are incompatible between these types.
    Type 'string | null' is not assignable to type 'string'.
      Type 'null' is not assignable to type 'string'.

78 export declare class AnimationState implements IAnimationState<AnimationStateData> {
                                                                  ~~~~~~~~~~~~~~~~~~

Older runtimes 4.0 and 3.8 compile correctly even with the strict mode.

Easiest way to reproduce/fix these issues is to enable strictNullChecks: true in the project's tsconfig.json. That'll throw a bunch of compile errors.

Though looking at the core Pixi.js repository it doesn't seem to have strict null checks enabled either. It would be great if these packages would be fully strict mode compliant.

Okay seems like there is already an issue about this for Pixi itself: pixijs/pixijs#8852