Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(types): defineComponent object format with no props type #839

Merged
merged 1 commit into from Nov 1, 2021

Conversation

xiaoxiangmoe
Copy link
Collaborator

see https://github.com/vuejs/vue-next/blob/140f08991727d7c15db907eea5a101979fe390b2/packages/runtime-core/src/apiDefineComponent.ts#L95-L120

// overload 2: object format with no props
// (uses user defined props interface)
// return type is for Vetur and TSX support
export function defineComponent<
  Props = {},
  RawBindings = {},
  D = {},
  C extends ComputedOptions = {},
  M extends MethodOptions = {},
  Mixin extends ComponentOptionsMixin = ComponentOptionsMixin,
  Extends extends ComponentOptionsMixin = ComponentOptionsMixin,
  E extends EmitsOptions = EmitsOptions,
  EE extends string = string
>(
  options: ComponentOptionsWithoutProps<
    Props,
    RawBindings,
    D,
    C,
    M,
    Mixin,
    Extends,
    E,
    EE
  >
): DefineComponent<Props, RawBindings, D, C, M, Mixin, Extends, E, EE>

Vue 3 use {} rather than unknown when object format with no props.

@antfu antfu changed the title fix: defineComponent object format with no props type fix(types): defineComponent object format with no props type Nov 1, 2021
@antfu antfu merged commit 8a31c78 into vuejs:main Nov 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants