[TS] Use strict mode in LGraph (#579)

* [TS] Undefined is not a valid object key

* Deprecate unused code

Adds ts-expect-error to TS strict issues on unmaintained public interfaces.

* [TS] Fix nullability: asSerialisable return type

* nit - Remove outdated comment

* [TS] Strict mode: LGraph

- Adds minor coercion changes; would need extremely specific hacks performed to result in runtime change

* [TMP] Work around typescript-strict-plugin

Must be reverted once plugin removed.
See #578
This commit is contained in:
filtered
2025-02-24 22:12:46 +11:00
committed by GitHub
parent 9d6c867607
commit c8ffacf172
3 changed files with 26 additions and 9 deletions

View File

@@ -184,7 +184,7 @@ type ReadOnlyTypedArray<T extends TypedArrays | TypedBigIntArrays> =
Omit<T, "fill" | "copyWithin" | "reverse" | "set" | "sort" | "subarray">
/** Union of property names that are of type Match */
export type KeysOfType<T, Match> = { [P in keyof T]: T[P] extends Match ? P : never }[keyof T]
export type KeysOfType<T, Match> = Exclude<{ [P in keyof T]: T[P] extends Match ? P : never }[keyof T], undefined>
/** A new type that contains only the properties of T that are of type Match */
export type PickByType<T, Match> = { [P in keyof T]: Extract<T[P], Match> }