Add strict null checks to @pixi/ticker #10087
Open
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.
Description of change
Ref #8852
I have made the following adjustments to resolve the strict null check errors occurring under the packages/ticker directory.
packages/ticker/src/TickerPlugin.ts
_ticker
andticker
nullable and added optional chaining when referenced.packages/ticker/src/TickerListener.ts
TickerCallback
within this file.emit
method, to enable type inference for thefn
property, set the type of TickerCallback to a union type.T
of the classTickerListener
fromany
toRecord<string, any> | null
.fn
,context
,priority
, andonce
with the constructor's parameter definitions. This prevents redundant type management between the properties and constructor parameters. Additionally, sincenull
is set tofn
andcontext
within the destroy method, made them nullable.packages/ticker/src/Ticker.ts
null
is set to_head
and_requestId
within the destroy method, made them nullable._head
.Pre-Merge Checklist
npm run lint
)npm run test
)