Skip to content
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

antd-dayjs-webpack-plugin插件替换moment之后,TypeScript声明文件还是要求传参类型为moment.Moment #23

Open
1 task done
chj-damon opened this issue Apr 27, 2020 · 13 comments

Comments

@chj-damon
Copy link

  • 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 afc163 transferred this issue from ant-design/ant-design Apr 27, 2020
@iamkun
Copy link
Collaborator

iamkun commented Apr 27, 2020

@afc163 请教下 antd 的 定义文件是写死 moment.Moment type 的, 这种情况下使用了插件替换 alias ,是不是没啥好办法解决这个问题?

@afc163
Copy link
Member

afc163 commented Apr 27, 2020

看看有没有可能 extends 覆盖 antd 提供的类型。

@GrayFrost
Copy link

我也遇到这样的情况,请问要怎么解决?
I have same issue. Is there any solution to resolve this issue?

@ChiaJune
Copy link

我也遇到这样的情况,请问要怎么解决?
I have same issue. Is there any solution to resolve this issue?

+1

@Lizhooh
Copy link

Lizhooh commented Jun 19, 2020

as any 吧

@chenyuhu
Copy link

chenyuhu commented Aug 9, 2020

我也遇到这样的情况,请问要怎么解决?
I have same issue. Is there any solution to resolve this issue?

+1

@hr837
Copy link

hr837 commented Aug 13, 2020

我也遇到这样的情况,请问要怎么解决?
I have same issue. Is there any solution to resolve this issue?

+1

+1

@0408jiahuicao
Copy link

+1

@iamkun
Copy link
Collaborator

iamkun commented Sep 29, 2020

Seems there's nothing we can do until antd makes some change.

@yokiguan
Copy link

我也遇到这样的情况,请问要怎么解决?
I have same issue. Is there any solution to resolve this issue?

+1

+1

+1 能不能考虑干脆把Moment类替换成Dayjs类编译(虽然有点笨笨)

@chayin
Copy link

chayin commented Oct 18, 2020

[Facepalm] 我直接把 Moment 声明改成 Dayjs 了

declare module 'moment' {
  import { Dayjs } from 'dayjs'
  namespace moment {
    type Moment = Dayjs
  }
  export = moment
  export as namespace moment
}

大家有什么好的办法也请共享下,感谢~

@qluwlh
Copy link

qluwlh commented Mar 5, 2021

我也遇到这样的情况,请问要怎么解决?
I have same issue. Is there any solution to resolve this issue?

+1

1 similar comment
@Ray-56
Copy link

Ray-56 commented Jul 22, 2021

我也遇到这样的情况,请问要怎么解决?
I have same issue. Is there any solution to resolve this issue?

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests