-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Convert text-bitmap package to TypeScript #6479
Convert text-bitmap package to TypeScript #6479
Conversation
Alright @lloydevans! Just ping us when this is ready for review or if you have any questions. Lots of packages have been completed so far, check out text, which is pretty close to this one. |
@bigtimebuddy Thanks! will do. Yea did have a couple of questions but looking at the text PR and existing packages answered things. |
Hey @bigtimebuddy, I think I've done a good chunk of the conversion here. Some of it needs slightly bigger refactoring work to get full type coverage. I've opted for casting things to any over refactoring code just to silence typescript errors for now. BitmapFont.ts - Converted fine for the most part, with the need to cast data going to the auto-selected format parser as any. BitmapFontData.ts - The JSDoc comments mark properties as readonly, but it is changed from outside of the class in the format parsers. Maybe this only needs to be an interface now? BitmapFontLoader.ts - Some need for any around the resource object as the custom bitmap font loader adds some additional properties there. BitmapText.ts - Fine for the most part, but there are two things. One is the BitmapTextStyle.ts - This is a new file I've added with some interfaces for text style. Would you prefer these interface/types live at the top of the BitmapText.ts file? TextFormat.ts - This file has a few TS issues with the way it's accessing properties on the bitmap font data object from string attribute names. It is also using parseInt to both cast to number and floor I believe, but TypeScript errors passing a number to parseInt. I've cast things to any for now, but could possibly look at doing a bit of refactoring here to avoid that. XMLFormat.ts - Apart from the wider point about the format classes, this one converted fine. |
Possibly want to add some validation for this?
Codecov Report
@@ Coverage Diff @@
## dev #6479 +/- ##
==========================================
- Coverage 83.01% 82.48% -0.53%
==========================================
Files 45 38 -7
Lines 2272 1907 -365
==========================================
- Hits 1886 1573 -313
+ Misses 386 334 -52 Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two small comments but otherwise looks good!
Thank you @lloydevans! |
Description of change
Convert text-bitmap package to TypeScript.
Pre-Merge Checklist
npm run lint
)npm run test
)