antd-dayjs-webpack-plugin
antd-dayjs-webpack-plugin copied to clipboard
antd-dayjs-webpack-plugin插件替换moment之后,TypeScript声明文件还是要求传参类型为moment.Moment
- [x] I have searched the issues of this repository and believe that this is not a duplicate.
Reproduction link
https://github.com/chj-damon/transfer-bug-reproduce
Steps to reproduce
npm start
What is expected?
传参类型不限定moment.Moment
What is actually happening?
传参类型还是moment.Moment
| Environment | Info |
|---|---|
| antd | 4.1.5 |
| React | 16.13 |
| System | MacOS Majave |
| Browser | Chrome 81.0.4044.113 |
@afc163 请教下 antd 的 定义文件是写死 moment.Moment type 的, 这种情况下使用了插件替换 alias ,是不是没啥好办法解决这个问题?
看看有没有可能 extends 覆盖 antd 提供的类型。
我也遇到这样的情况,请问要怎么解决? I have same issue. Is there any solution to resolve this issue?
我也遇到这样的情况,请问要怎么解决? I have same issue. Is there any solution to resolve this issue?
+1
as any 吧
我也遇到这样的情况,请问要怎么解决? I have same issue. Is there any solution to resolve this issue?
+1
我也遇到这样的情况,请问要怎么解决? I have same issue. Is there any solution to resolve this issue?
+1
+1
+1
Seems there's nothing we can do until antd makes some change.
我也遇到这样的情况,请问要怎么解决? I have same issue. Is there any solution to resolve this issue?
+1
+1
+1 能不能考虑干脆把Moment类替换成Dayjs类编译(虽然有点笨笨)
[Facepalm] 我直接把 Moment 声明改成 Dayjs 了
declare module 'moment' {
import { Dayjs } from 'dayjs'
namespace moment {
type Moment = Dayjs
}
export = moment
export as namespace moment
}
大家有什么好的办法也请共享下,感谢~
我也遇到这样的情况,请问要怎么解决? I have same issue. Is there any solution to resolve this issue?
+1
我也遇到这样的情况,请问要怎么解决? I have same issue. Is there any solution to resolve this issue?
+1