Skip to content

Empty object passes as array to stimulus values #89

@tacman

Description

@tacman

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: {}
}> 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions