Skip to content

The imported world-Proxy should also work in the transformer method for defineParameterType #2447

@htho

Description

@htho

🤔 What's the problem you're trying to solve?

I want to access the world within a transformer arrow-function when I defineParameterType.
But this fails with: Error: Attempted to access 'world' from incorrect scope; only applicable to steps and case-level hooks

defineParameterType({
  name: 'person',
  regexp: /Lucy|Sean/,
  transformer: function (name){
    console.log("########################", this, this.attach); // OK
    console.log("########################", world, world.attach); // FAILS
    return new Person(name);
  }
})

✨ What's your proposed solution?

This should be possible, because I can access the World through this in a normal function.

⛏ Have you considered any alternatives or workarounds?

I can use a function instead of an arrow function and use this instead of world.

📚 Any additional context?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐛 bugDefect / Bug✅ acceptedThe core team has agreed that it is a good idea to fix this

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions