Skip to content

Commit 094cfd7

Browse files
committed
Move the interface detour above the rest
1 parent 9ed2e15 commit 094cfd7

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

docs/composition-api.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,18 @@ In addition to the Renderless Components and the Mixins, Feathers-Vuex includes
1111

1212
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.
1313

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+
1426
## useFind <Badge text="3.0.0+" />
1527

1628
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:
5971
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`
6072
2. Create a computed property for the params. Return an object with a `query` object.
6173

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-
7474
### Options
7575

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.
7777

7878
```ts
7979
interface UseFindOptions {

0 commit comments

Comments
 (0)