Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: abstract base classes should implement shared type interfaces #684

Merged
merged 2 commits into from
Feb 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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