Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

How can I fix the eslint error saying a TypeScript props interface is not used when it's actually used?

$
0
0

I have this component using AvatarProps as type for the props :

enter image description here

Here's the interface declaration:

export interface AvatarProps {  userName: string;  userLastName: string;  userImg?: string;  onPress?: Function;  backgroundColorAvatar?: string;  editMode?: boolean;  onPressEdit?: Function;  editButtonIcon?: string;  backgroundColorEditButton?: string;  textStyle?: TextStyle;}

When running eslint, this error pops up :

5:15  error    'AvatarProps' is defined but never used  

eslint is triggered on commit with lefthook from a lefthook.yml file like so :

 pre-commit:  parallel: true  commands:    lint:      files: git diff --name-only @{push}      glob: "*.{js,ts,jsx,tsx}"      run: npx eslint {files}    types:      files: git diff --name-only @{push}      glob: "*.{js,ts, jsx, tsx}"      run: npx tsc --noEmitcommit-msg:  parallel: true  commands:    commitlint:      run: npx commitlint --edit

What can I do to get rid of the error in a clean way?


Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>