我一直在嘗試爲'react-dates'npm模塊編寫自定義聲明文件,但無法讓編譯器解析我的聲明文件到該模塊。找不到聲明文件與'react-dates'模塊的自定義聲明文件
當我做import {DateRangePicker} from 'react-dates'
我得到以下錯誤:
Could not find a declaration file for module 'react-dates'. 'absolute_path/src/node_modules/react-dates/index.js' implicitly has an 'any' type.
我的聲明文件所在的路徑「@類型/反應-日期/ index.d.ts」,看起來像這樣:
import * as React from 'react';
declare class DateRangePicker extends React.Component<{}, {}> { }
的tsconfig.json看起來是這樣的:
{
"compilerOptions": {
"outDir": "./dist/",
"sourceMap": true,
"noImplicitAny": true,
"strictNullChecks": true,
"module": "commonjs",
"target": "es6",
"jsx": "react",
"typeRoots": [
"./@types"
]
},
"include": [
"./app/**/*",
"./@types/**/*"
]
}
你與分型themselve取得任何進展? –
我只使用圖書館的一小部分,但這是我到目前爲止:https://gist.github.com/torryt/ccdaf6daf0d7df6252ac2a4539a00520 – torryt