New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
app.d.ts 写的有问题,编译后的 index.d.ts 会报错 #11
Comments
另外,定义了 enum 但只导出它的 type 这个行为其实也不太好,包的使用者还得自己再定义遍 enum |
感谢指出!我看 #12 被 Close 了没有合并,需要重新打开么?
在我个人使用来看,是通过 |
呃,#12 不用重新打开,那个是我试了下 github 的在线编辑功能,还挺好使的。 因为 GuardLevel 导出时用的是 |
v0.3.1 已修正; |
就正常编译到 es5 成 object 就行,tsc 把 enum 编译成 object 后,类型上还是 enum。
|
因为 app.d.ts 里有个
export enum GuardLevel
,现在会编译到 index.d.ts 里变成enum GuardLevel
,然后引入这个包后就会报错:编译的时候 d.ts 和 ts 的处理是不同的,其实按你这个项目的用途来看,app 不应该是 d.ts,而是一个正常的 ts 文件,因为按照官方的解释 microsoft/TypeScript#5112 (comment) ,d.ts 文件应该是构建系统的输入,不应该参与到输出,而你 app 文件里全是用于输出的,所以应该是 ts 文件,那样就可以编译成正常的
declare enum GuardLevel
。The text was updated successfully, but these errors were encountered: