postcss-normalize
postcss-normalize copied to clipboard
Support TS `moduleResolution: "node16"`
First issue fixed
"moduleResolution": "node16" in TS will cause:
TS7016: Could not find a declaration file for module postcss-normalize. `postcss-normalize/index.mjs` implicitly has an any type.
There are types at `postcss-normalize/index.d.ts`, but this result could not be resolved when respecting package.json exports. The postcss-normalize library may need to update its package.json or typings.
Second issue fixed:
- Typescript
"moduleResolution": "node16"requires different type info whenCJSmodules like this one are imported fromESMmodule. - To make default exports (
export default) work for both CJS and ESM, we needexport = Xand notexport default X. - When you have multiple exports you need to create a namespace named exactly X and in there define the exports.
refs:
- https://github.com/microsoft/TypeScript/issues/52086
- https://stackoverflow.com/a/51238234/339872
PS/FYI: npm run test tape was failing even before my changes so i had to commit with --no-verify.