8000 use 'declare' define prop? · Issue #962 · vue-macros/vue-macros · GitHub
[go: up one dir, main page]

Skip to content
use 'declare' define prop? #962
Open
@liuzw2579

Description

@liuzw2579

Clear and concise description of the problem

exportProps problem

Suggested solution

declare global {
    type Prop<T, Default extends T | undefined = undefined> = Default extends T ? T : (T | undefined)
}

/** with default **/
declare let modelValue: Prop<number, 0>

/** that prop is required: false **/
declare const show: Prop<boolean>

/** that prop is required: true **/
declare const title: string

const inc = () => {
    modelValue += 1
}

/** expose */
export const dec = () => {
    modelValue -= 1
}

/** render **/
export default () => <div title={title} onClick={inc}>{modelValue}</div>

Alternative

No response

Additional context

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0