spine icon indicating copy to clipboard operation
spine copied to clipboard

Bug: When updating to pixijs v 7.2.4 when using boilerplate projet a lot of typescript errors are generated

Open mjscosta opened this issue 1 year ago • 1 comments

Current Behavior

A lot of errors on build due to typescript:

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> {
                                                                  ~~~~~~~~~~~~~~~~~~

node_modules/@pixi-spine/runtime-4.1/index.d.ts:84:5 - error TS2416: Property 'tracks' in type 'AnimationState' is not assignable to the same property in base type 'IAnimationState<AnimationStateData>'.
  Type 'TrackEntry[]' is not assignable to type 'ITrackEntry[]'.
    Type 'TrackEntry' is not assignable to type 'ITrackEntry'.
      Types of property 'listener' are incompatible.
        Type 'AnimationStateListener | null' is not assignable to type 'IAnimationStateListener'.
          Type 'null' is not assignable to type 'IAnimationStateListener'.

84     tracks: TrackEntry[];
       ~~~~~~

node_modules/@pixi-spine/runtime-4.1/index.d.ts:92:5 - error TS2416: Property 'listeners' in type 'AnimationState' is not assignable to the same property in base type 'IAnimationState<AnimationStateData>'.
  Type 'AnimationStateListener[]' is not assignable to type 'IAnimationStateListener[]'.
    Type 'AnimationStateListener' is not assignable to type 'IAnimationStateListener'.
      Types of property 'start' are incompatible.
        Type '((entry: TrackEntry) => void) | undefined' is not assignable to type '((entry: ITrackEntry) => void) | undefined'.
          Type '(entry: TrackEntry) => void' is not assignable to type '(entry: ITrackEntry) => void'.
            Types of parameters 'entry' and 'entry' are incompatible.
              Type 'ITrackEntry' is missing the following properties from type 'TrackEntry': animation, previous, next, mixingFrom, and 27 more.

92     listeners: AnimationStateListener[];
       ~~~~~~~~~

node_modules/@pixi-spine/runtime-4.1/index.d.ts:105:5 - error TS2416: Property 'apply' in type 'AnimationState' is not assignable to the same property in base type 'IAnimationState<AnimationStateData>'.
  Type '(skeleton: Skeleton) => boolean' is not assignable to type '(skeleton: ISkeleton<ISkeletonData<IBoneData, ISlotData, ISkin, IAnimation<ITimeline>, IEventData, IIkConstraintData, ITransformConstraintData, IPathConstraintData>, IBone, ISlot, ISkin>) => boolean'.
    Types of parameters 'skeleton' and 'skeleton' are incompatible.
      Type 'ISkeleton<ISkeletonData<IBoneData, ISlotData, ISkin, IAnimation<ITimeline>, IEventData, IIkConstraintData, ITransformConstraintData, IPathConstraintData>, IBone, ISlot, ISkin>' is missing the following properties from type 'Skeleton': ikConstraints, transformConstraints, pathConstraints, _updateCache, and 21 more.

105     apply(skeleton: Skeleton): boolean;
        ~~~~~

node_modules/@pixi-spine/runtime-4.1/index.d.ts:125:5 - error TS2416: Property 'setAnimation' in type 'AnimationState' is not assignable to the same property in base type 'IAnimationState<AnimationStateData>'.
  Type '(trackIndex: number, animationName: string, loop?: boolean | undefined) => TrackEntry' is not assignable to type '(trackIndex: number, animationName: string, loop: boolean) => ITrackEntry'.
    Type 'TrackEntry' is not assignable to type 'ITrackEntry'.

125     setAnimation(trackIndex: number, animationName: string, loop?: boolean): TrackEntry;
        ~~~~~~~~~~~~

node_modules/@pixi-spine/runtime-4.1/index.d.ts:136:5 - error TS2416: Property 'addAnimation' in type 'AnimationState' is not assignable to the same property in base type 'IAnimationState<AnimationStateData>'.
  Type '(trackIndex: number, animationName: string, loop?: boolean | undefined, delay?: number | undefined) => TrackEntry' is not assignable to type '(trackIndex: number, animationName: string, loop: boolean, delay: number) => ITrackEntry'.
    Type 'TrackEntry' is not assignable to type 'ITrackEntry'.

136     addAnimation(trackIndex: number, animationName: string, loop?: boolean, delay?: number): TrackEntry;
        ~~~~~~~~~~~~

node_modules/@pixi-spine/runtime-4.1/index.d.ts:160:5 - error TS2416: Property 'setEmptyAnimation' in type 'AnimationState' is not assignable to the same property in base type 'IAnimationState<AnimationStateData>'.
  Type '(trackIndex: number, mixDuration?: number | undefined) => TrackEntry' is not assignable to type '(trackIndex: number, mixDuration: number) => ITrackEntry'.
    Type 'TrackEntry' is not assignable to type 'ITrackEntry'.

160     setEmptyAnimation(trackIndex: number, mixDuration?: number): TrackEntry;
        ~~~~~~~~~~~~~~~~~

node_modules/@pixi-spine/runtime-4.1/index.d.ts:172:5 - error TS2416: Property 'addEmptyAnimation' in type 'AnimationState' is not assignable to the same property in base type 'IAnimationState<AnimationStateData>'.
  Type '(trackIndex: number, mixDuration?: number | undefined, delay?: number | undefined) => TrackEntry' is not assignable to type '(trackIndex: number, mixDuration: number, delay: number) => ITrackEntry'.
    Type 'TrackEntry' is not assignable to type 'ITrackEntry'.

172     addEmptyAnimation(trackIndex: number, mixDuration?: number, delay?: number): TrackEntry;
        ~~~~~~~~~~~~~~~~~

node_modules/@pixi-spine/runtime-4.1/index.d.ts:186:5 - error TS2416: Property 'addListener' in type 'AnimationState' is not assignable to the same property in base type 'IAnimationState<AnimationStateData>'.
  Type '(listener: AnimationStateListener) => void' is not assignable to type '(listener: IAnimationStateListener) => void'.
    Types of parameters 'listener' and 'listener' are incompatible.
      Type 'IAnimationStateListener' is not assignable to type 'AnimationStateListener'.
        Types of property 'start' are incompatible.
          Type '((entry: ITrackEntry) => void) | undefined' is not assignable to type '((entry: TrackEntry) => void) | undefined'.
            Type '(entry: ITrackEntry) => void' is not assignable to type '(entry: TrackEntry) => void'.
              Types of parameters 'entry' and 'entry' are incompatible.
                Type 'TrackEntry' is not assignable to type 'ITrackEntry'.

186     addListener(listener: AnimationStateListener): void;
        ~~~~~~~~~~~

node_modules/@pixi-spine/runtime-4.1/index.d.ts:188:5 - error TS2416: Property 'removeListener' in type 'AnimationState' is not assignable to the same property in base type 'IAnimationState<AnimationStateData>'.
  Type '(listener: AnimationStateListener) => void' is not assignable to type '(listener: IAnimationStateListener) => void'.
    Types of parameters 'listener' and 'listener' are incompatible.
      Type 'IAnimationStateListener' is not assignable to type 'AnimationStateListener'.

188     removeListener(listener: AnimationStateListener): void;
        ~~~~~~~~~~~~~~

node_modules/@pixi-spine/runtime-4.1/index.d.ts:223:72 - error TS2344: Type 'SkeletonData' does not satisfy the constraint 'ISkeletonData<IBoneData, ISlotData, ISkin, IAnimation<ITimeline>, IEventData, IIkConstraintData, ITransformConstraintData, IPathConstraintData>'.

223 export declare class AnimationStateData implements IAnimationStateData<SkeletonData, Animation_2> {
                                                                           ~~~~~~~~~~~~

node_modules/@pixi-spine/runtime-4.1/index.d.ts:250:26 - error TS2430: Interface 'AnimationStateListener' incorrectly extends interface 'IAnimationStateListener'.

250 export declare interface AnimationStateListener extends IAnimationStateListener {
                             ~~~~~~~~~~~~~~~~~~~~~~

node_modules/@pixi-spine/runtime-4.1/index.d.ts:338:5 - error TS2416: Property 'data' in type 'Bone' is not assignable to the same property in base type 'IBone'.
  Type 'BoneData' is not assignable to type 'IBoneData'.
    Types of property 'parent' are incompatible.
      Type 'BoneData | null' is not assignable to type 'IBoneData'.
        Type 'null' is not assignable to type 'IBoneData'.

338     data: BoneData;
        ~~~~

node_modules/@pixi-spine/runtime-4.1/index.d.ts:489:5 - error TS2416: Property 'endSlot' in type 'ClippingAttachment' is not assignable to the same property in base type 'IClippingAttachment'.
  Type 'SlotData | null' is not assignable to type 'ISlotData | undefined'.
    Type 'null' is not assignable to type 'ISlotData | undefined'.

489     endSlot: SlotData | null;
        ~~~~~~~

node_modules/@pixi-spine/runtime-4.1/index.d.ts:770:5 - error TS2416: Property 'region' in type 'MeshAttachment' is not assignable to the same property in base type 'IMeshAttachment'.
  Type 'TextureRegion | null' is not assignable to type 'TextureRegion'.
    Type 'null' is not assignable to type 'TextureRegion'.

770     region: TextureRegion | null;
        ~~~~~~

node_modules/@pixi-spine/runtime-4.1/index.d.ts:789:5 - error TS2416: Property 'sequence' in type 'MeshAttachment' is not assignable to the same property in base type 'IHasTextureRegion'.
  Type 'Sequence | null' is not assignable to type 'ISequence | null'.
    Type 'Sequence' is not assignable to type 'ISequence'.
      Types of property 'apply' are incompatible.
        Type '(slot: Slot, attachment: IHasTextureRegion) => void' is not assignable to type '(slot: ISlot, attachment: IHasTextureRegion) => void'.
          Types of parameters 'slot' and 'slot' are incompatible.
            Type 'ISlot' is not assignable to type 'Slot'.

789     sequence: Sequence | null;
        ~~~~~~~~

node_modules/@pixi-spine/runtime-4.1/index.d.ts:789:5 - error TS2416: Property 'sequence' in type 'MeshAttachment' is not assignable to the same property in base type 'IMeshAttachment'.
  Type 'Sequence | null' is not assignable to type 'ISequence | undefined'.
    Type 'null' is not assignable to type 'ISequence | undefined'.

789     sequence: Sequence | null;
        ~~~~~~~~

node_modules/@pixi-spine/runtime-4.1/index.d.ts:799:5 - error TS2416: Property 'computeWorldVertices' in type 'MeshAttachment' is not assignable to the same property in base type 'IMeshAttachment'.
  Type '(slot: Slot, start: number, count: number, worldVertices: NumberArrayLike, offset: number, stride: number) => void' is not assignable to type '(slot: ISlot, start: number, count: number, worldVertices: ArrayLike<number>, offset: number, stride: number) => void'.
    Types of parameters 'slot' and 'slot' are incompatible.
      Type 'ISlot' is missing the following properties from type 'Slot': attachment, attachmentState, sequenceIndex, deform, and 3 more.

799     computeWorldVertices(slot: Slot, start: number, count: number, worldVertices: NumberArrayLike, offset: number, stride: number): void;
        ~~~~~~~~~~~~~~~~~~~~

node_modules/@pixi-spine/runtime-4.1/index.d.ts:967:5 - error TS2416: Property 'region' in type 'RegionAttachment' is not assignable to the same property in base type 'IRegionAttachment'.
  Type 'TextureRegion | null' is not assignable to type 'TextureRegion'.
    Type 'null' is not assignable to type 'TextureRegion'.

967     region: TextureRegion | null;
        ~~~~~~

node_modules/@pixi-spine/runtime-4.1/index.d.ts:968:5 - error TS2416: Property 'sequence' in type 'RegionAttachment' is not assignable to the same property in base type 'IHasTextureRegion'.
  Type 'Sequence | null' is not assignable to type 'ISequence | null'.

968     sequence: Sequence | null;
        ~~~~~~~~

node_modules/@pixi-spine/runtime-4.1/index.d.ts:968:5 - error TS2416: Property 'sequence' in type 'RegionAttachment' is not assignable to the same property in base type 'IRegionAttachment'.
  Type 'Sequence | null' is not assignable to type 'ISequence | undefined'.

968     sequence: Sequence | null;
        ~~~~~~~~

node_modules/@pixi-spine/runtime-4.1/index.d.ts:1119:5 - error TS2416: Property 'apply' in type 'Sequence' is not assignable to the same property in base type 'ISequence'.
  Type '(slot: Slot, attachment: IHasTextureRegion) => void' is not assignable to type '(slot: ISlot, attachment: IHasTextureRegion) => void'.

1119     apply(slot: Slot, attachment: IHasTextureRegion): void;
         ~~~~~

node_modules/@pixi-spine/runtime-4.1/index.d.ts:1194:52 - error TS2344: Type 'SkeletonData' does not satisfy the constraint 'ISkeletonData<IBoneData, ISlotData, ISkin, IAnimation<ITimeline>, IEventData, IIkConstraintData, ITransformConstraintData, IPathConstraintData>'.

1194 export declare class Skeleton implements ISkeleton<SkeletonData, Bone, Slot, Skin> {
                                                        ~~~~~~~~~~~~

node_modules/@pixi-spine/runtime-4.1/index.d.ts:1212:5 - error TS2416: Property 'skin' in type 'Skeleton' is not assignable to the same property in base type 'ISkeleton<SkeletonData, Bone, Slot, Skin>'.
  Type 'Skin | null' is not assignable to type 'Skin'.
    Type 'null' is not assignable to type 'Skin'.

1212     skin: Skin | null;
         ~~~~

node_modules/@pixi-spine/runtime-4.1/index.d.ts:1280:5 - error TS2416: Property 'getAttachmentByName' in type 'Skeleton' is not assignable to the same property in base type 'ISkeleton<SkeletonData, Bone, Slot, Skin>'.
  Type '(slotName: string, attachmentName: string) => Attachment | null' is not assignable to type '(slotName: string, attachmentName: string) => IAttachment'.
    Type 'Attachment | null' is not assignable to type 'IAttachment'.
      Type 'null' is not assignable to type 'IAttachment'.

1280     getAttachmentByName(slotName: string, attachmentName: string): Attachment | null;
         ~~~~~~~~~~~~~~~~~~~

node_modules/@pixi-spine/runtime-4.1/index.d.ts:1356:64 - error TS2344: Type 'BoundingBoxAttachment' does not satisfy the constraint 'IVertexAttachment<ISlot>'.
  Types of property 'computeWorldVerticesOld' are incompatible.
    Type '(slot: Slot, worldVertices: ArrayLike<number>) => void' is not assignable to type '(slot: ISlot, worldVertices: ArrayLike<number>) => void'.
      Types of parameters 'slot' and 'slot' are incompatible.
        Type 'ISlot' is not assignable to type 'Slot'.

1356 export declare class SkeletonBounds extends SkeletonBoundsBase<BoundingBoxAttachment> {
                                                                    ~~~~~~~~~~~~~~~~~~~~~

node_modules/@pixi-spine/runtime-4.1/index.d.ts:1365:60 - error TS2344: Type 'BoneData' does not satisfy the constraint 'IBoneData'.

1365 export declare class SkeletonData implements ISkeletonData<BoneData, SlotData, Skin, Animation_2, EventData, IkConstraintData, TransformConstraintData, PathConstraintData> {
                                                                ~~~~~~~~

node_modules/@pixi-spine/runtime-4.1/index.d.ts:1367:5 - error TS2416: Property 'name' in type 'SkeletonData' is not assignable to the same property in base type 'ISkeletonData<BoneData, SlotData, Skin, Animation_2, EventData, IkConstraintData, TransformConstraintData, PathConstraintData>'.
  Type 'string | null' is not assignable to type 'string'.
    Type 'null' is not assignable to type 'string'.

1367     name: string | null;
         ~~~~

node_modules/@pixi-spine/runtime-4.1/index.d.ts:1377:5 - error TS2416: Property 'defaultSkin' in type 'SkeletonData' is not assignable to the same property in base type 'ISkeletonData<BoneData, SlotData, Skin, Animation_2, EventData, IkConstraintData, TransformConstraintData, PathConstraintData>'.
  Type 'Skin | null' is not assignable to type 'Skin'.
    Type 'null' is not assignable to type 'Skin'.

1377     defaultSkin: Skin | null;
         ~~~~~~~~~~~

node_modules/@pixi-spine/runtime-4.1/index.d.ts:1397:5 - error TS2416: Property 'version' in type 'SkeletonData' is not assignable to the same property in base type 'ISkeletonData<BoneData, SlotData, Skin, Animation_2, EventData, IkConstraintData, TransformConstraintData, PathConstraintData>'.
  Type 'string | null' is not assignable to type 'string'.
    Type 'null' is not assignable to type 'string'.

1397     version: string | null;
         ~~~~~~~

node_modules/@pixi-spine/runtime-4.1/index.d.ts:1399:5 - error TS2416: Property 'hash' in type 'SkeletonData' is not assignable to the same property in base type 'ISkeletonData<BoneData, SlotData, Skin, Animation_2, EventData, IkConstraintData, TransformConstraintData, PathConstraintData>'.
  Type 'string | null' is not assignable to type 'string'.
    Type 'null' is not assignable to type 'string'.

1399     hash: string | null;
         ~~~~

node_modules/@pixi-spine/runtime-4.1/index.d.ts:1521:5 - error TS2416: Property 'data' in type 'Slot' is not assignable to the same property in base type 'ISlot'.
  Type 'SlotData' is not assignable to type 'ISlotData'.
    Types of property 'boneData' are incompatible.
      Type 'BoneData' is not assignable to type 'IBoneData'.

1521     data: SlotData;
         ~~~~

node_modules/@pixi-spine/runtime-4.1/index.d.ts:1523:5 - error TS2416: Property 'bone' in type 'Slot' is not assignable to the same property in base type 'ISlot'.
  Type 'Bone' is not assignable to type 'IBone'.
    Types of property 'data' are incompatible.
      Type 'BoneData' is not assignable to type 'IBoneData'.

1523     bone: Bone;
         ~~~~

node_modules/@pixi-spine/runtime-4.1/index.d.ts:1529:5 - error TS2416: Property 'darkColor' in type 'Slot' is not assignable to the same property in base type 'ISlot'.
  Type 'Color | null' is not assignable to type 'Color'.
    Type 'null' is not assignable to type 'Color'.

1529     darkColor: Color | null;
         ~~~~~~~~~

node_modules/@pixi-spine/runtime-4.1/index.d.ts:1544:5 - error TS2416: Property 'getAttachment' in type 'Slot' is not assignable to the same property in base type 'ISlot'.
  Type '() => Attachment | null' is not assignable to type '() => IAttachment'.
    Type 'Attachment | null' is not assignable to type 'IAttachment'.
      Type 'null' is not assignable to type 'IAttachment'.

1544     getAttachment(): Attachment | null;
         ~~~~~~~~~~~~~

node_modules/@pixi-spine/runtime-4.1/index.d.ts:1562:5 - error TS2416: Property 'boneData' in type 'SlotData' is not assignable to the same property in base type 'ISlotData'.
  Type 'BoneData' is not assignable to type 'IBoneData'.

1562     boneData: BoneData;
         ~~~~~~~~

node_modules/@pixi-spine/runtime-4.1/index.d.ts:1568:5 - error TS2416: Property 'darkColor' in type 'SlotData' is not assignable to the same property in base type 'ISlotData'.
  Type 'Color | null' is not assignable to type 'Color'.
    Type 'null' is not assignable to type 'Color'.

1568     darkColor: Color | null;
         ~~~~~~~~~

node_modules/@pixi-spine/runtime-4.1/index.d.ts:1570:5 - error TS2416: Property 'attachmentName' in type 'SlotData' is not assignable to the same property in base type 'ISlotData'.
  Type 'string | null' is not assignable to type 'string'.
    Type 'null' is not assignable to type 'string'.

1570     attachmentName: string | null;
         ~~~~~~~~~~~~~~

node_modules/@pixi-spine/runtime-4.1/index.d.ts:1599:46 - error TS2344: Type 'Skeleton' does not satisfy the constraint 'ISkeleton<ISkeletonData<IBoneData, ISlotData, ISkin, IAnimation<ITimeline>, IEventData, IIkConstraintData, ITransformConstraintData, IPathConstraintData>, IBone, ISlot, ISkin>'.
  Types of property 'bones' are incompatible.
    Type 'Bone[]' is not assignable to type 'IBone[]'.
      Type 'Bone' is not assignable to type 'IBone'.

1599 export declare class Spine extends SpineBase<Skeleton, SkeletonData, AnimationState, AnimationStateData> {
                                                  ~~~~~~~~

node_modules/@pixi-spine/runtime-4.1/index.d.ts:1600:5 - error TS2416: Property 'createSkeleton' in type 'Spine' is not assignable to the same property in base type 'SpineBase<Skeleton, SkeletonData, AnimationState, AnimationStateData>'.
  Type '(spineData: SkeletonData) => void' is not assignable to type '(spineData: ISkeletonData<IBoneData, ISlotData, ISkin, IAnimation<ITimeline>, IEventData, IIkConstraintData, ITransformConstraintData, IPathConstraintData>) => any'.
    Types of parameters 'spineData' and 'spineData' are incompatible.
      Type 'ISkeletonData<IBoneData, ISlotData, ISkin, IAnimation<ITimeline>, IEventData, IIkConstraintData, ITransformConstraintData, IPathConstraintData>' is missing the following properties from type 'SkeletonData': x, y, fps, imagesPath, and 2 more.

1600     createSkeleton(spineData: SkeletonData): void;
         ~~~~~~~~~~~~~~

node_modules/@pixi-spine/runtime-4.1/index.d.ts:1640:5 - error TS2416: Property 'listener' in type 'TrackEntry' is not assignable to the same property in base type 'ITrackEntry'.
  Type 'AnimationStateListener | null' is not assignable to type 'IAnimationStateListener'.
    Type 'null' is not assignable to type 'IAnimationStateListener'.

1640     listener: AnimationStateListener | null;
         ~~~~~~~~

node_modules/@types/css-font-loading-module/index.d.ts:22:9 - error TS2717: Subsequent property declarations must have the same type.  Property 'display' must be of type 'FontDisplay | undefined', but here has type 'string | undefined'.

22         display?: string | undefined;
           ~~~~~~~

  node_modules/typescript/lib/lib.dom.d.ts:549:5
    549     display?: FontDisplay;
            ~~~~~~~
    'display' was also declared here.

node_modules/@types/css-font-loading-module/index.d.ts:42:9 - error TS2717: Subsequent property declarations must have the same type.  Property 'display' must be of type 'FontDisplay', but here has type 'string'.

42         display: string;
           ~~~~~~~

  node_modules/typescript/lib/lib.dom.d.ts:8523:5
    8523     display: FontDisplay;
             ~~~~~~~
    'display' was also declared here.


Found 43 errors in 2 files.

Errors  Files
    41  node_modules/@pixi-spine/runtime-4.1/index.d.ts:78
     2  node_modules/@types/css-font-loading-module/index.d.ts:22

Expected Behavior

Build with no errors.

Steps to Reproduce

git clone https://github.com/mjscosta/pixi-typescript-boilerplate
cd pixi-typescript-boilerplate
npm install
npm run build

Environment

Possible Solution

No response

Additional Information

No response

mjscosta avatar Sep 14 '23 10:09 mjscosta

you could use the non forked version of the boilerplate , which i recently updated.

there was a tsc --no-emit script in there which caused your issue

yordan-kanchelov avatar Dec 26 '23 14:12 yordan-kanchelov