tldraw/scripts/lib
alex f9ed1bf2c9
Force interface instead of type for better docs (#3815)
Typescript's type aliases (`type X = thing`) can refer to basically
anything, which makes it hard to write an automatic document formatter
for them. Interfaces on the other hand are only object, so they play
much nicer with docs. Currently, object-flavoured type aliases don't
really get expanded at all on our docs site, which means we have a bunch
of docs content that's not shown on the site.

This diff introduces a lint rule that forces `interface X {foo: bar}`s
instead of `type X = {foo: bar}` where possible, as it results in a much
better documentation experience:

Before:
<img width="437" alt="Screenshot 2024-05-22 at 15 24 13"
src="https://github.com/tldraw/tldraw/assets/1489520/32606fd1-6832-4a1e-aa5f-f0534d160c92">

After:
<img width="431" alt="Screenshot 2024-05-22 at 15 33 01"
src="https://github.com/tldraw/tldraw/assets/1489520/4e0d59ee-c38e-4056-b9fd-6a7f15d28f0f">


### Change Type

- [x] `sdk` — Changes the tldraw SDK
- [x] `docs` — Changes to the documentation, examples, or templates.
- [x] `improvement` — Improving existing features
2024-05-22 15:55:49 +00:00
..
add-extensions.ts transfer-out: transfer out 2023-04-25 12:01:25 +01:00
didAnyPackageChange.ts Fix patch release script (#3597) 2024-04-24 15:52:57 +00:00
eslint-plugin.ts ban using @internal items in examples (#3746) 2024-05-14 08:49:28 +00:00
exec.ts Force interface instead of type for better docs (#3815) 2024-05-22 15:55:49 +00:00
file.ts allow changes 2024-02-29 18:09:30 +00:00
labels.ts Force interface instead of type for better docs (#3815) 2024-05-22 15:55:49 +00:00
makeEnv.ts unbrivate, dot com in (#2475) 2024-01-16 14:38:05 +00:00
nicelog.ts unbrivate, dot com in (#2475) 2024-01-16 14:38:05 +00:00
publishing.ts Force interface instead of type for better docs (#3815) 2024-05-22 15:55:49 +00:00
sort-unions.ts New migrations again (#3220) 2024-04-15 12:53:42 +00:00
workspace.ts Force interface instead of type for better docs (#3815) 2024-05-22 15:55:49 +00:00