Skip to content

useModal().create accepts returnBoolean but it doesn't appear to work #2934

@gtbuchanan

Description

@gtbuchanan

Describe the bug

useModal().create accepts the returnBoolean option in its second argument. The typing of modal.show indicates it can return BvTriggerableEvent | boolean | null, so I would have expected it to return boolean in this case. However, it still returns BvTriggerableEvent when returnBoolean is set to true.

I'd personally like to see an API that doesn't require type guards, which brings two options to mind:

  1. Remove returnBoolean and always return BvTriggerableEvent
  2. Make returnBoolean impact the return type (VueUse does crazy stuff like this)

As an aside, I also don't know of a situation where null should be returned, so it would be nice if the return type was only BvTriggerableEvent.

Reproduction

https://stackblitz.com/edit/github-y6vc86fd?file=src%2FApp.vue

Used Package Manager

pnpm

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions