小编jsw*_*ler的帖子

是否可以在 Node 模块的编译发行版中输出简化的 Typescript 类型

我正在尝试在打字稿文件中创建更简化的输出,*.d.ts这些输出包含在我的模块代码的捆绑版本中。这些文件是通过涉及 typescript 编译器、babel 和 rollup 的链生成的。我也使用relay和graphql,但我认为这不会对问题产生太大影响。

举个例子,在.tsx源代码中,我有这样的内容:

import { graphql } from 'babel-plugin-relay/macro'

// produces some generated code 
graphql`fragment task_model on Task { id message createdAt deadline modifiers { hard medium easy } }`

// There is a generated type for this fragment, but it is a little ugly
import { task_model } from './__generated__/task.graphql'

// We can "correct" the type information and export it with a nicer name
export type Task = Readonly<Omit<task_model & { …
Run Code Online (Sandbox Code Playgroud)

javascript relay typescript babeljs rollupjs

12
推荐指数
1
解决办法
750
查看次数

标签 统计

babeljs ×1

javascript ×1

relay ×1

rollupjs ×1

typescript ×1