From 34b8f18a57bfd88ba5c8856b9789ef720672ebf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Ku=CC=88hn?= Date: Tue, 14 Apr 2020 10:13:27 +0200 Subject: [PATCH] fix some types --- packages/core/src/Editor.ts | 20 ++++++++++---------- tsconfig.json | 7 ++----- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/packages/core/src/Editor.ts b/packages/core/src/Editor.ts index 931f5a63..6c804217 100644 --- a/packages/core/src/Editor.ts +++ b/packages/core/src/Editor.ts @@ -29,11 +29,11 @@ export interface CommandSpec { type EditorContent = string | JSON | null -interface Options { - element?: HTMLElement, - content?: EditorContent - extensions?: (Extension | Node | Mark)[] - injectCSS?: Boolean +interface EditorOptions { + element: HTMLElement, + content: EditorContent + extensions: (Extension | Node | Mark)[] + injectCSS: Boolean, } @magicMethods @@ -43,24 +43,24 @@ export class Editor extends EventEmitter { extensionManager!: ExtensionManager schema!: Schema view!: EditorView - options: Options = { + commands: { [key: string]: any } = {} + css!: HTMLStyleElement + options: EditorOptions = { element: document.createElement('div'), content: '', injectCSS: true, extensions: [], } - commands: { [key: string]: any } = {} - css!: HTMLStyleElement private lastCommand = Promise.resolve() public selection = { from: 0, to: 0 } - constructor(options: Options) { + constructor(options: Partial = {}) { super() this.options = { ...this.options, ...options } } - + private init() { this.createExtensionManager() this.createSchema() diff --git a/tsconfig.json b/tsconfig.json index d91955ed..cdbef1c0 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -11,11 +11,8 @@ "experimentalDecorators": true, "sourceMap": true, "baseUrl": ".", - "allowJs": true, - "checkJs": true, - "types": [ - "node" - ], + "allowJs": false, + "checkJs": false, "paths": { "@/*": [ "packages/*"