Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
htho opened this issue Nov 27, 2024 · 1 comment · Fixed by #2465
Closed
Labels
🐛 bug Defect / Bug ✅ accepted The core team has agreed that it is a good idea to fix this

Comments

@htho
Copy link

htho commented Nov 27, 2024

🤔 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

@davidjgoss davidjgoss added 🐛 bug Defect / Bug ✅ accepted The core team has agreed that it is a good idea to fix this labels Jan 8, 2025
@htho
Copy link
Author

htho commented Jan 8, 2025

Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Defect / Bug ✅ accepted The core team has agreed that it is a good idea to fix this
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants