eBay / nice-modal-react

A modal state manager for React.
https://ebay.github.io/nice-modal-react
MIT License
1.96k stars 110 forks source link

[Question] Typesafe args #95

Closed osrl closed 9 months ago

osrl commented 1 year ago

I'm not an expert ts developer so there might be something I missed. When I change the signature of the show method to below, args parameter becomes type safe, instead of any. Is there a reason why this isn't the case?

export declare function show<T extends any, Arg extends any>(modal: React.FC<Arg>, args?: NiceModalArgs<React.FC<Arg>>): Promise<T>;

Yedidyar commented 1 year ago

I also have an issue when I use the show or create functions with plugin:@typescript-eslint/recommended-requiring-type-checking rules. I get:

osrl commented 1 year ago

I think #102 closes this.