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

[Dialog] 实例里的方法都是存在的,为什么定义成可选的类型? #1782

Closed
moecasts opened this issue Dec 7, 2022 · 3 comments · Fixed by #1783
Closed

[Dialog] 实例里的方法都是存在的,为什么定义成可选的类型? #1782

moecasts opened this issue Dec 7, 2022 · 3 comments · Fixed by #1783

Comments

@moecasts
Copy link
Collaborator

moecasts commented Dec 7, 2022

tdesign-react 版本

0.44.0

重现链接

No response

重现步骤

定义成可选的话,老代码都要改成 dialog.hide?.(),对于已经大量使用 dialog 组件的项目极不友好。

期望结果

export interface DialogInstance {
/**
* 销毁弹框
*/
destroy?: () => void;
/**
* 隐藏弹框
*/
hide?: () => void;
/**
* 显示弹框
*/
show?: () => void;
/**
* 更新弹框内容
*/
update?: (props: DialogOptions) => void;
}

实际结果

可以将类型定义成必选的。

框架版本

No response

浏览器版本

No response

系统版本

No response

Node版本

No response

补充说明

No response

@github-actions
Copy link
Contributor

github-actions bot commented Dec 7, 2022

👋 @moecasts,感谢给 TDesign 提出了 issue。
请根据 issue 模版确保背景信息的完善,我们将调查并尽快回复你。

@github-actions
Copy link
Contributor

github-actions bot commented Dec 7, 2022

♥️ 有劳 @ldwonday @HQ-Lin @psaren @huoyuhao 尽快确认问题。
确认有效后将下一步计划和可能需要的时间回复给 @moecasts

@chaishi
Copy link
Collaborator

chaishi commented Dec 7, 2022

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

Successfully merging a pull request may close this issue.

2 participants