javascript - 从ts文件中的js文件导入函数( Angular 2)

标签 javascript angular typescript

我有一个包含一些函数的 JavaScript 文件,我想将这些函数导入到一个 ts 文件中,我尝试使用下面的技术但它没有用

import * as downloadExport from "./leaflet_export";

它引发了以下错误:

enter image description here

关于如何将函数从 js 文件导入 ts 文件有什么想法吗??

最佳答案

请参阅此处的文档:https://www.typescriptlang.org/docs/handbook/compiler-options.html

--allowJs boolean false(defacult value) Allow JavaScript files to be compiled.

关于javascript - 从ts文件中的js文件导入函数( Angular 2),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44061353/

相关文章:

javascript - 圆线段碰撞

angular - 如何在 Angular2/4 FormArray 字段中动态设置值?

typescript - 如何在 TypeScript 中创建通用 Map 接口(interface)

javascript - 如何维护 javascript 事件监听器中的 'correct' 范围?

javascript - 循环执行获取请求

javascript - 如何 - 将事件类添加到当前元素

Javascript - 在每个新行中复制日期/时间

json - Angular HttpClient 错误处理困难

javascript - Paginate Pipe 如何在 Angular 2 应用程序中成功访问数组的长度?

typescript - [嵌套接口(interface)/类型] : How to declare function return types inside a class in Typescript?