diff --git a/src/engine/target.js b/src/engine/target.js index b67b42a5a..7b2f1d66f 100644 --- a/src/engine/target.js +++ b/src/engine/target.js @@ -87,7 +87,7 @@ class Target extends EventEmitter { const variable = this.lookupVariableById(id); if (variable) return variable; // No variable with this name exists - create it locally. - const newVariable = new Variable(id, name, '', false); + const newVariable = new Variable(id, name, Variable.SCALAR_TYPE, false); this.variables[id] = newVariable; return newVariable; } diff --git a/src/engine/variable.js b/src/engine/variable.js index a44324f6e..5896e593b 100644 --- a/src/engine/variable.js +++ b/src/engine/variable.js @@ -9,7 +9,7 @@ class Variable { /** * @param {string} id Id of the variable. * @param {string} name Name of the variable. - * @param {(string|number)} type Type of the variable, one of "" or "list" + * @param {string} type Type of the variable, one of '' or 'list' * @param {boolean} isCloud Whether the variable is stored in the cloud. * @constructor */ diff --git a/src/serialization/sb2.js b/src/serialization/sb2.js index 0c6c37813..f7b7b30da 100644 --- a/src/serialization/sb2.js +++ b/src/serialization/sb2.js @@ -234,7 +234,7 @@ const parseScratchObject = function (object, runtime, extensions, topLevel) { const newVariable = new Variable( getVariableId(variable.name), variable.name, - '', + Variable.SCALAR_TYPE, variable.isPersistent ); newVariable.value = variable.value; @@ -254,7 +254,7 @@ const parseScratchObject = function (object, runtime, extensions, topLevel) { const newVariable = new Variable( getVariableId(list.listName), list.listName, - 'list', + Variable.LIST_TYPE, list.isPersistent ); newVariable.value = list.contents;