##// END OF EJS Templates
updated _WidgetBase typings, added support for the generic type parameter to the constructor
cin -
r1:d55cc09feba1 default
parent child
Show More
@@ -0,0 +1,17
1 import _WidgetBase = require("dijit/_WidgetBase");
2
3 interface ScheduleWidgetAttrs {
4 data: string[];
5 }
6
7 declare const w0: _WidgetBase<ScheduleWidgetAttrs>;
8
9 w0.get("data");
10
11 declare class ScheduleWidget extends _WidgetBase {
12 data: string[];
13 }
14
15 const w = new ScheduleWidget({title: "Year schedule", data: ["a", "b"] });
16
17 w.get("data"); No newline at end of file
@@ -13,6 +13,7 npm {
13 sources {
13 sources {
14 main { me ->
14 main { me ->
15 ts {
15 ts {
16 // to check typings with the compiler
16 srcDir me.typings
17 srcDir me.typings
17 }
18 }
18 }
19 }
@@ -550,7 +550,7 declare namespace dijit {
550 }
550 }
551
551
552 /* dijit/_WidgetBase */
552 /* dijit/_WidgetBase */
553 interface _WidgetBase<Attrs = any> extends dojo.Stateful<Attrs>, Destroyable {
553 interface _WidgetBase<Attrs = any> extends dojo.Stateful<Attrs & _WidgetBase>, Destroyable {
554
554
555 /**
555 /**
556 * A unique, opaque ID string that can be assigned by users or by the
556 * A unique, opaque ID string that can be assigned by users or by the
@@ -7,8 +7,14 declare module 'dijit/_Widget' {
7 }
7 }
8
8
9 declare module 'dijit/_WidgetBase' {
9 declare module 'dijit/_WidgetBase' {
10 type _WidgetBase = dijit._WidgetBase;
10 type _WidgetBase<A = any> = dijit._WidgetBase<A>;
11 const _WidgetBase: dijit._WidgetBaseConstructor<_WidgetBase>;
11
12 // individual _WidgetBase constructor to keep type parameters
13 interface _WidgetBaseConstructor {
14 new <A = any>(params?: Partial<_WidgetBase<A> & A>, srcNodeRef?: dojo.NodeOrString): _WidgetBase<A> & dojo._base.DeclareCreatedObject;
15 prototype: _WidgetBase;
16 }
17 const _WidgetBase: _WidgetBaseConstructor;
12 export = _WidgetBase;
18 export = _WidgetBase;
13 }
19 }
14
20
@@ -1,8 +1,9
1 import Memory = require("dojo/store/Memory");
1 import Observable = require("dojo/store/Observable");
2 import Observable = require("dojo/store/Observable");
2
3
3 interface Schedule {
4 interface Schedule {
4
5
5 id: string;
6 id?: string;
6
7
7 title: string;
8 title: string;
8
9
@@ -13,9 +14,15 declare const store: dojo.store.api.Stor
13
14
14 const observable = new Observable(store);
15 const observable = new Observable(store);
15
16
17 const mem = new Memory<Schedule>();
18
16 (async () => {
19 (async () => {
17 observable.query().observe(() => {});
20 observable.query().observe(() => {});
18 store.query().forEach(() => {});
21 store.query().forEach(() => {});
19 const total = await store.query().total;
22 const total = await store.query().total;
20 const result = await store.query();
23 const result = await store.query();
24
25 mem.query();
26
27 mem.add({duration: 10, title: "Test event"});
21 })(); No newline at end of file
28 })();
General Comments 0
You need to be logged in to leave comments. Login now