Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add type annotations for TiledPixiTrack and utils #1184

Open
wants to merge 17 commits into
base: develop
Choose a base branch
from

Conversation

etowahadams
Copy link
Collaborator

@etowahadams etowahadams commented Oct 29, 2023

Towards #1172

  • types for TiledPixiTrack.js
  • types for utils/pixi-text-to-svg.js
  • types for utils/svg-line.js

Description

What was changed in this pull request?

Why is it necessary?

Fixes #___

Checklist

  • Set proper GitHub labels (e.g. v1.6+, ignore if you don't know)
  • Unit tests added or updated
  • Documentation added or updated
  • Example(s) added or updated
  • Update schema.json if there are changes to the viewconf JSON structure format
  • Screenshot for visual changes (e.g. new tracks or UI changes)
  • Updated CHANGELOG.md

@etowahadams
Copy link
Collaborator Author

TiledPixiTrack is 95% of the way there. There are a few gnarly areas I could use some help on though. Perhaps we can discuss on Thursday or find a time before then.



/**
* @template {ExtendedPixiOptions<{[key: string]: any}>} Options
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since classes which extend this one call super with the options which later gets set to this.options, I need a template of an object which must have all of the PixiTrackOptions but can have any other additional property

@etowahadams
Copy link
Collaborator Author

One existing challenge is to get the HandleTilesetInfoFinished implementation to satisfy all three types

export type HandleTilesetInfoFinished = {
(info: null): void;
(info: TilesetInfo, tilesetUid?: string): void;
(error: { error: string }): void;
};

@manzt
Copy link
Member

manzt commented Nov 28, 2023

One existing challenge is to get the HandleTilesetInfoFinished implementation to satisfy all three types

Agreed. It seems like that the usage of that function has been overloaded over time. Overloads are annoying to implement in TypeScript and often require lying to the typechecker. I wonder if a more flexbile definitoin would be easier to implement:

 export type HandleTilesetInfoFinished = { 
    (info: TilesetInfo | null | { error: string }, tilesetUid?: string): void; 
 }; 

@etowahadams etowahadams marked this pull request as ready for review December 6, 2023 22:07
@manzt
Copy link
Member

manzt commented Dec 7, 2023

Looking forward to reviewing this, but won't be able to until after this weekend. Let me know if you are blocked

@etowahadams
Copy link
Collaborator Author

No problem, have a good weekend!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants