{"id":19304097,"url":"https://github.com/foolishchow/vue-typescript-util","last_synced_at":"2026-04-18T03:32:22.741Z","repository":{"id":126856658,"uuid":"136428404","full_name":"foolishchow/vue-typescript-util","owner":"foolishchow","description":null,"archived":false,"fork":false,"pushed_at":"2018-07-04T02:14:31.000Z","size":56,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-27T17:41:41.416Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/foolishchow.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-06-07T05:54:02.000Z","updated_at":"2018-06-27T12:46:19.000Z","dependencies_parsed_at":"2023-06-30T07:46:33.119Z","dependency_job_id":null,"html_url":"https://github.com/foolishchow/vue-typescript-util","commit_stats":{"total_commits":20,"total_committers":2,"mean_commits":10.0,"dds":"0.050000000000000044","last_synced_commit":"7327f63d94529ce4c2cbd8fa08112e0da7875181"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/foolishchow/vue-typescript-util","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foolishchow%2Fvue-typescript-util","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foolishchow%2Fvue-typescript-util/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foolishchow%2Fvue-typescript-util/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foolishchow%2Fvue-typescript-util/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/foolishchow","download_url":"https://codeload.github.com/foolishchow/vue-typescript-util/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foolishchow%2Fvue-typescript-util/sbom","scorecard":{"id":406455,"data":{"date":"2025-08-11","repo":{"name":"github.com/foolishchow/vue-typescript-util","commit":"7327f63d94529ce4c2cbd8fa08112e0da7875181"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.7,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/19 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 3 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"24 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-cwfw-4gq5-mrqx","Warn: Project is vulnerable to: GHSA-g95f-p29q-9xw4","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-c6rq-rjc2-86v2","Warn: Project is vulnerable to: GHSA-8r6j-v8pm-fqw3","Warn: Project is vulnerable to: MAL-2023-462","Warn: Project is vulnerable to: GHSA-qqgx-2p2h-9c37","Warn: Project is vulnerable to: GHSA-6c8f-qphg-qjgp","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-3jfq-g458-7qm9","Warn: Project is vulnerable to: GHSA-r628-mhmh-qjhw","Warn: Project is vulnerable to: GHSA-9r2w-394v-53qc","Warn: Project is vulnerable to: GHSA-5955-9wpr-37jh","Warn: Project is vulnerable to: GHSA-qq89-hq3f-393p","Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36","Warn: Project is vulnerable to: GHSA-5j4c-8p2g-v4jx"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-18T21:24:17.672Z","repository_id":126856658,"created_at":"2025-08-18T21:24:17.672Z","updated_at":"2025-08-18T21:24:17.672Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31955712,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T00:39:45.007Z","status":"online","status_checked_at":"2026-04-18T02:00:07.018Z","response_time":103,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T23:28:40.593Z","updated_at":"2026-04-18T03:32:22.724Z","avatar_url":"https://github.com/foolishchow.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# vue-typescript-util\n\n\u003cp\u003e\n    \u003ca href=\"https://www.npmjs.com/package/vue-typescript-util\"\u003e\n        \u003cimg src=\"https://img.shields.io/npm/v/vue-typescript-util.svg\" alt=\"Version\"\u003e\n    \u003c/a\u003e \n    \u003ca href=\"https://www.npmjs.com/package/vue-typescript-util\"\u003e\n        \u003cimg src=\"https://img.shields.io/npm/dm/vue-typescript-util.svg\" alt=\"Downloads\"\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n\u003e write vue with type check   \nthis module only work with `/.tsx?/` file \n\n## important \nto make `VueComponent` active.     \nyou have to create a `jsx.d.ts` file in project root like [this](https://github.com/foolishchow/vue-typescript/blob/master/jsx.d.ts)\n\nyou may need this =\u003e [how it worked](https://github.com/foolishchow/vue-typescript)  and [preview](http://htmlpreview.github.io/?https://github.com/foolishchow/vue-typescript/blob/preview/dist/index.html)\n\n### exposed\n  - vue\n    - VueComponent\n  - vuex\n    - MakeVuexModule\n    - BindToRootMutation\n    - BindToRootActions\n    - InjectStore \n\n\n### usage \n\n\u003e see folder `demo`\n\n- `VueComponent\u003cProps={}, store extends Store\u003cany\u003e = Store\u003cany\u003e\u003e`   \n  with `vue-class-component` you can use type checking \n  ```typescript\n  import Component from \"vue-class-component\";\n  import { Prop } from \"vue-property-decorator\"\n  import { VueComponent } from \"vue-typescript-util\";\n  import { CreateElement } from \"vue\";\n\n  export type MyComponentPropsType = {\n    name:string;\n    title?:string;\n  }\n  //define a component MyComponent\n  @Component\n  export class MyComponent extends VueComponent\u003cMyComponentPropsType\u003e{\n    @Prop()\n    name:string;\n    @Prop()\n    title:string;\n    render(h: CreateElement){\n\n    }\n  }\n  //use MyComponent in MyComponent1\n  @Component\n  export class MyComponent1 extends VueComponent{\n    render(h: CreateElement){\n      // type ckeck error \n      return \u003cMyComponent\u003e\u003c/MyComponent\u003e\n    }\n  }\n  ```\n\n#### about `vuex`\n\n- define vuex module State\n\n  ```typescript\n  export type EventState = {\n    name: string;\n  }\n  const state = {\n    name: ''\n  }\n  // declartion migration globalState\n  declare module \"../..\" {\n    interface AppStoreStates {\n      event: EventState\n    }\n  }\n  ```\n\n- define vuex module getters\n  ```typescript\n  type EventGetters = {\n    // name : return type\n    nameLength: number;\n  }\n  const getters: GetterModule\u003cEventGetters, EventState\u003e = {\n    nameLength(state) {\n      return state.name.length;\n    }\n  }\n  //AppStoreGetters globalGetters type\n  declare module \"../..\" {\n    // common module\n    interface AppStoreGetters extends EventGetters { }\n    // namespaced module\n    interface AppStoreGetters {\n      event:EventGetters\n    }\n  }\n  ```\n\n- define vuex mutations\n\n  ```typescript\n  type EventMutations = {\n    setName: string\n  }\n  const mutations: MutationModule\u003cEventMutations, EventState\u003e = {\n    setName(state, payload) {\n      state.name = payload;\n    }\n  }\n  // AppStoreMutations global mutation type\n  declare module \"../..\" {\n    interface AppStoreMutations {\n      // EventModule result of MakeVuexModule\n      event: typeof EventModule.mutations\n    }\n  }\n  ```\n\n - define vuex Actions\n    ```typescript\n      type EventActions = {\n        clearName: boolean\n      }\n\n      const actions: ActionModule\u003cEventActions, EventState, EventGetters\u003e = {\n        clearName(context, payload) {\n          if (payload) {\n            // commit from root\n            context.commit(StoreMutations.event.setName, '', { root: true })\n          } else {\n            // commit from module\n            context.commit(ModuleMutations.setName, '')\n            console.info(`commit from module`)\n          }\n        }\n      }\n      declare module \"../..\" {\n        interface AppStoreActions {\n          // EventModule result of MakeVuexModule\n          event: typeof EventModule.actions\n        }\n      }\n    ```\n- define vuex module   \n  `MakeVuexModule(moduleTree:_moduleTree,moduleName: string,namespace: boolean = false)`   \n  ```typescript\n  const moduleInstance = {\n    state,\n    getters,\n    mutations,\n    actions\n  }\n  // no namespaced\n  const EventModule = MakeVuexModule(moduleInstance, 'event',false);\n  const ModuleMutations = EventModule.moduleMutations;\n  // wrap of BindToRootActions\n  registeActions(EventModule.actions, 'event');\n  // wrap of BindToRootMutation\n  registeMutations(EventModule.mutations, 'event')\n  export default EventModule.module;//this is vuex module\n  ```\n\n- global store   \n  type define global Store \n  ```typescript\n  export interface AppStoreStates { }\n  export interface AppStoreGetters { }\n  export interface AppStoreActions { }\n  export interface AppStoreMutations { }\n  export interface AppStore extends InjectStore\u003cAppStoreStates, AppStoreGetters\u003e { }\n  ```\n  define global Actions and Mutaions , then we can use declaration migration to enhance them;   \n  ```typescript\n  export const StoreActions: AppStoreActions = {} as any;\n  export const StoreMutations: AppStoreMutations = {} as any;\n  //wrap of Bindings to StoreActions/StoreMutations\n  export function registeActions\u003cActions = any\u003e(actions: ActionNames\u003cActions\u003e, namespace: string) {\n    BindToRootActions(actions, namespace, StoreActions)\n  }\n  export function registeMutations\u003cMutations = any\u003e(mutations: MutationNames\u003cMutations\u003e, namespace: string) {\n    BindToRootMutation(mutations, namespace, StoreMutations);\n  }\n  ```\n  \n  type define utils of GetterModule,MutationModule,ActionModule\n  ```typescript\n  export type GetterModule\u003cTypedef, State\u003e = AbstractGetterModule\u003cTypedef, State, AppStoreStates, AppStoreGetters\u003e;\n  export type MutationModule\u003cTypedef, State\u003e = AbstractMutationModule\u003cTypedef, State\u003e;\n  export type ActionModule\u003cTypedef, State, Getters\u003e = AbstractActionModule\u003cTypedef, State, Getters, AppStoreStates, AppStoreGetters\u003e;\n  ```\n  define vuex store and InjectIt\n  ```typescript\n  import dom from './modules/dom';\n  import event from './modules/event';\n\n  const store: AppStore = new Vuex.Store({\n    modules: {\n      dom,\n      event\n    }\n  }) as any;\n  InjectStore(store);\n  // after \n  //you can use store.Commit with StoreMutations\n  //you can use store.Dispatch with StoreMutations\n  export { store }\n\n  // define a class Injected AppStore\n  export interface PageComponent\u003cProps = {}\u003e extends VueComponent\u003cProps, AppStore\u003e { }\n  export class PageComponent\u003cProps = {}\u003e extends VueComponent\u003cProps, AppStore\u003e{ }\n  ```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffoolishchow%2Fvue-typescript-util","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffoolishchow%2Fvue-typescript-util","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffoolishchow%2Fvue-typescript-util/lists"}