mirror of
https://github.com/konvajs/konva.git
synced 2025-09-18 09:50:05 +08:00
refactor: enable typescript option erasableSyntaxOnly
This commit is contained in:
@@ -664,10 +664,10 @@ export class Context {
|
|||||||
this._context.setLineDash(segments);
|
this._context.setLineDash(segments);
|
||||||
} else if ('mozDash' in this._context) {
|
} else if ('mozDash' in this._context) {
|
||||||
// verified that this works in firefox
|
// verified that this works in firefox
|
||||||
(<any>this._context['mozDash']) = segments;
|
(this._context as any)['mozDash'] = segments;
|
||||||
} else if ('webkitLineDash' in this._context) {
|
} else if ('webkitLineDash' in this._context) {
|
||||||
// does not currently work for Safari
|
// does not currently work for Safari
|
||||||
(<any>this._context['webkitLineDash']) = segments;
|
(this._context as any)['webkitLineDash'] = segments;
|
||||||
}
|
}
|
||||||
|
|
||||||
// no support for IE9 and IE10
|
// no support for IE9 and IE10
|
||||||
|
@@ -1911,7 +1911,7 @@ export abstract class Node<Config extends NodeConfig = NodeConfig> {
|
|||||||
attrs[key] = obj[key];
|
attrs[key] = obj[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
const node = new (<any>this.constructor)(attrs);
|
const node = new (this.constructor as any)(attrs);
|
||||||
// copy over listeners
|
// copy over listeners
|
||||||
for (key in this.eventListeners) {
|
for (key in this.eventListeners) {
|
||||||
allListeners = this.eventListeners[key];
|
allListeners = this.eventListeners[key];
|
||||||
|
@@ -529,7 +529,7 @@ export const Util = {
|
|||||||
const canvas = document.createElement('canvas');
|
const canvas = document.createElement('canvas');
|
||||||
// on some environments canvas.style is readonly
|
// on some environments canvas.style is readonly
|
||||||
try {
|
try {
|
||||||
(<any>canvas).style = canvas.style || {};
|
(canvas as any).style = canvas.style || {};
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
return canvas;
|
return canvas;
|
||||||
},
|
},
|
||||||
@@ -991,7 +991,7 @@ export const Util = {
|
|||||||
// very simplified version of Object.assign
|
// very simplified version of Object.assign
|
||||||
_assign<T, U>(target: T, source: U) {
|
_assign<T, U>(target: T, source: U) {
|
||||||
for (const key in source) {
|
for (const key in source) {
|
||||||
(<any>target)[key] = source[key];
|
(target as any)[key] = source[key];
|
||||||
}
|
}
|
||||||
return target as T & U;
|
return target as T & U;
|
||||||
},
|
},
|
||||||
|
42
src/types.ts
42
src/types.ts
@@ -51,27 +51,27 @@ export interface IFrame {
|
|||||||
|
|
||||||
export type AnimationFn = (frame: IFrame) => boolean | void;
|
export type AnimationFn = (frame: IFrame) => boolean | void;
|
||||||
|
|
||||||
export enum KonvaNodeEvent {
|
export const KonvaNodeEvent = {
|
||||||
mouseover = 'mouseover',
|
mouseover: 'mouseover',
|
||||||
mouseout = 'mouseout',
|
mouseout: 'mouseout',
|
||||||
mousemove = 'mousemove',
|
mousemove: 'mousemove',
|
||||||
mouseleave = 'mouseleave',
|
mouseleave: 'mouseleave',
|
||||||
mouseenter = 'mouseenter',
|
mouseenter: 'mouseenter',
|
||||||
mousedown = 'mousedown',
|
mousedown: 'mousedown',
|
||||||
mouseup = 'mouseup',
|
mouseup: 'mouseup',
|
||||||
wheel = 'wheel',
|
wheel: 'wheel',
|
||||||
contextmenu = 'contextmenu',
|
contextmenu: 'contextmenu',
|
||||||
click = 'click',
|
click: 'click',
|
||||||
dblclick = 'dblclick',
|
dblclick: 'dblclick',
|
||||||
touchstart = 'touchstart',
|
touchstart: 'touchstart',
|
||||||
touchmove = 'touchmove',
|
touchmove: 'touchmove',
|
||||||
touchend = 'touchend',
|
touchend: 'touchend',
|
||||||
tap = 'tap',
|
tap: 'tap',
|
||||||
dbltap = 'dbltap',
|
dbltap: 'dbltap',
|
||||||
dragstart = 'dragstart',
|
dragstart: 'dragstart',
|
||||||
dragmove = 'dragmove',
|
dragmove: 'dragmove',
|
||||||
dragend = 'dragend',
|
dragend: 'dragend',
|
||||||
}
|
} as const;
|
||||||
|
|
||||||
export interface RGB {
|
export interface RGB {
|
||||||
r: number;
|
r: number;
|
||||||
|
@@ -7,8 +7,8 @@
|
|||||||
"noUncheckedSideEffectImports": true,
|
"noUncheckedSideEffectImports": true,
|
||||||
"rewriteRelativeImportExtensions": true,
|
"rewriteRelativeImportExtensions": true,
|
||||||
"isolatedModules": true,
|
"isolatedModules": true,
|
||||||
|
"erasableSyntaxOnly": true,
|
||||||
// ideally we want to enable erasableSyntaxOnly & verbatimModuleSyntax for true node interop
|
// ideally we want to enable erasableSyntaxOnly & verbatimModuleSyntax for true node interop
|
||||||
"erasableSyntaxOnly": false,
|
|
||||||
"verbatimModuleSyntax": false,
|
"verbatimModuleSyntax": false,
|
||||||
// "sourceMap": true,
|
// "sourceMap": true,
|
||||||
"noEmitOnError": true,
|
"noEmitOnError": true,
|
||||||
|
Reference in New Issue
Block a user