Skip to content

The withDefaults function loses arguments when assigning a function default value #5253

@hcg1023

Description

@hcg1023

Version

3.2.26

Reproduction link

sfc.vuejs.org/

Steps to reproduce

const props = withDefaults(defineProps<{
  fn?: (name: string) => void
}>(), {
  fn(name: string) {
    return name.toUpperCase()
  }
})
console.log(props.fn)

What is expected?

Returns the correct default value

What is actually happening?

Function defaults lose arguments

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions