Skip to content

chartjs-annotation-plugin 1.0.0-rc not working with chart.js 3.0.0-rc.4 (Typescript) #8723

@cnoelle

Description

@cnoelle

Expected Behavior

Annotation plugin to work with latest rc

Current Behavior

The typescript compilation fails:

node_modules/chartjs-plugin-annotation/types/index.d.ts:4:16 - error TS2665: Invalid module name in augmentation. Module 'chart.js' resolves to an untyped module at './node_modules/chart.js/dist/chart.js', which cannot be augmented.

Possible Solution

It worked in rc.3. Not sure if it is a regression in Chart.js or if the plugin needs to be updated, but I suspect the former.

Steps to Reproduce

I have not been able to get any of the interactive typescript playgrounds to work, but the setup to reproduce is really simple.

package.json:

{
  "name": "chartjs-test2",
  "version": "1.0.0",
  "description": "",
  "scripts": {
    "build": "tsc index.ts"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "chart.js": "3.0.0-rc.4",
    "chartjs-plugin-annotation": "1.0.0-rc"
  },
  "devDependencies": {
    "typescript": "^4.2.3"
  }
}

index.ts:

import { Chart } from 'chart.js';
import Annotation from 'chartjs-plugin-annotation';
Chart.register(Annotation);

Then run npm install followed by npm run build in the same folder.

Environment

  • Chart.js version: 3.0.0-rc.4
  • chartjs-annotation-plugin: 1.0.0-rc

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions