##// END OF EJS Templates
Compatibility with dojo-typings package
cin -
r21:b1e622a3b266 default
parent child
Show More
@@ -1,10 +1,11
1 1 import declare = require("dojo/_base/declare");
2 2 import { each } from "@implab/core-amd/safe";
3 3 import { Constructor } from "@implab/core-amd/interfaces";
4 import dojo = require("dojo/_base/kernel");
4 5
5 6 // declare const declare: any;
6 7
7 type DeclareConstructor<T> = declare.DeclareConstructor<T>;
8 type DeclareConstructor<T> = dojo._base.DeclareConstructor<T>;
8 9
9 10 export interface AbstractConstructor<T = {}> {
10 11 prototype: T;
@@ -1,6 +1,7
1 1 import { Handle } from "dojo/interfaces";
2 2 import _WidgetBase = require("./_WidgetBase");
3 3 import declare = require("dojo/_base/declare");
4 import dojo = require("dojo/_base/html");
4 5
5 6 declare module "./_WidgetBase" {
6 7 interface _WidgetBase {
@@ -81,7 +82,7 interface _AttachMixin {
81 82 destroyRendering(preserveDom?: boolean): void;
82 83 }
83 84
84 interface _AttachMixinConstructor extends declare.DeclareConstructor<_AttachMixin> { }
85 interface _AttachMixinConstructor extends dojo._base.DeclareConstructor<_AttachMixin> { }
85 86
86 87 declare const _AttachMixin: _AttachMixinConstructor;
87 88 export = _AttachMixin;
@@ -1,138 +1,142
1 import dojo = require("./kernel");
2
1 3 declare module "./kernel" {
2 4 interface Dojo {
3 declare: declare.Declare;
5 declare: dojo._base.Declare;
4 6 safeMixin: typeof declare.safeMixin;
5 7 }
6 }
7
8 declare namespace declare {
9 interface DeclareCreatedObject {
10 declaredClass: string;
11
12 /**
13 * Calls a super method.
14 *
15 * This method is used inside method of classes produced with
16 * declare() to call a super method (next in the chain). It is
17 * used for manually controlled chaining. Consider using the regular
18 * chaining, because it is faster. Use "this.inherited()" only in
19 * complex cases.
20 *
21 * This method cannot me called from automatically chained
22 * constructors including the case of a special (legacy)
23 * constructor chaining. It cannot be called from chained methods.
24 *
25 * If "this.inherited()" cannot find the next-in-chain method, it
26 * does nothing and returns "undefined". The last method in chain
27 * can be a default method implemented in Object, which will be
28 * called last.
29 *
30 * If "name" is specified, it is assumed that the method that
31 * received "args" is the parent method for this call. It is looked
32 * up in the chain list and if it is found the next-in-chain method
33 * is called. If it is not found, the first-in-chain method is
34 * called.
35 *
36 * If "name" is not specified, it will be derived from the calling
37 * method (using a methoid property "nom").
38 */
39 inherited<U>(args: IArguments, newArgs?: any[]): U;
40 inherited(args: IArguments, newArgs?: true): Function | void;
41 inherited<U>(name: string, args: IArguments, newArgs?: any[]): U;
42 inherited(name: string, args: IArguments, newArgs?: true): Function | void;
43
44 /**
45 * Returns a super method.
46 *
47 * This method is a convenience method for "this.inherited()".
48 * It uses the same algorithm but instead of executing a super
49 * method, it returns it, or "undefined" if not found.
50 */
51 getInherited(args: IArguments): Function | void;
52 getInherited(name: string, args: IArguments): Function | void;
53
54 /**
55 * Checks the inheritance chain to see if it is inherited from this class.
56 *
57 * This method is used with instances of classes produced with
58 * declare() to determine of they support a certain interface or
59 * not. It models "instanceof" operator.
60 */
61 isInstanceOf(cls: any): boolean;
62 }
63 8
64 interface DeclareConstructor<T> {
65 new(...args: any[]): T & DeclareCreatedObject;
66 prototype: T;
9 namespace _base {
10 interface DeclareCreatedObject {
11 declaredClass: string;
12
13 /**
14 * Calls a super method.
15 *
16 * This method is used inside method of classes produced with
17 * declare() to call a super method (next in the chain). It is
18 * used for manually controlled chaining. Consider using the regular
19 * chaining, because it is faster. Use "this.inherited()" only in
20 * complex cases.
21 *
22 * This method cannot me called from automatically chained
23 * constructors including the case of a special (legacy)
24 * constructor chaining. It cannot be called from chained methods.
25 *
26 * If "this.inherited()" cannot find the next-in-chain method, it
27 * does nothing and returns "undefined". The last method in chain
28 * can be a default method implemented in Object, which will be
29 * called last.
30 *
31 * If "name" is specified, it is assumed that the method that
32 * received "args" is the parent method for this call. It is looked
33 * up in the chain list and if it is found the next-in-chain method
34 * is called. If it is not found, the first-in-chain method is
35 * called.
36 *
37 * If "name" is not specified, it will be derived from the calling
38 * method (using a methoid property "nom").
39 */
40 inherited<U>(args: IArguments, newArgs?: any[]): U;
41 inherited(args: IArguments, newArgs?: true): Function | void;
42 inherited<U>(name: string, args: IArguments, newArgs?: any[]): U;
43 inherited(name: string, args: IArguments, newArgs?: true): Function | void;
44
45 /**
46 * Returns a super method.
47 *
48 * This method is a convenience method for "this.inherited()".
49 * It uses the same algorithm but instead of executing a super
50 * method, it returns it, or "undefined" if not found.
51 */
52 getInherited(args: IArguments): Function | void;
53 getInherited(name: string, args: IArguments): Function | void;
54
55 /**
56 * Checks the inheritance chain to see if it is inherited from this class.
57 *
58 * This method is used with instances of classes produced with
59 * declare() to determine of they support a certain interface or
60 * not. It models "instanceof" operator.
61 */
62 isInstanceOf(cls: any): boolean;
63 }
64
65 interface DeclareConstructor<T> {
66 new(...args: any[]): T & DeclareCreatedObject;
67 prototype: T;
67 68
68 /**
69 * Adds all properties and methods of source to constructor's
70 * prototype, making them available to all instances created with
71 * constructor. This method is specific to constructors created with
72 * declare().
73 *
74 * Adds source properties to the constructor's prototype. It can
75 * override existing properties.
76 *
77 * This method is similar to dojo.extend function, but it is specific
78 * to constructors produced by declare(). It is implemented
79 * using dojo.safeMixin, and it skips a constructor property,
80 * and properly decorates copied functions.
81 */
82 extend<U>(source: U): DeclareConstructor<T & U>;
69 /**
70 * Adds all properties and methods of source to constructor's
71 * prototype, making them available to all instances created with
72 * constructor. This method is specific to constructors created with
73 * declare().
74 *
75 * Adds source properties to the constructor's prototype. It can
76 * override existing properties.
77 *
78 * This method is similar to dojo.extend function, but it is specific
79 * to constructors produced by declare(). It is implemented
80 * using dojo.safeMixin, and it skips a constructor property,
81 * and properly decorates copied functions.
82 */
83 extend<U>(source: U): DeclareConstructor<T & U>;
83 84
84 /**
85 * Create a subclass of the declared class from a list of base classes.
86 *
87 * Create a constructor using a compact notation for inheritance and
88 * prototype extension.
89 *
90 * Mixin ancestors provide a type of multiple inheritance.
91 * Prototypes of mixin ancestors are copied to the new class:
92 * changes to mixin prototypes will not affect classes to which
93 * they have been mixed in.
94 */
95 createSubclass<U, V, X>(mixins: [DeclareConstructor<U>, DeclareConstructor<V>], props: X): DeclareConstructor<T & U & V & X>;
96 createSubclass<U, V>(mixins: [DeclareConstructor<U>], props: V): DeclareConstructor<T & U & V>;
97 createSubclass<U, V>(mixins: DeclareConstructor<U>, props: V): DeclareConstructor<T & U & V>;
98 createSubclass<U>(mixins: [DeclareConstructor<U>]): DeclareConstructor<T & U>;
99 createSubclass<U>(mixins: DeclareConstructor<U>): DeclareConstructor<T & U>;
100 createSubclass<U>(mixins: any, props: U): DeclareConstructor<T & U>;
85 /**
86 * Create a subclass of the declared class from a list of base classes.
87 *
88 * Create a constructor using a compact notation for inheritance and
89 * prototype extension.
90 *
91 * Mixin ancestors provide a type of multiple inheritance.
92 * Prototypes of mixin ancestors are copied to the new class:
93 * changes to mixin prototypes will not affect classes to which
94 * they have been mixed in.
95 */
96 createSubclass<U, V, X>(mixins: [DeclareConstructor<U>, DeclareConstructor<V>], props: X): DeclareConstructor<T & U & V & X>;
97 createSubclass<U, V>(mixins: [DeclareConstructor<U>], props: V): DeclareConstructor<T & U & V>;
98 createSubclass<U, V>(mixins: DeclareConstructor<U>, props: V): DeclareConstructor<T & U & V>;
99 createSubclass<U>(mixins: [DeclareConstructor<U>]): DeclareConstructor<T & U>;
100 createSubclass<U>(mixins: DeclareConstructor<U>): DeclareConstructor<T & U>;
101 createSubclass<U>(mixins: any, props: U): DeclareConstructor<T & U>;
102 }
103
104 interface Declare {
105 <A, B, C, D>(superClass: [DeclareConstructor<A>, DeclareConstructor<B>, DeclareConstructor<C>, DeclareConstructor<D>]): DeclareConstructor<A & B & C & D>;
106 <A, B, C>(superClass: [DeclareConstructor<A>, DeclareConstructor<B>, DeclareConstructor<C>]): DeclareConstructor<A & B & C>;
107 <A, B>(superClass: [DeclareConstructor<A>, DeclareConstructor<B>]): DeclareConstructor<A & B>;
108 <A>(superClass: DeclareConstructor<A> | [DeclareConstructor<A>]): DeclareConstructor<A>;
109
110 <A, B, C, D, E>(superClass: [DeclareConstructor<A>, DeclareConstructor<B>, DeclareConstructor<C>, DeclareConstructor<D>], props: E): DeclareConstructor<A & B & C & D & E>;
111 <A, B, C, D>(superClass: [DeclareConstructor<A>, DeclareConstructor<B>, DeclareConstructor<C>], props: D): DeclareConstructor<A & B & C & D>;
112 <A, B, C>(superClass: [DeclareConstructor<A>, DeclareConstructor<B>], props: C): DeclareConstructor<A & B & C>;
113 <A, B>(superClass: DeclareConstructor<A> | [DeclareConstructor<A>], props: B): DeclareConstructor<A & B>;
114
115 <A, B, C, D>(className: string, superClass: [DeclareConstructor<A>, DeclareConstructor<B>, DeclareConstructor<C>, DeclareConstructor<D>]): DeclareConstructor<A & B & C & D>;
116 <A, B, C>(className: string, superClass: [DeclareConstructor<A>, DeclareConstructor<B>, DeclareConstructor<C>]): DeclareConstructor<A & B & C>;
117 <A, B>(className: string, superClass: [DeclareConstructor<A>, DeclareConstructor<B>]): DeclareConstructor<A & B>;
118 <A>(className: string, superClass: DeclareConstructor<A> | [DeclareConstructor<A>]): DeclareConstructor<A>;
119
120 <A, B, C, D, E>(className: string, superClass: [DeclareConstructor<A>, DeclareConstructor<B>, DeclareConstructor<C>, DeclareConstructor<D>], props: E): DeclareConstructor<A & B & C & D & E>;
121 <A, B, C, D>(className: string, superClass: [DeclareConstructor<A>, DeclareConstructor<B>, DeclareConstructor<C>], props: D): DeclareConstructor<A & B & C & D>;
122 <A, B, C>(className: string, superClass: [DeclareConstructor<A>, DeclareConstructor<B>], props: C): DeclareConstructor<A & B & C>;
123 <A, B>(className: string, superClass: DeclareConstructor<A> | [DeclareConstructor<A>], props: B): DeclareConstructor<A & B>;
124
125 <A>(className: string, superClass: any, props: A): DeclareConstructor<A>;
126 (className: string, superClass: any): DeclareConstructor<any>;
127 <A>(superClass: any, props: A): DeclareConstructor<A>;
128 (superClass: any): DeclareConstructor<any>;
129
130 /**
131 * Mix in properties skipping a constructor and decorating functions
132 * like it is done by declare().
133 */
134 safeMixin<A, B>(target: A, source: B): A & B;
135 }
101 136 }
102 137
103 interface Declare {
104 <A, B, C, D>(superClass: [DeclareConstructor<A>, DeclareConstructor<B>, DeclareConstructor<C>, DeclareConstructor<D>]): DeclareConstructor<A & B & C & D>;
105 <A, B, C>(superClass: [DeclareConstructor<A>, DeclareConstructor<B>, DeclareConstructor<C>]): DeclareConstructor<A & B & C>;
106 <A, B>(superClass: [DeclareConstructor<A>, DeclareConstructor<B>]): DeclareConstructor<A & B>;
107 <A>(superClass: DeclareConstructor<A> | [DeclareConstructor<A>]): DeclareConstructor<A>;
108
109 <A, B, C, D, E>(superClass: [DeclareConstructor<A>, DeclareConstructor<B>, DeclareConstructor<C>, DeclareConstructor<D>], props: E): DeclareConstructor<A & B & C & D & E>;
110 <A, B, C, D>(superClass: [DeclareConstructor<A>, DeclareConstructor<B>, DeclareConstructor<C>], props: D): DeclareConstructor<A & B & C & D>;
111 <A, B, C>(superClass: [DeclareConstructor<A>, DeclareConstructor<B>], props: C): DeclareConstructor<A & B & C>;
112 <A, B>(superClass: DeclareConstructor<A> | [DeclareConstructor<A>], props: B): DeclareConstructor<A & B>;
113
114 <A, B, C, D>(className: string, superClass: [DeclareConstructor<A>, DeclareConstructor<B>, DeclareConstructor<C>, DeclareConstructor<D>]): DeclareConstructor<A & B & C & D>;
115 <A, B, C>(className: string, superClass: [DeclareConstructor<A>, DeclareConstructor<B>, DeclareConstructor<C>]): DeclareConstructor<A & B & C>;
116 <A, B>(className: string, superClass: [DeclareConstructor<A>, DeclareConstructor<B>]): DeclareConstructor<A & B>;
117 <A>(className: string, superClass: DeclareConstructor<A> | [DeclareConstructor<A>]): DeclareConstructor<A>;
118
119 <A, B, C, D, E>(className: string, superClass: [DeclareConstructor<A>, DeclareConstructor<B>, DeclareConstructor<C>, DeclareConstructor<D>], props: E): DeclareConstructor<A & B & C & D & E>;
120 <A, B, C, D>(className: string, superClass: [DeclareConstructor<A>, DeclareConstructor<B>, DeclareConstructor<C>], props: D): DeclareConstructor<A & B & C & D>;
121 <A, B, C>(className: string, superClass: [DeclareConstructor<A>, DeclareConstructor<B>], props: C): DeclareConstructor<A & B & C>;
122 <A, B>(className: string, superClass: DeclareConstructor<A> | [DeclareConstructor<A>], props: B): DeclareConstructor<A & B>;
123
124 <A>(className: string, superClass: any, props: A): DeclareConstructor<A>;
125 (className: string, superClass: any): DeclareConstructor<any>;
126 <A>(superClass: any, props: A): DeclareConstructor<A>;
127 (superClass: any): DeclareConstructor<any>;
128
129 /**
130 * Mix in properties skipping a constructor and decorating functions
131 * like it is done by declare().
132 */
133 safeMixin<A, B>(target: A, source: B): A & B;
134 }
135 138 }
136 139
137 declare const declare: declare.Declare;
140
141 declare const declare: dojo._base.Declare;
138 142 export = declare;
General Comments 0
You need to be logged in to leave comments. Login now