简体   繁体   English

JS库的打字稿类型的API文档

[英]API Documentation for typescript types for JS libraries

I am trying to develop an exrpessjs application in typescript. 我正在尝试在打字稿中开发一个exrpessjs应用程序。 I installed @types and developed a working application after reading some articles. 我在阅读了一些文章之后安装了@types并开发了一个工作应用程序。 My question is where do I find documentation for typescript types for the libraries written in javascript. 我的问题是在哪里可以找到用javascript编写的库的打字稿类型的文档。

For example I learned from examples that I need to import Router, Response and Request as follows, I am looking for an official documentation where it lists classes, interfaces that the library exposes through @types 例如,我从示例中了解到我需要导入路由器,响应和请求,如下所示,我正在寻找一个官方文档,其中列出了库,通过@types公开的接口

import { Router, Response, Request } from 'express';

learned from examples that I need to import Router, Response and Request as follows, 从示例中了解到,我需要导入路由器,响应和请求,如下所示,

If the JS library is not written in TypeScript it probably has its own docs you should refer to eg Router is covered here : https://expressjs.com/en/guide/routing.html 如果JS库不是用TypeScript编写的,它可能有自己的文档,你应该参考,例如Router在这里介绍: https//expressjs.com/en/guide/routing.html

Other than that the usage of definitions can be figured out by autocomplete etc. 除此之外,定义的使用可以通过自动完成等来计算。

More 更多

In general TypeScript does not solve the problem of poorly documented or bad code. 通常,TypeScript无法解决文档记录不良或代码错误的问题。 That is left up to the developers (just like any other programming language). 这取决于开发人员(就像任何其他编程语言一样)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM