]> git.ipfire.org Git - thirdparty/vuejs/pinia.git/commitdiff
refactor: remove deprecations
authorEduardo San Martin Morote <posva13@gmail.com>
Thu, 28 Oct 2021 09:22:51 +0000 (11:22 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Thu, 28 Oct 2021 09:23:41 +0000 (11:23 +0200)
packages/pinia/src/index.ts
packages/pinia/src/rootStore.ts
packages/pinia/src/store.ts
packages/pinia/src/types.ts
packages/pinia/src/vue2-plugin.ts

index dd52d97ecdb43e97bed32976c6a09473d27c80f4..99fbd400e91b162090d7df37e934fdce579ee10e 100644 (file)
@@ -3,7 +3,13 @@
  */
 export { setActivePinia, getActivePinia } from './rootStore'
 export { createPinia } from './createPinia'
-export type { Pinia, PiniaStorePlugin, PiniaPluginContext } from './rootStore'
+export type {
+  Pinia,
+  // TODO: remove in next release
+  PiniaStorePlugin,
+  PiniaPlugin,
+  PiniaPluginContext,
+} from './rootStore'
 
 export { defineStore, skipHydrate } from './store'
 export type { StoreActions, StoreGetters, StoreState } from './store'
@@ -12,8 +18,6 @@ export type {
   StateTree,
   Store,
   StoreGeneric,
-  // TODO: remove in release
-  GenericStore,
   StoreDefinition,
   _StoreWithGetters,
   _GettersTree,
@@ -64,10 +68,6 @@ export type {
 
 export { acceptHMRUpdate } from './hmr'
 
-export {
-  // TODO: remove in release and deprecate PiniaStorePlugin in favor of PiniaPlugin
-  PiniaPlugin,
-  PiniaVuePlugin,
-} from './vue2-plugin'
+export { PiniaVuePlugin } from './vue2-plugin'
 
 export * from './globalExtensions'
index 2713f4cc7de69b29bb2c794fe1b97995f3677437..4c96c81bed7df8372612b57ba2cb3b993407228e 100644 (file)
@@ -129,9 +129,9 @@ export interface PiniaPluginContext<
 }
 
 /**
- * Plugin to extend every store
+ * Plugin to extend every store.
  */
-export interface PiniaStorePlugin {
+export interface PiniaPlugin {
   /**
    * Plugin to extend every store. Returns an object to extend the store or
    * nothing.
@@ -142,3 +142,9 @@ export interface PiniaStorePlugin {
     PiniaCustomProperties & PiniaCustomStateProperties
   > | void
 }
+
+/**
+ * Plugin to extend every store.
+ * @deprecated use PiniaPlugin instead
+ */
+export type PiniaStorePlugin = PiniaPlugin
index 9ab67fa04f7d4269f4502f959c09ff80646b9a63..51963231361704e621975bf6fc4ef4501f4e3aeb 100644 (file)
@@ -371,23 +371,9 @@ function createSetupStore<
     $patch,
     $reset,
     $subscribe(callback, options = {}) {
-      /* istanbul ignore if */
-      if (__DEV__ && typeof options === 'boolean') {
-        console.warn(
-          `[🍍]: store.$subscribe() no longer accepts a boolean as the 2nd parameter:\n` +
-            `Replace "store.$subscribe(fn, ${String(
-              options
-            )})" with "store.$subscribe(fn, { detached: ${String(
-              options
-            )} })".\nThis will fail in production.`
-        )
-        options = { detached: options }
-      }
-
       const _removeSubscription = addSubscription(
         subscriptions,
         callback,
-        // @ts-expect-error: until the deprecation is removed
         options.detached
       )
       const stopWatcher = scope.run(() =>
index 05dd5afb520387f1bafb01257873ba859cd44edf..31d192ac862dbba570a82c4d5ab22b6ff3c1659e 100644 (file)
@@ -358,22 +358,6 @@ export interface _StoreWithState<
     options?: { detached?: boolean } & WatchOptions
   ): () => void
 
-  /**
-   * Setups a callback to be called whenever the state changes. It also returns
-   * a function to remove the callback. Note than when calling
-   * `store.$subscribe()` inside of a component, it will be automatically
-   * cleanup up when the component gets unmounted unless `detached` is set to
-   * true.
-   *
-   * @deprecated use `store.$subscribe(fn, { detached: true })` instead.
-   *
-   * @param callback - callback passed to the watcher
-   * @param detached - detach the subscription from the context this is called
-   * from
-   * @returns function that removes the watcher
-   */
-  $subscribe(callback: SubscriptionCallback<S>, detached?: boolean): () => void
-
   /**
    * @alpha Please send feedback at https://github.com/posva/pinia/issues/240
    * Setups a callback to be called every time an action is about to get
@@ -494,25 +478,6 @@ export type StoreGeneric = Store<
   _ActionsTree
 >
 
-/**
- * Generic and type-unsafe version of Store. Doesn't fail on access with
- * strings, making it much easier to write generic functions that do not care
- * about the kind of store that is passed.
- * @deprecated Use `StoreGeneric` instead
- */
-export type GenericStore<
-  Id extends string = string,
-  S extends StateTree = StateTree,
-  G /* extends GettersTree<S> */ = _GettersTree<S>,
-  // has the actions without the context (this) for typings
-  A /* extends ActionsTree */ = _ActionsTree
-> = _StoreWithState<Id, S, G, A> &
-  UnwrapRef<S> &
-  _StoreWithGetters<G> &
-  A &
-  PiniaCustomProperties<Id, S, G, A> &
-  PiniaCustomStateProperties<S>
-
 /**
  * Return type of `defineStore()`. Function that allows instantiating a store.
  */
@@ -711,11 +676,4 @@ export interface DefineStoreOptionsInPlugin<
    * Defaults to an empty object if no actions are defined.
    */
   actions: A
-
-  /**
-   * Id of the store. Only available when the options API is used.
-   *
-   * @deprecated  Use `store.$id` instead.
-   */
-  id?: Id
 }
index f11d6f63fea6ef8def827681affe43c8d5fc472f..1b3bde6bf192275617bd03d5ae301e4af75ad4da 100644 (file)
@@ -69,8 +69,3 @@ export const PiniaVuePlugin: Plugin = function (_Vue) {
     },
   })
 }
-
-/**
- * @deprecated use `PiniaVuePlugin` instead.
- */
-export const PiniaPlugin = PiniaVuePlugin