Someone who knows more about .d.ts files and packages should probably take a look at what I have set up. I’ll ask on Mastodon.
I tested the setup locally via a TypeScript repo and npm add ../regex and the types worked.
dist/regex.min.js should maybe be included in the package exports in some way.
You may want to clear dist/ before "build" and types/ before "types". I’m using package shx for cross-platform shell commands.
Maybe:
Rename "build" to "esbuild"
Define "build" as "npm run esbuild && npm run types"
I don’t know whether or not "typescript" should become a devDependency.
@overload is another option for overloading regex but I’m not sure in which of the multiple JSDoc comments the actual documentation would go.
Benefit of @overload: It may help with specifying this for regex. I don’t know how to best do that. I avoid using this as an implicit parameter in my code.
Command for checking if the types are correct (potential addition to package.json "scripts"):
Someone who knows more about .d.ts files and packages should probably take a look at what I have set up. I’ll ask on Mastodon.
npm add ../regex
and the types worked.dist/regex.min.js
should maybe be included in the package exports in some way.dist/
before "build" andtypes/
before "types". I’m using packageshx
for cross-platform shell commands.@overload
is another option for overloadingregex
but I’m not sure in which of the multiple JSDoc comments the actual documentation would go.@overload
: It may help with specifyingthis
forregex
. I don’t know how to best do that. I avoid usingthis
as an implicit parameter in my code.Command for checking if the types are correct (potential addition to
package.json
"scripts"):