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

Remove scriptability from defaults.font types #9794

Merged
merged 2 commits into from Oct 29, 2021

Conversation

kurkle
Copy link
Member

@kurkle kurkle commented Oct 25, 2021

Fix #9786

The option is in reality scriptable too, but I think most use cases are covered this way.

etimberg
etimberg previously approved these changes Oct 25, 2021
@etimberg etimberg added this to the Version 3.6.1 milestone Oct 25, 2021
@LeeLenaleee LeeLenaleee added the type: types Typescript type changes label Oct 25, 2021
@LeeLenaleee
Copy link
Collaborator

Can't you define it as: font: Scriptable<Partial<FontSpec>, ScriptableContext<TType>> | Partial<FontSpec> or does that not work?

So you would have the scriptable part still available so it doesnt throw an error if used that way

@kurkle
Copy link
Member Author

kurkle commented Oct 25, 2021

Can't you define it as: font: Scriptable<Partial<FontSpec>, ScriptableContext<TType>> | Partial<FontSpec> or does that not work?

So you would have the scriptable part still available so it doesnt throw an error if used that way

The Scriptable<T, TContext> already allows the T, so the Partial<FontSpec> was already included as acceptable type.
The type fails currently, because you can not set a .size to a function, which it could be.

I don't know any way to make this work properly.

@LeeLenaleee
Copy link
Collaborator

Alright, thanks for the explanation

@etimberg etimberg merged commit 1749e57 into chartjs:master Oct 29, 2021
@kurkle kurkle deleted the defaults-font branch June 29, 2022 10:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug type: types Typescript type changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TypeScript error when using Chart.defaults.font.size = 8; in v 3.6.0
3 participants