1

Does anyone know why I'm getting the following error when trying to populate an array that I've typed?

Unsafe assignment of an `any` value.eslint@typescript-eslint/no-unsafe-assignment
Unsafe member access .lorem on an `any` value.eslint@typescript-eslint/no-unsafe-member-access
Unsafe call of an `any` typed value.eslint@typescript-eslint/no-unsafe-call

My code is:

import { PrismaClient } from "@prisma/client";
import {faker} from '@faker-js/faker'

const prisma = new PrismaClient();

enum Priority {
    HIGH = 'HIGH',
    MEDIUM = 'MEDIUM',
    LOW = 'LOW'
}

interface Deadline {
    title: string;
    description?:string;
    date: Date;
}   

const deadlines: Deadline[] = Array.from({length:100}, () => ({
    title: faker.lorem.sentences({min: 10, max: 20}),
    description: faker.lorem.sentences({min: 3, max: 30}),
    date: faker.date.future({years: 1})
}))
Mathew
  • 318
  • 11
  • Can you clarify at what lines do each error appear? – Alejandro Jun 16 '23 at 16:40
  • Each prop gets the same error – Mathew Jun 16 '23 at 16:41
  • @Mathew were you able to solve this? I'm having the same issue. not sure if it's helpful, but these are the packages I'm using. "@faker-js/faker": "^7.6.0", "@types/faker": "^6.6.9", "@typescript-eslint/eslint-plugin": "^5.61.0", "@typescript-eslint/parser": "^5.61.0", "typescript": "^3.9.5", – Giwoo Gustavo Lee Jul 13 '23 at 16:55

0 Answers0