Skip to content

Commit 930a4ca

Browse files
committed
docs: add ts import example in readme
1 parent 62dcfc9 commit 930a4ca

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ pnpm install @faker-js/faker -D
5454

5555
```js
5656
const { faker } = require('@faker-js/faker');
57+
5758
const randomName = faker.name.findName(); // Rowan Nikolaus
5859
const randomEmail = faker.internet.email(); // [email protected]
5960
const randomPhoneNumber = faker.phone.phoneNumber(); // (279) 329-8663 x30233
@@ -95,6 +96,12 @@ In order to have faker working properly, you need to check if these `compilerOpt
9596
}
9697
```
9798

99+
And then simply import it like everything else:
100+
101+
```ts
102+
import { faker } from '@faker-js/faker';
103+
```
104+
98105
If you want for whatever reason the versions prior to `v6`,
99106
you can use `@types/faker` and rebind the declarations to the `@faker-js/faker` package with a `faker.d.ts` file in your e.g. src folder.
100107

0 commit comments

Comments
 (0)