我有一份打字文件在
src/@types/yargs-interactive/index.d.ts
我为之创造的
https://github.com/nanovazquez/yargs-interactive
.其内容如下:
declare function yargsInteractive(): any;
declare namespace yargsInteractive {
interface OptionData {
type: string;
describe: string;
default?: string | number | boolean;
prompt?: string;
}
interface Option {
[key: string]: OptionData;
}
interface Interactive {
usage(usage: string): any;
interactive(options: Option[]): any;
then(callback: (result: any) => any): any;
}
}
export = yargsInteractive;
但是当我尝试导入它时,我得到的只是
Could not find a declaration file for module 'yargs-interactive'
错误。我已尝试更改tsconfig.json文件以添加
typeRoots
致
src/@types
目录,但仍然找不到。当它在下面的时候它会识别它
node_modules/@types/yargs-interactive/index.d.ts
.
我在这里做错什么了?