Skip to content

The types don't include the tooltip property in datasets #12046

Closed
@julienw

Description

@julienw

Expected behavior

Hey,
I want to override a tooltip callback in datasets, this works fine, but the types don't allow it.

Sample code:

datasets: [
  {
    data,
    tooltip: {
      callbacks: {
        label: (ctx) => {
          // do something with ctx
        },
      },
    },
  },
]

Current behavior

I get this typescript error:

E: Object literal may only specify known properties, and 'tooltip' does not exist in type 'ChartDataset<"line", PressureAndConsumption[]>'

Reproducible sample

https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBAbzgYQBYENZwL5wGZQQhwDkAxhrAHQBWAziQNwCwAUGwG6ZxkwAecALxwAJhDIBXEAFMAdjCoBzaTACiAG2kz5AIQCeASREAKAEQg9aTDFMBKOOjpwAEgBUAsgBlk6WVzoaWnIwLKxcUHAWVljCstIA7iiUMMa8fAA0iGxwOXAwemDSAFyk6sBxJOnZuSLoMOglCNW5cOroAEbS6nQlANqmAErSIqaZpjrqEtKjcKYAml3qEPEzpgDiUNJyqwAKElBgmqsA8lC+yqYAulWsLTm19XQqPXC9Tbd3LW2d6iUkAMRwCB4OAANQgMGkDBunxaDwarwAjAAmTKIgCcmQAzJkAKyZVFwLHXZq5bAkj4tGAQCDqGDAMCNUktMjodTqdroMgAaxe71huW+XRKqX49kEAD4spSBXAAPRy0QQOB0IgqVDlRRweLAGCoHj8Zl3bAw2Emo3mmWWloQMD0iCyPlGuiszROmUtPhMj13I05a2wvTe2VwP04C2k7BsbC2RhAA

Optional extra steps/info to reproduce

No response

Possible solution

No response

Context

No response

chart.js version

v4.4.8

Browser name and version

No response

Link to your project

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions