{"name":"vue-component-type-helpers","version":"1.5.4","license":"MIT","_id":"vue-component-type-helpers@1.5.4","homepage":"https://github.com/vuejs/language-tools#readme","bugs":{"url":"https://github.com/vuejs/language-tools/issues"},"dist":{"shasum":"dab7e727dce8d73e57e27144549dd65940f41d13","tarball":"http://registry-npm.ywwl.com/vue-component-type-helpers/download/vue-component-type-helpers-1.5.4.tgz","fileCount":5,"integrity":"sha512-IkOF3nWXOdNwd7ZhETSu3dswjbnWCpOtvEj/jXs4XcR0GddGtoXzrI7cbBc7sPBuZWakuQN6TSe+9cFn/4tZyg==","signatures":[{"sig":"MEUCIBQ3XJaJJDEGVqq6wpebapIKy6bRVc+AHeekwDfEMsPuAiEAoej2PFQaL46fk1gHDLfkonQdz2kV50ATQwjoZ03SjUA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":3908,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkSSgqACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqDGA/+MaoazVScFMQ0NJItAaGnJIdam5qCiVVHVvbh99pOjnFSF9lN\r\nw037qHDdvlpamOex8mvxRWAZqDpY1zZxR5ed1CEYgMs22DrKISuhj6z47Co0\r\nNjqN7NOloEfO0lBFkbG96Oi4Q7ey1Uiste36F7sQFZ3L9B7E8fF/9HHJXrn/\r\nWLijM4NcFAXOQPBduDrDcy1hbZ+r0DwAUCrriyHtxYwe2ho2Lm3msq1NBcyt\r\nJlXTaZ9FQL++l2B4ZhpAl16SpAT7M9GNXyXR/cvKUkybkl0HAaijaQvynV+b\r\npLUGEAk3Kw7xS4BBdqUlS6a91IZyHhJ6Qnoef7D97Z9XYo8GUmjj5+NofWu5\r\njwWmLdfgjeHJsQur0Yi6gLsLu+0UMDS/Kqjf8mX31VIjwN0LukHQGvYY1O2T\r\nuY0Lfaapluayt3czLgpBAcM0h+XSyetBWciJ5/4gU0AdfcRCJadr7fGVu7pu\r\nvpfclDVe1K9NN5PKbzY1IoHWqDRb/Y1JbvoDIuDnKUxwgJev319mmhMEvdgt\r\nj3BzQQXVpgSD9NhYD5uY4Uf/ztxdzKJhf/yMwEAoVrkMZQ+AnqveQJwQf86n\r\nnbXxKtWT5DUBlefdTw9QzOmweNWC+ZrDSdw0DfqCAzemUl8UHkpJUlg8BspM\r\nQJBuGANV0MDKSJnCEdR4Zev6RYFEqFY+RC8=\r\n=X5v7\r\n-----END PGP SIGNATURE-----\r\n","size":1649,"noattachment":false,"key":"/vue-component-type-helpers/-/vue-component-type-helpers-1.5.4.tgz"},"types":"./index.d.ts","gitHead":"efa9b71f8bed110f8a7723942f86df2b7bcb1764","_npmUser":{"name":"johnsoncodehk","email":"johnsoncodehk@gmail.com"},"repository":{"url":"git+https://github.com/vuejs/language-tools.git","type":"git","directory":"packages/vue-component-type-helpers"},"_npmVersion":"lerna/2.1.0/node@v18.13.0+x64 (darwin)","description":"Some very simple type helpers used behind `vue-component-meta` for extract component props, slots, emit, exposed types.","directories":{},"_nodeVersion":"18.13.0","_hasShrinkwrap":false,"readmeFilename":"README.md","_npmOperationalInternal":{"tmp":"tmp/vue-component-type-helpers_1.5.4_1682516010390_0.12754130552783138","host":"s3://npm-registry-packages"},"readme":"# vue-component-type-helpers\n\n<p>\n  <a href=\"https://www.npmjs.com/package/vue-component-type-helpers\"><img src=\"https://img.shields.io/npm/v/vue-component-type-helpers.svg?labelColor=18181B&color=1584FC\" alt=\"NPM version\"></a>\n  <a href=\"https://github.com/vuejs/language-tools/blob/master/LICENSE\"><img src=\"https://img.shields.io/github/license/vuejs/language-tools.svg?labelColor=18181B&color=1584FC\" alt=\"License\"></a>\n</p>\n\nHelper utilities for extracting types such as props, slots, attrs, emit, and exposed from Vue component types. No runtime dependencies; provides TypeScript type definitions only.\n\n## Installation\n\n```bash\nnpm install vue-component-type-helpers\n```\n\n## Type Helpers\n\n### `ComponentProps<T>`\n\nExtracts the props type of a component.\n\n```typescript\nimport type { ComponentProps } from 'vue-component-type-helpers';\nimport MyComponent from './MyComponent.vue';\n\ntype Props = ComponentProps<typeof MyComponent>;\n```\n\n### `ComponentSlots<T>`\n\nExtracts the slots type of a component.\n\n```typescript\nimport type { ComponentSlots } from 'vue-component-type-helpers';\nimport MyComponent from './MyComponent.vue';\n\ntype Slots = ComponentSlots<typeof MyComponent>;\n```\n\n### `ComponentAttrs<T>`\n\nExtracts the attrs type of a component.\n\n```typescript\nimport type { ComponentAttrs } from 'vue-component-type-helpers';\nimport MyComponent from './MyComponent.vue';\n\ntype Attrs = ComponentAttrs<typeof MyComponent>;\n```\n\n### `ComponentEmit<T>`\n\nExtracts the emit function type of a component.\n\n```typescript\nimport type { ComponentEmit } from 'vue-component-type-helpers';\nimport MyComponent from './MyComponent.vue';\n\ntype Emit = ComponentEmit<typeof MyComponent>;\n```\n\n### `ComponentExposed<T>`\n\nExtracts the instance type exposed via `defineExpose`.\n\n```typescript\nimport type { ComponentExposed } from 'vue-component-type-helpers';\nimport MyComponent from './MyComponent.vue';\n\ntype Exposed = ComponentExposed<typeof MyComponent>;\n```\n\n## Example\n\nGiven the following component:\n\n```vue\n<!-- MyComponent.vue -->\n<script setup lang=\"ts\">\ndefineProps<{\n  title: string;\n  count?: number;\n}>();\n\ndefineEmits<{\n  update: [value: string];\n  close: [];\n}>();\n\ndefineSlots<{\n  default(props: { item: string }): any;\n  header(): any;\n}>();\n\nconst internalState = ref(0);\ndefineExpose({\n  reset: () => { internalState.value = 0; },\n});\n</script>\n```\n\nUsing type helpers:\n\n```typescript\nimport type { ComponentProps, ComponentSlots, ComponentEmit, ComponentExposed } from 'vue-component-type-helpers';\nimport MyComponent from './MyComponent.vue';\n\ntype Props = ComponentProps<typeof MyComponent>;\n// { title: string; count?: number }\n\ntype Slots = ComponentSlots<typeof MyComponent>;\n// { default(props: { item: string }): any; header(): any }\n\ntype Emit = ComponentEmit<typeof MyComponent>;\n// { (e: 'update', value: string): void; (e: 'close'): void }\n\ntype Exposed = ComponentExposed<typeof MyComponent>;\n// { reset: () => void }\n```\n\n## License\n\n[MIT](https://github.com/vuejs/language-tools/blob/master/LICENSE) License\n","publish_time":1682516010540,"maintainers":[{"name":"johnsoncodehk","email":"johnsoncodehk@gmail.com"}],"_cnpm_publish_time":1682516010540,"dist-tags":{"latest":"3.3.13","v3.0":"3.0.11"}}