aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorPiotr Kuczynski <[email protected]>2022-03-31 01:52:27 +0200
committerGitHub <[email protected]>2022-03-30 23:52:27 +0000
commitf285dc98cd50b94a38534e220ade7cdb1a4e69fe (patch)
treec54e3be62d6723387b333533cf87e55ed2dff74a /README.md
parent7afd8c55baac6f7d895caabeb623cc6a0514d6cb (diff)
downloadfaker-f285dc98cd50b94a38534e220ade7cdb1a4e69fe.tar.xz
faker-f285dc98cd50b94a38534e220ade7cdb1a4e69fe.zip
docs: add ts import example in readme (#719)
Diffstat (limited to 'README.md')
-rw-r--r--README.md7
1 files changed, 7 insertions, 0 deletions
diff --git a/README.md b/README.md
index ac8c6807..14461fab 100644
--- a/README.md
+++ b/README.md
@@ -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.