refactor: enable typescript option erasableSyntaxOnly

This commit is contained in:
Nathan Muir
2025-08-20 11:16:11 +12:00
parent 42e70ee82e
commit 0568cfc7c9
5 changed files with 27 additions and 27 deletions

View File

@@ -664,10 +664,10 @@ export class Context {
this._context.setLineDash(segments);
} else if ('mozDash' in this._context) {
// verified that this works in firefox
(<any>this._context['mozDash']) = segments;
(this._context as any)['mozDash'] = segments;
} else if ('webkitLineDash' in this._context) {
// does not currently work for Safari
(<any>this._context['webkitLineDash']) = segments;
(this._context as any)['webkitLineDash'] = segments;
}
// no support for IE9 and IE10

View File

@@ -1911,7 +1911,7 @@ export abstract class Node<Config extends NodeConfig = NodeConfig> {
attrs[key] = obj[key];
}
const node = new (<any>this.constructor)(attrs);
const node = new (this.constructor as any)(attrs);
// copy over listeners
for (key in this.eventListeners) {
allListeners = this.eventListeners[key];

View File

@@ -529,7 +529,7 @@ export const Util = {
const canvas = document.createElement('canvas');
// on some environments canvas.style is readonly
try {
(<any>canvas).style = canvas.style || {};
(canvas as any).style = canvas.style || {};
} catch (e) {}
return canvas;
},
@@ -991,7 +991,7 @@ export const Util = {
// very simplified version of Object.assign
_assign<T, U>(target: T, source: U) {
for (const key in source) {
(<any>target)[key] = source[key];
(target as any)[key] = source[key];
}
return target as T & U;
},

View File

@@ -51,27 +51,27 @@ export interface IFrame {
export type AnimationFn = (frame: IFrame) => boolean | void;
export enum KonvaNodeEvent {
mouseover = 'mouseover',
mouseout = 'mouseout',
mousemove = 'mousemove',
mouseleave = 'mouseleave',
mouseenter = 'mouseenter',
mousedown = 'mousedown',
mouseup = 'mouseup',
wheel = 'wheel',
contextmenu = 'contextmenu',
click = 'click',
dblclick = 'dblclick',
touchstart = 'touchstart',
touchmove = 'touchmove',
touchend = 'touchend',
tap = 'tap',
dbltap = 'dbltap',
dragstart = 'dragstart',
dragmove = 'dragmove',
dragend = 'dragend',
}
export const KonvaNodeEvent = {
mouseover: 'mouseover',
mouseout: 'mouseout',
mousemove: 'mousemove',
mouseleave: 'mouseleave',
mouseenter: 'mouseenter',
mousedown: 'mousedown',
mouseup: 'mouseup',
wheel: 'wheel',
contextmenu: 'contextmenu',
click: 'click',
dblclick: 'dblclick',
touchstart: 'touchstart',
touchmove: 'touchmove',
touchend: 'touchend',
tap: 'tap',
dbltap: 'dbltap',
dragstart: 'dragstart',
dragmove: 'dragmove',
dragend: 'dragend',
} as const;
export interface RGB {
r: number;

View File

@@ -7,8 +7,8 @@
"noUncheckedSideEffectImports": true,
"rewriteRelativeImportExtensions": true,
"isolatedModules": true,
"erasableSyntaxOnly": true,
// ideally we want to enable erasableSyntaxOnly & verbatimModuleSyntax for true node interop
"erasableSyntaxOnly": false,
"verbatimModuleSyntax": false,
// "sourceMap": true,
"noEmitOnError": true,