codex-team/editor.js

TS2351: This expression is not constructable.

Ouverte

#2 624 ouverte le 18 févr. 2024

 (2 commentaires) (4 réactions) (0 personne assignée)TypeScript (1 985 forks)batch import
good first issue

Métriques du dépôt

Stars
 (26 602 étoiles)
Métriques de merge PR
 (Métriques PR en attente)

Description

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:

Guide contributeur