Ejemplo 1: no se pudo encontrar un archivo de declaración para el módulo en el proyecto react
//First try ( works for most of the cases)
npm install @types/module-name
//if that does not solve your problem than . (will surely solve your problem)
Inside the project create a folder called @types and added it to
tsconfig.json for find all required types from it . So it looks somewhat
like this -
"typeRoots": [
"../node_modules/@types",
"../@types"
]
And inside @types folder create a file called alltypes.d.ts .To find the unknown
types from it . so for me these were the unknown types and I added it over there.
declare module 'react';
declate module 'react-dom' ;
So now the typescript didn't complain about the types not found anymore .
Ejemplo 2: No se pudo encontrar un archivo de declaración para el módulo ‘react’
yarn add eslint-import-resolver-typescript -D
// Add in .eslintrc
"settings": {
"import/resolver": {
"typescript": {}
}
}
¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)