【发布时间】:2021-03-26 06:48:17
【问题描述】:
我已经看了很多流程文档,但仍有一些问题。 我编写了一个名为 Track 的构造函数;尽我所能对其进行类型注释 还没有完全理解。
代码如下:
javascript
//@flow
"use strict";
/**
*A track is compatible with
* other track and can be parsed to
*a higher order function using the
* `this keyword.
*/
type ITrack<T> = {
x: T,
y: T,
width: T,
};
/**
* A Track is an adjustable and join-able imaginary ray
* That stretches out indefinite with a fixed starting x position.
*@Function Track
*@Param x -The x position to place the track
*@Param y - The y position to palce the track
*@Param width - The width of the track.
**/
function Track<ITrack> (x, y, width) {
this.x = x;
this.y = y;
this.width = width;
}
【问题讨论】:
-
首先,我想证明我的意图,我正在从 html5 画布构建一个树小部件。它必须放在轨道上
标签: javascript node.js types flowtype type-systems