Skip to content

Commit

Permalink
chore(docs): utilities via graffle namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonkuhrt committed Sep 10, 2024
1 parent 612b08a commit 279854c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ tsconfig.vitest-temp.json
website/.vitepress/dist
website/.vitepress/cache
legacy
.vitepress
32 changes: 24 additions & 8 deletions website/content/guides/overview/getting-started-generated.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,24 +166,40 @@ console.log(countries)

Its worth knowing Graffle also gives you utilities beyond the direct client itself. For example you can build up reusable selection sets:

```ts twoslash
// TODO
// import { Select } from './graffle/__.js'
import { Select } from './graffle/modules/Select.js'
::: code-group

```ts twoslash [Graffle Namespace]
import { Graffle } from './graffle/__.js'
const ContinentSelection = Graffle.Select.Continent({ name: true })
```

```ts twoslash [Barrel Import]
import { Select } from './graffle/_.js'
const ContinentSelection = Select.Continent({ name: true })
```

:::

You can also do the same thing at the type level which can sometimes be handy when you want to define data types based on selection sets.

```ts twoslash
// TODO
// import { type Select } from './graffle/__.js'
import { type Select } from './graffle/modules/Select.js'
::: code-group

```ts twoslash [Graffle Namespace]
import { type Graffle } from './graffle/__.js'
type Continent = Graffle.Select.Continent<{ name: true }>
```

```ts twoslash [Barrel Import]
import { type Select } from './graffle/_.js'
type Continent = Select.Continent<{ name: true }>
```

:::

## Conclusion

There is more to learn (e.g. how directives, unions, interfaces, custom scalars, ... are modelled into the TypeScript interface) but hopefully this has already given you some confidence to go off and start building. Of course feel free to continue digging deeper into more specific feature guides too. Thanks for taking time to learn Graffle and we're excited to see what you'll build!

0 comments on commit 279854c

Please sign in to comment.