# HG changeset patch # User cin # Date 2020-08-26 11:09:57 # Node ID b1e622a3b266e348e0fde0711cc8a635f8d42051 # Parent 10be5c661c79524b85cd1905c08e77d3502e06d0 Compatibility with dojo-typings package diff --git a/src/main/ts/declare.ts b/src/main/ts/declare.ts --- a/src/main/ts/declare.ts +++ b/src/main/ts/declare.ts @@ -1,10 +1,11 @@ import declare = require("dojo/_base/declare"); import { each } from "@implab/core-amd/safe"; import { Constructor } from "@implab/core-amd/interfaces"; +import dojo = require("dojo/_base/kernel"); // declare const declare: any; -type DeclareConstructor = declare.DeclareConstructor; +type DeclareConstructor = dojo._base.DeclareConstructor; export interface AbstractConstructor { prototype: T; diff --git a/src/typings/dijit/_AttachMixin.d.ts b/src/typings/dijit/_AttachMixin.d.ts --- a/src/typings/dijit/_AttachMixin.d.ts +++ b/src/typings/dijit/_AttachMixin.d.ts @@ -1,6 +1,7 @@ import { Handle } from "dojo/interfaces"; import _WidgetBase = require("./_WidgetBase"); import declare = require("dojo/_base/declare"); +import dojo = require("dojo/_base/html"); declare module "./_WidgetBase" { interface _WidgetBase { @@ -81,7 +82,7 @@ interface _AttachMixin { destroyRendering(preserveDom?: boolean): void; } -interface _AttachMixinConstructor extends declare.DeclareConstructor<_AttachMixin> { } +interface _AttachMixinConstructor extends dojo._base.DeclareConstructor<_AttachMixin> { } declare const _AttachMixin: _AttachMixinConstructor; export = _AttachMixin; diff --git a/src/typings/dojo/_base/declare.d.ts b/src/typings/dojo/_base/declare.d.ts --- a/src/typings/dojo/_base/declare.d.ts +++ b/src/typings/dojo/_base/declare.d.ts @@ -1,138 +1,142 @@ +import dojo = require("./kernel"); + declare module "./kernel" { interface Dojo { - declare: declare.Declare; + declare: dojo._base.Declare; safeMixin: typeof declare.safeMixin; } -} - -declare namespace declare { - interface DeclareCreatedObject { - declaredClass: string; - - /** - * Calls a super method. - * - * This method is used inside method of classes produced with - * declare() to call a super method (next in the chain). It is - * used for manually controlled chaining. Consider using the regular - * chaining, because it is faster. Use "this.inherited()" only in - * complex cases. - * - * This method cannot me called from automatically chained - * constructors including the case of a special (legacy) - * constructor chaining. It cannot be called from chained methods. - * - * If "this.inherited()" cannot find the next-in-chain method, it - * does nothing and returns "undefined". The last method in chain - * can be a default method implemented in Object, which will be - * called last. - * - * If "name" is specified, it is assumed that the method that - * received "args" is the parent method for this call. It is looked - * up in the chain list and if it is found the next-in-chain method - * is called. If it is not found, the first-in-chain method is - * called. - * - * If "name" is not specified, it will be derived from the calling - * method (using a methoid property "nom"). - */ - inherited(args: IArguments, newArgs?: any[]): U; - inherited(args: IArguments, newArgs?: true): Function | void; - inherited(name: string, args: IArguments, newArgs?: any[]): U; - inherited(name: string, args: IArguments, newArgs?: true): Function | void; - - /** - * Returns a super method. - * - * This method is a convenience method for "this.inherited()". - * It uses the same algorithm but instead of executing a super - * method, it returns it, or "undefined" if not found. - */ - getInherited(args: IArguments): Function | void; - getInherited(name: string, args: IArguments): Function | void; - - /** - * Checks the inheritance chain to see if it is inherited from this class. - * - * This method is used with instances of classes produced with - * declare() to determine of they support a certain interface or - * not. It models "instanceof" operator. - */ - isInstanceOf(cls: any): boolean; - } - interface DeclareConstructor { - new(...args: any[]): T & DeclareCreatedObject; - prototype: T; + namespace _base { + interface DeclareCreatedObject { + declaredClass: string; + + /** + * Calls a super method. + * + * This method is used inside method of classes produced with + * declare() to call a super method (next in the chain). It is + * used for manually controlled chaining. Consider using the regular + * chaining, because it is faster. Use "this.inherited()" only in + * complex cases. + * + * This method cannot me called from automatically chained + * constructors including the case of a special (legacy) + * constructor chaining. It cannot be called from chained methods. + * + * If "this.inherited()" cannot find the next-in-chain method, it + * does nothing and returns "undefined". The last method in chain + * can be a default method implemented in Object, which will be + * called last. + * + * If "name" is specified, it is assumed that the method that + * received "args" is the parent method for this call. It is looked + * up in the chain list and if it is found the next-in-chain method + * is called. If it is not found, the first-in-chain method is + * called. + * + * If "name" is not specified, it will be derived from the calling + * method (using a methoid property "nom"). + */ + inherited(args: IArguments, newArgs?: any[]): U; + inherited(args: IArguments, newArgs?: true): Function | void; + inherited(name: string, args: IArguments, newArgs?: any[]): U; + inherited(name: string, args: IArguments, newArgs?: true): Function | void; + + /** + * Returns a super method. + * + * This method is a convenience method for "this.inherited()". + * It uses the same algorithm but instead of executing a super + * method, it returns it, or "undefined" if not found. + */ + getInherited(args: IArguments): Function | void; + getInherited(name: string, args: IArguments): Function | void; + + /** + * Checks the inheritance chain to see if it is inherited from this class. + * + * This method is used with instances of classes produced with + * declare() to determine of they support a certain interface or + * not. It models "instanceof" operator. + */ + isInstanceOf(cls: any): boolean; + } + + interface DeclareConstructor { + new(...args: any[]): T & DeclareCreatedObject; + prototype: T; - /** - * Adds all properties and methods of source to constructor's - * prototype, making them available to all instances created with - * constructor. This method is specific to constructors created with - * declare(). - * - * Adds source properties to the constructor's prototype. It can - * override existing properties. - * - * This method is similar to dojo.extend function, but it is specific - * to constructors produced by declare(). It is implemented - * using dojo.safeMixin, and it skips a constructor property, - * and properly decorates copied functions. - */ - extend(source: U): DeclareConstructor; + /** + * Adds all properties and methods of source to constructor's + * prototype, making them available to all instances created with + * constructor. This method is specific to constructors created with + * declare(). + * + * Adds source properties to the constructor's prototype. It can + * override existing properties. + * + * This method is similar to dojo.extend function, but it is specific + * to constructors produced by declare(). It is implemented + * using dojo.safeMixin, and it skips a constructor property, + * and properly decorates copied functions. + */ + extend(source: U): DeclareConstructor; - /** - * Create a subclass of the declared class from a list of base classes. - * - * Create a constructor using a compact notation for inheritance and - * prototype extension. - * - * Mixin ancestors provide a type of multiple inheritance. - * Prototypes of mixin ancestors are copied to the new class: - * changes to mixin prototypes will not affect classes to which - * they have been mixed in. - */ - createSubclass(mixins: [DeclareConstructor, DeclareConstructor], props: X): DeclareConstructor; - createSubclass(mixins: [DeclareConstructor], props: V): DeclareConstructor; - createSubclass(mixins: DeclareConstructor, props: V): DeclareConstructor; - createSubclass(mixins: [DeclareConstructor]): DeclareConstructor; - createSubclass(mixins: DeclareConstructor): DeclareConstructor; - createSubclass(mixins: any, props: U): DeclareConstructor; + /** + * Create a subclass of the declared class from a list of base classes. + * + * Create a constructor using a compact notation for inheritance and + * prototype extension. + * + * Mixin ancestors provide a type of multiple inheritance. + * Prototypes of mixin ancestors are copied to the new class: + * changes to mixin prototypes will not affect classes to which + * they have been mixed in. + */ + createSubclass(mixins: [DeclareConstructor, DeclareConstructor], props: X): DeclareConstructor; + createSubclass(mixins: [DeclareConstructor], props: V): DeclareConstructor; + createSubclass(mixins: DeclareConstructor, props: V): DeclareConstructor; + createSubclass(mixins: [DeclareConstructor]): DeclareConstructor; + createSubclass(mixins: DeclareConstructor): DeclareConstructor; + createSubclass(mixins: any, props: U): DeclareConstructor; + } + + interface Declare { + (superClass: [DeclareConstructor, DeclareConstructor, DeclareConstructor, DeclareConstructor]): DeclareConstructor; + (superClass: [DeclareConstructor, DeclareConstructor, DeclareConstructor]): DeclareConstructor; + (superClass: [DeclareConstructor, DeclareConstructor]): DeclareConstructor; + (superClass: DeclareConstructor | [DeclareConstructor]): DeclareConstructor; + + (superClass: [DeclareConstructor, DeclareConstructor, DeclareConstructor, DeclareConstructor], props: E): DeclareConstructor; + (superClass: [DeclareConstructor, DeclareConstructor, DeclareConstructor], props: D): DeclareConstructor; + (superClass: [DeclareConstructor, DeclareConstructor], props: C): DeclareConstructor; + (superClass: DeclareConstructor | [DeclareConstructor], props: B): DeclareConstructor; + + (className: string, superClass: [DeclareConstructor, DeclareConstructor, DeclareConstructor, DeclareConstructor]): DeclareConstructor; + (className: string, superClass: [DeclareConstructor, DeclareConstructor, DeclareConstructor]): DeclareConstructor; + (className: string, superClass: [DeclareConstructor, DeclareConstructor]): DeclareConstructor; + (className: string, superClass: DeclareConstructor | [DeclareConstructor]): DeclareConstructor; + + (className: string, superClass: [DeclareConstructor, DeclareConstructor, DeclareConstructor, DeclareConstructor], props: E): DeclareConstructor; + (className: string, superClass: [DeclareConstructor, DeclareConstructor, DeclareConstructor], props: D): DeclareConstructor; + (className: string, superClass: [DeclareConstructor, DeclareConstructor], props: C): DeclareConstructor; + (className: string, superClass: DeclareConstructor | [DeclareConstructor], props: B): DeclareConstructor; + + (className: string, superClass: any, props: A): DeclareConstructor; + (className: string, superClass: any): DeclareConstructor; + (superClass: any, props: A): DeclareConstructor; + (superClass: any): DeclareConstructor; + + /** + * Mix in properties skipping a constructor and decorating functions + * like it is done by declare(). + */ + safeMixin(target: A, source: B): A & B; + } } - interface Declare { - (superClass: [DeclareConstructor, DeclareConstructor, DeclareConstructor, DeclareConstructor]): DeclareConstructor; - (superClass: [DeclareConstructor, DeclareConstructor, DeclareConstructor]): DeclareConstructor; - (superClass: [DeclareConstructor, DeclareConstructor]): DeclareConstructor; - (superClass: DeclareConstructor | [DeclareConstructor]): DeclareConstructor; - - (superClass: [DeclareConstructor, DeclareConstructor, DeclareConstructor, DeclareConstructor], props: E): DeclareConstructor; - (superClass: [DeclareConstructor, DeclareConstructor, DeclareConstructor], props: D): DeclareConstructor; - (superClass: [DeclareConstructor, DeclareConstructor], props: C): DeclareConstructor; - (superClass: DeclareConstructor | [DeclareConstructor], props: B): DeclareConstructor; - - (className: string, superClass: [DeclareConstructor, DeclareConstructor, DeclareConstructor, DeclareConstructor]): DeclareConstructor; - (className: string, superClass: [DeclareConstructor, DeclareConstructor, DeclareConstructor]): DeclareConstructor; - (className: string, superClass: [DeclareConstructor, DeclareConstructor]): DeclareConstructor; - (className: string, superClass: DeclareConstructor | [DeclareConstructor]): DeclareConstructor; - - (className: string, superClass: [DeclareConstructor, DeclareConstructor, DeclareConstructor, DeclareConstructor], props: E): DeclareConstructor; - (className: string, superClass: [DeclareConstructor, DeclareConstructor, DeclareConstructor], props: D): DeclareConstructor; - (className: string, superClass: [DeclareConstructor, DeclareConstructor], props: C): DeclareConstructor; - (className: string, superClass: DeclareConstructor | [DeclareConstructor], props: B): DeclareConstructor; - - (className: string, superClass: any, props: A): DeclareConstructor; - (className: string, superClass: any): DeclareConstructor; - (superClass: any, props: A): DeclareConstructor; - (superClass: any): DeclareConstructor; - - /** - * Mix in properties skipping a constructor and decorating functions - * like it is done by declare(). - */ - safeMixin(target: A, source: B): A & B; - } } -declare const declare: declare.Declare; + +declare const declare: dojo._base.Declare; export = declare;