fix types, enable async imports in ts

This commit is contained in:
Oleg Isonen committed 2022-08-20 09:05:50 +03:00
1 parent 085f7836ff
commit d99adaf329
3 files changed
+9 -7

No files matched your search

@@ -12,7 +12,7 @@ import { config } from "./config";
import { useEffect } from "react";
import { useSelectedElement } from "~/canvas/shared/nano-states";
type EditorProps = {
export type EditorProps = {
editable: JSX.Element;
instance: Instance;
onChange: (updates: ChildrenUpdates) => void;
@@ -41,7 +41,7 @@ const Editor = ({ instance, editable, onChange }: EditorProps) => {
);
};
const EditorConfigured = (props) => {
const EditorConfigured = (props: EditorProps) => {
return (
<LexicalComposer initialConfig={config}>
<Editor {...props} />
@@ -1,10 +1,11 @@
import { memo, lazy, Suspense } from "react";
import { memo, lazy, Suspense, ComponentProps } from "react";
import type { EditorProps } from "./editor";
const EditorLazy = lazy(() => import("./editor"));
const EditorWithSuspense = (props) => {
const EditorWithSuspense = (props: EditorProps) => {
return (
<Suspense fallback={<div>Loading...</div>}>
<Suspense fallback={props.editable}>
<EditorLazy {...props} />
</Suspense>
);
+3 -2
View File
@@ -5,8 +5,9 @@
"compilerOptions": {
"noEmit": true,
"jsx": "react-jsx",
"target": "ES2019",
"lib": ["DOM", "DOM.Iterable", "ES2019"]
"target": "ES2020",
"module": "ES2020",
"lib": ["DOM", "DOM.Iterable", "ES2020"]
},
"include": ["app", "remix.env.d.ts"],
"exclude": ["node_modules"]