ui: Input component's InputProps interface gives no-empty-interface ESLint error

Hi! I have a NextJS project using TypeScript, and I just installed the Input component. ESLint flags the following line of the generated input.tsx component:

export interface InputProps
  extends React.InputHTMLAttributes<HTMLInputElement> {}

With the following error: “An interface declaring no members is equivalent to its supertype.” As the error message states, the InputProps interface has no members, which is causing the problem.

**Steps to Reproduce: **

  • Install shadcn with all the default options suggested by the installer.
  • Run npx shadcn-ui@latest add input
  • See the ESLint error on the InputProps interface inside the generated Input component

I’m using npm as my package manager, if it helps. Thanks!

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 5
  • Comments: 15 (2 by maintainers)

Most upvoted comments

Still happening.

Failed to compile.

./src/components/ui/input.tsx
5:18  Error: An interface declaring no members is equivalent to its supertype.  @typescript-eslint/no-empty-interface

Replacing the empty interface with this snippet works for me.

export type InputProps = React.InputHTMLAttributes<HTMLInputElement>

I use .eslintignore instead:

/src/components/ui/**.tsx
/src/types/nav.ts

This method may be better than off the whole rule.

This is still an issue shound’t be closed yet

I have the same error for textArea component.

Hey there,

You can disable the check temporally on .eslintrc.json:

"rules": {
    "@typescript-eslint/no-empty-object-type": "off"
  }

Learn more here: https://nextjs.org/docs/basic-features/eslint#disabling-rules

thats now working

Hey there,

You can disable the check temporally on .eslintrc.json:

"rules": {
    "@typescript-eslint/no-empty-object-type": "off"
  }

Learn more here: https://nextjs.org/docs/basic-features/eslint#disabling-rules