Skip to content

Commit 3a4b1d2

Browse files
author
Rich Harris
committed
Merge branch 'main' into fixes-297
2 parents 7df5faf + 9cd4c56 commit 3a4b1d2

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/routes/tutorial/[slug]/filetree/Filetree.svelte

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,14 @@
2929
collapsed,
3030
3131
add: async (name, type) => {
32-
if (!$solution[name] && !exercise.editing_constraints.create.has(name)) {
32+
const expected = $solution[name];
33+
34+
if (type !== expected.type) {
35+
modal_text = `${name.slice(exercise.scope.prefix.length)} should be a ${expected.type}, not a ${type}!`;
36+
return;
37+
}
38+
39+
if (!expected && !exercise.editing_constraints.create.has(name)) {
3340
modal_text =
3441
'Only the following files and folders are allowed to be created in this exercise:\n' +
3542
Array.from(exercise.editing_constraints.create).join('\n');

0 commit comments

Comments
 (0)