Broken TypeScript sample in your homepage hero snippets

Open Beginner friendly
#816 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
typescript
Domain
documentation

Research direction

Start with the homepage hero partials and inspect both the standard and realtime TypeScript snippets against @directus/sdk@25.0.1. Verify the examples compile after composing the clients as described, then run the existing checker or TypeScript validation; done means both snippets compile without the reported client errors.

Written by the indexing model from the issue text.

Description

I ran a checker over your docs and 2 of the TypeScript samples don't compile
against @directus/sdk@25.0.1 (found via the homepage hero partials, reused
elsewhere). Example:

import { createDirectus, rest, readItems } from '@directus/sdk';
const directus = createDirectus('http://directus.example.com');

const item = await directus.request(
  readItems('articles', { fields: ['id', 'title'] })
);

// TS error: Property 'request' does not exist on type 'DirectusClient<any>'.

The snippet imports rest but never calls .with(rest()) — the bare client
from createDirectus() doesn't have .request() until you compose it in.
Same issue on the realtime hero snippet: it calls .setToken() without
.with(authentication()).

Separately: docs.directus.io/llms-full.txt currently redirects to a dead
Vercel preview URL (404) — probably unrelated, but worth a look.

I think it's drift between the published package and the docs rather than a
mistake in the sample.

I'm building a small CLI that catches this in CI. Two questions if you have a
minute: does this kind of thing get reported to you by users, and is it
something anyone currently owns?

Happy to share the full JSON report if that's useful — just ask.

David

Dominant language
TypeScript
Stars
22
Forks
82
Avg merge
18h 49m
Merged PRs (30d)
4

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from directus/docs

All issues in directus/docs

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.