You are using some strange method. It should be like this:
figma.variables.createVariable(name, collectionId, resolvedType);
To set an alias:
variable.setValueForMode(mode, alias);
You are using some strange method. It should be like this:
figma.variables.createVariable(name, collectionId, resolvedType);
To set an alias:
variable.setValueForMode(mode, alias);