Skip to content

Commit a598c46

Browse files
committed
docs: format
1 parent 3abf019 commit a598c46

File tree

1 file changed

+16
-31
lines changed

1 file changed

+16
-31
lines changed

packages/openapi-typescript/README.md

Lines changed: 16 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,8 @@ openapi-typescript turns [OpenAPI 3.0 & 3.1](https://spec.openapis.org/oas/lates
44

55
The code is [MIT-licensed](https://github.com/openapi-ts/openapi-typescript/blob/main/packages/openapi-typescript/LICENSE") and free for use.
66

7-
::: tip
8-
9-
New to OpenAPI? Speakeasy’s [Intro to OpenAPI](https://www.speakeasyapi.dev/openapi) is an accessible guide to newcomers that explains the “why” and “how” of OpenAPI.
10-
11-
:::
7+
> **Tip:**
8+
> New to OpenAPI? Speakeasy’s [Intro to OpenAPI](https://www.speakeasyapi.dev/openapi) is an accessible guide to newcomers that explains the “why” and “how” of OpenAPI.
129
1310
## Features
1411

@@ -33,34 +30,26 @@ npm i -D openapi-typescript typescript
3330

3431
And in your `tsconfig.json`, to load the types properly:
3532

36-
::: code-group
37-
38-
```json [tsconfig.json]
33+
```diff [tsconfig.json]
3934
{
4035
"compilerOptions": {
41-
"module": "ESNext", // or "NodeNext" // [!code ++]
42-
"moduleResolution": "Bundler" // or "NodeNext" // [!code ++]
36+
+ "module": "ESNext", // or "NodeNext"
37+
+ "moduleResolution": "Bundler" // or "NodeNext"
4338
}
4439
}
4540
```
4641

47-
:::
48-
49-
::: tip Highly recommended
50-
51-
Also adding the following can boost type safety:
52-
53-
::: code-group
54-
55-
```json [tsconfig.json]
56-
{
57-
"compilerOptions": {
58-
"noUncheckedIndexedAccess": true // [!code ++]
59-
}
60-
}
61-
```
62-
63-
:::
42+
> **Tip:**
43+
> **Highly recommended**
44+
>
45+
> Also adding the following can boost type safety:
46+
> ```diff [tsconfig.json]
47+
> {
48+
> "compilerOptions": {
49+
> + "noUncheckedIndexedAccess": true
50+
> }
51+
> }
52+
> ```
6453
6554
## Basic usage
6655
@@ -78,8 +67,6 @@ npx openapi-typescript https://myapi.dev/api/v1/openapi.yaml -o ./path/to/my/sch
7867
7968
Then in your TypeScript project, import types where needed:
8069

81-
::: code-group
82-
8370
```ts [src/my-project.ts]
8471
import type { paths, components } from "./my-openapi-3-schema"; // generated by openapi-typescript
8572

@@ -96,8 +83,6 @@ type ErrorResponse =
9683
paths["/my/endpoint"]["get"]["responses"][500]["content"]["application/json"]["schema"];
9784
```
9885

99-
:::
100-
10186
From here, you can use these types for any of the following (but not limited to):
10287

10388
- Using an OpenAPI-supported fetch client (like [openapi-fetch](/openapi-fetch/))

0 commit comments

Comments
 (0)