-
I was trying to follow the syntax in the https://github.com/pkosiec/mongo-seeding/blob/master/examples/import-data-ts/example/data/1-categories/testCategories.ts page. import faker from "faker";
type User = {
firstName: string;
lastName: string;
email: string;
mobileNumber: string;
dob: Date;
weight: number;
profession: string;
age: number;
};
let users: User[];
for (let i = 0; i < 20; i++) {
const user: User = {
firstName: faker.name.firstName(),
lastName: faker.name.lastName(),
email: faker.internet.email(),
mobileNumber: faker.phone.phoneNumber(),
dob: faker.date.past(),
weight: faker.random.number(),
profession: "Software Engineer",
age: faker.random.number(),
};
users.push(user);
}
export = users; However, I'm getting the following error:
I was going to use Is there another way to deal with this? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Hi @leanjunio, |
Beta Was this translation helpful? Give feedback.
-
Thanks! That helped me out! I'm not sure if I should make another ticket for this but, is it possible to relate ObjectIds with this package? |
Beta Was this translation helpful? Give feedback.
Hi @leanjunio,
If you'd like to use this syntax, please make sure that the
compilerOptions.module
intsconfig.json
file is set tocommonjs
- like this: https://github.com/pkosiec/mongo-seeding/blob/master/core/tsconfig.json#L5