Skip to content

Commit d3d07c1

Browse files
committed
docs(readme): rewrite READMEs and tidy license metadata
Restructure root, npm package, and VS Code extension READMEs with centered heroes, logo, static MIT badges, and clearer quick-start sections. Standardize root LICENSE text, trim changelog boilerplate, and document the intentional empty-object intersection in global.d.ts.
1 parent bb718ed commit d3d07c1

8 files changed

Lines changed: 185 additions & 88 deletions

File tree

CHANGELOG.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ This monorepo ships two artifacts with independent versioning:
77
| `ts-hover-prettify` | [npm](https://www.npmjs.com/package/ts-hover-prettify) | [packages/ts-hover-prettify/CHANGELOG.md](packages/ts-hover-prettify/CHANGELOG.md) |
88
| `ts-hover-prettify-vscode` | `marcoantolini.ts-hover-prettify-vscode` | [packages/vscode-extension/CHANGELOG.md](packages/vscode-extension/CHANGELOG.md) |
99

10-
Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) where noted below. Version numbers refer to the published package or extension manifest, not necessarily every commit on `main`.
11-
1210
---
1311

1412
## Repository

LICENSE

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,21 @@
1-
Copyright 2023 Marco Antolini
1+
MIT License
22

3-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
3+
Copyright (c) 2026 Marco Antolini
44

5-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
611

7-
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 89 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,52 @@
1+
<div align="center">
2+
3+
<img src="packages/vscode-extension/icon.png" alt="TS Hover Prettify logo" width="128" />
4+
15
# ts-hover-prettify
26

3-
Flatten intersected TypeScript types in **hover tooltips** by wrapping them in `Prettify<T>`.
7+
Flatten intersected TypeScript types in hover tooltips with `Prettify<T>`.
8+
9+
[![License: MIT](https://img.shields.io/badge/License-MIT-blue?style=for-the-badge)](https://github.com/MarcoAntolini/ts-hover-prettify/blob/main/LICENSE)
10+
[![Stars](https://img.shields.io/github/stars/MarcoAntolini/ts-hover-prettify?style=for-the-badge)](https://github.com/MarcoAntolini/ts-hover-prettify/stargazers)
11+
[![npm](https://img.shields.io/npm/dm/ts-hover-prettify?style=for-the-badge)](https://www.npmjs.com/package/ts-hover-prettify)
12+
13+
</div>
414

5-
Without `Prettify`, hovering an intersection often shows `{ a: string } & { b: number } & …`. With `Prettify`, the same hover tends to show a single object: `{ a: string; b: number; … }`. This uses the well-known mapped-type pattern ([Total TypeScript — Prettify](https://www.totaltypescript.com/concepts/the-prettify-helper)); it affects type display only and has no runtime cost.
15+
## What is this?
616

7-
## Install
17+
Without `Prettify`, hovering an intersection often shows `{ a: string } & { b: number } & …`. With `Prettify`, the same hover tends to show a single object: `{ a: string; b: number; … }`.
818

9-
| Approach | When to use it | Setup |
10-
|----------|----------------|--------|
11-
| **[VS Code / Cursor extension](packages/vscode-extension)** | Editor-only, no npm dependency | Install or load the extension — `Prettify` is injected for you |
12-
| **[npm package](packages/ts-hover-prettify)** | `tsc`, CI, other editors, explicit control | `npm add -D ts-hover-prettify` + a one-line global types file |
19+
This monorepo ships two ways to use the same mapped-type pattern ([Total TypeScript — Prettify](https://www.totaltypescript.com/concepts/the-prettify-helper)): an [npm package](packages/ts-hover-prettify) for `tsc`, CI, and any editor, and a [VS Code / Cursor extension](packages/vscode-extension) that injects the type with zero npm setup. It affects type display only and has no runtime cost.
1320

14-
You only need one approach per project. Do not mix the extension’s auto-generated `.vscode/ts-hover-prettify.d.ts` with a manual npm setup unless you know they stay in sync.
21+
## Quick Start
22+
23+
Pick one approach per project — do not mix the extension’s auto-generated `.vscode/ts-hover-prettify.d.ts` with a manual npm setup unless you know they stay in sync.
1524

1625
### Extension (zero-config)
1726

1827
1. Install **TS Hover Prettify** (`marcoantolini.ts-hover-prettify-vscode`) from a `.vsix` or, after release, from the Marketplace / Open VSX.
1928
2. Open a TypeScript workspace and wrap types with `Prettify<…>`.
2029
3. Hover the alias. Run **TypeScript: Restart TS Server** if hovers do not update after install.
2130

22-
On first use the extension may create `.vscode/ts-hover-prettify.d.ts` and append that path to `tsconfig.json` `include` or `files` when those arrays already exist. Projects without `include`/`files` still receive `Prettify` via the TypeScript server plugin.
23-
2431
Details: [packages/vscode-extension/README.md](packages/vscode-extension/README.md).
2532

2633
### npm package
2734

2835
```bash
29-
npm add -D ts-hover-prettify
36+
pnpm add -D ts-hover-prettify
3037
```
3138

32-
Add `prettify.d.ts` (name is up to you) at the project root or anywhere included by `tsconfig.json`:
39+
Add a declaration file included by your `tsconfig.json`:
3340

3441
```typescript
3542
import "ts-hover-prettify/global";
3643
```
3744

38-
Or import the type where needed:
39-
40-
```typescript
41-
import type { Prettify } from "ts-hover-prettify";
42-
```
43-
44-
Ensure the declaration file is part of your TypeScript project (`include`, `files`, or `types`).
45-
46-
Published package: [npm — ts-hover-prettify](https://www.npmjs.com/package/ts-hover-prettify) (current version **1.1.1**).
47-
4845
Details: [packages/ts-hover-prettify/README.md](packages/ts-hover-prettify/README.md).
4946

50-
## Example
47+
### Example
5148

52-
**Before** — intersection shown as chained `&` types in the hover:
49+
**Before** — intersection shown as chained `&` types:
5350

5451
```typescript
5552
type Intersected = { a: string } & { b: number } & { c: boolean };
@@ -65,49 +62,81 @@ type Intersected = Prettify<
6562
// Hover: { a: string; b: number; c: boolean; }
6663
```
6764

68-
Runnable demos:
65+
Runnable demos: [examples/intersected-types](examples/intersected-types) (extension) · [examples/intersected-types-npm](examples/intersected-types-npm) (npm).
6966

70-
- Extension only: [examples/intersected-types](examples/intersected-types)
71-
- npm + `tsc`: [examples/intersected-types-npm](examples/intersected-types-npm)
67+
### Development
7268

73-
## What this does and does not do
74-
75-
**Does**
69+
Requirements: Node.js 16+, [pnpm](https://pnpm.io/) 8.
7670

77-
- Improve hover (and related quick info) for types you explicitly wrap in `Prettify<…>`.
78-
- Work with strict TypeScript projects; the utility type is a few lines of types-only code.
71+
```bash
72+
pnpm install
73+
pnpm build
74+
pnpm lint
75+
pnpm verify:example-extension
76+
pnpm verify:example-npm
77+
pnpm package:extension # VSIX → packages/vscode-extension/build/
78+
```
7979

80-
**Does not**
80+
Local extension debugging: open `packages/vscode-extension`, press **F5**, then open `examples/intersected-types` in the Extension Development Host.
8181

82-
- Change runtime values or emitted JavaScript.
83-
- Rewrite hovers for types you never wrapped (aliases, inferred types, etc. stay as TypeScript prints them).
84-
- Replace dedicated “expand any hover” extensions or VS Code’s experimental expandable hover (`typescript.experimental.expandableHover` with a recent TypeScript workspace version).
82+
## Architecture
83+
84+
```mermaid
85+
graph TD
86+
Root[ts-hover-prettify monorepo]
87+
Root --> Lib[packages/ts-hover-prettify]
88+
Root --> Ext[packages/vscode-extension]
89+
Root --> ExExt[examples/intersected-types]
90+
Root --> ExNpm[examples/intersected-types-npm]
91+
Ext --> Lib
92+
ExNpm --> Lib
93+
ExExt --> Ext
94+
```
8595

86-
## Repository layout
96+
## Project Structure
8797

8898
```
89-
packages/
90-
ts-hover-prettify/ # npm library
91-
vscode-extension/ # VS Code / Cursor extension (ts-hover-prettify-vscode)
99+
.github/
100+
workflows/
101+
.changeset/
92102
examples/
93-
intersected-types/ # extension workflow (no committed prettify.d.ts)
94-
intersected-types-npm/ # npm workflow + pnpm verify:example-npm
103+
intersected-types/
104+
intersected-types-npm/
105+
packages/
106+
ts-hover-prettify/
107+
vscode-extension/
108+
scripts/
109+
CHANGELOG.md
110+
LICENSE
111+
package.json
112+
pnpm-lock.yaml
113+
pnpm-workspace.yaml
114+
turbo.json
115+
tsconfig.json
95116
```
96117

97-
## Development
118+
## Documentation
98119

99-
Requirements: Node.js 16+, [pnpm](https://pnpm.io/) 8.
120+
| Resource | Description |
121+
|----------|-------------|
122+
| [packages/ts-hover-prettify/README.md](packages/ts-hover-prettify/README.md) | npm install, global setup, and API |
123+
| [packages/vscode-extension/README.md](packages/vscode-extension/README.md) | VS Code / Cursor extension usage |
124+
| [examples/intersected-types](examples/intersected-types) | Extension workflow demo |
125+
| [examples/intersected-types-npm](examples/intersected-types-npm) | npm + `tsc` workflow demo |
126+
| [CHANGELOG.md](CHANGELOG.md) | Release history |
100127

101-
```bash
102-
pnpm install
103-
pnpm build # library + extension
104-
pnpm lint
105-
pnpm verify:example-extension # extension example + tsc
106-
pnpm verify:example-npm # npm example + tsc
107-
pnpm package:extension # VSIX → packages/vscode-extension/build/
108-
```
128+
## What this does and does not do
109129

110-
Local extension debugging: open `packages/vscode-extension`, press **F5**, then open `examples/intersected-types` in the Extension Development Host.
130+
**Does**
131+
132+
- Improve hover (and related quick info) for types you explicitly wrap in `Prettify<…>`.
133+
- Work with strict TypeScript projects; the utility type is a few lines of types-only code.
134+
135+
**Does not**
136+
137+
- Change runtime values or emitted JavaScript.
138+
- Rewrite hovers for types you never wrapped (aliases, inferred types, etc. stay as TypeScript prints them).
139+
- Replace dedicated “expand any hover” extensions or VS Code’s experimental expandable hover (`typescript.experimental.expandableHover` with a recent TypeScript workspace version).
111140

112141
## Release
113142

@@ -116,7 +145,13 @@ Local extension debugging: open `packages/vscode-extension`, press **F5**, then
116145
| **npm** (`ts-hover-prettify`) | [Changesets](https://github.com/changesets/changesets) on `main` / `master`[`.github/workflows/publish.yml`](.github/workflows/publish.yml) |
117146
| **Extension** (`ts-hover-prettify-vscode`) | Git tag `vscode-v*` or manual workflow — [`.github/workflows/publish-extension.yml`](.github/workflows/publish-extension.yml) |
118147

119-
Changelog: [CHANGELOG.md](CHANGELOG.md).
148+
## Contributing
149+
150+
Issues and pull requests are welcome on [GitHub](https://github.com/MarcoAntolini/ts-hover-prettify).
151+
152+
<a href="https://github.com/MarcoAntolini/ts-hover-prettify/graphs/contributors">
153+
<img src="https://contrib.rocks/image?repo=MarcoAntolini/ts-hover-prettify" />
154+
</a>
120155

121156
## License
122157

packages/ts-hover-prettify/CHANGELOG.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88

99
All notable changes to **ts-hover-prettify** are documented here.
1010

11-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
12-
1311
## [1.1.0] - 2023-09-25
1412

1513
### Added

packages/ts-hover-prettify/README.md

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,29 @@
1+
<div align="center">
2+
13
# ts-hover-prettify
24

3-
[![npm version](https://img.shields.io/npm/v/ts-hover-prettify)](https://www.npmjs.com/package/ts-hover-prettify)
5+
Provide `Prettify<T>` so TypeScript hovers show a single object shape instead of a chain of intersections.
6+
7+
[![npm version](https://img.shields.io/npm/v/ts-hover-prettify?style=for-the-badge)](https://www.npmjs.com/package/ts-hover-prettify)
8+
[![npm downloads](https://img.shields.io/npm/dm/ts-hover-prettify?style=for-the-badge)](https://www.npmjs.com/package/ts-hover-prettify)
9+
[![License: MIT](https://img.shields.io/badge/License-MIT-blue?style=for-the-badge)](https://github.com/MarcoAntolini/ts-hover-prettify/blob/main/LICENSE)
10+
11+
</div>
412

5-
Provide the `Prettify<T>` utility type so TypeScript hovers show a single object shape instead of a chain of intersections.
13+
## What is this?
614

7-
This package is for projects where you want the type in source control or need `tsc` / CI without the [VS Code extension](../vscode-extension). The extension injects the same type automatically; pick one approach per repo.
15+
This package exports the `Prettify<T>` utility type for projects where you want the type in source control or need `tsc` / CI without the [VS Code extension](../vscode-extension). The extension injects the same type automatically pick one approach per repo.
816

9-
## Install
17+
The mapped-type pattern only affects how TypeScript prints types in the language service. It is erased at compile time and does not change JavaScript output.
18+
19+
## Quick Start
1020

1121
```bash
12-
npm add -D ts-hover-prettify
13-
# pnpm add -D ts-hover-prettify
22+
pnpm add -D ts-hover-prettify
23+
# npm add -D ts-hover-prettify
1424
# yarn add -D ts-hover-prettify
1525
```
1626

17-
## Setup
18-
1927
### Global `Prettify` (recommended)
2028

2129
Create a declaration file included by your `tsconfig.json`, for example `prettify.d.ts`:
@@ -24,7 +32,7 @@ Create a declaration file included by your `tsconfig.json`, for example `prettif
2432
import "ts-hover-prettify/global";
2533
```
2634

27-
Add it to `compilerOptions.types`, or to top-level `include` / `files`, for example:
35+
Add it to `compilerOptions.types`, or to top-level `include` / `files`:
2836

2937
```json
3038
{
@@ -68,7 +76,7 @@ export type Prettify<T> = {
6876
} & {};
6977
```
7078

71-
Implementation matches the common community pattern (also documented as `Compute`, `Expand`, etc.). It only affects how TypeScript prints types in the language service; it is erased at compile time and does not change JavaScript output.
79+
Implementation matches the common community pattern (also documented as `Compute`, `Expand`, etc.).
7280

7381
## Behaviour and limits
7482

@@ -80,6 +88,22 @@ Implementation matches the common community pattern (also documented as `Compute
8088

8189
Use the [ts-hover-prettify-vscode](../vscode-extension) extension instead of this package if you only need editor hovers and accept workspace injection of `.vscode/ts-hover-prettify.d.ts`.
8290

91+
## Documentation
92+
93+
| Resource | Description |
94+
|----------|-------------|
95+
| [Root README](../../README.md) | Monorepo overview and install options |
96+
| [Extension README](../vscode-extension/README.md) | Zero-config editor setup |
97+
| [CHANGELOG.md](./CHANGELOG.md) | Package release notes |
98+
99+
## Contributing
100+
101+
Issues and pull requests are welcome on [GitHub](https://github.com/MarcoAntolini/ts-hover-prettify).
102+
103+
<a href="https://github.com/MarcoAntolini/ts-hover-prettify/graphs/contributors">
104+
<img src="https://contrib.rocks/image?repo=MarcoAntolini/ts-hover-prettify" />
105+
</a>
106+
83107
## License
84108

85-
[MIT](../../LICENSE).
109+
[MIT](../../LICENSE) — Copyright 2023 Marco Antolini.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
type Prettify<T> = {
22
[K in keyof T]: T[K];
3+
// eslint-disable-next-line @typescript-eslint/ban-types -- `{}` expands the mapped type for hover display
34
} & {};

packages/vscode-extension/CHANGELOG.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
All notable changes to **ts-hover-prettify-vscode** are documented here.
44

5-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6-
75
## [0.1.4] - 2026-05-29
86

97
### Fixed

0 commit comments

Comments
 (0)