-
-
Notifications
You must be signed in to change notification settings - Fork 919
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: add ts import example in readme (#719)
- Loading branch information
1 parent
7afd8c5
commit f285dc9
Showing
1 changed file
with
7 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,6 +54,7 @@ pnpm install @faker-js/faker -D | |
|
||
```js | ||
const { faker } = require('@faker-js/faker'); | ||
|
||
const randomName = faker.name.findName(); // Rowan Nikolaus | ||
const randomEmail = faker.internet.email(); // [email protected] | ||
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 | |
} | ||
``` | ||
|
||
And then simply import it like everything else: | ||
|
||
```ts | ||
import { faker } from '@faker-js/faker'; | ||
``` | ||
|
||
If you want for whatever reason the versions prior to `v6`, | ||
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. | ||
|
||
|