Skip to content

Commit 51c89d7

Browse files
committed
Use unknown rather than any for BaseController state
The BaseController state now uses `unknown` rather than `any` as the type for state properties. `unknown` is more type-safe than `any` in cases like this where we don't know what type to expect. See here for details [1]. This was suggested by @rekmarks during review of #362 [2]. [1]: microsoft/TypeScript#24439 [2]: #362 (comment)
1 parent 6e0b2da commit 51c89d7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/BaseControllerV2.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export type Listener<T> = (state: T, patches: Patch[]) => void;
1414
/**
1515
* Controller class that provides state management and subscriptions
1616
*/
17-
export class BaseController<S extends Record<string, any>> {
17+
export class BaseController<S extends Record<string, unknown>> {
1818
private internalState: S;
1919

2020
private internalListeners: Set<Listener<S>> = new Set();

0 commit comments

Comments
 (0)