You have to import it like:

import * as faker from 'faker';

And use it like:

faker.name.findName()
Answer from Saravana on Stack Overflow
🌐
FakerJS
fakerjs.dev › guide › usage
Usage | Faker
Faker mostly generates values for primitives. This is because in the real world, most object schemas simply look very different. So, if you want to create an object, you most likely need to write a factory function for it. For our example, we use TypeScript to strongly type our model.
Discussions

Feat: Add typescript types for @faker-js/faker
Generate massive amounts of fake data in the browser and node.js - Feat: Add typescript types for @faker-js/faker · Issue #9 · faker-js/faker More on github.com
🌐 github.com
22
January 7, 2022
Is there a library that generates fake data from a typescript interface?
Fakerjs or chance come to mind More on reddit.com
🌐 r/node
37
21
November 10, 2025
🌐
npm
npmjs.com › package › @faker-js › faker
@faker-js/faker - npm
3 weeks ago - // ESM import { faker } from '@faker-js/faker'; // CJS const { faker } = require('@faker-js/faker'); export function createRandomUser() { return { userId: faker.string.uuid(), username: faker.internet.username(), email: faker.internet.email(), avatar: faker.image.avatar(), password: faker.internet.password(), birthdate: faker.date.birthdate(), registeredAt: faker.date.past(), }; } export const users = faker.helpers.multiple(createRandomUser, { count: 5, });
      » npm install @faker-js/faker
    
Published   Mar 23, 2026
Version   10.4.0
🌐
npm
npmjs.com › package › @types › faker
@types/faker - npm
October 23, 2024 - Stub TypeScript definitions entry for faker, which provides its own types definitions. Latest version: 6.6.11, last published: a year ago. Start using @types/faker in your project by running `npm i @types/faker`. There are 301 other projects in the npm registry using @types/faker.
      » npm install @types/faker
    
Published   Oct 23, 2024
Version   6.6.11
🌐
DEV Community
dev.to › serifcolakel › building-a-typescript-helper-for-mock-data-generation-with-zod-and-faker-4b8f
Building a TypeScript Helper for Mock Data Generation with Zod and Faker - DEV Community
November 5, 2024 - import { ZodSchema, ZodObject, ZodString, ZodNumber, ZodBoolean, ZodArray, ZodOptional, ZodNullable, ZodTypeAny, ZodStringCheck, } from "zod"; import { faker } from "@faker-js/faker"; import { z } from "zod"; const handleStringCheck = (check: ZodStringCheck) => { switch (check.kind) { case "date": return faker.date.recent().toISOString(); case "url": return faker.internet.url(); case "email": return faker.internet.email(); case "uuid": case "cuid": case "nanoid": case "cuid2": case "ulid": return crypto.randomUUID(); case "emoji": return faker.internet.emoji(); default: return faker.lorem.word
🌐
Medium
jaferson123.medium.com › tdd-factory-generator-with-factory-ts-and-faker-js-to-ease-your-testing-in-typescript-applications-5afdd45e6e8
TDD: Factory generator with factory.ts and faker.js to ease your testing in TypeScript applications | by Jose Silva | Medium
April 17, 2019 - TDD: Factory generator with factory.ts and faker.js to ease your testing in TypeScript applications When writing unit testing it is alway a good practice to mock the database with test data to …
🌐
GitHub
github.com › magiqans › faker.ts
GitHub - magiqans/faker.ts: Faker typescript decorators
Generate massive amounts of fake contextual data using typescript decorators · import Faker, { address, internet } from "faker-ts"; @Faker() class MyObject { @address.name() randomName: string; @internet.email() randomEmail: string; } const instance = new MyObject(); instance.randomName; // // Rowan Nikolaus instance.randomEmail; // Kassandra.Haley@erich.biz
Starred by 3 users
Forked by 2 users
Languages   TypeScript 100.0% | TypeScript 100.0%
Find elsewhere
🌐
GitHub
github.com › faker-js
faker-js · GitHub
TypeScript 12 3 4 11 Updated · Apr 15, 2026 · playground Public · A playground project to test cjs and esm for js and ts and an additional browser setup · There was an error while loading. Please reload this page. faker-js/playground’s past year of commit activity ·
🌐
GitHub
github.com › faker-js › faker › issues › 9
Feat: Add typescript types for @faker-js/faker · Issue #9 · faker-js/faker
January 7, 2022 - Generate massive amounts of fake data in the browser and node.js - Feat: Add typescript types for @faker-js/faker · Issue #9 · faker-js/faker
Author   damienwebdev
🌐
DEV Community
dev.to › sirwanafifi › ts-faker-generating-fake-data-using-typescript-interfaces-2em2
ts-faker - Generating fake data using TypeScript interfaces - DEV Community
July 29, 2021 - You just need to define your schema as TypeScript interfaces, and the test data will be generated automatically. I thought it would be a good idea to share the source code with you so that you can learn something from it. I hope you enjoy it. source: https://github.com/SirwanAfifi/ts-faker website: https://ts-faker.vercel.app/
🌐
Untitled Publication
noam.hashnode.dev › using-faker-in-typescript
Using faker in typescript - noam honig's blog
January 9, 2022 - import { Remult } from "remult"; import { AccountManager } from "../AccountManagers/AccountManager.entity"; import { name, internet } from 'faker'; export async function generateDataIfEmpty(remult: Remult) { console.log("here"); const repo = remult.repo(AccountManager); if (await repo.count() == 0) { for (let index = 0; index < 10; index++) { const firstName = name.firstName(); const lastName = name.lastName(); await repo.save({ firstName, lastName, email: internet.email(firstName, lastName) }, true) } } }
🌐
FakerJS
fakerjs.dev › guide
Getting Started | Faker
Faker was originally written in Perl and this is the JavaScript port.
🌐
GitHub
github.com › cytle › faker-ts
GitHub - cytle/faker-ts: Mock data from TypeScript
import { tsMock, tsMockService } from 'faker-ts'; const files = ['foo.ts']; // foo.ts // export interface IFoo { a: string } const mocker = tsMock(files); mocker.generateMock('IFoo'); // { "a": "commodo voluptate pariatur" } // or listening file change const mocker = tsMockService(files); // see more Mock Server with Koa ... import Koa from 'koa'; import Router from 'koa-router'; import * as ts from 'typescript'; import { tsMockService } from 'faker-ts'; export function createServer(files: string[], jsonCompilerOptions?: ts.CompilerOptions, basePath?: string) { const app = new Koa(); const rou
Starred by 32 users
Forked by 7 users
Languages   TypeScript 93.0% | JavaScript 7.0% | TypeScript 93.0% | JavaScript 7.0%
🌐
DEV Community
dev.to › matthewmayer › leveling-up-your-custom-fake-data-with-fakerjs-3f7m
Leveling up your custom fake data with Faker.js - DEV Community
January 28, 2024 - Faker.js is a very useful library which lets you generate large amounts of fake data in... Tagged with javascript, faker, typescript, webdev.
🌐
GitHub
github.com › google › intermock
GitHub - google/intermock: Mocking library to create mock objects with fake data for TypeScript interfaces · GitHub
Mocking library to create mock objects and JSON for TypeScript interfaces via Faker.
Starred by 1.2K users
Forked by 70 users
Languages   TypeScript 92.4% | JavaScript 7.6%
🌐
CodeSandbox
codesandbox.io › examples › package › @types › faker
@types/faker examples - CodeSandbox
AboutStub TypeScript definitions entry for faker, which provides its own types definitions740,493Weekly Downloads
🌐
GitHub
github.com › faker-js › faker
GitHub - faker-js/faker: Generate massive amounts of fake data in the browser and node.js · GitHub
// ESM import { faker } from '@faker-js/faker'; // CJS const { faker } = require('@faker-js/faker'); export function createRandomUser() { return { userId: faker.string.uuid(), username: faker.internet.username(), email: faker.internet.email(), avatar: faker.image.avatar(), password: faker.internet.password(), birthdate: faker.date.birthdate(), registeredAt: faker.date.past(), }; } export const users = faker.helpers.multiple(createRandomUser, { count: 5, });
Starred by 15K users
Forked by 1.1K users
Languages   TypeScript 99.6% | JavaScript 0.4%