-
Notifications
You must be signed in to change notification settings - Fork 120
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
NiceModalProps should let objects with id #106
Comments
hmm, I remember calling |
Just tried and it works but with typescript error. export const MyAntdModal = NiceModal.create(({ name , id}: { name: string, id: string }) => {
const modal = useModal();
return (
<Modal title="Hello Antd" visible={modal.visible} onOk={modal.hide} onCancel={modal.hide} afterClose={modal.remove}>
Greetings: {name} ({id})!
</Modal>
);
});
export default function AntdSample() {
return (
<Space>
<Button type="primary" onClick={() => {
//@ts-ignore
NiceModal.show(MyAntdModal, { name: 'Nate', id: 'nateid' })}
}>
Show Modal
</Button>
</Space>
);
} |
Hi @supnate any luck with this? |
Type check now fixed in v1.2.12. You can use |
@supnate I'm using 1.2.13 and still facing the same problem. typescript still reports error because I passed id prop as number type |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
NiceModalHocProps has a field named id. This is too common and prevents us to pass a type with id in it.
This is not possible:
I actually opened a PR for this #96. But closed it since it wasn't backward compatible.
To reproduce:
The text was updated successfully, but these errors were encountered: