types.tsx 660 B

123456789101112131415161718192021
  1. /**
  2. * All stores implementing this interface have a common getState which returns
  3. * the stores state.
  4. *
  5. * When a store implements this it becomes usable with the `useLegacyStore` hook.
  6. *
  7. * Does not have the `[key: string]: any;` index signature that `Reflux.StoreDefinition` has.
  8. */
  9. export interface StrictStoreDefinition<T> {
  10. /**
  11. * Returns the current state represented within the store
  12. */
  13. getState(): Readonly<T>;
  14. init(): void;
  15. state: Readonly<T>;
  16. /**
  17. * Trigger is not defined by the store definition, but is added by Reflux
  18. * We could try to type this better, but would need to update all .listen calls
  19. */
  20. trigger?: any;
  21. }