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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export PublicFormContext interface #3222

Merged
merged 1 commit into from Mar 17, 2021
Merged

Export PublicFormContext interface #3222

merged 1 commit into from Mar 17, 2021

Conversation

notiv-nt
Copy link
Contributor

@notiv-nt notiv-nt commented Mar 16, 2021

馃攷 Overview

If i need to pass form variable to the nested component, i want to define prop type, and for that i we need to export PublicFormContext

i've checked it's working.

App.vue:

<template>
  <TestForm :form="form" />
</template>

<script lang="ts">
export default defineComponent({
  setup() {
    const form = useForm<SomeInterface>(); // form: PublicFormContext<SomeInterface>

    return {
      form,
    };
  },
});
</script>

TestForm.vue:

<script lang="ts">
import '...';

// I need this
import { PublicFormContext } from 'vee-validate';

export default defineComponent({
  props: {
    form: {
      type: Object as PropType<PublicFormContext<SomeInterface>>, // to use here
    },
  },
});
</script>

Copy link
Owner

@logaretm logaretm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks!

@logaretm logaretm merged commit 3e14a7a into logaretm:main Mar 17, 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