Skip to content
This repository was archived by the owner on Jul 25, 2020. It is now read-only.

Commit 7f28e29

Browse files
committed
Updated for TypeScript 1.6.
1 parent b593e54 commit 7f28e29

File tree

8 files changed

+162
-108
lines changed

8 files changed

+162
-108
lines changed

Manual.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,7 @@ to use dojo/store, you must add another reference:
169169
III. TypeScript setup
170170
---------------------
171171

172-
You MUST be using TypeScript version 1.5 or higher (with generics
173-
support and union type support).
172+
You MUST be using TypeScript version 1.6 or higher.
174173

175174
When using the command line compiler, use the `--module amd` flag
176175
since Dojo works with AMD-style modules.

dijit.form.d.ts

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@
44

55
/// <reference path="dijit.d.ts"/>
66

7-
declare module dijit {
8-
module form {
9-
interface _FormMixin extends Dijit._Mixin {
7+
declare module dijit
8+
{
9+
module form
10+
{
11+
interface _FormMixin extends Dijit._Mixin
12+
{
1013
//state: string;
1114

1215
get(name: "state"): string;
@@ -23,7 +26,8 @@ declare module dijit {
2326
validate(): void;
2427
}
2528

26-
interface _FormWidgetMixin extends Dijit._Mixin {
29+
interface _FormWidgetMixin extends Dijit._Mixin
30+
{
2731
//alt: string;
2832
//"aria-label": string
2933

@@ -66,7 +70,8 @@ declare module dijit {
6670
focus(): void;
6771
}
6872

69-
interface _FormValueMixin extends _FormWidgetMixin {
73+
interface _FormValueMixin extends _FormWidgetMixin
74+
{
7075
//readOnly: boolean;
7176

7277
get(name: "readOnly"): boolean;
@@ -112,7 +117,8 @@ declare module dijit {
112117
watch(prop: string, callback: Dojo.WatchCallback<any>): Dojo.WatchHandle;
113118
}
114119

115-
class _FormWidget extends _Widget implements _TemplatedMixin, _CssStateMixin, _FormWidgetMixin {
120+
class _FormWidget extends _Widget implements _TemplatedMixin, _CssStateMixin, _FormWidgetMixin
121+
{
116122
// dijit/_Widget
117123
get(name: "baseClass"): string;
118124
get(name: "class"): string;
@@ -233,7 +239,8 @@ declare module dijit {
233239
watch(prop: string, callback: Dojo.WatchCallback<any>): Dojo.WatchHandle;
234240
}
235241

236-
class _FormValueWidget extends _FormWidget implements _FormValueMixin {
242+
class _FormValueWidget extends _FormWidget implements _FormValueMixin
243+
{
237244
// dijit/form/_FormWidget
238245
get(name: "baseClass"): string;
239246
get(name: "class"): string;

dijit.form.select.d.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,20 @@
77
/// <reference path="dijit.form.d.ts"/>
88
/// <reference path="dojo.store.d.ts"/>
99

10-
declare module dijit {
11-
module form {
12-
interface _SelectOption {
10+
declare module dijit
11+
{
12+
module form
13+
{
14+
interface _SelectOption
15+
{
1316
label: string;
1417
value?: string;
1518
disabled?: boolean;
1619
selected?: boolean;
1720
}
1821

19-
class _FormSelectWidget extends _FormValueWidget {
22+
class _FormSelectWidget extends _FormValueWidget
23+
{
2024
// dijit/form/_FormValueWidget
2125
get(name: "baseClass"): string;
2226
get(name: "class"): string;
@@ -209,7 +213,8 @@ declare module dijit {
209213
on(type: Dojo.ExtensionEvent, func: Dojo.Action): Dojo.RemovableHandle;
210214
}
211215

212-
class Select extends _FormSelectWidget implements _HasDropDown, _KeyNavMixin {
216+
class Select extends _FormSelectWidget implements _HasDropDown, _KeyNavMixin
217+
{
213218
// dijit/form/_FormSelectWidget
214219
get(name: "baseClass"): string;
215220
get(name: "class"): string;

dijit.menu.d.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@
44

55
/// <reference path="dijit.d.ts"/>
66

7-
declare module dijit {
7+
declare module dijit
8+
{
89
// dijit/MenuBase
910

10-
class MenuBase extends _Widget implements _TemplatedMixin, _KeyNavContainer, _CssStateMixin {
11+
class MenuBase extends _Widget implements _TemplatedMixin, _KeyNavContainer, _CssStateMixin
12+
{
1113
// dijit/_Widget
1214
get(name: "baseClass"): string;
1315
get(name: "class"): string;
@@ -156,7 +158,8 @@ declare module dijit {
156158

157159
// dijit/DropDownMenu
158160

159-
class DropDownMenu extends MenuBase {
161+
class DropDownMenu extends MenuBase
162+
{
160163
// MenuBase
161164
get(name: "baseClass"): string;
162165
get(name: "class"): string;
@@ -259,7 +262,8 @@ declare module dijit {
259262

260263
// dijit/Menu
261264

262-
class Menu extends DropDownMenu {
265+
class Menu extends DropDownMenu
266+
{
263267
// DropDownMenu
264268
get(name: "baseClass"): string;
265269
get(name: "class"): string;
@@ -397,7 +401,8 @@ declare module dijit {
397401

398402
// dijit/MenuItem
399403

400-
class MenuItem extends _Widget implements _TemplatedMixin, _Container, _CssStateMixin {
404+
class MenuItem extends _Widget implements _TemplatedMixin, _Container, _CssStateMixin
405+
{
401406
// dijit/_Widget
402407
get(name: "baseClass"): string;
403408
get(name: "class"): string;
@@ -516,7 +521,8 @@ declare module dijit {
516521

517522
// dijit/MenuSeparator
518523

519-
class MenuSeparator extends _WidgetBase implements _TemplatedMixin, _Contained {
524+
class MenuSeparator extends _WidgetBase implements _TemplatedMixin, _Contained
525+
{
520526
// dijit/_WidgetBase
521527
get(name: "baseClass"): string;
522528
get(name: "class"): string;

dojo.d.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ declare module Dojo
338338
hitch<F extends Function>(scope: Object, method: string | F): F;
339339
mixin<T extends Object>(dest: T, ...sources: PropertiesMap[]): T;
340340
partial<F extends Function>(method: string | F, ...v_args: any[]): F;
341-
replace(tmpl: string, map: string[]| Dictionary<any> | ((matched: string, key: string, offset: number, template: string) => string), pattern?: string): string;
341+
replace(tmpl: string, map: string[] | Dictionary<any> | ((matched: string, key: string, offset: number, template: string) => string), pattern?: string): string;
342342
setObject(path: string, value: any, thisObject?: Object): Object;
343343
trim(str: string): string;
344344

@@ -1128,7 +1128,7 @@ declare module Dojo
11281128
interface IOQuery
11291129
{
11301130
objectToQuery(map: Dojo.Dictionary<any>): string;
1131-
queryToObject(str: string): Dojo.Dictionary<any>;
1131+
queryToObject(str: string): Dojo.Dictionary<string>;
11321132
}
11331133
}
11341134
declare module "dojo/io-query"
@@ -1220,7 +1220,7 @@ declare module Dojo
12201220
interface Json
12211221
{
12221222
parse(str: string, secured?: boolean): any;
1223-
stringify(obj: any, replacer?: any[]| ((key: string, value: string) => any), space?: boolean): string;
1223+
stringify(obj: any, replacer?: any[] | ((key: string, value: string) => any), space?: boolean): string;
12241224
}
12251225
}
12261226
declare module "dojo/json"
@@ -1271,7 +1271,7 @@ declare module Dojo
12711271
}
12721272
declare module dojo
12731273
{
1274-
type NodesLike = HTMLElement | HTMLElement[]| _HTMLNodeList | dojo.NodeList;
1274+
type NodesLike = HTMLElement | HTMLElement[] | _HTMLNodeList | dojo.NodeList;
12751275

12761276
class NodeList
12771277
{
@@ -1379,7 +1379,7 @@ declare module dojo
13791379
fadeIn(args?: Dojo.Fx.AutoBaseCreateOptions | Dojo.Fx.BaseCreateOptions): dojo.NodeList;
13801380
fadeOut(args?: Dojo.Fx.AutoBaseCreateOptions | Dojo.Fx.BaseCreateOptions): dojo.NodeList;
13811381
filter(filter: string | ((item: HTMLElement, index: number, list: dojo.NodeList) => boolean)): dojo.NodeList;
1382-
first(): HTMLElement;
1382+
first(): dojo.NodeList;
13831383
forEach(callback: (item: HTMLElement, index: number, list: dojo.NodeList) => void, thisObject?: Object): dojo.NodeList;
13841384

13851385
html(): string;
@@ -1393,7 +1393,7 @@ declare module dojo
13931393
insertAfter(query: string): dojo.NodeList;
13941394
insertBefore(query: string): dojo.NodeList;
13951395
instantiate(declaredClass: string, properties?: Dojo.PropertiesMap): dojo.NodeList;
1396-
last(): HTMLElement;
1396+
last(): dojo.NodeList;
13971397
lastIndexOf(value: HTMLElement, fromIndex?: number): number;
13981398
map(func: (item: HTMLElement, index: number, list: dojo.NodeList) => HTMLElement, thisObject?: Object): dojo.NodeList;
13991399
marginBox(): Position;
@@ -1841,7 +1841,7 @@ declare module Dojo
18411841
{
18421842
interface All
18431843
{
1844-
<T>(promises: T[]| dojo.Promise<T>[]): dojo.Promise<T[]>;
1844+
<T>(promises: T[] | dojo.Promise<T>[]): dojo.Promise<T[]>;
18451845
<T>(promises: Dojo.Dictionary<dojo.Promise<T>>): dojo.Promise<Dojo.Dictionary<T>>;
18461846
<T>(promises: T): dojo.Promise<T>;
18471847
}
@@ -1862,7 +1862,7 @@ declare module Dojo
18621862
{
18631863
interface First
18641864
{
1865-
<T>(promises: T[]| dojo.Promise<T>[]| Dojo.Dictionary<dojo.Promise<T>>): dojo.Promise<T>;
1865+
<T>(promises: T[] | dojo.Promise<T>[] | Dojo.Dictionary<dojo.Promise<T>>): dojo.Promise<T>;
18661866
<T>(promises: T): dojo.Promise<T>;
18671867
}
18681868
}
@@ -2254,7 +2254,7 @@ declare module Dojo
22542254
{
22552255
pad(text: string, size: number, ch?: string, end?: boolean): string;
22562256
rep(str: string, num: number): string;
2257-
substitute(template: string, map: string[]| { [text: string]: string; }, transform?: (value: any, key: string) => string, thisObject?: Object): string;
2257+
substitute(template: string, map: string[] | { [text: string]: string; }, transform?: (value: any, key: string) => string, thisObject?: Object): string;
22582258
trim(str: string): string;
22592259
}
22602260
}

dojo.data.d.ts

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ declare module Dojo.Data
2020
query?: any;
2121
queryOptions?: { ignoreCase?: boolean; deep?: boolean; };
2222
onBegin?: (size: number, request: Request<T>) => void;
23-
onItem?: (item: T, request: Request<T>) => void;
24-
onComplete?: (items: T[], request: Request<T>) => void;
23+
onItem?: (item: Item<T>, request: Request<T>) => void;
24+
onComplete?: (items: Item<T>[], request: Request<T>) => void;
2525
onError?: (errorData: any, request: Request<T>) => void;
2626
scope?: Object;
2727
start?: number;
@@ -67,15 +67,15 @@ declare module Dojo.Data
6767
onError?: (error: any) => void;
6868
scope?: Object;
6969
}): Item<T>;
70-
filter(requestArgs: RequestArgs<T>, arrayOfItems: Item<T>[], findCallback: (item: Item<T>) => void ): void;
70+
filter(requestArgs: RequestArgs<T>, arrayOfItems: Item<T>[], findCallback: (item: Item<T>) => void): void;
7171
getAttributes(item: Item<T>): string[];
7272
getFeatures(): { [feature: string]: boolean; };
7373
getIdentity(item: Item<T>): any;
7474
getIdentityAttributes(item: Item<T>): string[];
7575
getLabel(item: Item<T>): string;
7676
getLabelAttributes(item: Item<T>): string[];
77-
getValue(item: Item<T>, attribute: string, defaultValue?: T): T;
78-
getValues(item: Item<T>, attribute: string): T[];
77+
getValue<V>(item: Item<T>, attribute: string, defaultValue?: V): V;
78+
getValues<V>(item: Item<T>, attribute: string): V[];
7979
hasAttribute(item: Item<T>, attribute: string): boolean;
8080
isItem(something: Object): boolean;
8181
isItemLoaded(something: Object): boolean;
@@ -105,8 +105,8 @@ declare module Dojo.Data
105105
onError?: (error: any) => void;
106106
scope?: Object;
107107
}): boolean;
108-
setValue(item: Item<T>, attribute: string, value: T): boolean;
109-
setValues(item: Item<T>, attribute: string, values: T[]): boolean;
108+
setValue<V>(item: Item<T>, attribute: string, value: V): boolean;
109+
setValues<V>(item: Item<T>, attribute: string, values: V[]): boolean;
110110
unsetAttribute(item: Item<T>, attribute: string): boolean;
111111
}
112112

@@ -134,15 +134,15 @@ declare module Dojo.Data
134134
onError?: (error: any) => void;
135135
scope?: Object;
136136
}): Item<T>;
137-
filter(requestArgs: RequestArgs<T>, arrayOfItems: Item<T>[], findCallback: (item: Item<T>) => void ): void;
137+
filter(requestArgs: RequestArgs<T>, arrayOfItems: Item<T>[], findCallback: (item: Item<T>) => void): void;
138138
getAttributes(item: Item<T>): string[];
139139
getFeatures(): { [feature: string]: boolean; };
140140
getIdentity(item: Item<T>): any;
141141
getIdentityAttributes(item: Item<T>): string[];
142142
getLabel(item: Item<T>): string;
143143
getLabelAttributes(item: Item<T>): string[];
144-
getValue(item: Item<T>, attribute: string, defaultValue?: T): T;
145-
getValues(item: Item<T>, attribute: string): T[];
144+
getValue<V>(item: Item<T>, attribute: string, defaultValue?: V): V;
145+
getValues<V>(item: Item<T>, attribute: string): V[];
146146
hasAttribute(item: Item<T>, attribute: string): boolean;
147147
isItem(something: Object): boolean;
148148
isItemLoaded(something: Object): boolean;
@@ -166,11 +166,23 @@ declare module Dojo.Data
166166
onError?: (error: any) => void;
167167
scope?: Object;
168168
}): boolean;
169-
setValue(item: Item<T>, attribute: string, value: T): boolean;
170-
setValues(item: Item<T>, attribute: string, values: T[]): boolean;
169+
setValue<V>(item: Item<T>, attribute: string, value: V): boolean;
170+
setValues<V>(item: Item<T>, attribute: string, values: V[]): boolean;
171171
unsetAttribute(item: Item<T>, attribute: string): boolean;
172172

173173
// Notification
174+
on(type: "Delete", listener: (deleteditem: Item<T>) => void): Dojo.RemovableHandle;
175+
on<P>(type: "New", listener: (newitem: Item<T>, parentInfo?: {
176+
item: Item<P>;
177+
attribute: string;
178+
oldValue: any;
179+
newValue: any;
180+
}) => void): Dojo.RemovableHandle;
181+
on(type: "Fetch", listener: (results: Object) => void): Dojo.RemovableHandle;
182+
on(type: "Set", listener: (item: Item<T>, attribute: string, oldValue: any, newValue: any) => void): Dojo.RemovableHandle;
183+
on(type: string, listener: Dojo.Action): Dojo.RemovableHandle;
184+
on(type: Dojo.ExtensionEvent, listener: Dojo.Action): Dojo.RemovableHandle;
185+
174186
onDelete(deleteditem: Item<T>): void;
175187
onNew<P>(newitem: Item<T>, parentInfo?: {
176188
item: Item<P>;
@@ -207,19 +219,18 @@ declare module Dojo.Data
207219
}
208220
}
209221

210-
211-
declare module "dojo/data/ItemFileReadStore"
222+
declare module "dojo/data/ItemFileReadStore"
212223
{
213224
var ItemFileReadStore: typeof Dojo.Data.ItemFileReadStore;
214225
export = ItemFileReadStore;
215226
}
216-
declare module "dojo/data/ItemFileWriteStore"
227+
declare module "dojo/data/ItemFileWriteStore"
217228
{
218229
var ItemFileWriteStore: typeof Dojo.Data.ItemFileWriteStore;
219230
export = ItemFileWriteStore;
220231
}
221-
declare module "dojo/data/ObjectStore"
232+
declare module "dojo/data/ObjectStore"
222233
{
223234
var ObjectStore: typeof Dojo.Data.ObjectStore
224235
export = ObjectStore;
225-
}
236+
}

0 commit comments

Comments
 (0)