I'm trying to use the react-csv-reader package in a React project that was created with create-react-app --typescript. Since react-csv-reader doesn't come with a types declaration file, I created one myself. I created a file types/react-csv-reader/index.d.ts. VS Code's Intellisense can find it just fine (I can command-click on the function name in module where I'm using react-csv-reader, and it takes me to my declarations file. It also complains when I don't have all the required props, etc.).
But when I run npm start, I get this:
Failed to compile.
./src/screens/ReadCsv.tsx
Module not found: Can't resolve '../types/react-csv-reader' in '/my/proj/root/src/screens'
Here's my index.d.ts:
import React from 'react'
interface CSVReaderProps {
cssClass?: string
cssInputClass?: string
label?: string
onFileLoaded: (data: any, filename: string) => void
onError: () => void
inputId?: string
inputStyle?: any
parserOptions?: any
}
declare const CSVReader: React.SFC<CSVReaderProps>
export default CSVReader