refactor(core): let reactive node prototypes conform to their type (#51722) (#51772)

This commit adds explicit type annotations to the reactive node prototype objects,
such that the prototypes are type-checked against the interface they are supposed
to (partially) implement. This also allows IDEs to better track usages of reactive
node properties, improving code navigation.

PR Close #51722

PR Close #51772
This commit is contained in:
JoostK
2023-09-10 19:00:58 +02:00
committed by Pawel Kozlowski
parent 82712f80df
commit 7b40d74fb4
3 changed files with 3 additions and 3 deletions
@@ -57,7 +57,7 @@ export function commitLViewConsumerIfHasProducers(
currentConsumer = createLViewConsumer();
}
const REACTIVE_LVIEW_CONSUMER_NODE = {
const REACTIVE_LVIEW_CONSUMER_NODE: ReactiveLViewConsumer = {
...REACTIVE_NODE,
consumerIsAlwaysLive: true,
consumerMarkedDirty: (node: ReactiveLViewConsumer) => {
+1 -1
View File
@@ -26,7 +26,7 @@ export function setActiveConsumer(consumer: ReactiveNode|null): ReactiveNode|nul
return prev;
}
export const REACTIVE_NODE = {
export const REACTIVE_NODE: ReactiveNode = {
version: 0 as Version,
dirty: false,
producerNode: undefined,
+1 -1
View File
@@ -83,7 +83,7 @@ interface WatchNode extends ReactiveNode {
ref: Watch;
}
const WATCH_NODE = {
const WATCH_NODE: Partial<WatchNode> = {
...REACTIVE_NODE,
consumerIsAlwaysLive: true,
consumerAllowSignalWrites: false,