Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/google-app-engine/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 打字脚本可以';我看不到申报文件_Javascript_Angular_Typescript - Fatal编程技术网

Javascript 打字脚本可以';我看不到申报文件

Javascript 打字脚本可以';我看不到申报文件,javascript,angular,typescript,Javascript,Angular,Typescript,我有app.ts import { Name } from './hello' 我有hello.js module.exports.Name = "great"; 我有typings文件夹,其中有hello文件夹,其中有index.d.ts,在此文件中,我有: export const Name: string; 我有tsconfig.json,其中 "typeRoots" : ["./typings"] 所发生的是intellisence在app.ts的/hello位置给我错误信息。

我有
app.ts

import { Name }  from './hello'
我有
hello.js

module.exports.Name = "great";
我有
typings
文件夹,其中有
hello
文件夹,其中有
index.d.ts
,在此文件中,我有:

export const Name: string;
我有
tsconfig.json
,其中

"typeRoots" : ["./typings"]
所发生的是intellisence在
app.ts
/hello
位置给我错误信息。它说它找不到声明文件。我的问题是为什么?假设它开始在当前目录中查找声明。它找不到它。然后它应该搜索
typings
文件夹,并在那里找到它。但为什么它会给我错误


我观察到的是,如果我运行
tsc--traceResolution
,它会在当前目录中搜索
hello.ts,hello.d.ts
,在没有找到它之后,它会在当前目录中搜索
hello.js
,当它找到它时,它会解析它。然后它继续进入
打字
文件夹,并再次解析
index.d.ts
。但是为什么intellisence会给我一个错误?

模块导出和导入(ESM)可以混合吗?是的。设想一些为ES5编写的模块,我们仍然将它们作为ES6导入。导出和导入(ESM)是否可以混合使用?是的。设想一些为ES5编写的模块,我们仍然将它们作为ES6导入。