cudr/react-modal-promise

Trying to pass props from a Typescript component fails.

bassamanator opened this issue · 1 comments

This is the TSX component that calls the modal:
image

TitleModal({ isOpen, currentTitle: 'hi' })
  .then(() => {})
  .catch(() => {});

Error message:

(property) currentTitle: string
Argument of type '{ isOpen: boolean; currentTitle: string; }' is not assignable to parameter of type 'Omit<InstanceProps<any, any>, keyof InstanceProps<Resolve, Reject>> & Partial<InstanceProps<any, any>>'.
Object literal may only specify known properties, and 'currentTitle' does not exist in type 'Omit<InstanceProps<any, any>, keyof InstanceProps<Resolve, Reject>> & Partial<InstanceProps<any, any>>'.ts(2345)

Using:

"react": "^17.0.2", "react-modal-promise": "^1.0.2", "typescript": "^4.5.3"

cudr commented

@bassamanator, you should provide your modal component props, like:

const TitleModal = React.FC<{ ...your typed props }> = <></>

Please check new basic example