editor.js icon indicating copy to clipboard operation
editor.js copied to clipboard

Fix (??) type of `pasteConfig`

Open RyanCavanaugh opened this issue 3 years ago • 0 comments

TypeScript 4.9 found something is wrong with this code, but it's unclear (to me) which line is wrong. This PR is a guess, do with it what you will.

In paste.ts there's a check to see if pasteConfig === false: https://github.com/codex-team/editor.js/blob/next/src/components/modules/paste.ts#L287

However, this getter never returns false because if the LHS of the || is false, { } is returned instead.

It seems like this meant to be ?? instead so that if this.constructable[InternalBlockToolSettings.PasteConfig] was undefined (missing), then {} would be returned instead. But maybe you meant false here - I don't know.

RyanCavanaugh avatar Aug 29 '22 19:08 RyanCavanaugh