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

Is it possible to make params non-undefined? #135

Open
bezenson opened this issue Jan 4, 2024 · 1 comment
Open

Is it possible to make params non-undefined? #135

bezenson opened this issue Jan 4, 2024 · 1 comment
Assignees
Labels
good first issue Good for newcomers new feature New feature or request question Question about how the library works/if it provides a certain feature

Comments

@bezenson
Copy link

bezenson commented Jan 4, 2024

If I described params in react-native-modalfy.d.ts - it means that they are required for my modal. Is it possible to have an error if I call openModal() without params if my modal require them? Because currently I have to check each param in modal like params?.title, params?.items etc. but it makes no sense.

@CharlesMangwa CharlesMangwa self-assigned this Mar 8, 2024
@CharlesMangwa CharlesMangwa added new feature New feature or request good first issue Good for newcomers question Question about how the library works/if it provides a certain feature labels Mar 8, 2024
@CharlesMangwa
Copy link
Member

CharlesMangwa commented Mar 8, 2024

hey @bezenson! you're making a valid point here indeed. without having thought too much about it, i believe this would require a refactoring of how params is typed here:

openModal: <N extends M>(modalName: N, params?: P[N], callback?: () => void) => void

until i manage to find some more time to work on this, any pull request would be more than welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers new feature New feature or request question Question about how the library works/if it provides a certain feature
Projects
None yet
Development

No branches or pull requests

2 participants