Skip to content
This repository has been archived by the owner on Jan 24, 2022. It is now read-only.

Commit

Permalink
Fix project mixin type
Browse files Browse the repository at this point in the history
  • Loading branch information
ylv-io committed Apr 17, 2019
1 parent 133e1bf commit 9efc6a4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
8 changes: 3 additions & 5 deletions packages/lib/src/project/AppProject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ interface ExistingAddresses {
proxyFactoryAddress?: string;
}

class AppProject extends BasePackageProject {
class BaseAppProject extends BasePackageProject {
private name: string;
private app: App;
public proxyAdmin: ProxyAdmin;
Expand Down Expand Up @@ -69,7 +69,7 @@ class AppProject extends BasePackageProject {
if (!await app.hasPackage(name, version)) await app.setPackage(name, thepackage.address, version);
const proxyAdmin: ProxyAdmin | null = proxyAdminAddress ? await ProxyAdmin.fetch(proxyAdminAddress, txParams) : null;
const proxyFactory = ProxyFactory.tryFetch(proxyFactoryAddress, txParams);
const project: AppProject = new this(app, name, version, proxyAdmin, proxyFactory, txParams);
const project: AppProject = new AppProject(app, name, version, proxyAdmin, proxyFactory, txParams);
project.directory = directory;
project.package = thepackage;
return project;
Expand Down Expand Up @@ -267,8 +267,6 @@ class AppProject extends BasePackageProject {
}
}
}


// Mixings produce value but not type
// We have to export full class with type & callable
export default class _ extends ProxyAdminProjectMixin(AppProject) {};
export default class AppProject extends ProxyAdminProjectMixin(BaseAppProject) {};
8 changes: 4 additions & 4 deletions packages/lib/src/project/ProxyAdminProject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import ProxyAdminProjectMixin from './mixin/ProxyAdminProjectMixin';

const log: Logger = new Logger('ProxyAdminProject');

class ProxyAdminProject extends BaseSimpleProject {
class BaseProxyAdminProject extends BaseSimpleProject {
public proxyAdmin: ProxyAdmin;

public static async fetch(name: string = 'main', txParams: any = {}, proxyAdminAddress?: string, proxyFactoryAddress?: string) {
public static async fetch(name: string = 'main', txParams: any = {}, proxyAdminAddress?: string, proxyFactoryAddress?: string): Promise<ProxyAdminProject> {
const proxyAdmin = proxyAdminAddress ? await ProxyAdmin.fetch(proxyAdminAddress, txParams) : null;
const proxyFactory = proxyFactoryAddress ? await ProxyFactory.fetch(proxyFactoryAddress, txParams) : null;
return new this(name, proxyAdmin, proxyFactory, txParams);
return new ProxyAdminProject(name, proxyAdmin, proxyFactory, txParams);
}

constructor(name: string = 'main', proxyAdmin: ProxyAdmin, proxyFactory?: ProxyFactory, txParams: any = {}) {
Expand Down Expand Up @@ -55,4 +55,4 @@ class ProxyAdminProject extends BaseSimpleProject {

// Mixings produce value but not type
// We have to export full class with type & callable
export default class _ extends ProxyAdminProjectMixin(ProxyAdminProject) {};
export default class ProxyAdminProject extends ProxyAdminProjectMixin(BaseProxyAdminProject) {};

0 comments on commit 9efc6a4

Please sign in to comment.