Copy
var test = mods.compatskills.TraitCreator.createTrait("test", 2, 3, "compatskills:banana", 1, "compatskills:banana|5");

test.onPlayerTick = function(event as crafttweaker.event.PlayerTickEvent) {
    ...
};