如何在 TypeScript 中生成“*.d.ts"? [英] How to generate “*.d.ts” in TypeScript?

查看:183
本文介绍了如何在 TypeScript 中生成“*.d.ts"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在打字稿中生成*.d.ts"或创建并导入@types?有没有办法为 jquery 插件或普通 javascript 库创建 d.ts?

How to generate "*.d.ts" in typescript or creates and import @types? Is there any way to create d.ts for jquery plugin or plain javascript library?

推荐答案

File .d.ts 是声明文件.详情.

要从 ts 文件创建 .d.ts.您只需要添加 -d--declaration> 使用 tsc 编译期间的参数.

示例:

File .d.ts is a declaration file.For details see.

To create .d.ts from a ts file.You only need to add the -d or --declaration parameter during compile using tsc.

Example:

tsc -d your_ts_file.ts

这篇关于如何在 TypeScript 中生成“*.d.ts"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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