Possible code duplication
BlueMagnificent opened this issue · comments
There seems to be a sort of code duplication here:
WebAssemblyStudio/src/utils/Template.ts
Lines 72 to 83 in 49afdef
Given that the below code is to handle such case:
WebAssemblyStudio/src/models/types.ts
Lines 234 to 261 in 49afdef
The default value for an unknown file.type
in the above src\utils\Template.ts
snippet is an empty string, while its equivalent in getIconForFileType
of src\models\types.ts
is the string "txt-ext-file-icon"
. However from observing rendered files in the DirectoryTree, these two default values still give the same icon.
We can correct this duplication by modifying:
WebAssemblyStudio/src/utils/Template.ts
Line 22 in 49afdef
to
import { File, FileType, Problem, Directory, getIconForFileType } from "../models";
and replacing:
WebAssemblyStudio/src/utils/Template.ts
Lines 72 to 83 in 49afdef
with
let icon = getIconForFileType(file.type);
It would be appropriate to note that without the above modifications the code still works well. I'm just pointing it out since it would make it easy to include additional file types later.
You should probably open a pull request.