We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
const regions = data && d3 .hierarchy('data') .sum((d) => 1) .sort((a, b) => b.value - a.value);
The callback of sort() will throw an error Object is possibly 'undefined'. when I use typeScript, and if I add a condition like this:
Object is possibly 'undefined'.
const regions = data && d3 .hierarchy('data') .sum((d) => 1) .sort((a, b) => { if (a.value && b.value) { return b.value - a.value; } });
It'll say Type 'number | undefined' is not assignable to type 'number'. How can I handle with it?
Type 'number | undefined' is not assignable to type 'number'.
The text was updated successfully, but these errors were encountered:
Please address D3 typescript queries to https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/d3
PS: I am surprised by the quotes around 'data' in the hierarchy() call.
Sorry, something went wrong.
No branches or pull requests
The callback of sort() will throw an error
Object is possibly 'undefined'.
when I use typeScript, and if I add a condition like this:It'll say
Type 'number | undefined' is not assignable to type 'number'.
How can I handle with it?The text was updated successfully, but these errors were encountered: