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

* fix(log): deprecated messages copyedit for consistency

* fix(log): adjust logging per comment
This commit is contained in:
Jonathan Horak 2023-02-10 04:04:39 -06:00 committed by GitHub
parent f719b5b371
commit 6d0cb03eb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 8 additions and 8 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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 =
@ -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)

View File

@ -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)

View File

@ -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()
@ -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)