diff --git a/.vscode/settings.json b/.vscode/settings.json --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -5,5 +5,9 @@ "**/.project": true, "**/.settings": true, "**/.factorypath": true - } + }, + "cSpell.words": [ + "djbase", + "djclass" + ] } \ No newline at end of file diff --git a/package-lock.json b/package-lock.json --- a/package-lock.json +++ b/package-lock.json @@ -859,6 +859,12 @@ "integrity": "sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw==", "dev": true }, + "requirejs": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/requirejs/-/requirejs-2.3.6.tgz", + "integrity": "sha512-ipEzlWQe6RK3jkzikgCupiTbTvm4S0/CAU5GlgptkN5SO6F3u0UD0K18wy6ErDqiCyP4J4YYe1HuAShvsxePLg==", + "dev": true + }, "resolve": { "version": "1.17.0", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz", diff --git a/package.json b/package.json --- a/package.json +++ b/package.json @@ -29,6 +29,7 @@ "eslint": "6.8.0", "tslint": "^6.1.3", "typescript": "4.0.2", - "yaml": "~1.7.2" + "yaml": "~1.7.2", + "requirejs": "2.3.6" } } 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 @@ -14,11 +14,11 @@ export interface AbstractConstructor { new(...args: any[]): T; mock: boolean; - base: AbstractConstructor; + bases: AbstractConstructor[]; } export function djbase( - b0: AbstractConstructor + b0?: AbstractConstructor ): DeclareConstructor; export function djbase( @@ -96,11 +96,11 @@ export function djbase(...bases: any[]): const t = class { static mock: boolean; - static base: AbstractConstructor; + static bases: AbstractConstructor[]; }; t.mock = true; - t.base = declare(bases); + t.bases = bases; return t as any; } @@ -122,7 +122,9 @@ export function djclass { if (typeof m === "function" && p !== "constructor" && - target.prototype.hasOwnProperty(p) && - p in t.prototype + target.prototype.hasOwnProperty(p) ) { bp[p] = proxy(m); } }); - const cls = declare(t, target.prototype); // TODO mixin static members return cls as any; } else {