mirror of
				https://github.com/KevinMidboe/vue-js-modal.git
				synced 2025-10-29 18:00:20 +00:00 
			
		
		
		
	Add type definitions
This commit is contained in:
		
							
								
								
									
										21
									
								
								types/index.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								types/index.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,21 @@ | ||||
| import Vue, { PluginObject } from "vue"; | ||||
|  | ||||
| declare const VueJSModal: PluginObject<VueJSModalOptions>; | ||||
| export default VueJSModal; | ||||
|  | ||||
| export declare interface VueJSModalOptions { | ||||
|   componentName?: string; | ||||
|   dialog?: boolean; | ||||
| } | ||||
|  | ||||
| declare interface VModal { | ||||
|   show(name: string, params?: object): void; | ||||
|   hide(name: string, params?: object): void; | ||||
|   toggle(name: string, params?: object): void; | ||||
| } | ||||
|  | ||||
| declare module "vue/types/vue" { | ||||
|   interface Vue { | ||||
|     $modal: VModal; | ||||
|   } | ||||
| } | ||||
							
								
								
									
										16
									
								
								types/test/index.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								types/test/index.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,16 @@ | ||||
| import Vue from "vue"; | ||||
| import VueJSModal, { VueJSModalOptions } from "../index"; | ||||
|  | ||||
| Vue.use(VueJSModal); | ||||
| Vue.use<VueJSModalOptions>(VueJSModal, { | ||||
|   componentName: "another-modal-name", | ||||
|   dialog: false | ||||
| }); | ||||
|  | ||||
| const vm = new Vue({ | ||||
|   template: `<vue-modal name="awesome-modal"></vue-modal>` | ||||
| }).$mount("#app"); | ||||
|  | ||||
| vm.$modal.show("awesome-modal"); | ||||
| vm.$modal.hide("awesome-modal", { customeEvent: "customEventParam" }); | ||||
| vm.$modal.toggle("awesome-modal"); | ||||
							
								
								
									
										13
									
								
								types/test/tsconfig.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								types/test/tsconfig.json
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,13 @@ | ||||
| { | ||||
|   "compilerOptions": { | ||||
|     "target": "es5", | ||||
|     "module": "es2015", | ||||
|     "moduleResolution": "node", | ||||
|     "strict": true, | ||||
|     "noEmit": true | ||||
|   }, | ||||
|   "include": [ | ||||
|     "*.ts", | ||||
|     "../index.d.ts" | ||||
|   ] | ||||
| } | ||||
		Reference in New Issue
	
	Block a user