gpt4 book ai didi

typescript - 为具有多个入口点的库导出声明

转载 作者:行者123 更新时间:2023-12-05 06:33:28 24 4
gpt4 key购买 nike

假设我正在导出一个文件结构如下的库

|__ src
| |__ index.ts
| |__ other-file.ts

我想像这样消费它

import { something } from 'library'
import { other } from 'library/other-file'

我应该如何构建输出以实现这一目标?

最佳答案

How should I structure the output in order to achieve that?

|__ lib
| |__ index.js
| |__ index.d.ts
| |__ other-file.js
| |__ other-file.d.ts
|__ src
| |__ index.ts
| |__ other-file.ts

tsconfig.jsonoutDir:lib/declaration:true/include:['src']

使用看起来像:

import { something } from 'library'
import { other } from 'library/lib/other-file'

更多

关于typescript - 为具有多个入口点的库导出声明,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50712650/

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