codex-team/editor.js

TS2351: This expression is not constructable.

Open

#2624 aperta il 18 feb 2024

Vedi su GitHub
 (2 commenti) (4 reazioni) (0 assegnatari)TypeScript (1985 fork)batch import
good first issue

Metriche repository

Star
 (26.602 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

Steps to reproduce:

  1. Change moduleResolution to node16 or nodenext in tsconfig.json

Expected behavior:

Type is correct

Screenshots:

'use client'
import EditorJS from '@editorjs/editorjs'
import { useCallback, useRef } from 'react'

export const Editor = () => {
  const editorRef = useRef<EditorJS.default | null>(null)
  return <div ref={useCallback((ref: HTMLDivElement | null) => {
    if (ref) {
      editorRef.current = new EditorJS({
        holder: ref
      })
    } else {
      editorRef.current?.destroy()
    }
  }, [])}
  />
}

Device, Browser, OS:

Editor.js version: latest

Plugins you use with their versions:

Guida contributor