You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/composition-api.md
+13-13Lines changed: 13 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,6 +11,18 @@ In addition to the Renderless Components and the Mixins, Feathers-Vuex includes
11
11
12
12
Before you can use the `useFind` and `useGet` composition functions, you'll need to [install the Vue Composition API](https://github.com/vuejs/composition-api#Installation) plugin.
13
13
14
+
## Detour: Reading a TypeScript interface
15
+
16
+
The next few sections show various TypeScript interfaces, which are basically shorthand descriptions of the types of data that make up a variable. If this is your first time, here's a quick primer as an alternative to reading the [TypeScript interface docs](https://www.typescriptlang.org/docs/handbook/interfaces.html):
17
+
18
+
- In the [first interface example](#options), below, `UseFindOptions` is the name of the interface, similar to naming any other variable. When using TypeScript, you can import and pass them around like variables.
19
+
- Each line of the interface describes a property.
20
+
- The part before the `:` is the name of the property.
21
+
- The part after the `:` describes what type of variable it can be.
22
+
- You can look at any `|` after the `:` as a conditional "or"
23
+
- Any property followed by a `?` is optional.
24
+
- Any property not followed by a `?` is required.
25
+
14
26
## useFind <Badgetext="3.0.0+" />
15
27
16
28
The `useFind` utility reduces boilerplate for querying with fall-through cache and realtime updates. To get started with it you provide a `model` class and a computed `params` object.
@@ -59,21 +71,9 @@ Let's review each of the numbered comments, above:
59
71
1. Get a reference to the model class. With the Vue Composition API, there's no `this` object. It has been replaced by the context object. So, only when using the composition API, the `$FeathersVuex` object is found at `context.root.$FeathersVuex`
60
72
2. Create a computed property for the params. Return an object with a `query` object.
61
73
62
-
### Detour: Reading a TypeScript interface
63
-
64
-
The next few sections show various TypeScript interfaces, which are basically shorthand descriptions of the types of data that make up a variable. If this is your first time, here's a quick primer as an alternative to reading the [TypeScript interface docs](https://www.typescriptlang.org/docs/handbook/interfaces.html):
65
-
66
-
- In the below exampe, `UseFindOptions` is the name of the interface, similar to naming any other variable. When using TypeScript, you can import and pass them around like variables.
67
-
- Each line of the interface describes a property.
68
-
- The part before the `:` is the name of the property.
69
-
- The part after the `:` describes what type of variable it can be.
70
-
- You can look at any `|` after the `:` as a conditional "or"
71
-
- Any property followed by a `?` is optional.
72
-
- Any property not followed by a `?` is required.
73
-
74
74
### Options
75
75
76
-
Since we learned in the previous section how to read a TypeScript interface, let's look at the TypeScript definition for the `UseFindOptions`.
76
+
Since we learned earlier [how to read a TypeScript interface](#detour-reading-a-typescript-interface), let's look at the TypeScript definition for the `UseFindOptions` interface.
0 commit comments