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

Empty object passes as array to stimulus values #89

Open
tacman opened this issue Apr 18, 2024 · 0 comments
Open

Empty object passes as array to stimulus values #89

tacman opened this issue Apr 18, 2024 · 0 comments

Comments

@tacman
Copy link

tacman commented Apr 18, 2024

Perhaps this should go in the Twig issues. I can't figure out how to pass an empty object to a stimulus controller, it keeps getting interpreted as a empty array.

export default class extends Controller {
    static values = {
        languageMap: Object,
// this works
<div {{ stimulus_controller('language', {
        languageMap: {en:'English'}
}> 

// this throws an error: TypeError: expected value of type "object" but instead got value "[]" of type "array"
<div {{ stimulus_controller('language', {
        languageMap: {}
}> 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant