Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typescript/9.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
Typescript 从tsd导出可导入的类型脚本_Typescript_Tsd_Swagger Codegen - Fatal编程技术网

Typescript 从tsd导出可导入的类型脚本

Typescript 从tsd导出可导入的类型脚本,typescript,tsd,swagger-codegen,Typescript,Tsd,Swagger Codegen,使用swagger codegen生成的文件index.ts 文件tsd.d.ts 打字脚本2.2.1 为什么我仍然需要使用import语句从ts文件中的“path/to/file/myDTO”导入myDTO? 我是否缺少一个概念,是否应该声明一个模块?如果在index.ts中有导出语句,这将使它成为一个新的概念。为了使用外部模块,您必须导入它 如果你不介意的话,可以再问一些。一个小问题。我可以在生成的JS代码没有定义、要求或其他模块机制的情况下使用导入语句吗?我这样问是因为用TS编写angul

使用swagger codegen生成的文件index.ts

文件tsd.d.ts

打字脚本2.2.1

为什么我仍然需要使用import语句从ts文件中的“path/to/file/myDTO”导入myDTO?
我是否缺少一个概念,是否应该声明一个模块?

如果在index.ts中有导出语句,这将使它成为一个新的概念。为了使用外部模块,您必须导入它


如果你不介意的话,可以再问一些。

一个小问题。我可以在生成的JS代码没有定义、要求或其他模块机制的情况下使用导入语句吗?我这样问是因为用TS编写angular1工厂,无法用模块管理绕过生成的代码。我担心这是不可能的。即使您将使用outFile+AMD/系统模块,transpiler中的see-模块仍将使用相应的函数包装生成的单个文件。
export * from './api/api';
export * from './model/models';
...
/// <reference path="path/to/index.ts" />