gpt4 book ai didi

javascript - 如何使用 Flow 解决 Untyped 模块错误?

转载 作者:行者123 更新时间:2023-12-03 07:13:33 28 4
gpt4 key购买 nike

我收到流程错误:

Importing a type from an untyped module makes it any and is not safe! Did you mean to add // @flow to the top of ../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 语句,它们都很好。)

关于javascript - 如何使用 Flow 解决 Untyped 模块错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56722165/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com