Next.js Discord

Discord Forum

Issues with function args in Typescript types

Answered
"use php" posted this in #help-forum
Open in Discord
I'm getting this error, How do I fix it?
I believe its something relating to eslint
Answered by "use php"
So, based on this stackoverflow link: https://stackoverflow.com/questions/68802881/get-rid-of-is-defined-but-never-used-in-function-parameter

I found a comment
You need to use the TypeScript version of the rule, ESLint's rules aren't aware of types

This helped me solve the issue by extending typescript-eslint.
View full answer

28 Replies

-# .eslintsrc.js
const path = require("path")

module.exports =  {
  "root": true,
  "extends": [
    "eslint:recommended",
    "next/core-web-vitals",
    "plugin:eslint-plugin-next-on-pages/recommended",
    "plugin:tailwindcss/recommended",
    "next",
    "prettier",
    
  ],
  settings: {
    tailwindcss: {
      config: path.join(__dirname, './tailwind.config.ts'),
    },
  },
  "plugins": [
    "eslint-plugin-next-on-pages"
  ]
}
@"use php" I'm getting this error, How do I fix it? I believe its something relating to eslint
Yellowstripe scad
Quick google search for how to remove no unused vars eslint should help you out
//disable…
I already know that. I asked this question to remove this warning
Yellowstripe scad
No, in your eslint config file
@Yellowstripe scad No, in your eslint config file
I don’t want to disable it
Issue is I’m getting this warning in ts types
@gin why is your eslint so advanced
To be able to see all my errors like u used variables
bump
@"use php" bump
Blue Picardy Spaniel
just don't declare the variable?
@Blue Picardy Spaniel just don't declare the variable?
I'll get a warning in my code then
Blue Picardy Spaniel
saying what
I'm not sure if I will
But The point of typescript is to define types
and I need types
Blue Picardy Spaniel
paste the code that's having issues
interface PopupContentProps {
  onClick: (state: string) => void;
}
I'm getting warning on state
thats the min repro
Blue Picardy Spaniel
Will try this soon
Blue Picardy Spaniel
@"use php" do you still need the link?
No, found it
So, based on this stackoverflow link: https://stackoverflow.com/questions/68802881/get-rid-of-is-defined-but-never-used-in-function-parameter

I found a comment
You need to use the TypeScript version of the rule, ESLint's rules aren't aware of types

This helped me solve the issue by extending typescript-eslint.
Answer