Browse Source

adapt index.d.ts for end users (#3582)

* adapt index.d.ts for end users

* fix extend return type
dev
wumingyang 8 years ago
committed by Evan You
parent
commit
4061c42748
  1. 2
      package.json
  2. 6
      types/index.d.ts
  3. 2
      types/test/options-test.ts
  4. 2
      types/test/plugin-test.ts
  5. 2
      types/test/vue-test.ts
  6. 2
      types/vue.d.ts

2
package.json

@ -3,7 +3,7 @@
"version": "2.0.0-rc.4", "version": "2.0.0-rc.4",
"description": "Reactive, component-oriented view layer for modern web interfaces.", "description": "Reactive, component-oriented view layer for modern web interfaces.",
"main": "dist/vue.common.js", "main": "dist/vue.common.js",
"typings": "index.d.ts", "typings": "types/index.d.ts",
"files": [ "files": [
"dist/vue.common.js", "dist/vue.common.js",
"dist/vue.js", "dist/vue.js",

6
types/index.d.ts

@ -1,2 +1,6 @@
import {Vue} from "./vue.d"; import {Vue as _Vue} from "./vue.d";
// `Vue` in `export = Vue` must be a namespace
declare namespace Vue {}
// TS cannot merge imported class with namespace, declare a subclass to bypass
declare class Vue extends _Vue {}
export = Vue; export = Vue;

2
types/test/options-test.ts

@ -1,4 +1,4 @@
import { Vue } from "../vue.d"; import Vue = require("../index.d");
import { ComponentOptions } from "../options.d"; import { ComponentOptions } from "../options.d";
interface Component extends Vue { interface Component extends Vue {

2
types/test/plugin-test.ts

@ -1,4 +1,4 @@
import { Vue } from "../vue.d"; import Vue = require("../index.d");
import { PluginFunction, PluginObject } from "../plugin.d"; import { PluginFunction, PluginObject } from "../plugin.d";
class Option { class Option {

2
types/test/vue-test.ts

@ -1,4 +1,4 @@
import { Vue } from "../vue.d"; import Vue = require("../index.d");
class Test extends Vue { class Test extends Vue {
testProperties() { testProperties() {

2
types/vue.d.ts

@ -53,7 +53,7 @@ export declare class Vue {
keyCodes: { [key: string]: number }; keyCodes: { [key: string]: number };
} }
static extend(options: ComponentOptions): Vue; static extend(options: ComponentOptions): typeof Vue;
static nextTick(callback: () => void, context?: any[]): void; static nextTick(callback: () => void, context?: any[]): void;
static set<T>(object: Object, key: string, value: T): T; static set<T>(object: Object, key: string, value: T): T;
static set<T>(array: T[], key: number, value: T): T; static set<T>(array: T[], key: number, value: T): T;

Loading…
Cancel
Save