gpt4 book ai didi

TypeScript:导入和导出 "at the same time"

转载 作者:搜寻专家 更新时间:2023-10-30 20:59:58 25 4
gpt4 key购买 nike

有没有办法在同一个 TypeScript 文件中同时导入和导出同名变量?

比如下面的情况:

import { State as UIState } from './ui'
import { State as ConnectionState } from './connection'

export { State as UIState } from './ui'
export { State as ConnectionState } from './connection'

export type State = {
ui: UIState
connection: ConnectionState
}

为了降低写作成本,我希望能够写出这样的东西:

export import { State as UIState } from './ui'

有什么想法吗?

最佳答案

Is there a way of doing an import and an export of a the same named variable, at the same time, in the same TypeScript file

没有。没有JS 模块 的语法。

关于TypeScript:导入和导出 "at the same time",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48554819/

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