✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🐇 Announcing Dash VTK for 3d simulation graphics. Check out the March webinar.

Missing layout properties in custom build

We’re trying to use a custom Plotly build to only load the trace types that we need for the scatter and polar plots we create in our app (using Angular with Typescript, bundling with WebPack and the ts-loader). This is generally straightforward and works well in development:

let plotlyCore = require(‘plotly.js/lib/core’)

let plotlyScatter = require(‘plotly.js/lib/scatter’),
plotlyScatterPolar = require(‘plotly.js/lib/scatterpolar’),
plotlyBarPolar = require(‘plotly.js/lib/barpolar’),
plotlyScatterPolarGl = require(‘plotly.js/lib/scatterpolargl’)

plotlyCore.register(plotlyScatter)
plotlyCore.register(plotlyScatterPolar)
plotlyCore.register(plotlyBarPolar)
plotlyCore.register(plotlyScatterPolarGl)

module.exports = plotlyCore

However in our production build we get some typing errors because the “polar” properties don’t exist on the Layout object:

TS2345: Argument of type ‘{ font: { family: string; size: number; color: string; }; showlegend: boolean; polar: { angularaxis: { rotation: number; tickmode: string; tickvals: number; ticktext: string; }; radialaxis: { angle: number; title: { …; }; nticks: number; tickfont: { …; }; }; }; margin: { …; }; paper_bgcolor: string; } | { …’ is not assignable to parameter of type ‘Partial’.
Type ‘{ font: { family: string; size: number; color: string; }; showlegend: boolean; polar: { angularaxis: { rotation: number; tickmode: string; tickvals: number; ticktext: string; }; radialaxis: { angle: number; title: { …; }; nticks: number; tickfont: { …; }; }; }; margin: { …; }; paper_bgcolor: string; }’ is not assignable to type ‘Partial’.
Object literal may only specify known properties, and ‘polar’ does not exist in type ‘Partial’.

I assumed that these options should get added to the layout as needed depending on the registered scatter types, but they don’t. Anybody have suggestions for this?