Skip to content

TypeScript type issues #977

Description

@joshkel

I'm working on updating a Node.js TypeScript project to use TypeScript's "module": "nodenext" and "moduleResolution": "nodenext" and am getting several compiler errors similar to the following:

error TS2614: Module '"chartjs-plugin-annotation"' has no exported member 'AnnotationOptions'.
Did you mean to use 'import AnnotationOptions from "chartjs-plugin-annotation"' instead?

import type { AnnotationOptions } from 'chartjs-plugin-annotation';
              ~~~~~~~~~~~~~~~~~

From what I can tell, the problem is caused by the relative imports within chartjs-plugin-annotation's types directory. Running tsc reveals that TypeScript expects to see, e.g., a ./options file and doesn't check for ./options.d.ts:

======== Resolving module './options' from '/Users/josh/src/app/node_modules/chartjs-plugin-annotation/types/index.d.ts'. ========
Explicitly specified module resolution kind: 'NodeNext'.
Resolving in ESM mode with conditions 'import', 'types', 'node'.
Loading module as file / folder, candidate module location '/Users/josh/src/app/node_modules/chartjs-plugin-annotation/types/options', target file types: TypeScript, JavaScript, Declaration, JSON.
Directory '/Users/josh/src/app/node_modules/chartjs-plugin-annotation/types/options' does not exist, skipping all lookups in it.
======== Module name './options' was not resolved. ========

The Are the Types Wrong tool reports these as "internal resolution errors" and also points out issues with CJS versus ESM types.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions