Add vue/vue.d.ts,vue/vue-tests.ts

This commit is contained in:
odangosan
2014-12-21 13:39:32 +09:00
parent 682b016021
commit 16cb05c0f6
4 changed files with 172 additions and 0 deletions

29
vue/vue-tests.ts Normal file
View File

@@ -0,0 +1,29 @@
/// <reference path="vue.d.ts" />
module myapp {
"use strict";
export class Application extends Vue {
constructor() {
super();
Vue.config.debug = true;
this._init({
// data is necessary to always write in init()
data: {
text: "hello world."
// },
// methods : {
// action : this.action
/* same as unser */
}
});
this.methods = {
action: this.action
}
}
action(): void {
console.log("action");
}
}
}
var app = new myapp.Application();
app.$mount("#main");

View File

@@ -0,0 +1 @@
--noImplicitAny

141
vue/vue.d.ts vendored Normal file
View File

@@ -0,0 +1,141 @@
// Type definitions for vuejs 0.11.0
// Project: https://github.com/yyx990803/vue
// Definitions by: odangosan https://github.com/odangosan
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module vue {
export class Vue {
/**
* The Vue Constructor
* http://vuejs.org/api/index.html
*/
constructor(options?: {});
/**
* Options
* http://vuejs.org/api/options.html
*/
// still...
/**
* Instance Properties
* http://vuejs.org/api/instance-properties.html
*/
$el: HTMLElement;
$data: Object;
$options: Object;
$parent: Vue;
$root: Vue;
$: Object;
$$: Object;
/**
* Instance Methods
* http://vuejs.org/api/instance-methods.html
*/
/**
* Data
*/
$watch(expression: string, callback: ValueCallback, deep?: boolean, immediate?: boolean): void;
$get(expression: string): any;
$set(keypath: string, value: any): void;
$add(keypath: string, value: any): void;
$delete(keypath: string): void;
$eval(expression: string): any;
$interpolate(templateString: string): string;
$log(keypath?: string): void;
/**
* Events
*/
$dispatch(event: string, ...args: any[]): Vue;
$broadcast(event: string, ...args: any[]): Vue;
$emit(event: string, ...args: any[]): Vue;
$on(event: string, callback: Function): Vue;
$once(event: string, callback: Function): Vue;
$off(event?: string, callback?: Function): Vue;
/**
* DOM
*/
$appendTo(element: any, callback?: Function): Vue;// element or selector
$prependTo(element: any, callback?: Function): Vue;// element or selector
$before(element: any, callback?: Function): Vue;// element or selector
$after(element: any, callback?: Function): Vue;// element or selector
$remove(callback?: Function): Vue;
/**
* Lifecycle
*/
$mount(element?: any): Vue;// element or selector
$destroy(remove?: boolean): void;
$compile(element: HTMLElement): VueCallback;// returns a decompile function
$addChild(options?: Object, constructor?: Function): Vue;
/**
* Global Api
* http://vuejs.org/api/global-api.html
*/
static config: VueConfig;
static extend(options: {}): Vue;
static directive(id: string, definition?: Object): void;
static directive(id: string, definition?: VueCallback): void;
static filter(id: string, definition?: VueCallback): void;
static component(id: string, definition: Vue): void;
static component(id: string, definition?: Object): void;
static transition(id: string, definition?: Object): void;
static partial(id: string, definition?: string): void;
static partial(id: string, definition?: HTMLElement): void;
static nextTick(callback: VueCallback): void;
static require(module: string): void;
static use(plugin: Object, ...args: any[]): Vue;
static use(plugin: VueCallback, ...args: any[]): Vue;
/**
* exports members.
*/
_init(options: {}): void;
_cleanup(): void;
// static require(module:string) : void;
el: string;
data: {};
ready: VueCallback;
beforeCompile: VueCallback;
compiled: VueCallback;
created: VueCallback;
attached: VueCallback;
detached: VueCallback;
beforeDestroy: VueCallback;
destroyed: VueCallback;
directives: {};
filters: {};
partials: {};
transitions: {};
components: {};
watch: {};
events: {};
methods: {};
computed: {};
}
class VueConfig {
prefix: string;
debug: boolean;
silent: boolean;
proto: boolean;
interpolate: boolean;
async: boolean;
delimiters: string[];
}
interface ValueCallback {
(newValue: {}, oldValue: {}): void;
}
interface VueCallback {
(): void;
}
}
import Vue = vue.Vue;

1
vue/vue.d.ts.tscparams Normal file
View File

@@ -0,0 +1 @@
--noImplicitAny