我使用for作为我的打字代码。我想记录一个接口的属性。tsLint给出了一个错误JSDoc tag '@property' is redundant in TypeScript code. (no-redundant-jsdoc)tslint(1)
以下是我的评论
/**
* @property value - number with a unit as string
*/
禁用下一行的tslint也不起作用。
目标是从TypeScript代码中获取JSDoc文档。来自TypeDoc (TypeScript文档解决方案)的文档的质量是不可接受的,因为文档是针对JS用户的,不应该被特定于TypeScript实现(接口等)的细节所淹没。
目前,转换为ES6并从JS文件生成文档在很大程度上做到了这一点。没有赋值的属性除外。就像看起来的那样,
class A {
/**
* @private
* @var _a
*/
private _a;
/**
* @public
* @var a
*/
public a = t
在放弃之前,我想在这里试一试。 我有一个定义文件,其类型如下: /**
* My json decode function, in reality very different
* implementation (class like) but it works as an example
*/
function decodeJSON<T = unknown>(str: string): T; 如果我想在TypeScript中使用这个泛型,我会做如下操作 const value = decodeJSON<number[]>("[1,2,3]"
因此,基本上,我想使用TypeScript来检查我的代码在编辑器中是否有错误(VS代码),但不想执行任何转换步骤。
我在.js文件中有我的代码,"allowJs":tsconfig.json中的真
唯一的问题是,编辑器会抱怨js文件中的类型记录词的使用,例如:
declare module "something" {
export interface MyInterface {
导致错误:
"'module' declarations can only be used in TypeScript files"
我试图不去
在我的Angular类(Typescript)中,我有一个构造函数:
constructor(public http: Http) {
[...]
}
这是jsDoc注释此构造函数的参数的正确方式吗?
/**
* @constructor
* @param {Http} Http service
* called when the ApiService is created
*/