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

弹出层NzModalSubject的泛型类型有问题,导致代码大量报错“export declare class NzModalSubject extends Subject<any>” #719

Closed
fuybooo opened this issue Dec 10, 2017 · 6 comments · Fixed by #722
Assignees
Labels

Comments

@fuybooo
Copy link

fuybooo commented Dec 10, 2017

Version

0.6.4

Environment

0.6.4

Reproduction link

http://www.a.com

Steps to reproduce

1.升级到0.6.4
2.运行项目npm start
3.编译不通过:Argument of type '{ type: string; data: any[]; }' is not assignable to parameter of type 'string'
1.注入NzModalSubject:constructor(
private subject: NzModalSubject,
) { },
2.使用subject发送自定义事件:this.subject.next({type: 'save'});
3.此时会报错:subject的泛型不支持any,只支持string。
4.问题根源:nz-modal-subject.service.d.ts文件的第二行:

export declare class NzModalSubject extends Subject<string> {应该改为export declare class NzModalSubject extends Subject<any> {

What is expected?

nz-modal-subject.service.d.ts文件的第二行:export declare class NzModalSubject extends Subject {应该改为export declare class NzModalSubject extends Subject {
这样能够支持更多的自定义事件。

What is actually happening?

NzModalSubject:subject的泛型不支持any,只支持string。

Other?

弹出框发送自定义事件时传递的类型可以是any,这样支持的事件更多。之前的版本是any类型的,代码能够正常启动,但是更新之后,报错,导致项目出现较大的问题。

@ng-zorro-bot
Copy link
Collaborator

It will be better to write your issue/comment in English, so more people can understand you.
And this means that more people can help you or benefit from your issue/comment.

@vthinkxie
Copy link
Member

vthinkxie commented Dec 10, 2017

@trotyl , should support other type here.

@vthinkxie
Copy link
Member

vthinkxie commented Dec 10, 2017

@fuybooo , you can use 0.6.3 now or just stringify your data, we will fix it soon.

@vthinkxie
Copy link
Member

@fuybooo please try it again in 0.6.5 version.

@fuybooo
Copy link
Author

fuybooo commented Dec 11, 2017

OK,Thank you!

schsiung pushed a commit to schsiung/ng-zorro-antd that referenced this issue Dec 18, 2017
@lock
Copy link

lock bot commented Feb 18, 2019

This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.

@lock lock bot locked as resolved and limited conversation to collaborators Feb 18, 2019
hsuanxyz pushed a commit to hsuanxyz/ng-zorro-antd that referenced this issue Aug 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants