postcss / postcss-custom-properties

Use Custom Properties in CSS
https://postcss.github.io/postcss-custom-properties
MIT License
597 stars 77 forks source link

Fix type definitions #257

Closed noahtallen closed 2 years ago

noahtallen commented 2 years ago

Hi! I found that postcss-custom-properties v12 was showing an error in my Typescript project recently (https://github.com/Automattic/wp-calypso/pull/56600)

node_modules/postcss-custom-properties/index.d.ts:23:19 - error TS7031: Binding element 'any' implicitly has an 'any' type.

This is because prepare({ root: any }) means to destructure root and then assign it to the variable any. (An easy mistake to make; I remember doing the same thing a while ago!) It should be prepare( { root }: Type ), which translates to prepare( { root }: { root: any } ). We could also split the latter part out into its own type definition, but this gets the job done.

To test this, I copied original file to the TS playground, and it has an error (link to playground). The new version does not have an error (link to playground).

Thanks for taking a look! cc @jonathantneal, any chance this could make a quick patch release?

noahtallen commented 2 years ago

@Semigradsky could this get a patch release soon?

SergeAstapov commented 2 years ago

cc @jonathantneal

gregaubert commented 2 years ago

Could we get a patch release with this fix ?