]> git.ipfire.org Git - thirdparty/vuejs/pinia.git/commitdiff
fix(types): exclude internal properties from store
authorEduardo San Martin Morote <posva13@gmail.com>
Fri, 18 Feb 2022 22:06:40 +0000 (23:06 +0100)
committerEduardo San Martin Morote <posva13@gmail.com>
Fri, 18 Feb 2022 22:06:40 +0000 (23:06 +0100)
Fix #1013

packages/pinia/api-extractor.json
packages/pinia/src/globalExtensions.ts
packages/pinia/src/mapHelpers.ts
packages/pinia/src/types.ts

index d3486484bfa52cbc7f0aa9b840d558cc193ceec1..759c87e8f25ff26e7fb595074e132af0ee330885 100644 (file)
@@ -14,7 +14,7 @@
 
   "dtsRollup": {
     "enabled": true,
-    "untrimmedFilePath": "./dist/<unscopedPackageName>.d.ts"
+    "publicTrimmedFilePath": "./dist/<unscopedPackageName>.d.ts"
   },
 
   "tsdocMetadata": {
index 432ff15dc8b63b57bf660637fc71add45408cea3..9575fa3d835c76730a689470eaf985cf897b39e2 100644 (file)
@@ -15,7 +15,7 @@ declare module 'vue/types/vue' {
 
     /**
      * Cache of stores instantiated by the current instance. Used by map
-     * helpers.
+     * helpers. Used internally by Pinia.
      *
      * @internal
      */
@@ -44,7 +44,7 @@ declare module '@vue/runtime-core' {
 
     /**
      * Cache of stores instantiated by the current instance. Used by devtools to
-     * list currently used stores.
+     * list currently used stores. Used internally by Pinia.
      *
      * @internal
      */
index 2b97ebdd380fc4acd65ccbddd89b89670a01b629..b69fc5ce47a81fd375fb1bb84ba942c33e6ec1b7 100644 (file)
@@ -20,7 +20,7 @@ export interface MapStoresCustomization {
 }
 
 /**
- * @internal
+ * For internal use **only**.
  */
 export type _StoreObject<S> = S extends StoreDefinition<
   infer Ids,
@@ -48,7 +48,7 @@ export type _StoreObject<S> = S extends StoreDefinition<
   : {}
 
 /**
- * @internal
+ * For internal use **only**.
  */
 export type _Spread<A extends readonly any[]> = A extends [infer L, ...infer R]
   ? _StoreObject<L> & _Spread<R>
@@ -120,7 +120,7 @@ export function mapStores<Stores extends any[]>(
 }
 
 /**
- * @internal
+ * For internal use **only**
  */
 export type _MapStateReturn<
   S extends StateTree,
@@ -136,7 +136,7 @@ export type _MapStateReturn<
 }
 
 /**
- * @internal
+ * For internal use **only**
  */
 export type _MapStateObjectReturn<
   Id extends string,
@@ -285,14 +285,14 @@ export function mapState<
 export const mapGetters = mapState
 
 /**
- * @internal
+ * For internal use **only**
  */
 export type _MapActionsReturn<A> = {
   [key in keyof A]: A[key]
 }
 
 /**
- * @internal
+ * For internal use **only**
  */
 export type _MapActionsObjectReturn<A, T extends Record<string, keyof A>> = {
   [key in keyof T]: A[T[key]]
@@ -407,7 +407,7 @@ export function mapActions<
 }
 
 /**
- * @internal
+ * For internal use **only**
  */
 export type _MapWritableStateReturn<S extends StateTree> = {
   [key in keyof S]: {
@@ -417,7 +417,7 @@ export type _MapWritableStateReturn<S extends StateTree> = {
 }
 
 /**
- * @internal
+ * For internal use **only**
  */
 export type _MapWritableStateObjectReturn<
   S extends StateTree,
index 78983cb0a63402930b8800c40ee02f3bef503074..5471281eed24485972d79526c8d3fd72b4df8fe4 100644 (file)
@@ -30,7 +30,7 @@ export function isPlainObject(
 /**
  * Recursive `Partial<T>`. Used by {@link Store.$patch}.
  *
- * @internal
+ * For internal use **only**
  */
 export type _DeepPartial<T> = { [K in keyof T]?: _DeepPartial<T[K]> }
 // type DeepReadonly<T> = { readonly [P in keyof T]: DeepReadonly<T[P]> }
@@ -172,7 +172,7 @@ export type _Awaited<T> = T extends null | undefined
 /**
  * Actual type for {@link StoreOnActionListenerContext}. Exists for refactoring
  * purposes. For internal use only.
- * @internal
+ * For internal use **only**
  */
 export interface _StoreOnActionListenerContext<
   Store,
@@ -289,8 +289,6 @@ export interface StoreProperties<Id extends string> {
    * Used by devtools plugin to retrieve properties added with plugins. Removed
    * in production. Can be used by the user to add property keys of the store
    * that should be displayed in devtools.
-   *
-   * @internal
    */
   _customProperties: Set<string>
 
@@ -436,7 +434,7 @@ export interface _StoreWithState<
 /**
  * Generic type for a function that can infer arguments and return type
  *
- * @internal
+ * For internal use **only**
  */
 export type _Method = (...args: any[]) => any
 
@@ -448,7 +446,7 @@ export type _Method = (...args: any[]) => any
 // in this type we forget about this because otherwise the type is recursive
 /**
  * Store augmented for actions. For internal usage only.
- * @internal
+ * For internal use **only**
  */
 export type _StoreWithActions<A> = {
   [k in keyof A]: A[k] extends (...args: infer P) => infer R
@@ -458,7 +456,7 @@ export type _StoreWithActions<A> = {
 
 /**
  * Store augmented with getters. For internal usage only.
- * @internal
+ * For internal use **only**
  */
 export type _StoreWithGetters<G> = {
   readonly [k in keyof G]: G[k] extends (...args: any[]) => infer R
@@ -542,7 +540,7 @@ export interface PiniaCustomStateProperties<S extends StateTree = StateTree> {}
 
 /**
  * Type of an object of Getters that infers the argument. For internal usage only.
- * @internal
+ * For internal use **only**
  */
 export type _GettersTree<S extends StateTree> = Record<
   string,
@@ -552,13 +550,13 @@ export type _GettersTree<S extends StateTree> = Record<
 
 /**
  * Type of an object of Actions. For internal usage only.
- * @internal
+ * For internal use **only**
  */
 export type _ActionsTree = Record<string, _Method>
 
 /**
  * Type that enables refactoring through IDE.
- * @internal
+ * For internal use **only**
  */
 export type _ExtractStateFromSetupStore_Keys<SS> = keyof {
   [K in keyof SS as SS[K] extends _Method | ComputedRef ? never : K]: any
@@ -566,7 +564,7 @@ export type _ExtractStateFromSetupStore_Keys<SS> = keyof {
 
 /**
  * Type that enables refactoring through IDE.
- * @internal
+ * For internal use **only**
  */
 export type _ExtractActionsFromSetupStore_Keys<SS> = keyof {
   [K in keyof SS as SS[K] extends _Method ? K : never]: any
@@ -574,7 +572,7 @@ export type _ExtractActionsFromSetupStore_Keys<SS> = keyof {
 
 /**
  * Type that enables refactoring through IDE.
- * @internal
+ * For internal use **only**
  */
 export type _ExtractGettersFromSetupStore_Keys<SS> = keyof {
   [K in keyof SS as SS[K] extends ComputedRef ? K : never]: any
@@ -582,12 +580,12 @@ export type _ExtractGettersFromSetupStore_Keys<SS> = keyof {
 
 /**
  * Type that enables refactoring through IDE.
- * @internal
+ * For internal use **only**
  */
 export type _UnwrapAll<SS> = { [K in keyof SS]: UnwrapRef<SS[K]> }
 
 /**
- * @internal
+ * For internal use **only**
  */
 export type _ExtractStateFromSetupStore<SS> = SS extends undefined | void
   ? {}
@@ -596,7 +594,7 @@ export type _ExtractStateFromSetupStore<SS> = SS extends undefined | void
   : never
 
 /**
- * @internal
+ * For internal use **only**
  */
 export type _ExtractActionsFromSetupStore<SS> = SS extends undefined | void
   ? {}
@@ -605,7 +603,7 @@ export type _ExtractActionsFromSetupStore<SS> = SS extends undefined | void
   : never
 
 /**
- * @internal
+ * For internal use **only**
  */
 export type _ExtractGettersFromSetupStore<SS> = SS extends undefined | void
   ? {}