如何使用Flow解决无类型的模块错误?

问题描述 投票:2回答:1

我在流程中遇到错误:

从未类型化的模块中导入类型使其变为any,而不是安全!您是要在// @flow的顶部添加../types吗?(untyped-type-import

这是'../types'文件中的一些代码。

   // @flow
   import type { Account } from '../../props/account'
   import type { Accrual } from '../../props/accrual-prop'
   import type { Amount } from '../../props/amount'
   import type { Customer } from '../../props/customer'
   import type { PaymentTerms } from '../../props/payment-terms'
   import type { NumberSeries } from '../../props/number-series'
   import type { SalesDocumentLock } from '../../props/lock-prop'

    export type Status = 'invoice'|'order'|'offer'

    export type CustomerContact = {
customerContactNumber: number,
name: string,
    }

    export type Employee = {
self?: ?string,
employeeNumber: number,
name: string,
    }

    export type AdditionalExpenseLine = {
additionalExpense: {
    additionalExpenseNumber: number,
    name: string,
    isSystemCreated: boolean
 },
vatAccount: VATAccount,
vatAmount?: ?number,
amount?: number,
grossAmount?:number,
isExcluded: boolean,
salesPricesEnteredInGross : boolean,
vatRate?:number,
additionalExpenseType: AdditionalExpenseType
    }
javascript reactjs flowtype
1个回答
0
投票

我有一个类似的问题,似乎是由两个导出功能引起的:

export function foo() {}

并且还有一个

module.exports = { ... }

也在文件中。

一旦我摆脱了export function陈述,问题就消失了。 (我在文件中有很多export type语句,它们很好。)

© www.soinside.com 2019 - 2024. All rights reserved.