Skip to content

Commit

Permalink
fix(log): deprecated messages copyedit for consistency (#1588)
Browse files Browse the repository at this point in the history
* fix(log): deprecated messages copyedit for consistency

* fix(log): adjust logging per comment
  • Loading branch information
jareha authored Feb 10, 2023
1 parent f719b5b commit 6d0cb03
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ type WithoutCallSignature<T> = { [K in keyof T]: T[K] }
function createContext<S extends StoreApi<unknown>>() {
if (__DEV__) {
console.warn(
'[DEPRECATED] zustand/context will be removed in the future version. Please use `import { createStore, useStore } from "zustand"` for context usage. See: https://github.com/pmndrs/zustand/discussions/1180'
"[DEPRECATED] `context` will be removed in a future version. Instead use `import { createStore, useStore } from 'zustand'`. See: https://github.com/pmndrs/zustand/discussions/1180."
)
}
const ZustandContext = reactCreateContext<S | undefined>(undefined)
Expand Down
2 changes: 1 addition & 1 deletion src/middleware/persist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ const persistImpl: PersistImpl = (config, baseOptions) => {
) {
if (__DEV__) {
console.warn(
'[DEPRECATED] `getStorage`, `serialize` and `deserialize` options are deprecated. Please use `storage` option instead.'
'[DEPRECATED] `getStorage`, `serialize` and `deserialize` options are deprecated. Use `storage` option instead.'
)
}
return oldImpl(config, baseOptions)
Expand Down
4 changes: 2 additions & 2 deletions src/react.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ type Create = {
const createImpl = <T>(createState: StateCreator<T, [], []>) => {
if (__DEV__ && typeof createState !== 'function') {
console.warn(
'[DEPRECATED] Passing a vanilla store will be unsupported in the future version. Please use `import { useStore } from "zustand"` to use the vanilla store in React.'
"[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`."
)
}
const api =
Expand All @@ -93,7 +93,7 @@ export const create = (<T>(createState: StateCreator<T, [], []> | undefined) =>
export default ((createState: any) => {
if (__DEV__) {
console.warn(
"[DEPRECATED] default export is deprecated, instead import { create } from'zustand'"
"[DEPRECATED] Default export is deprecated. Instead use `import { create } from 'zustand'`."
)
}
return create(createState)
Expand Down
2 changes: 1 addition & 1 deletion src/shallow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export function shallow<T>(objA: T, objB: T) {
export default ((objA, objB) => {
if (__DEV__) {
console.warn(
"[DEPRECATED] default export is deprecated, instead import { shallow } from'zustand/shallow'"
"[DEPRECATED] Default export is deprecated. Instead use `import { create } from 'zustand/shallow'`."
)
}
return shallow(objA, objB)
Expand Down
6 changes: 3 additions & 3 deletions src/vanilla.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ const createStoreImpl: CreateStoreImpl = (createState) => {
const destroy: StoreApi<TState>['destroy'] = () => {
if (__DEV__) {
console.warn(
'[DEPRECATED] The destroy method will be unsupported in the future version. You should use unsubscribe function returned by subscribe. Everything will be garbage collected if store is garbage collected.'
'[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected.'
)
}
listeners.clear()
Expand All @@ -106,12 +106,12 @@ export const createStore = ((createState) =>
createState ? createStoreImpl(createState) : createStoreImpl) as CreateStore

/**
* @deprecated Use `import { createStore } from ...`
* @deprecated Use `import { createStore } from 'zustand/vanilla'`
*/
export default ((createState) => {
if (__DEV__) {
console.warn(
'[DEPRECATED] default export is deprecated, instead import { createStore } ...'
"[DEPRECATED] Default export is deprecated. Instead use import { createStore } from 'zustand/vanilla'."
)
}
return createStore(createState)
Expand Down

0 comments on commit 6d0cb03

Please sign in to comment.