Skip to content

Commit c68a26c

Browse files
authored
Merge branch 'main' into prettier-ignore-temp-files
2 parents 6161595 + f12fbf6 commit c68a26c

File tree

5 files changed

+209
-177
lines changed

5 files changed

+209
-177
lines changed

docs/guide/index.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,38 @@ It is highly recommended to use version tags when importing libraries in Deno, e
9090

9191
- https://cdn.jsdelivr.net/npm/@faker-js/faker
9292

93+
### TypeScript Support
94+
95+
Since version `v6+` there is native TypeScript support.
96+
97+
In order to have faker working properly, you need to check if these `compilerOptions` are set correctly in your `tsconfig` file:
98+
99+
```json
100+
{
101+
"compilerOptions": {
102+
"esModuleInterop": true,
103+
"moduleResolution": "Node"
104+
}
105+
}
106+
```
107+
108+
And then simply import it like everything else:
109+
110+
```ts
111+
import { faker } from '@faker-js/faker';
112+
```
113+
114+
If you want for whatever reason the versions prior to `v6`,
115+
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.
116+
117+
```ts
118+
// faker.d.ts
119+
declare module '@faker-js/faker' {
120+
import faker from 'faker';
121+
export default faker;
122+
}
123+
```
124+
93125
## Community
94126

95127
If you have questions or need help, reach out to the community via [Discord](https://chat.fakerjs.dev) and [GitHub Discussions](https://github.com/faker-js/faker/discussions).

package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,18 +94,18 @@
9494
"@algolia/client-search": "~4.13.0",
9595
"@types/markdown-it": "~12.2.3",
9696
"@types/node": "~17.0.31",
97-
"@types/prettier": "~2.6.0",
97+
"@types/prettier": "~2.6.1",
9898
"@types/react": "~17.0.45",
9999
"@types/sanitize-html": "~2.6.2",
100100
"@types/validator": "~13.7.2",
101-
"@typescript-eslint/eslint-plugin": "~5.22.0",
102-
"@typescript-eslint/parser": "~5.22.0",
103-
"@vitest/ui": "~0.10.5",
101+
"@typescript-eslint/eslint-plugin": "~5.23.0",
102+
"@typescript-eslint/parser": "~5.23.0",
103+
"@vitest/ui": "~0.12.6",
104104
"c8": "~7.11.2",
105105
"conventional-changelog-cli": "~2.2.2",
106-
"cypress": "~9.6.0",
107-
"esbuild": "~0.14.38",
108-
"eslint": "~8.14.0",
106+
"cypress": "~9.6.1",
107+
"esbuild": "~0.14.39",
108+
"eslint": "~8.15.0",
109109
"eslint-config-prettier": "~8.5.0",
110110
"eslint-define-config": "~1.4.0",
111111
"eslint-gitignore": "~0.1.0",
@@ -129,9 +129,9 @@
129129
"typedoc-plugin-missing-exports": "~0.22.6",
130130
"typescript": "~4.6.4",
131131
"validator": "~13.7.0",
132-
"vite": "~2.9.8",
132+
"vite": "~2.9.9",
133133
"vitepress": "~0.22.4",
134-
"vitest": "~0.10.5"
134+
"vitest": "~0.12.6"
135135
},
136136
"packageManager": "[email protected]",
137137
"engines": {

0 commit comments

Comments
 (0)