api-docs icon indicating copy to clipboard operation
api-docs copied to clipboard

Recommend augmenting csstype instead of casting to `any`

Open cpmsmith opened this issue 3 years ago • 1 comments

Currently, the docs recommend just casting to any whenever using CSS variables in TypeScript, but you don't have to do that. If you use module augmentation instead, you still get the benefits of typechecking, including on your CSS variables!

And here's a CodeSandbox to prove that it works: https://codesandbox.io/s/framer-motion-csstype-augmentation-shmjq

Note how it correctly flags the misspelled CSS variable:

image

cpmsmith avatar May 12 '21 23:05 cpmsmith

@cpmsmith is attempting to deploy a commit to the Framer Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar May 12 '21 23:05 vercel[bot]