twin.examples icon indicating copy to clipboard operation
twin.examples copied to clipboard

[next-styled-components] Type parameter ("T") defined but never used

Open lguima opened this issue 2 years ago • 5 comments

Hi there, I'm using Twin version 2.6.2 and following the next-styled-components example with TypeScript.

And my twin.d.ts file is warning me about a type parameter ("T") defined but never used. I'm learning TypeScript now, the project where I'm installing it's part of a course.

Is this something I should care about?

twin-macro-ts

lguima avatar Jul 09 '21 20:07 lguima

Cheers for letting me know, I'll take a look into this 👍

ben-rogerson avatar Jul 19 '21 20:07 ben-rogerson

Sorry to ping such an old issue - just curious if you ever found out what to do with the unused generic. Thanks - and thanks for such an amazing library!

babycourageous avatar Mar 17 '22 18:03 babycourageous

Hey, I didn't get to the bottom of this one - but I'm keen on any help and insight.

ben-rogerson avatar Mar 18 '22 23:03 ben-rogerson

@ben-rogerson I'll try to poke around. It's def a non-issue issue heheh.

babycourageous avatar Mar 19 '22 01:03 babycourageous

A common practice is to prefix unused variables with an underscore, or to simply use _ as the variable name - in fact, this is built directly into some languages like Go. So one option here could be to replace T with _, and you'll probably have to configure eslint to ignore variables with this pattern (e.g., "@typescript-eslint/no-unused-vars": [1, { "varsIgnorePattern": "^_" }] or ^_$ if you only want to ignore specifically _. Of course, whether or not this is a good pattern is entirely personal :p

zax-xyz avatar Jul 06 '22 07:07 zax-xyz