posthtml / htmlnano

Modular HTML minifier, built on top of the PostHTML
https://htmlnano.netlify.app
MIT License
253 stars 29 forks source link

Types don't work using `"module": "NodeNext"` in TypeScript #270

Closed sondr3 closed 5 months ago

sondr3 commented 8 months ago

This is obviously not a problem on your end but I've been unable to figure out how to fix it for myself. I'm writing a CLI tool using "module": "NodeNext" and "moduleResolution": "NodeNext" and it can't find typings for anything. I get the following error when type checking

error TS2614: Module '"htmlnano"' has no exported member 'HtmlnanoOptions'. Did you mean to use 'import HtmlnanoOptions from "htmlnano"' instead?

and all fields exported from htmlnano are marked with any. I tried to figure out the magic incantation of which files to export where but couldn't make any headway. Any ideas for how to fix this?

maltsev commented 6 months ago

Sorry, I'm not sure how to fix it.

Maybe other contributors have some ideas?

SukkaW commented 6 months ago

I don't have any ideas either. We already export the option type, there is no reason that TypeScript can't find it:

https://github.com/posthtml/htmlnano/blob/151da26bf6b1e82e380ace889bcf8da6e34f7976/index.d.ts#L6

A PR will be welcome!