JsDoc types fixed and typecheck activated

This commit is contained in:
barsdeveloper
2022-03-30 21:59:41 +02:00
parent 464a9c068d
commit 90400110e2
33 changed files with 391 additions and 151 deletions

View File

@@ -23,10 +23,6 @@ export default class IElement extends HTMLElement {
/** @type {IContext[]} */
inputObjects = []
/**
* @param {IEntity} entity The entity containing blueprint related data for this graph element
* @param {ITemplate} template The template to render this node
*/
constructor(entity, template) {
super()
this.blueprint = null

View File

@@ -6,11 +6,11 @@ import MouseMoveNodes from "../input/mouse/MouseMoveNodes"
/**
* @typedef {import("../template/SelectableDraggableTemplate").default} SelectableDraggableTemplate
* @typedef {import("../entity/IntegerEntity").default} IntegerEntity
*/
export default class ISelectableDraggableElement extends IElement {
constructor(...args) {
// @ts-expect-error
super(...args)
this.dragObject = null
this.location = [0, 0]

View File

@@ -21,7 +21,7 @@ export default class NodeElement extends ISelectableDraggableElement {
/** @type {NodeTemplate} */
this.template
this.dragLinkObjects = []
super.setLocation([this.entity.NodePosX, this.entity.NodePosY])
super.setLocation([this.entity.NodePosX.value, this.entity.NodePosY.value])
}
static fromSerializedObject(str) {
@@ -56,7 +56,9 @@ export default class NodeElement extends ISelectableDraggableElement {
setLocation(value = [0, 0]) {
let nodeType = this.entity.NodePosX.constructor
// @ts-expect-error
this.entity.NodePosX = new nodeType(value[0])
// @ts-expect-error
this.entity.NodePosY = new nodeType(value[1])
super.setLocation(value)
}

View File

@@ -7,8 +7,9 @@ import ExecPinTemplate from "../template/ExecPinTemplate"
import StringPinTemplate from "../template/StringPinTemplate"
/**
* @typedef {import("./NodeElement").default} NodeElement
* @typedef {import("../entity/GuidEntity").default} GuidEntity
* @typedef {import("../entity/PinEntity").default} PinEntity
* @typedef {import("./NodeElement").default} NodeElement
*/
export default class PinElement extends IElement {
@@ -34,7 +35,7 @@ export default class PinElement extends IElement {
new (PinElement.#typeTemplateMap[entity.getType()] ?? PinTemplate)()
)
/** @type {import("../entity/PinEntity").default} */
/** @type {PinEntity} */
this.entity
/** @type {PinTemplate} */

View File

@@ -17,7 +17,7 @@ export default class SelectorElement extends IElement {
/**
* Create a selection rectangle starting from the specified position
* @param {number[]} initialPosition - Selection rectangle initial position (relative to the .ueb-grid element)
* @param {Number[]} initialPosition - Selection rectangle initial position (relative to the .ueb-grid element)
*/
startSelecting(initialPosition) {
this.template.applyStartSelecting(this, initialPosition)
@@ -26,7 +26,7 @@ export default class SelectorElement extends IElement {
/**
* Move selection rectagle to the specified final position. The initial position was specified by startSelecting()
* @param {number[]} finalPosition - Selection rectangle final position (relative to the .ueb-grid element)
* @param {Number[]} finalPosition - Selection rectangle final position (relative to the .ueb-grid element)
*/
doSelecting(finalPosition) {
this.template.applyDoSelecting(this, finalPosition)