New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

statery

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

statery - npm Package Compare versions

Comparing version 0.5.2 to 0.5.4

.DS_Store

5

CHANGELOG.md

@@ -8,2 +8,7 @@ # Changelog

## [0.5.4] - 2021-03-20
- **Changed:** Slightly improved typings. Most importantly, `store.state` is now typed as readonly, which should make Typescript et al warn you if you're trying to directly mutate the state object.
- **Changed:** Statery now uses Typescript 4.2.
## [0.5.2] - 2020-12-22

@@ -10,0 +15,0 @@

10

dist/index.d.ts

@@ -14,3 +14,3 @@ /**

*/
state: T;
state: Readonly<T>;
/**

@@ -45,7 +45,7 @@ * Updates the store. Accepts an object that will be (shallow-)merged into the current state,

};
export declare type StateUpdateFunction<T extends State> = (state: T) => Partial<T>;
export declare type StateUpdateFunction<T extends State> = (state: Readonly<T>) => Partial<T>;
/**
* A callback that can be passed to a store's `subscribe` and `unsubscribe` functions.
*/
export declare type Listener<T extends State> = (updates: Partial<T>, state: T) => void;
export declare type Listener<T extends State> = (updates: Readonly<Partial<T>>, state: Readonly<T>) => void;
/**

@@ -56,3 +56,3 @@ * Creates a Statery store and populates it with an initial state.

*/
export declare const makeStore: <T extends Record<string | number, any>>(initialState: T) => Store<T>;
export declare const makeStore: <T extends State>(initialState: T) => Store<T>;
/**

@@ -65,2 +65,2 @@ * Provides reactive read access to a Statery store. Returns a proxy object that

*/
export declare const useStore: <T extends Record<string | number, any>>(store: Store<T>) => T;
export declare const useStore: <T extends State>(store: Store<T>) => T;

@@ -16,3 +16,4 @@ {

],
"version": "0.5.2",
"sideEffects": false,
"version": "0.5.4",
"main": "dist/index.js",

@@ -29,3 +30,4 @@ "module": "dist/index.esm.js",

"build": "yarn clean && rollup -c",
"test": "jest"
"test": "jest",
"docs": "typedoc src/index.ts"
},

@@ -46,2 +48,3 @@ "devDependencies": {

"tslib": "^2.0.3",
"typedoc": "^0.20.1",
"typescript": "^4.1.3"

@@ -48,0 +51,0 @@ },

@@ -30,3 +30,3 @@ import { useEffect, useRef, useState } from "react"

*/
state: T
state: Readonly<T>

@@ -65,3 +65,3 @@ /**

export type StateUpdateFunction<T extends State> = (state: T) => Partial<T>
export type StateUpdateFunction<T extends State> = (state: Readonly<T>) => Partial<T>

@@ -71,3 +71,3 @@ /**

*/
export type Listener<T extends State> = (updates: Partial<T>, state: T) => void
export type Listener<T extends State> = (updates: Readonly<Partial<T>>, state: Readonly<T>) => void

@@ -180,3 +180,3 @@ /*

{
get: (_, prop: keyof T) => {
get: (_, prop: string) => {
/* Add the prop we're interested in to the list of props */

@@ -183,0 +183,0 @@ subscribedProps.add(prop)

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc