I've been struggling to create a custom declaration file for the 'react-dates' npm package, but I'm facing issues with the compiler not recognizing my declaration file.
Whenever I try to import
DateRangePicker from 'react-dates'
, I encounter the following error:
The compiler could not locate a declaration file for the 'react-dates' module. The file 'absolute_path/src/node_modules/react-dates/index.js' is implicitly assigned an 'any' type.
My declaration file is stored at '@types/react-dates/index.d.ts' and it's structured like this:
import * as React from 'react';
declare class DateRangePicker extends React.Component<{}, {}> { }
This is how my tsconfig.json file looks:
{
"compilerOptions": {
"outDir": "./dist/",
"sourceMap": true,
"noImplicitAny": true,
"strictNullChecks": true,
"module": "commonjs",
"target": "es6",
"jsx": "react",
"typeRoots": [
"./@types"
]
},
"include": [
"./app/**/*",
"./@types/**/*"
]
}