-
Notifications
You must be signed in to change notification settings - Fork 11.9k
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
Preparing the project for TypeScript #10595
Preparing the project for TypeScript #10595
Conversation
@kurkle @LeeLenaleee @etimberg @benmccann Hi guys. Would you please do a review? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to convince people to switch to TypeScript back when we started on Chart.js 3 and I remember there being some issue around class members. Could you switch one class that sets fields in the constructor so we can make sure there won't be problems?
@benmccann I will make it on Monday 👌 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Needs a rebase and a converted class to make sure it works.
@@ -3,6 +3,8 @@ import {_angleBetween, getAngleFromPoint, TAU, HALF_PI, valueOrDefault} from '.. | |||
import {PI, _isBetween, _limitValue} from '../helpers/helpers.math'; | |||
import {_readValueToProps} from '../helpers/helpers.options'; | |||
|
|||
/** @typedef {{ x: number, y: number, startAngle: number, endAngle: number, innerRadius: number, outerRadius: number, circumference: number }} ArcProps */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't work with an imported interface for some reason (maybe interface
vs type
), so I temporarily inlined it.
@benmccann @etimberg @kurkle review re-request is buggy 🤷♂️ Review pls 🙏 |
import {terser} from 'rollup-plugin-terser'; | ||
import { readFileSync } from "fs"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nit]
Not sure what eslint is configured to but either keep the spaces here and in auto/auto.d.ts or also remove the spaces with all other import brackets.
But giving it a quick look it seems like there are a lot more with spacing as without
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I compared the output of The only thing I'd want to make sure everyone is aware of is that we're now forcing a bundle step to develop Chart.js, which we wouldn't need otherwise. I do like TypeScript more than JSDocs though. I'm happy with the tradeoff either way whatever the team decides |
Thanks for checking the output @benmccann I am ok with the bundle step. I am, personally, a big fan of TS these days and I think it can make our code a lot better |
tsc