You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As of now, harfbuzzjs itself is untyped and requires explicitly using the harfbuzz.ts file - to avoid unnecessary duplication, the .js and .d.ts files could be generated instead.
Haha alright… I see. Yeah TypeScript (.ts) is JS with static type checking, usually compiled to JS for distribution. It’s difficult for me to read C++, but I’m quite comfortable with writing TS. Will see if I get to contribute and unify the JS and TS aspects of this repo.
I don't think community-driven types are better than having them written by the authors of the actual code, and published alongside it.
#54 has problems and should be closed. #90 does a lot of other things that I don't think are necessary. I agree we should converge into one TS file. I have been sort of avoiding that since it's going to be somewhat of a change-the-whole-world PR, but I think it's going to be the best way forward.
Yeah, I also feel community-maintained typing is usually only a solution when it’s not practical to maintain the typing in the project itself. In this case, as long as we get the project’s (reluctant) lead @khaledhosny’s bless, it should be easy to convert such a small project to TS. It’s even already written with some JSDoc type annotations.
I hope it won’t make it complicated for Khaled’s future maintenance though, as TS certainly has its own quirkiness. I do hope the static type checking can balance that.
What can be some next steps? For example, certainly we’ll need to set up a TS-based npm package – what’s the best practice these days? We should definitely avoid the complicated direction of #90.
I think it would be best to generate hbjs.js and hbjs.d.ts from a TypeScript file, which would also support tsdoc to explain the parameters and give inline examples.
Activity
lianghai commentedon Sep 4, 2024
@khaledhosny, what’s actually the currently relationship between this harfbuzz.ts and the rest of this project?
khaledhosny commentedon Sep 4, 2024
I don’t know. I don’t even know what
.ts
is (I’m not much of a web developer myself and I’m maintaining this project only because no one else does).lianghai commentedon Sep 5, 2024
Haha alright… I see. Yeah TypeScript (.ts) is JS with static type checking, usually compiled to JS for distribution. It’s difficult for me to read C++, but I’m quite comfortable with writing TS. Will see if I get to contribute and unify the JS and TS aspects of this repo.
lianghai commentedon Mar 9, 2025
Hi @ebraminio, @alker0, @chearon, @Jackie1210, and @tomasdev,
You guys all have tried to improve the TypeScript aspect of this project:
Seems like it’ll benefit everyone if this neglected harfbuzz.ts can converge with hbjs.js. Any idea how we can make some progress?
tomasdev commentedon Mar 9, 2025
chearon commentedon Apr 6, 2025
I don't think community-driven types are better than having them written by the authors of the actual code, and published alongside it.
#54 has problems and should be closed. #90 does a lot of other things that I don't think are necessary. I agree we should converge into one TS file. I have been sort of avoiding that since it's going to be somewhat of a change-the-whole-world PR, but I think it's going to be the best way forward.
lianghai commentedon Apr 6, 2025
Yeah, I also feel community-maintained typing is usually only a solution when it’s not practical to maintain the typing in the project itself. In this case, as long as we get the project’s (reluctant) lead @khaledhosny’s bless, it should be easy to convert such a small project to TS. It’s even already written with some JSDoc type annotations.
I hope it won’t make it complicated for Khaled’s future maintenance though, as TS certainly has its own quirkiness. I do hope the static type checking can balance that.
What can be some next steps? For example, certainly we’ll need to set up a TS-based npm package – what’s the best practice these days? We should definitely avoid the complicated direction of #90.
khaledhosny commentedon Apr 6, 2025
I think I’ll have to learn my way through, so whatever people who actually use this library best is fine by me.
jlarmstrongiv commentedon Apr 9, 2025
In the meantime, I wrote:
.d.ts file for harfbuzzjs
I would think that because the project is now using emscripten, types for the
wasmExports
could be generated too:wasmExports
I think it would be best to generate
hbjs.js
andhbjs.d.ts
from a TypeScript file, which would also support tsdoc to explain the parameters and give inline examples.