我一直在尝试为'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