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

[Bug]: Object literal may only specify known properties, and 'params' does not exist in type 'AgChartTheme'.ts(2353) #3649

Open
sina-ss opened this issue Feb 20, 2025 · 1 comment
Assignees

Comments

@sina-ss
Copy link

sina-ss commented Feb 20, 2025

Link to reproducible scenario

https://ag-grid.com/charts/react/themes/

Describe the bug

There appears to be a discrepancy between the documentation and the actual TypeScript interface for AgChartTheme. The official documentation shows an example using a params property to customize theme properties like background color and font settings, but this property is not defined in the TypeScript interface, causing type errors.

Current Behavior

When attempting to use the params property as shown in the documentation:

const myTheme: AgChartTheme = {
    palette: {
        fills: ["#006f9b", "#ff7faa", "#00994d", "#ff8833", "#00a0dd"],
        strokes: ["#003f58", "#934962", "#004a25", "#914d1d", "#006288"],
    },
    params: {
        backgroundColor: "#fff1e5",
        foregroundColor: "#262a33",
        // ... other params
    }
};

TypeScript raises the following error:

Object literal may only specify known properties, and 'params' does not exist in type 'AgChartTheme'.ts(2353)

Importantly, this error only occurs when importing AgChartTheme from ag-charts-enterprise. When importing from ag-charts-community, the TypeScript error does not appear. This suggests there might be a difference in type definitions between the enterprise and community versions.

Expected Behavior

Since the params property is shown in the official documentation, it should either:

  1. Be included in the AgChartTheme TypeScript interface, or
  2. The documentation should be updated to show the correct way to customize these theme properties
  3. The type definitions in ag-charts-enterprise should match those in ag-charts-community

Questions

  1. What is the correct way to set theme properties like background color and font settings?
  2. If the params property is deprecated, what is the current recommended approach?
  3. Why is there a difference in type definitions between enterprise and community versions?

Environment

  • "react": "^19.0.0",
  • "react-dom": "^19.0.0"
  • "ag-charts-react": "^11.1.1",
  • "ag-grid-enterprise": "^33.1.1"
  • "typescript": "^5.7.3"

Additional Context

This issue affects developers trying to customize chart themes according to the official documentation. Would appreciate clarification on the correct approach to implement these customizations.

The discrepancy between enterprise and community versions makes it unclear which is the correct implementation, and which should be updated to match the other.

Version

11.1.1

Does the issue occur for a specific framework only?

React

Is the issue only observable on a specific browser?

All browsers

@AG-DavidG
Copy link
Contributor

Hi @sina-ss

We have tried this on our end and it all works as expected. Please see https://codesandbox.io/p/sandbox/simple-box-plot-forked-jjlt5c for an example of this.

Please can you send us a codesandbox or similar live reproduction of the issue you are seeing.

A few points to check:

  • The params was only added in version 11.1 so if you are using version 11.0 or earlier then it won't be available.
  • You mention ag-charts-enterprise in the description, but ag-grid-enterprise in your environment. There are different things.

We can give more specific advice once we can reproduce on our end.

Thanks

David

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants