Skip to content

Commit

Permalink
Update typescript.md
Browse files Browse the repository at this point in the history
Change the importing of the `Ajv` object from default import to named import. This will avoid the typescript errors described in #2132
  • Loading branch information
paulovieira authored Jan 12, 2025
1 parent 82735a1 commit d896934
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions docs/guide/typescript.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ For the same example as in [Getting started](./getting-started):
<code-group>
<code-block title="JSON Schema">
```typescript
import Ajv, {JSONSchemaType} from "ajv"
import {Ajv, JSONSchemaType} from "ajv"
const ajv = new Ajv()

interface MyData {
Expand Down Expand Up @@ -61,7 +61,7 @@ if (validate(data)) {

<code-block title="JSON Type Definition">
```typescript
import Ajv, {JTDSchemaType} from "ajv/dist/jtd"
import {Ajv, JTDSchemaType} from "ajv/dist/jtd.js"
const ajv = new Ajv()

interface MyData {
Expand Down Expand Up @@ -110,7 +110,7 @@ You can use JTD schema to construct the type of data using utility type `JTDData
<code-group>
<code-block title="JSON Type Definition">
```typescript
import Ajv, {JTDDataType} from "ajv/dist/jtd"
import {Ajv, JTDDataType} from "ajv/dist/jtd.js"
const ajv = new Ajv()

const schema = {
Expand Down Expand Up @@ -181,7 +181,7 @@ if (validate(data)) {

<code-block title="JSON Type Definition">
```typescript
import {JTDErrorObject} from "ajv/dist/jtd"
import {JTDErrorObject} from "ajv/dist/jtd.js"

// ...

Expand Down Expand Up @@ -214,7 +214,7 @@ This example uses the same data and schema types as above:
<code-group>
<code-block title="JSON Type Definition">
```typescript
import Ajv, {JTDSchemaType} from "ajv/dist/jtd"
import {Ajv, JTDSchemaType} from "ajv/dist/jtd.js"
const ajv = new Ajv()

interface MyData {
Expand Down Expand Up @@ -290,7 +290,7 @@ Here's a more detailed example showing several union types:
<code-group>
<code-block title="JSON Schema">
```typescript
import Ajv, {JSONSchemaType} from "ajv"
import {Ajv, JSONSchemaType} from "ajv"
const ajv = new Ajv()

type MyUnion = {prop: boolean} | string | number
Expand Down

0 comments on commit d896934

Please sign in to comment.