在“任何”值@typescript-eslint/no-unsafe-member-access 上不安全的成员访问 .toString

Unsafe member access .toString on an `any` value @typescript-eslint/no-unsafe-member-access

我在第 3 行收到以下错误 (id: faker.unique(().....):

“不安全成员访问 .toString any 值 @typescript-eslint/no-unsafe-member-access”

我明白为什么会收到错误消息,但我不确定如何修复它。任何建议将不胜感激 :) 提前致谢。

export const mockFinance = (): FinanceData => (
    {
        id: faker.unique(() => faker.datatype.number({ min: 1, max: 10000 })).toString() as Scalars['ID'],
        monthlyPrice: faker.commerce.price() as Maybe<Scalars['Float']>
    }
);

那个问题是我缺少 faker 的类型。我需要安装它们。

npm i --save @types/faker