[Chartjs]-Typescript types for chartjs-adapter-date-fns

1👍

You need to specify your own type definitions for this package.

There are three ways how the library can be typed:

  • Bundled Types
  • DefinitelyTyped / @types
  • Your Own Definitions

As the types aren’t bundled with the chartjs-adapter-date-fns package and there are no @types for it in the DefinitelyTyped repository, the only option you have is to provide your own type definition for this package.

The easiest way to do it is to add an empty declaration for it in a .d.ts file in your project with the content.

declare module "chartjs-adapter-date-fns";

It will silence warnings about this module

1👍

The date adapter does not export any functionalities so you can just add a // @ts-ignore above the import or create your own declaration file whith an empty module that provides the typing for the date adapter.

All the typings for the config itself are already provided by chart.js itself.

Leave a comment