我在流程中遇到错误:
从未类型化的模块中导入类型使其变为
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
}
我有一个类似的问题,似乎是由两个导出功能引起的:
export function foo() {}
并且还有一个
module.exports = { ... }
也在文件中。
一旦我摆脱了export function
陈述,问题就消失了。 (我在文件中有很多export type
语句,它们很好。)