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

@@ -18,7 +18,7 @@ const Playground: React.FC<PlaygroundProps> = ({ initFiles, initImportMap }) =>
const handleOnChangeFileContent = (content: string, fileName: string, files: IFiles) => {
if (fileName === IMPORT_MAP_FILE_NAME) {
setImportMap(JSON.parse(content))
setImportMap(JSON.parse(content) as IImportMap)
} else {
delete files[IMPORT_MAP_FILE_NAME]
setFiles(files)