You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/guide/index.md
+32Lines changed: 32 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -90,6 +90,38 @@ It is highly recommended to use version tags when importing libraries in Deno, e
90
90
91
91
-https://cdn.jsdelivr.net/npm/@faker-js/faker
92
92
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
+
declaremodule'@faker-js/faker' {
120
+
importfakerfrom'faker';
121
+
exportdefaultfaker;
122
+
}
123
+
```
124
+
93
125
## Community
94
126
95
127
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).
0 commit comments