Open lyqht opened 2 years ago
I normally get the same typescript error.
i just do //@ts-ignore
To type react-native-user-avatar you can do:
1 - Create a folder named @types
inside your .src
directory, and a file named userAvatar.d.ts
inside it.
2 - Declare the 'react-native-user-avatar' module typing it as:
declare module 'react-native-user-avatar' {
const content: {
name: string;
src?: string;
bgColor?: string;
bgColors?: string[];
textColor?: string;
size?: number;
imageStyle?: object;
textStyle?: object;
style?: object;
borderRadius?: number;
component?: React.ComponentType;
};
export default content;
}
3 - Inside your tsconfig.json file, add this line to tell Typescript where to find the declaration typing file for the library:
"typeRoots": ["./node_modules/@types", "./@types"]
4 - Restart your IDE.
Now your problem should be gone. Happy coding.
When i install the library in a Typescript project, I get the following error