From 1039e74c23c949a1d8d8238cd21f7fc3f1064253 Mon Sep 17 00:00:00 2001 From: tre-dev <59442299+tre-dev@users.noreply.github.com> Date: Fri, 18 Sep 2020 04:31:55 +0200 Subject: [PATCH] fixed typescript errors for strict usage (#45) --- packages/slate-vue/components/children.tsx | 4 +- packages/slate-vue/components/editable.tsx | 156 +++++++++++---------- packages/slate-vue/components/element.tsx | 15 +- packages/slate-vue/components/fragment.tsx | 18 +-- packages/slate-vue/components/leaf.tsx | 4 +- packages/slate-vue/components/slate.tsx | 22 +-- packages/slate-vue/components/string.tsx | 2 +- packages/slate-vue/components/text.tsx | 14 +- packages/slate-vue/plugins/runtime-util.ts | 2 +- packages/slate-vue/plugins/slate-plugin.ts | 26 ++-- packages/slate-vue/plugins/vue-runtime.ts | 6 +- packages/slate-vue/utils/hotkeys.ts | 7 +- tsconfig.json | 2 +- 13 files changed, 142 insertions(+), 136 deletions(-) diff --git a/packages/slate-vue/components/children.tsx b/packages/slate-vue/components/children.tsx index 4f2d771..30b7576 100644 --- a/packages/slate-vue/components/children.tsx +++ b/packages/slate-vue/components/children.tsx @@ -12,7 +12,7 @@ import {fragment} from './fragment'; * Children. */ -const Children = tsx.component({ +const Children: any = tsx.component({ props: { node: Object }, @@ -27,7 +27,7 @@ const Children = tsx.component({ elementWatcherPlugin(this, 'children') }, render() { - const editor: any = this.$editor; + const editor: any = (this as any).$editor; const {node} = this; const path = VueEditor.findPath(editor, node) const isLeafBlock = diff --git a/packages/slate-vue/components/editable.tsx b/packages/slate-vue/components/editable.tsx index a633802..b3a343e 100644 --- a/packages/slate-vue/components/editable.tsx +++ b/packages/slate-vue/components/editable.tsx @@ -8,6 +8,14 @@ import {DOMStaticRange} from '../utils/dom'; import { IS_FIREFOX, IS_SAFARI, IS_EDGE_LEGACY } from '../utils/environment' import Hotkeys from '../utils/hotkeys' +interface IEvent extends Event { + data: string | null + dataTransfer: DataTransfer | null + getTargetRanges(): DOMStaticRange[] + inputType: string + isComposing: boolean +} + // COMPAT: Firefox/Edge Legacy don't support the `beforeinput` event const HAS_BEFORE_INPUT_SUPPORT = !(IS_FIREFOX || IS_EDGE_LEGACY) @@ -251,13 +259,13 @@ export const Editable = tsx.component({ } }, methods: { - _onClick(event) { - const editor = this.$editor + _onClick(event: IEvent) { + const editor = (this as any).$editor if ( !this.readOnly && hasTarget(editor, event.target) && isDOMNode(event.target) && - !isEventHandled(event, this.onClick) + !isEventHandled(event, (this as any).onClick) ) { const node = VueEditor.toSlateNode(editor, event.target) const path = VueEditor.findPath(editor, node) @@ -269,10 +277,10 @@ export const Editable = tsx.component({ } } }, - onSelectionchange(e) { + onSelectionchange() { const { readOnly } = this; - const editor = this.$editor - if (!readOnly && !this.isComposing && !this.isUpdatingSelection) { + const editor = (this as any).$editor + if (!readOnly && !(this as any).isComposing && !(this as any).isUpdatingSelection) { const { activeElement } = window.document const el = VueEditor.toDOMNode(editor, editor) const domSelection = window.getSelection() @@ -282,7 +290,7 @@ export const Editable = tsx.component({ domSelection.getRangeAt(0) if (activeElement === el) { - this.latestElement = activeElement + (this as any).latestElement = activeElement IS_FOCUSED.set(editor, true) } else { IS_FOCUSED.delete(editor) @@ -300,18 +308,12 @@ export const Editable = tsx.component({ } } }, - _onBeforeInput(event: Event & { - data: string | null - dataTransfer: DataTransfer | null - getTargetRanges(): DOMStaticRange[] - inputType: string - isComposing: boolean - }) { - const editor = this.$editor; + _onBeforeInput(event: IEvent) { + const editor = (this as any).$editor; if ( !this.readOnly && hasEditableTarget(editor, event.target) && - !isEventHandled(event, this.onBeforeInput) + !isEventHandled(event, (this as any).onBeforeInput) ) { const { selection } = editor const { inputType: type } = event @@ -432,13 +434,13 @@ export const Editable = tsx.component({ } } }, - _onCompositionEnd(event) { - const editor = this.$editor; + _onCompositionEnd(event: any) { + const editor = (this as any).$editor; if ( hasEditableTarget(editor, event.target) && - !isEventHandled(event, this.onCompositionEnd) + !isEventHandled(event, (this as any).onCompositionEnd) ) { - this.isComposing = false + (this as any).isComposing = false // COMPAT: In Chrome, `beforeinput` events for compositions // aren't correct and never fire the "insertFromComposition" @@ -449,21 +451,21 @@ export const Editable = tsx.component({ } } }, - _onCompositionStart(event) { - const editor = this.$editor + _onCompositionStart(event: IEvent) { + const editor = (this as any).$editor if ( hasEditableTarget(editor, event.target) && - !isEventHandled(event, this.onCompositionStart) + !isEventHandled(event, (this as any).onCompositionStart) ) { - this.isComposing = true + (this as any).isComposing = true } }, - _onKeyDown(event) { - const editor = this.$editor + _onKeyDown(event: any) { + const editor = (this as any).$editor if ( !this.readOnly && hasEditableTarget(editor, event.target) && - !isEventHandled(event, this.onKeyDown) + !isEventHandled(event, (this as any).onKeyDown) ) { const nativeEvent = event const { selection } = editor @@ -660,16 +662,16 @@ export const Editable = tsx.component({ } } }, - _onFocus(event) { - const editor = this.$editor + _onFocus(event: any) { + const editor = (this as any).$editor if ( !this.readOnly && - !this.isUpdatingSelection && + !(this as any).isUpdatingSelection && hasEditableTarget(editor, event.target) && - !isEventHandled(event, this.onFocus) + !isEventHandled(event, (this as any).onFocus) ) { const el = VueEditor.toDOMNode(editor, editor) - this.latestElement = window.document.activeElement + ;(this as any).latestElement = window.document.activeElement // COMPAT: If the editor has nested editable elements, the focus // can go to them. In Firefox, this must be prevented because it @@ -682,13 +684,13 @@ export const Editable = tsx.component({ IS_FOCUSED.set(editor, true) } }, - _onBlur(event) { - const editor = this.$editor + _onBlur(event: any) { + const editor = (this as any).$editor if ( this.readOnly || - this.isUpdatingSelection || + (this as any).isUpdatingSelection || !hasEditableTarget(editor, event.target) || - !isEventHandled(event, this.onBlur) + !isEventHandled(event, (this as any).onBlur) ) { return } @@ -697,7 +699,7 @@ export const Editable = tsx.component({ // one, this is due to the window being blurred when the tab // itself becomes unfocused, so we want to abort early to allow to // editor to stay focused when the tab becomes focused again. - if (this.latestElement === window.document.activeElement) { + if ((this as any).latestElement === window.document.activeElement) { return } @@ -737,37 +739,37 @@ export const Editable = tsx.component({ IS_FOCUSED.delete(editor) }, - _onCopy(event) { - const editor = this.$editor + _onCopy(event: any) { + const editor = (this as any).$editor if ( hasEditableTarget(editor, event.target) && - !isEventHandled(event, this.onCopy) + !isEventHandled(event, (this as any).onCopy) ) { event.preventDefault() setFragmentData(event.clipboardData, editor) } }, - _onPaste(event) { - const editor = this.$editor + _onPaste(event: any) { + const editor = (this as any).$editor const {readOnly} = this if ( (!HAS_BEFORE_INPUT_SUPPORT || isPlainTextOnlyPaste(event)) && !readOnly && hasEditableTarget(editor, event.target) && - !isEventHandled(event, this.onPaste) + !isEventHandled(event, (this as any).onPaste) ) { event.preventDefault() VueEditor.insertData(editor, event.clipboardData) } }, - _onCut(event) { - const editor = this.$editor + _onCut(event: any) { + const editor = (this as any).$editor const {readOnly} = this if ( !readOnly && hasEditableTarget(editor, event.target) && - !isEventHandled(event, this.onCut) + !isEventHandled(event, (this as any).onCut) ) { event.preventDefault() setFragmentData(event.clipboardData, editor) @@ -778,11 +780,11 @@ export const Editable = tsx.component({ } } }, - _onDragOver(event) { - const editor = this.$editor + _onDragOver(event: any) { + const editor = (this as any).$editor if ( hasTarget(editor, event.target) && - !isEventHandled(event, this.onDragOver) + !isEventHandled(event, (this as any).onDragOver) ) { // Only when the target is void, call `preventDefault` to signal // that drops are allowed. Editable content is droppable by @@ -794,11 +796,11 @@ export const Editable = tsx.component({ } } }, - _onDragStart(event) { - const editor = this.$editor + _onDragStart(event: any) { + const editor = (this as any).$editor if ( hasTarget(editor, event.target) && - !isEventHandled(event, this.onDragStart) + !isEventHandled(event, (this as any).onDragStart) ) { const node = VueEditor.toSlateNode(editor, event.target) const path = VueEditor.findPath(editor, node) @@ -814,12 +816,12 @@ export const Editable = tsx.component({ setFragmentData(event.dataTransfer, editor) } }, - _onDrop(event) { - const editor = this.$editor + _onDrop(event: any) { + const editor = (this as any).$editor if ( hasTarget(editor, event.target) && !this.readOnly && - !isEventHandled(event, this.onDrop) + !isEventHandled(event, (this as any).onDrop) ) { // COMPAT: Certain browsers don't fire `beforeinput` events at all, and // Chromium browsers don't properly fire them for files being @@ -839,16 +841,16 @@ export const Editable = tsx.component({ } }, hooks() { - const ref = this.ref = useRef(null); - const editor = this.$editor; + const ref = (this as any).ref = useRef(null); + const editor = (this as any).$editor; IS_READ_ONLY.set(editor, this.readOnly) const initListener = ()=>{ // Attach a native DOM event handler for `selectionchange` useEffect(()=>{ - document.addEventListener('selectionchange', this.onSelectionchange) + document.addEventListener('selectionchange', (this as any).onSelectionchange) return () => { - document.removeEventListener('selectionchange', this.onSelectionchange) + document.removeEventListener('selectionchange', (this as any).onSelectionchange) } }); }; @@ -879,7 +881,7 @@ export const Editable = tsx.component({ const { selection } = editor const domSelection = window.getSelection() - if (this.isComposing || !domSelection || !VueEditor.isFocused(editor)) { + if ((this as any).isComposing || !domSelection || !VueEditor.isFocused(editor)) { return } @@ -903,7 +905,7 @@ export const Editable = tsx.component({ // Otherwise the DOM selection is out of sync, so update it. const el = VueEditor.toDOMNode(editor, editor) - this.isUpdatingSelection = true + ;(this as any).isUpdatingSelection = true domSelection.removeAllRanges() if (newDomRange) { @@ -919,7 +921,7 @@ export const Editable = tsx.component({ el.focus() } - this.isUpdatingSelection = false + ;(this as any).isUpdatingSelection = false }) }) } @@ -935,23 +937,23 @@ export const Editable = tsx.component({ updateAutoFocus(); }, render() { - const editor = this.$editor; - const {ref} = this; + const editor = (this as any).$editor; + const {ref} = this as any; // name must be corresponded with standard const on = { - click: this._onClick, - keydown: this._onKeyDown, - focus: this._onFocus, - blur: this._onBlur, - beforeinput: this._onBeforeInput, - copy: this._onCopy, - cut: this._onCut, - compositionend: this._onCompositionEnd, - compositionstart: this._onCompositionStart, - dragover: this._onDragOver, - dragstart: this._onDragStart, - drop: this._onDrop, - paste: this._onPaste + click: (this as any)._onClick, + keydown: (this as any)._onKeyDown, + focus: (this as any)._onFocus, + blur: (this as any)._onBlur, + beforeinput: (this as any)._onBeforeInput, + copy: (this as any)._onCopy, + cut: (this as any)._onCut, + compositionend: (this as any)._onCompositionEnd, + compositionstart: (this as any)._onCompositionStart, + dragover: (this as any)._onDragOver, + dragstart: (this as any)._onDragStart, + drop: (this as any)._onDrop, + paste: (this as any)._onPaste }; const attrs = { spellcheck: !HAS_BEFORE_INPUT_SUPPORT ? undefined : this.spellCheck, diff --git a/packages/slate-vue/components/element.tsx b/packages/slate-vue/components/element.tsx index b84c960..a773534 100644 --- a/packages/slate-vue/components/element.tsx +++ b/packages/slate-vue/components/element.tsx @@ -5,6 +5,7 @@ */ import * as tsx from "vue-tsx-support" import { Editor, Node } from 'slate' +// @ts-ignore import getDirection from 'direction' import Text from './text' @@ -30,9 +31,9 @@ export const Element = tsx.component({ elementWatcherPlugin(this, 'element') }, hooks() { - const ref = this.ref = useRef(null); + const ref = (this as any).ref = useRef(null); const element = this.element - const key = VueEditor.findKey(this.$editor, element) + const key = VueEditor.findKey((this as any).$editor, element) useEffect(()=>{ if (ref.current) { @@ -47,8 +48,8 @@ export const Element = tsx.component({ }, render(h) { // call renderElement with children, attribute and element - const {element, renderElement = DefaultElement, ref} = this; - const editor = this.$editor + const {element, renderElement = DefaultElement, ref} = this as any; + const editor = (this as any).$editor const isInline = editor.isInline(element) let children: JSX.Element | null = ( { return tsx.component({ render() { const { attributes, children, element } = props - const editor = this.$editor + const editor = (this as any).$editor const Tag = editor.isInline(element) ? 'span' : 'div' return ( diff --git a/packages/slate-vue/components/fragment.tsx b/packages/slate-vue/components/fragment.tsx index a0eb03d..cc7209a 100644 --- a/packages/slate-vue/components/fragment.tsx +++ b/packages/slate-vue/components/fragment.tsx @@ -1,7 +1,7 @@ // forked from vue-fragment // https://github.com/y-nk/vue-fragment import * as tsx from 'vue-tsx-support' -const freeze = (object, property, value) => { +const freeze = (object: any, property: any, value: any) => { Object.defineProperty(object, property, { configurable: true, get() { return value; }, @@ -9,7 +9,7 @@ const freeze = (object, property, value) => { }); }; -const unfreeze = (object, property, value = null) => { +const unfreeze = (object: any, property: any, value: any = null) => { Object.defineProperty(object, property, { configurable: true, writable: true, @@ -47,8 +47,8 @@ export const fragment = tsx.component({ // }, mounted() { - const container = this.$el; - const parent = container.parentNode; + const container: any = this.$el; + const parent: any = container.parentNode; const head = document.createComment(`fragment#${this.name}#head`) const tail = document.createComment(`fragment#${this.name}#tail`) @@ -56,17 +56,17 @@ export const fragment = tsx.component({ parent.insertBefore(head, container) parent.insertBefore(tail, container) - container.appendChild = (node) => { + container.appendChild = (node: any) => { parent.insertBefore(node, tail) freeze(node, 'parentNode', container) } - container.insertBefore = (node, ref) => { + container.insertBefore = (node: any, ref: any) => { parent.insertBefore(node, ref) freeze(node, 'parentNode', container) } - container.removeChild = (node) => { + container.removeChild = (node: any) => { parent.removeChild(node) unfreeze(node, 'parentNode') } @@ -84,12 +84,12 @@ export const fragment = tsx.component({ freeze(tail, 'parentNode', container) const insertBefore = parent.insertBefore; - parent.insertBefore = (node, ref) => { + parent.insertBefore = (node: any, ref: any) => { insertBefore.call(parent, node, ref !== container ? ref : head) } const removeChild = parent.removeChild; - parent.removeChild = (node) => { + parent.removeChild = (node: any) => { if (node === container) { while(head.nextSibling !== tail) container.removeChild(head.nextSibling) diff --git a/packages/slate-vue/components/leaf.tsx b/packages/slate-vue/components/leaf.tsx index 4f0b09b..0356185 100644 --- a/packages/slate-vue/components/leaf.tsx +++ b/packages/slate-vue/components/leaf.tsx @@ -20,9 +20,9 @@ const Leaf = tsx.component({ fragment }, render(h) { - const { renderLeaf = DefaultLeaf, text, leaf} = this; + const { renderLeaf = DefaultLeaf, text, leaf} = this as any; let children = ( - + ); if (leaf[PLACEHOLDER_SYMBOL]) { children = ( diff --git a/packages/slate-vue/components/slate.tsx b/packages/slate-vue/components/slate.tsx index f8af8a5..5566585 100644 --- a/packages/slate-vue/components/slate.tsx +++ b/packages/slate-vue/components/slate.tsx @@ -25,7 +25,7 @@ export const Slate = tsx.component({ // This method is forked from Vuex, but is not an efficient methods, still need to be improved // prepare two objects, one for immer, the other for vue // when we get immer result, patch it to vue - this.renderSlate() + ;(this as any).renderSlate() }, watch: { value(newVal, oldVal) { @@ -52,24 +52,24 @@ export const Slate = tsx.component({ * force slate render by change fragment name * @param newVal */ - renderSlate(newVal) { + renderSlate(newVal: any) { const value = newVal || this.value - this.$editor.children = JSON.parse(value); + ;(this as any).$editor.children = JSON.parse(value); const $$data = JSON.parse(value); - this.$editor._state= Vue.observable($$data) - this.name = this.genUid() + ;(this as any).$editor._state= Vue.observable($$data) + ;(this as any).name = this.genUid() } }, render() { - EDITOR_TO_ON_CHANGE.set(this.$editor,()=>{ + EDITOR_TO_ON_CHANGE.set((this as any).$editor,()=>{ // patch to update all use // update editable manual // notify all update - this.$editor._state.__ob__.dep.notify() + ;(this as any).$editor._state.__ob__.dep.notify() // update focus manual - const gvm = getGvm(this.$editor) - gvm.focused = VueEditor.isFocused(this.$editor) - let op = this.$editor._operation + const gvm = getGvm((this as any).$editor) + gvm.focused = VueEditor.isFocused((this as any).$editor) + let op = (this as any).$editor._operation if(op && op.type === 'set_selection') { gvm.updateSelected() } @@ -78,7 +78,7 @@ export const Slate = tsx.component({ }) return ( - {this.$scopedSlots.default()} + {(this as any).$scopedSlots.default()} ) } diff --git a/packages/slate-vue/components/string.tsx b/packages/slate-vue/components/string.tsx index c30494c..0c679a3 100644 --- a/packages/slate-vue/components/string.tsx +++ b/packages/slate-vue/components/string.tsx @@ -53,7 +53,7 @@ const string = tsx.component({ TextString }, render() { - const { leaf, editor,isLast, parent, text } = this + const { leaf, editor, isLast, parent, text } = this as any const path = VueEditor.findPath(editor, text) const parentPath = Path.parent(path) diff --git a/packages/slate-vue/components/text.tsx b/packages/slate-vue/components/text.tsx index 316f5ca..2cf8b83 100644 --- a/packages/slate-vue/components/text.tsx +++ b/packages/slate-vue/components/text.tsx @@ -37,9 +37,9 @@ const Text = tsx.component({ } }, hooks() { - const ref = this.ref = useRef(null); + const ref = (this as any).ref = useRef(null); const {text} = this; - const editor = this.$editor; + const editor = (this as any).$editor; const key = VueEditor.findKey(editor, text) const initRef = () => { useEffect(()=>{ @@ -57,12 +57,12 @@ const Text = tsx.component({ initRef() }, render(h, ctx) { - const { text, placeholder } = this - let decorations = this.decorations; + const { text, placeholder } = this as any + let decorations: any = this.decorations; if(!decorations) { - const editor = this.$editor + const editor = (this as any).$editor const p = VueEditor.findPath(editor, text) - decorations = this.decorate([text, p]) + decorations = (this as any).decorate([text, p]) // init placeholder if ( @@ -91,7 +91,7 @@ const Text = tsx.component({ ) } return ( - + {children} ) diff --git a/packages/slate-vue/plugins/runtime-util.ts b/packages/slate-vue/plugins/runtime-util.ts index 16b2ac4..4aba937 100644 --- a/packages/slate-vue/plugins/runtime-util.ts +++ b/packages/slate-vue/plugins/runtime-util.ts @@ -340,7 +340,7 @@ export const runtimeNode = { } } -export const isVueObject = (obj) => { +export const isVueObject = (obj: any) => { return obj.__ob__ } diff --git a/packages/slate-vue/plugins/slate-plugin.ts b/packages/slate-vue/plugins/slate-plugin.ts index cdb7924..f17af8b 100644 --- a/packages/slate-vue/plugins/slate-plugin.ts +++ b/packages/slate-vue/plugins/slate-plugin.ts @@ -18,7 +18,7 @@ const createGvm = () => { }, methods: { updateSelected() { - const editor = GVM_TO_EDITOR.get(this) + const editor = GVM_TO_EDITOR.get(this) as VueEditor const {selection} = editor if(selection) { this.selected.elements.forEach(node => { @@ -42,7 +42,7 @@ export const getGvm = (editor: VueEditor) => { } // for element and element[] -export const elementWatcherPlugin = (vm, type) => { +export const elementWatcherPlugin = (vm: any, type: string) => { const update = vm._watcher.update; vm._watcher.update = () => { const op: Operation = vm.$editor._operation; @@ -64,22 +64,24 @@ export const elementWatcherPlugin = (vm, type) => { export const SlateMixin = { mounted() { - const editor = this.$editor - editor._state.__ob__.dep.addSub(this._watcher) + const editor = (this as any).$editor + editor._state.__ob__.dep.addSub((this as any)._watcher) } } export const SelectedMixin = { created() { - const gvm = getGvm(this.$editor) - const element = this.element || this.node + const gvm = getGvm((this as any).$editor) + const element = (this as any).element || (this as any).node gvm.selected.elements.push(element) }, computed: { selected() { - if(this.element) { - const gvm = getGvm(this.$editor) - return gvm.selected[NODE_TO_KEY.get(this.element).id] + if((this as any).element) { + const gvm = getGvm((this as any).$editor) + const key = NODE_TO_KEY.get((this as any).element) + if(!key) return false + return gvm.selected[key.id] } else { return false } @@ -90,7 +92,7 @@ export const SelectedMixin = { export const ReadOnlyMixin = { computed: { readOnly() { - const gvm = getGvm(this.$editor) + const gvm = getGvm((this as any).$editor) return gvm.readOnly } } @@ -99,7 +101,7 @@ export const ReadOnlyMixin = { export const FocusedMixin = { computed: { focused() { - const gvm = getGvm(this.$editor) + const gvm = getGvm((this as any).$editor) return gvm.focused } } @@ -114,7 +116,7 @@ export const createEditorInstance = () => { } export const SlatePlugin = { - install(Vue, options) { + install(Vue: any, options: any) { Vue.mixin({ beforeCreate() { if(!this.$editor) { diff --git a/packages/slate-vue/plugins/vue-runtime.ts b/packages/slate-vue/plugins/vue-runtime.ts index 5a59de1..e1dd3e3 100644 --- a/packages/slate-vue/plugins/vue-runtime.ts +++ b/packages/slate-vue/plugins/vue-runtime.ts @@ -22,8 +22,8 @@ const runtime = () => { } } -export const vueRuntimeFunc = (func): any => { - return (...args) => { +export const vueRuntimeFunc = (func: any): any => { + return (...args: any) => { const restore = runtime() const result = func(...args) restore() @@ -31,7 +31,7 @@ export const vueRuntimeFunc = (func): any => { } } -export const vueRuntime = (func, ...args): any => { +export const vueRuntime = (func: any, ...args: any): any => { const restore = runtime() const result = func(...args) restore() diff --git a/packages/slate-vue/utils/hotkeys.ts b/packages/slate-vue/utils/hotkeys.ts index 33937d4..7f206a8 100644 --- a/packages/slate-vue/utils/hotkeys.ts +++ b/packages/slate-vue/utils/hotkeys.ts @@ -1,3 +1,4 @@ +// @ts-ignore import { isKeyHotkey } from 'is-hotkey' import { IS_APPLE } from './environment' @@ -49,9 +50,9 @@ const WINDOWS_HOTKEYS = { */ const create = (key: string) => { - const generic = HOTKEYS[key] - const apple = APPLE_HOTKEYS[key] - const windows = WINDOWS_HOTKEYS[key] + const generic = (HOTKEYS as any)[key] + const apple = (APPLE_HOTKEYS as any)[key] + const windows = (WINDOWS_HOTKEYS as any)[key] const isGeneric = generic && isKeyHotkey(generic) const isApple = apple && isKeyHotkey(apple) const isWindows = windows && isKeyHotkey(windows) diff --git a/tsconfig.json b/tsconfig.json index ede44ef..a9b501c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "target": "esnext", "module": "esnext", - "strict": false, + "strict": true, "jsx": "preserve", "importHelpers": true, "moduleResolution": "node",