Skip to content
This repository was archived by the owner on Feb 18, 2022. It is now read-only.

Fix type definitions #257

Merged
merged 1 commit into from
Sep 28, 2021
Merged

Fix type definitions #257

merged 1 commit into from
Sep 28, 2021

Conversation

noahtallen
Copy link
Contributor

@noahtallen noahtallen commented Sep 27, 2021

Hi! I found that postcss-custom-properties v12 was showing an error in my Typescript project recently (Automattic/wp-calypso#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?

The type definitions have slightly invalid syntax.
{ root: any } should be { root }: { root: any }
@noahtallen
Copy link
Contributor Author

@Semigradsky could this get a patch release soon?

@SergeAstapov
Copy link
Contributor

cc @jonathantneal

@noahtallen noahtallen deleted the patch-1 branch October 21, 2021 23:27
@gregaubert
Copy link

Could we get a patch release with this fix ?

romainmenke pushed a commit to csstools/postcss-plugins that referenced this pull request Dec 15, 2021
The type definitions have slightly invalid syntax.
{ root: any } should be { root }: { root: any }
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants