{"name":"vue-component-type-helpers","version":"1.3.14-patch.1","license":"MIT","_id":"vue-component-type-helpers@1.3.14-patch.1","homepage":"https://github.com/vuejs/language-tools#readme","bugs":{"url":"https://github.com/vuejs/language-tools/issues"},"dist":{"shasum":"c263aa61f6855826b2989ea4346afecef0f3209b","tarball":"http://registry-npm.ywwl.com/vue-component-type-helpers/download/vue-component-type-helpers-1.3.14-patch.1.tgz","fileCount":3,"integrity":"sha512-v+03MWlsDYdXse6psH8Ch13d0RDJN1htPcwfK631W7y4fUpcMezzPruCW9+4kH92QGFiXvmyUSiNB6TDwZoNZg==","signatures":[{"sig":"MEUCIHSIHJkcI/9DpDDty/D7CIVJlZilPC7x96iIM6jUtz5GAiEA+CYA7JfRs0wC51BSmwQlh4AX62aBrINBp7V0yiDJEq0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2260,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkMw6+ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqheBAAkO3wNG7WF4+fJKHpRxVHY/kcBzBj+AeOypMd/KnMGMUbc4Co\r\nhG3NG/ea3MSDUN7jDDMjm20qMMwyiSnVrphpo907VP68S5ZI9vR6B8f+QltU\r\nnIPsf/vxUpidLiy1UunezuJ2fEJ2s4hM0MO3IIAbSwFfIvN3UHWNQuhlR4nf\r\np8ILg2GZwrL3UYLfdRT290xevV5/Phgcm3vnLQdh2ECI5gDOfJJAjR+MDP2W\r\nOVRPef1KYbFII4SHpnt6XMtpxqDJyiykr6vfGXc1CNPWdgfrPR0l98uEIxOw\r\nwScG5pI7qtdGYoflVrdz/4t/g2+UB68pz4Kwr+oGGzC13kK36kS4S3Rm5Guk\r\nFbj2gYn32DqI6f9UGzJAtKoMHcW+zoMrI/aHBPIS3XI35ObRNg/rsJ0GJYgl\r\neEwIDGGfjTDaejXHdpIwMXilW20tiWeijLk2ejZ8JS1io2+U+DDwP3tVZT5Y\r\nJys76Jo+ogItn9MxhvtrW35nhL/SxDR6TcnHgf7qekrxo3m5+tVeWAIXw+rG\r\nJ4zJ1B5SuHd5Yq3nWuwMemPrAaAxJL/Y67t4m6NoOeJoyQvgjrY98E3rYDH4\r\nFz/UrOIP1OGqJ2Grgj40lp1+iCZkHAT3bqcG0EEcAsvvJsEoVKGNJ4Uem8cA\r\ndN5zO/Q6eYRxo8NyA4TS/qENJ34txH2+dZs=\r\n=3KIm\r\n-----END PGP SIGNATURE-----\r\n","size":1175,"noattachment":false,"key":"/vue-component-type-helpers/-/vue-component-type-helpers-1.3.14-patch.1.tgz"},"types":"./index.d.ts","gitHead":"f1afe50e64deaeee65ba6826c33afc6e8848bba5","_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":"8.19.3","directories":{},"_nodeVersion":"18.13.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/vue-component-type-helpers_1.3.14-patch.1_1681067709816_0.5068424405528726","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":1681067709977,"maintainers":[{"name":"johnsoncodehk","email":"johnsoncodehk@gmail.com"}],"_cnpm_publish_time":1681067709977,"dist-tags":{"latest":"3.3.13","v3.0":"3.0.11"}}