Thunberg087 / vue-fragment

a very candide fragment component for Vue.js
http://jsfiddle.net/cdkn5wL3/
670 stars 51 forks source link

Add typescript declarations #37

Closed ChuckBorris33 closed 4 years ago

ChuckBorris33 commented 4 years ago

Closes #28

tobias-kuendig commented 4 years ago

Would you mind creating a new release with these changes? Thank you!

tobias-kuendig commented 4 years ago

Anything we can do to help you get a new release out that includes the typescript definitions, @y-nk?

weihao commented 4 years ago

Would you mind creating a new release with these changes? Thank you!

@y-nk ^

tobias-kuendig commented 4 years ago

For anyone waiting for the release, here is a workaround that uses the current master branch and builds the package using a postinstall script. Just add the following to your package.json:

{
    "scripts": {
        "postinstall": "cd ./node_modules/vue-fragment && yarn"
    },
    "dependencies": {
        "vue-fragment": "y-nk/vue-fragment#master",
    }
}

You can use npm install instead of yarn in the postinstall script.

ChuckBorris33 commented 4 years ago

You can also add file e.g. shims.vue-fragment.d.ts to your project.

declare module 'vue-fragment' {
  import Vue, { AsyncComponent, ComponentOptions, PluginObject } from 'vue'

  type Component = ComponentOptions<Vue> | typeof Vue | AsyncComponent

  export const Fragment: Component
  export const Plugin: PluginObject<undefined>

  namespace VueFragment {
    export const Fragment: Component
    export const Plugin: PluginObject<undefined>
  }
  export default VueFragment
}