micromark / micromark-extension-gfm-strikethrough

micromark extension to support GFM strikethrough
https://unifiedjs.com
MIT License
3 stars 5 forks source link

Add types #2

Closed remcohaszing closed 3 years ago

remcohaszing commented 3 years ago

Title says all. :)

wooorm commented 3 years ago

nice!

btw, I quite like the jsdoc based approach in xdm. Should we start moving towards that everywhere?

remcohaszing commented 3 years ago

btw, I quite like the jsdoc based approach in xdm. Should we start moving towards that everywhere?

I haven’t tried this myself. I have seen other project maintainers struggle with this in the wild. TBH it feels like if you do that, you might as well write the code using TypeScript instead.

ChristianMurphy commented 3 years ago

btw, I quite like the jsdoc based approach in xdm. Should we start moving towards that everywhere?

I'm open to adopting it more broadly.

I haven’t tried this myself. I have seen other project maintainers struggle with this in the wild.

I've run into this to some extent. JSDoc TS + TS strict mode is not an easy mix to get working. Dropping TS strict mode loses some internal checking, but makes the JSDoc TS transition more approachable and still has the same outward facing API.

wooorm commented 3 years ago

Released! https://github.com/micromark/micromark-extension-gfm-strikethrough/releases/tag/0.6.4

wooorm commented 3 years ago

files were missing

wooorm commented 3 years ago

Should I add "types/*.d.ts" for this, and to the whole gfm extensions to support both the syntax and html extensions?

remcohaszing commented 3 years ago

Yes, adding "types/*.d.ts" seems right.

I’m also wondering if it should be "types": "types" then instead of "types": "types/index.d.ts". :thinking:

wooorm commented 3 years ago

I dunno! We do have syntax as the default, so my guess is that types has to match that, instead of pointing to a folder?

remcohaszing commented 3 years ago

Actually neither appears to work. Moving the type definitions to the project root does seem to work.

I’m unsure what would be a proper solution.

wooorm commented 3 years ago

/cc @ChristianMurphy

ChristianMurphy commented 3 years ago

Actually neither appears to work. Moving the type definitions to the project root does seem to work.

I assume this comment relates to: https://github.com/micromark/micromark-extension-gfm-strikethrough/blob/main/types/html.d.ts ? If so, yeah, we've run into this a few times. If a file other than index needs to be typed, the typings need to be moved to the root.

ChristianMurphy commented 3 years ago

Another option is https://github.com/micromark/micromark-extension-gfm-strikethrough/pull/2#issuecomment-788986945 Which means that the types can be encoded in the JS files, automatically generated at the root level, and gitignored but included in the published package.