-
Notifications
You must be signed in to change notification settings - Fork 29.9k
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
[opentype.js] Improve Glyph #61702
[opentype.js] Improve Glyph #61702
Conversation
@alecmev Thank you for submitting this PR! This is a live comment which I will keep updated. 1 package in this PR
Code ReviewsBecause you edited one package and updated the tests (👏), I can help you merge this PR once someone else signs off on it. You can test the changes of this PR in the Playground. Status
All of the items on the list are green. To merge, you need to post a comment including the string "Ready to merge" to bring in your changes. Diagnostic Information: What the bot saw about this PR{
"type": "info",
"now": "-",
"pr_number": 61702,
"author": "alecmev",
"headCommitOid": "fb9c1adc735f5e5a3de644b3f9cfda77b072c14f",
"mergeBaseOid": "3f99ce278474a3f7a8bdf783dd7a2aa30849c686",
"lastPushDate": "2022-08-12T17:57:39.000Z",
"lastActivityDate": "2022-08-12T18:25:20.000Z",
"mergeOfferDate": "2022-08-12T18:24:47.000Z",
"mergeRequestDate": "2022-08-12T18:25:20.000Z",
"mergeRequestUser": "alecmev",
"hasMergeConflict": false,
"isFirstContribution": false,
"tooManyFiles": false,
"hugeChange": false,
"popularityLevel": "Well-liked by everyone",
"pkgInfo": [
{
"name": "opentype.js",
"kind": "edit",
"files": [
{
"path": "types/opentype.js/index.d.ts",
"kind": "definition"
},
{
"path": "types/opentype.js/opentype.js-tests.ts",
"kind": "test"
}
],
"owners": [
"danmarshall",
"edzis",
"peterblazejewicz"
],
"addedOwners": [],
"deletedOwners": [],
"popularityLevel": "Well-liked by everyone"
}
],
"reviews": [
{
"type": "approved",
"reviewer": "danmarshall",
"date": "2022-08-12T18:24:05.000Z",
"isMaintainer": false
}
],
"mainBotCommentID": 1213374453,
"ciResult": "pass"
} |
🔔 @danmarshall @edzis @peterblazejewicz — please review this PR in the next few days. Be sure to explicitly select |
yMax?: number | undefined; | ||
advanceWidth?: number | undefined; | ||
leftSideBearing?: number | undefined; | ||
path: Path; |
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.
The getter always returns a Path
, while the setter also accepts () => Path
, but I think it's more practical to not include it in the type. It's not possible to type them separately right now, unfortunately: microsoft/TypeScript#43662
xMin?: number | undefined; | ||
xMax?: number | undefined; | ||
yMin?: number | undefined; | ||
yMax?: number | undefined; |
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.
These aren't private.
yMin?: number | undefined; | ||
yMax?: number | undefined; | ||
advanceWidth?: number | undefined; | ||
leftSideBearing?: number | undefined; |
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.
The missing property that made me create this PR.
name: string | null; | ||
unicode?: number | undefined; |
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.
The code has no guards against these being null
/ undefined
.
|
||
private bindConstructorValues(options: GlyphOptions): void; |
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.
There's no point in calling this outside of the constructor. The library itself never uses it either.
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.
there as no point of addition 'private', just remove from declaration, so user cannot access this (unless doing module augmentation)
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.
Tried to google this when I was creating the PR, but couldn't find anything conclusive. My intention was to document this for future contributors, so that they don't add this back by mistake. Or is a comment preferred?
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.
easy, improve in future, it will come back
yMax?: number | undefined; | ||
advanceWidth?: number | undefined; | ||
leftSideBearing?: number | undefined; | ||
path?: Path | (() => Path) | undefined; |
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.
In this case it can, indeed, be a callback.
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.
LGTM
Ready to merge |
// @ts-expect-error | ||
Glyph.bindConstructorValues({}); |
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.
just remove on next iteration (private methods)
npm test <package to test>
.The actual change is in the second commit, the first one is a Prettier pass.