自定义类型文件到 angular 6 [英] custom typings files to angular 6

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

问题描述

我正在尝试以 angular 格式添加一些自定义类型定义文件,但遇到了一些错误.

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

在 app 文件夹中,我有外部文件夹,其中有 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"]

但它不起作用.

有人能给我一些关于将自定义类型文件添加到 angular 6 的想法.

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

推荐答案

将自定义类型文件添加到 typeRoots 在根文件夹中的 tsconfig.json 中为我工作.

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"],

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

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