Skip to content

Commit 235e064

Browse files
committed
Update readme file to include @inline details
1 parent d933edb commit 235e064

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

README.md

+47
Original file line numberDiff line numberDiff line change
@@ -89,3 +89,50 @@ node_modules/.bin/typedoc --declarationFile docs/v1.0/index.d.ts --maxVersion 1.
8989
# write declaration file for types with a max version of 2.0
9090
node_modules/.bin/typedoc --declarationFile docs/v2.0/index.d.ts --maxVersion 2.0
9191
```
92+
93+
## Inlining `keyof` types
94+
95+
You can use this plugin to *@inline* `keyof` types directly into a union to produce a more concise document and `.d.ts` file.
96+
97+
In addition to comments for each of the keys will also be documented as part of the `@inline` type.
98+
99+
### Example
100+
101+
Sample file:
102+
103+
```ts
104+
/**
105+
* @inline
106+
*/
107+
type SwitchState = keyof {
108+
/**
109+
* Switch is on
110+
*/
111+
on: string,
112+
/**
113+
* Switch is off
114+
*/
115+
off: string,
116+
/**
117+
* State of the switch is uknown
118+
*
119+
* @since 2.0
120+
*/
121+
unknown: string,
122+
};
123+
```
124+
125+
Produces the following (with `--maxVersion 1.0`):
126+
127+
```ts
128+
/**
129+
* Options:
130+
*
131+
* - `on`:
132+
* Switch is on
133+
*
134+
* - `off`:
135+
* Switch is off
136+
*/
137+
type SwitchState = "on" | "off";
138+
```

0 commit comments

Comments
 (0)