Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
export interface PropOption {
type?: { (...args: any[]): any; };
required?: boolean;
default?: any;
twoWay?: boolean;
validator?: (value: any) => boolean;
coerce?: (value: any) => any;
}

export interface WatchOption {
handler(val: any, oldVal: any): void;
deep?: boolean;
immidiate?: boolean;
}

export interface DirectiveOption {
bind?(): any;
update?(newVal?: any, oldVal?: any): any;
unbind?(): any;
params?: string[];
deep?: boolean;
twoWay?: boolean;
acceptStatement?: boolean;
priority?: boolean;
[key: string]: any;
}

export interface FilterOption {
read?: Function;
write?: Function;
}

export interface TransitionOption {
css?: boolean;
beforeEnter?(el: HTMLElement): void;
enter?(el: HTMLElement, done?: () => void): void;
afterEnter?(el: HTMLElement): void;
enterCancelled?(el: HTMLElement): void;
beforeLeave?(el: HTMLElement): void;
leave?(el: HTMLElement, done?: () => void): void;
afterLeave?(el: HTMLElement): void;
leaveCancelled?(el: HTMLElement): void;
stagger?(index: number): number;
}

export interface ComponentOption {
props?: string[] | { [key: string]: (PropOption | { new (...args: any[]): any; }) };
watch?: { [key: string]: ((val: any, oldVal: any) => void) | string | WatchOption };
template?: string;
directives?: { [key: string]: (DirectiveOption | Function) };
elementDirectives?: { [key: string]: (DirectiveOption | Function) };
filters?: { [key: string]: (Function | FilterOption) };
components?: { [key: string]: any };
transitions?: { [key: string]: TransitionOption };
partials?: { [key: string]: string };
parent?: any;
events?: { [key: string]: ((...args: any[]) => (boolean | void)) | string };
mixins?: ComponentOption[];
name?: string;
[key: string]: any;
}

declare var decorator: (options: ComponentOption) => ClassDecorator;

export default decorator;
6 changes: 5 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Object.defineProperty(exports, '__esModule', {
value: true
})

var Vue = require('vue')

var internalHooks = [
Expand Down Expand Up @@ -60,4 +64,4 @@ function decorator (options) {
}
}

module.exports = decorator
exports.default = decorator
25 changes: 25 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"isolatedModules": false,
"jsx": "react",
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"declaration": true,
"noImplicitAny": true,
"removeComments": true,
"noLib": false,
"preserveConstEnums": true,
"suppressImplicitAnyIndexErrors": true
},
"exclude": [
"node_modules"
],
"compileOnSave": false,
"buildOnSave": false,
"atom": {
"rewriteTsconfig": false
}
}