Skip to content

Commit

Permalink
fix: abstract base classes should implement shared type interfaces (#684
Browse files Browse the repository at this point in the history
)

* fix: abstract base classes should implement shared type interfaces

ISSUES CLOSED: #683

* tslint doesn't like it when I indicate unused vars
  • Loading branch information
malept authored and MarshallOfSound committed Feb 8, 2019
1 parent 177012e commit d15a8cc
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/maker/base/src/Maker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export interface MakerOptions {
packageJSON: any;
}

export default abstract class Maker<C> {
export default abstract class Maker<C> implements IForgeMaker {
public config!: C;
public abstract name: string;
public abstract defaultPlatforms: ForgePlatform[];
Expand Down
7 changes: 5 additions & 2 deletions packages/plugin/base/src/Plugin.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { ForgeHookFn, StartOptions } from '@electron-forge/shared-types';
import { ForgeConfig, ForgeHookFn, IForgePlugin, StartOptions } from '@electron-forge/shared-types';
import { ChildProcess } from 'child_process';

export { StartOptions };

export default abstract class Plugin<C> {
export default abstract class Plugin<C> implements IForgePlugin {
public abstract name: string;
/* tslint:disable variable-name */
__isElectronForgePlugin!: true;
Expand All @@ -17,6 +17,9 @@ export default abstract class Plugin<C> {
});
}

init(dir: string, config: ForgeConfig) {
}

getHook(hookName: string): ForgeHookFn | null {
return null;
}
Expand Down
6 changes: 3 additions & 3 deletions packages/publisher/base/src/Publisher.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ForgePlatform, ForgeConfig, ForgeMakeResult } from '@electron-forge/shared-types';
import { ForgePlatform, ForgeConfig, ForgeMakeResult, IForgePublisher } from '@electron-forge/shared-types';

/* eslint-disable no-unused-vars */

Expand All @@ -19,7 +19,7 @@ export interface PublisherOptions {
forgeConfig: ForgeConfig;
}

export default abstract class Publisher<C> {
export default abstract class Publisher<C> implements IForgePublisher {
public abstract name: string;
public defaultPlatforms?: ForgePlatform[];
/* tslint:disable variable-name */
Expand All @@ -38,7 +38,7 @@ export default abstract class Publisher<C> {
get platforms() {
if (this.providedPlatforms) return this.providedPlatforms;
if (this.defaultPlatforms) return this.defaultPlatforms;
return ['win32', 'linux', 'darwin', 'mas'];
return ['win32', 'linux', 'darwin', 'mas'] as ForgePlatform[];
}

/**
Expand Down
6 changes: 3 additions & 3 deletions packages/utils/types/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export interface IForgePlugin {

init(dir: string, forgeConfig: ForgeConfig): void;
getHook?(hookName: string): ForgeHookFn | null;
startLogic?(opts: StartOptions): Promise<ChildProcess | false>;
startLogic?(opts: StartOptions): Promise<ChildProcess | string | string[] | false>;
}

export interface IForgeResolvableMaker {
Expand All @@ -71,7 +71,7 @@ export interface IForgeResolvableMaker {

export interface IForgeMaker {
__isElectronForgeMaker: boolean;
platforms?: undefined;
readonly platforms?: ForgePlatform[];
}

export interface IForgeResolvablePublisher {
Expand All @@ -82,7 +82,7 @@ export interface IForgeResolvablePublisher {

export interface IForgePublisher {
__isElectronForgePublisher: boolean;
platforms?: undefined;
readonly platforms?: ForgePlatform[];
}

export interface StartOptions {
Expand Down

0 comments on commit d15a8cc

Please sign in to comment.