Optimize code

This commit is contained in:
2024-01-12 23:45:33 +08:00
parent dc4e49343b
commit 8e880cc1ed
5 changed files with 17 additions and 34 deletions

View File

@@ -4,8 +4,7 @@ import { Loader } from 'esbuild-wasm'
import '@/components/Playground/Output/Transform/transform.scss'
import { useUpdatedEffect } from '@/util/hooks'
import { IFile, ITheme } from '@/components/Playground/shared'
import { addReactImport } from '@/components/Playground/utils'
import { cssToJs, jsonToJs } from '@/components/Playground/files'
import { cssToJs, jsonToJs, addReactImport } from '@/components/Playground/files'
import Compiler from '@/components/Playground/compiler'
import { MonacoEditorConfig } from '@/components/Playground/CodeEditor/Editor/monacoConfig'
@@ -29,7 +28,7 @@ const Transform: React.FC<OutputProps> = ({ file, theme }) => {
setCompiledCode(value.code)
setErrorMsg('')
})
.catch((e) => {
.catch((e: Error) => {
setErrorMsg(`编译失败:${e.message}`)
})
}