[TS] Use strict mode in LGraphNode - initial (#598)

- Part of effort to convert LGraphNode to TS strict
- Adds some small runtime changes - no impact expected, but it is
possible
- Runtime changes are in separate commits from compile-time type changes
- Risk of downstream impact is low
This commit is contained in:
filtered
2025-02-26 04:19:27 +11:00
committed by GitHub
parent 0b84ca83d8
commit 4636367de2
7 changed files with 41 additions and 25 deletions

View File

@@ -13,6 +13,12 @@ export type NullableProperties<T> = {
[P in keyof T]: T[P] | null
}
/**
* If {@link T} is `null` or `undefined`, evaluates to {@link Result}. Otherwise, evaluates to {@link T}.
* Useful for functions that return e.g. `undefined` when a param is nullish.
*/
export type WhenNullish<T, Result> = T & {} | (T extends null ? Result : T extends undefined ? Result : T & {})
export type CanvasColour = string | CanvasGradient | CanvasPattern
/** An object containing a set of child objects */