You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG]: Layout type is missing all trace-contributed layout attributes in v4.0.0 (barmode, boxmode, scattermode, …) #8018
Updating to plotly.js 4.0.0 broke typechecking in my project since the generated Layout type omits every layout attribute contributed by a trace module, i.e., barmode (there are 30 of these). These are all valid and work at runtime, but they don't exist in the type Layout, failing the typecheck and thereby my pre-commit.
All six layout references should give an error. Playground Link
Notes
Plotly.validate (plotly.js 4.0.0) treats these as valid layout keys:
{ barmode: "overlay" } -> []
{ barmode: "nonsense" } -> ["value: In layout, key barmode is set to an invalid value (nonsense)"]
{ notARealAttr: 1 } -> ["schema: In layout, key notARealAttr is not part of the schema"]
Note the differing codes: barmode gets a value error (key recognised, value checked
against the enum), while an unknown key gets a schema error. So the runtime considers layout.barmode part of the schema even though the type says it does not exist. This leads me to believe that this is an unwanted change / a bug.
Thanks for the report! This is a real bug. The type generator only walks the schema at schema.layout.layoutAttributes. The attributes that you're referring to are located at schema.traces[<type>].layoutAttributes, so they get missed. But they should be included. I'll update the script to handle this.
Activity
camdecoster commentedon Sep 4, 2026
Thanks for the report! This is a real bug. The type generator only walks the schema at
schema.layout.layoutAttributes. The attributes that you're referring to are located atschema.traces[<type>].layoutAttributes, so they get missed. But they should be included. I'll update the script to handle this.