【问题标题】:Unsafe member access .toString on an `any` value @typescript-eslint/no-unsafe-member-access`any` 值上的不安全成员访问 .toString @typescript-eslint/no-unsafe-member-access
【发布时间】:2021-09-29 20:57:21
【问题描述】:

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

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

我明白为什么我会收到错误,但我不知道如何解决它。任何建议将不胜感激:) 提前致谢。

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']>
    }
);

【问题讨论】:

    标签: typescript-eslint faker.js


    【解决方案1】:

    那个问题是我错过了faker的类型。我需要安装它们。

    npm i --save @types/faker
    

    【讨论】:

      猜你喜欢
      • 2023-02-18
      • 2021-08-10
      • 2021-06-02
      • 1970-01-01
      • 1970-01-01
      • 2020-10-01
      • 1970-01-01
      • 2023-02-26
      • 2020-11-04
      相关资源
      最近更新 更多