Status Chart: chart.js 3.6.0, improve type info, weekly updates #2324
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
null
. (Forauthor
, this is when a user has been deleted; forclosedAt
/mergedAt
, this is when a PR/issue hasn't been closed/merged.) We're already testing fornull
, this just acknowledges that in the type system.RateLimit
and combinedRawNodes
thatretrieve_nodes_from_network()
andretrieve_nodes()
return.RateLimit
, TypeScript is intelligent enough to see thatspent
/remaining
/limit
will always benumber
instead ofnull
by the time we return, making theRateLimit
type more useful. To achieve this, we need individual variables inretrieve_nodes_from_network()
. We can say thatspent
/remaining
/limit
arenumber
without an initializer, and TypeScript will require that we assign to them before using them. We need to change thewhile
loop into ado/while
loop so that TypeScript will see that it always runs at least one iteration (this was already guaranteed becausevariables.want_prs
andvariables.want_issues
are initiallytrue
).retrieve_nodes()
, we need a type assertion (as RawNodes
) to tell the compiler what we're loading.warn_about_duplicates()
, constructingSet<string>
tells TypeScript what we're doing (otherwise we're working withSet<any>
).write_monthly_table()
, we're really using aMap<string, number>
.transform_pr_nodes()
andtransform_issue_nodes()
to have deduced return types (with explicitly typedret
variables). This is more consistent with the rest of the code now, and while both ways are equally type-checked, theret
variables offer better diagnostics if the types are wrong (as TypeScript doesn't have to complain about the huge transformation in the function).馃搱 Live preview: stephantlavavej.github.io/STL/