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

Typescript and Type break on 4.1.0 #10991

Closed
Nico-DF opened this issue Dec 16, 2022 · 1 comment · Fixed by #10993
Closed

Typescript and Type break on 4.1.0 #10991

Nico-DF opened this issue Dec 16, 2022 · 1 comment · Fixed by #10993
Assignees
Milestone

Comments

@Nico-DF
Copy link
Contributor

Nico-DF commented Dec 16, 2022

Expected behavior

App build and runs properly

Current behavior

When upgrading to 4.1.0 (from 4.0.1), build breaks due to index.d.ts not finding js modules.

Error: node_modules/chart.js/types/helpers/helpers.canvas.d.ts:4:32 - error TS2307: Cannot find module '../../src/helpers/helpers.options.js' or its corresponding type declaratio
ns.

4 import { CanvasFontSpec } from '../../src/helpers/helpers.options.js';
                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Error: node_modules/chart.js/types/index.d.ts:3:26 - error TS2307: Cannot find module '../src/core/core.adapters.js' or its corresponding type declarations.

3 import { TimeUnit } from '../src/core/core.adapters.js';
                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Error: node_modules/chart.js/types/index.d.ts:4:26 - error TS2307: Cannot find module '../src/elements/element.point.js' or its corresponding type declarations.

4 import PointElement from '../src/elements/element.point.js';
                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Error: node_modules/chart.js/types/index.d.ts:5:32 - error TS2307: Cannot find module '../src/helpers/helpers.easing.js' or its corresponding type declarations.

5 import { EasingFunction } from '../src/helpers/helpers.easing.js';
                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Error: node_modules/chart.js/types/index.d.ts:9:21 - error TS2307: Cannot find module '../src/core/core.element.js' or its corresponding type declarations.

9 import Element from '../src/core/core.element.js';
                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Error: node_modules/chart.js/types/index.d.ts:13:32 - error TS2307: Cannot find module '../src/helpers/helpers.options.js' or its corresponding type declarations.

13 import { CanvasFontSpec } from '../src/helpers/helpers.options.js';
                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Error: node_modules/chart.js/types/index.d.ts:15:32 - error TS2307: Cannot find module '../src/helpers/helpers.easing.js' or its corresponding type declarations.

15 export { EasingFunction } from '../src/helpers/helpers.easing.js';
                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Error: node_modules/chart.js/types/index.d.ts:16:49 - error TS2307: Cannot find module '../src/elements/element.arc.js' or its corresponding type declarations.

16 export { default as ArcElement, ArcProps } from '../src/elements/element.arc.js';
                                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Error: node_modules/chart.js/types/index.d.ts:17:53 - error TS2307: Cannot find module '../src/elements/element.point.js' or its corresponding type declarations.

17 export { default as PointElement, PointProps } from '../src/elements/element.point.js';

If I remember well, 4.0.1 was functional regarding this

Reproducible sample

Trying to find a a online tool to reproduce it, otherwise I will soon drop a zip

Optional extra steps/info to reproduce

No response

Possible solution

No response

Context

Migration from 3.x to 4.0.1 is OK (minus bug I opened due to TimeUnit not accepting StepSize)
Migration from 4.0.1 to 4.1.0 => Type break

image

From what I understand, the problem might be on build on your side when producing d.ts files?
Inside index.d.ts => import { TimeUnit } from '../src/core/core.adapters.js';
But src does not exist, the TimeUnit is exported indeed on a core.adapter.js (core.adapter.d.ts) but on ../dist/core/core.adapters.js(d.ts)

chart.js version

v4.1.0

Browser name and version

No response

Link to your project

No response

@dangreen dangreen self-assigned this Dec 16, 2022
@GipHub123
Copy link

I can confirm this / got same error messages. I had to rollback to the previous version.

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

Successfully merging a pull request may close this issue.

4 participants