Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(log): deprecated messages copyedit for consistency #1588

Merged
merged 2 commits into from
Feb 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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