feat: generate typescript types - #17
Conversation
|
Hey awesome. I'll definitely add this. Do you think it's worth pulling this into JSDocs |
|
if you're happy to add a |
# Conflicts: # README.md # src/highlight.js
|
@davatron5000 I've updated this to use JSdoc as the source of truth and added typescript v7. check/emit time is fast and hopefully not inconvenient: # emits declarations, run as part of the build
time npx tsc
real 0m0.472s
user 0m0.475s
sys 0m0.054s
# check types but don't emit declarations
time npm run typecheck
real 0m0.169s
user 0m0.189s
sys 0m0.035s |
|
@danielroe Awesome! I think allowing JSDoc to leverage the types will be a big deal for maintenance long term. I'm heading into work right now but I'll try to get this in tonight and cut a release. Appreciate it. Do you have a favorite way of automating releases for your projects? Do you use changesets or anything like that? |
|
funny you should ask 😆 I wrote a github action (https://github.com/danielroe/uppt) that handles everything in a pure github actions + npm staged publishing workflow. it's very opinionated (for example, it works via conventional commits, requires staged publishing, etc.). it has been mythos-scanned (by someone else, for what that's worth) and I've done my best to embed best security practices into it - for example, the workflow that actually has access to your id token doesn't run any commands or install your deps. I haven't used it for a project that doesn't do squash merging, so I'll take a look at whether I need to add support... |
|
Oh that's great. I might just use this. I can also add squash merging by default. Then the flow is: → Merge work w/ conventional commit - breaking |
|
→ merge work w/ conventional commit - breaking ! = major, feat = minor, else = patch |
What does this change?
I'm loving microlighter!
this adds typescript types for consumers who use TS (like me).
if you prefer:
tsc --allowJs --declaration --emitDeclarationOnly, but I'd need to tweak the JSdoc to be more specific (than e.g.@param {*} / Object), and I thought you might prefer to avoid the build stepImportant
update: I've refactored this to keep JSdoc as the source of truth except for declaration files that don't match any source
Checklist
npm testpasses locallydocs/index.html) if behavior changedCONTRIBUTING.mdSize impact