自定义键入文件到角度6 [英] custom typings files to angular 6

查看:61
本文介绍了自定义键入文件到角度6的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试用角度广告一些自定义类型的定义文件,但是遇到一些错误.

I am trying to ad some custom typings definition file in angular but facing some error.

在应用程序文件夹中,我有一个外部文件夹,其中有external.d.ts文件和下面的代码

in app folder I have external folder in which I have external.d.ts file and below code

declare function format(input: string, ...args): string;

我尝试在tsconfig.json中添加

文件":["/app/external/external.d.ts"]

in tsconfig.json I tried adding "files": ["/app/external/external.d.ts"]

,但不起作用.

有人可以给我关于将自定义类型的文件添加到角度6的想法吗.

can somebody give me idea about adding custom typings file to angular 6.

推荐答案

将自定义键入文件添加到根文件夹下tsconfig.json中的typeRoots中.

Add the custom typing file to typeRoots in tsconfig.json in the root folder work for me.

"typeRoots": ["node_modules/@types", "src/typings.d.ts"],

这篇关于自定义键入文件到角度6的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆