Skip to content

Commit

Permalink
[lexical-react] Bug Fix: Import JSX type from React to prevent "Can…
Browse files Browse the repository at this point in the history
…not find namespace 'JSX'"-error when type-checking with React 19 (#7080)
  • Loading branch information
Svish authored Jan 24, 2025
1 parent f8e5968 commit 6a98a47
Show file tree
Hide file tree
Showing 118 changed files with 195 additions and 1 deletion.
2 changes: 2 additions & 0 deletions examples/react-plain-text/src/plugins/TreeViewPlugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
*
*/

import type {JSX} from 'react';

import {useLexicalComposerContext} from '@lexical/react/LexicalComposerContext';
import {TreeView} from '@lexical/react/LexicalTreeView';

Expand Down
2 changes: 2 additions & 0 deletions examples/react-rich-collab/src/plugins/TreeViewPlugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
*
*/

import type {JSX} from 'react';

import {useLexicalComposerContext} from '@lexical/react/LexicalComposerContext';
import {TreeView} from '@lexical/react/LexicalTreeView';

Expand Down
2 changes: 2 additions & 0 deletions examples/react-rich/src/plugins/TreeViewPlugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
*
*/

import type {JSX} from 'react';

import {useLexicalComposerContext} from '@lexical/react/LexicalComposerContext';
import {TreeView} from '@lexical/react/LexicalTreeView';

Expand Down
2 changes: 2 additions & 0 deletions examples/react-table/src/plugins/TreeViewPlugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
*
*/

import type {JSX} from 'react';

import {useLexicalComposerContext} from '@lexical/react/LexicalComposerContext';
import {TreeView} from '@lexical/react/LexicalTreeView';

Expand Down
1 change: 1 addition & 0 deletions packages/lexical-devtools-core/src/TreeView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/

import type {EditorSetOptions, EditorState} from 'lexical';
import type {JSX} from 'react';

import * as React from 'react';
import {forwardRef, useCallback, useEffect, useRef, useState} from 'react';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
*
*/

import type {JSX} from 'react';

import {createEmptyHistoryState, registerHistory} from '@lexical/history';
import {useLexicalComposerContext} from '@lexical/react/LexicalComposerContext';
import {ContentEditable} from '@lexical/react/LexicalContentEditable';
Expand Down
2 changes: 2 additions & 0 deletions packages/lexical-playground/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
*
*/

import type {JSX} from 'react';

import {$createLinkNode} from '@lexical/link';
import {$createListItemNode, $createListNode} from '@lexical/list';
import {LexicalComposer} from '@lexical/react/LexicalComposer';
Expand Down
2 changes: 2 additions & 0 deletions packages/lexical-playground/src/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
*
*/

import type {JSX} from 'react';

import {AutoFocusPlugin} from '@lexical/react/LexicalAutoFocusPlugin';
import {CharacterLimitPlugin} from '@lexical/react/LexicalCharacterLimitPlugin';
import {CheckListPlugin} from '@lexical/react/LexicalCheckListPlugin';
Expand Down
2 changes: 2 additions & 0 deletions packages/lexical-playground/src/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
*
*/

import type {JSX} from 'react';

import {CAN_USE_BEFORE_INPUT} from '@lexical/utils';
import {useEffect, useMemo, useState} from 'react';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
*
*/

import type {JSX} from 'react';

import {
createContext,
ReactNode,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/

import type {SettingName} from '../appSettings';
import type {JSX} from 'react';

import * as React from 'react';
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/

import type {HistoryState} from '@lexical/react/LexicalHistoryPlugin';
import type {JSX} from 'react';

import {createEmptyHistoryState} from '@lexical/react/LexicalHistoryPlugin';
import * as React from 'react';
Expand Down
3 changes: 3 additions & 0 deletions packages/lexical-playground/src/context/ToolbarContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
* LICENSE file in the root directory of this source tree.
*
*/

import type {JSX} from 'react';

import {ElementFormatType} from 'lexical';
import React, {
createContext,
Expand Down
2 changes: 2 additions & 0 deletions packages/lexical-playground/src/hooks/useModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
*
*/

import type {JSX} from 'react';

import {useCallback, useMemo, useState} from 'react';
import * as React from 'react';

Expand Down
2 changes: 2 additions & 0 deletions packages/lexical-playground/src/nodes/EquationComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
*
*/

import type {JSX} from 'react';

import {useLexicalComposerContext} from '@lexical/react/LexicalComposerContext';
import {useLexicalEditable} from '@lexical/react/useLexicalEditable';
import {mergeRegister} from '@lexical/utils';
Expand Down
1 change: 1 addition & 0 deletions packages/lexical-playground/src/nodes/EquationNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import type {
SerializedLexicalNode,
Spread,
} from 'lexical';
import type {JSX} from 'react';

import katex from 'katex';
import {$applyNodeReplacement, DecoratorNode, DOMExportOutput} from 'lexical';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import type {ExcalidrawInitialElements} from '../../ui/ExcalidrawModal';
import type {NodeKey} from 'lexical';
import type {JSX} from 'react';

import {AppState, BinaryFiles} from '@excalidraw/excalidraw/types/types';
import {useLexicalComposerContext} from '@lexical/react/LexicalComposerContext';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
*
*/

import type {JSX} from 'react';

import {exportToSvg} from '@excalidraw/excalidraw';
import {
ExcalidrawElement,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import type {
SerializedLexicalNode,
Spread,
} from 'lexical';
import type {JSX} from 'react';

import {DecoratorNode} from 'lexical';
import * as React from 'react';
Expand Down
1 change: 1 addition & 0 deletions packages/lexical-playground/src/nodes/FigmaNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import type {
NodeKey,
Spread,
} from 'lexical';
import type {JSX} from 'react';

import {BlockWithAlignableContents} from '@lexical/react/LexicalBlockWithAlignableContents';
import {
Expand Down
1 change: 1 addition & 0 deletions packages/lexical-playground/src/nodes/ImageComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import type {
LexicalEditor,
NodeKey,
} from 'lexical';
import type {JSX} from 'react';

import './ImageNode.css';

Expand Down
1 change: 1 addition & 0 deletions packages/lexical-playground/src/nodes/ImageNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import type {
SerializedLexicalNode,
Spread,
} from 'lexical';
import type {JSX} from 'react';

import {$applyNodeReplacement, createEditor, DecoratorNode} from 'lexical';
import * as React from 'react';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/
import type {Position} from './InlineImageNode';
import type {BaseSelection, LexicalEditor, NodeKey} from 'lexical';
import type {JSX} from 'react';

import './InlineImageNode.css';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import type {
SerializedLexicalNode,
Spread,
} from 'lexical';
import type {JSX} from 'react';

import {
$applyNodeReplacement,
Expand Down
3 changes: 3 additions & 0 deletions packages/lexical-playground/src/nodes/PageBreakNode/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
* LICENSE file in the root directory of this source tree.
*
*/

import type {JSX} from 'react';

import './index.css';

import {useLexicalComposerContext} from '@lexical/react/LexicalComposerContext';
Expand Down
1 change: 1 addition & 0 deletions packages/lexical-playground/src/nodes/PollComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/

import type {Option, Options, PollNode} from './PollNode';
import type {JSX} from 'react';

import './PollNode.css';

Expand Down
2 changes: 2 additions & 0 deletions packages/lexical-playground/src/nodes/PollNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
*
*/

import type {JSX} from 'react';

import {
DecoratorNode,
DOMConversionMap,
Expand Down
1 change: 1 addition & 0 deletions packages/lexical-playground/src/nodes/StickyComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/

import type {LexicalEditor, NodeKey} from 'lexical';
import type {JSX} from 'react';

import './StickyNode.css';

Expand Down
1 change: 1 addition & 0 deletions packages/lexical-playground/src/nodes/StickyNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import type {
SerializedLexicalNode,
Spread,
} from 'lexical';
import type {JSX} from 'react';

import {$setSelection, createEditor, DecoratorNode} from 'lexical';
import * as React from 'react';
Expand Down
1 change: 1 addition & 0 deletions packages/lexical-playground/src/nodes/TweetNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import type {
NodeKey,
Spread,
} from 'lexical';
import type {JSX} from 'react';

import {BlockWithAlignableContents} from '@lexical/react/LexicalBlockWithAlignableContents';
import {
Expand Down
1 change: 1 addition & 0 deletions packages/lexical-playground/src/nodes/YouTubeNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import type {
NodeKey,
Spread,
} from 'lexical';
import type {JSX} from 'react';

import {BlockWithAlignableContents} from '@lexical/react/LexicalBlockWithAlignableContents';
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/

import type {LexicalEditor} from 'lexical';
import type {JSX} from 'react';

import {$createCodeNode, $isCodeNode} from '@lexical/code';
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/

import type {LexicalEditor} from 'lexical';
import type {JSX} from 'react';

import {
AutoEmbedOption,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
*
*/

import type {JSX} from 'react';

import {
AutoLinkPlugin,
createLinkMatcherWithRegExp,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/

import type {BaseSelection, NodeKey, TextNode} from 'lexical';
import type {JSX} from 'react';

import {useLexicalComposerContext} from '@lexical/react/LexicalComposerContext';
import {$isAtNodeEnd} from '@lexical/selection';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
*
*/

import type {JSX} from 'react';

import './index.css';

import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
*
*/

import type {JSX} from 'react';

import {registerCodeHighlighting} from '@lexical/code';
import {useLexicalComposerContext} from '@lexical/react/LexicalComposerContext';
import {useEffect} from 'react';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import type {
NodeKey,
RangeSelection,
} from 'lexical';
import type {JSX} from 'react';
import type {Doc} from 'yjs';

import './index.css';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
*
*/

import type {JSX} from 'react';

import {$createCodeNode} from '@lexical/code';
import {
INSERT_CHECK_LIST_COMMAND,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
*
*/

import type {JSX} from 'react';

import {$isLinkNode, TOGGLE_LINK_COMMAND} from '@lexical/link';
import {useLexicalComposerContext} from '@lexical/react/LexicalComposerContext';
import {
Expand Down
3 changes: 3 additions & 0 deletions packages/lexical-playground/src/plugins/DocsPlugin/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
* LICENSE file in the root directory of this source tree.
*
*/

import type {JSX} from 'react';

import * as React from 'react';

export default function DocsPlugin(): JSX.Element {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
* LICENSE file in the root directory of this source tree.
*
*/
import type {JSX} from 'react';

import './index.css';

import {DraggableBlockPlugin_EXPERIMENTAL} from '@lexical/react/LexicalDraggableBlockPlugin';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/

import type {LexicalEditor} from 'lexical';
import type {JSX} from 'react';

import {useLexicalComposerContext} from '@lexical/react/LexicalComposerContext';
import {TextNode} from 'lexical';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
*
*/

import type {JSX} from 'react';

import 'katex/dist/katex.css';

import {useLexicalComposerContext} from '@lexical/react/LexicalComposerContext';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/
import type {ExcalidrawInitialElements} from '../../ui/ExcalidrawModal';
import type {AppState, BinaryFiles} from '@excalidraw/excalidraw/types/types';
import type {JSX} from 'react';

import {useLexicalComposerContext} from '@lexical/react/LexicalComposerContext';
import {$wrapNodeInElement} from '@lexical/utils';
Expand Down
2 changes: 2 additions & 0 deletions packages/lexical-playground/src/plugins/FigmaPlugin/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
*
*/

import type {JSX} from 'react';

import {useLexicalComposerContext} from '@lexical/react/LexicalComposerContext';
import {$insertNodeToNearestRoot} from '@lexical/utils';
import {COMMAND_PRIORITY_EDITOR, createCommand, LexicalCommand} from 'lexical';
Expand Down
Loading

0 comments on commit 6a98a47

Please sign in to comment.