Skip to content

Commit 828f202

Browse files
committed
fix(types): fix editor prop types
1 parent 812730d commit 828f202

File tree

2 files changed

+5
-14
lines changed

2 files changed

+5
-14
lines changed

src/editor/types.ts

+4-12
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
import { type FunctionalComponent } from 'vue'
1+
import CodeMirrorEditor from "./CodeMirrorEditor.vue";
2+
import MonacoEditor from "./MonacoEditor.vue";
3+
4+
export type EditorComponentType = typeof CodeMirrorEditor | typeof MonacoEditor
25

36
export type PreviewMode = 'js' | 'css' | 'ssr'
47

@@ -12,14 +15,3 @@ export interface EditorProps {
1215
export interface EditorEmits {
1316
(e: 'change', code: string): void
1417
}
15-
16-
export type EditorComponentType = FunctionalComponent<
17-
EditorProps,
18-
{ change: (code: string) => void }
19-
> & {
20-
editorType: 'monaco' | 'codemirror'
21-
}
22-
23-
declare const EditorComponent: EditorComponentType
24-
25-
export default EditorComponent

test/main.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { createApp, h, watchEffect } from 'vue'
22
import { Repl, ReplStore } from '../src'
33
import MonacoEditor from '../src/editor/MonacoEditor.vue'
44
// import CodeMirrorEditor from '../src/editor/CodeMirrorEditor.vue'
5-
import { EditorComponentType } from '../src/editor/types'
65
;(window as any).process = { env: {} }
76

87
const App = {
@@ -43,7 +42,7 @@ const App = {
4342
h(Repl, {
4443
store,
4544
theme: 'dark',
46-
editor: MonacoEditor as any as EditorComponentType,
45+
editor: MonacoEditor,
4746
// layout: 'vertical',
4847
ssr: true,
4948
sfcOptions: {

0 commit comments

Comments
 (0)