Fixing Typings

This commit is contained in:
Martin Karkowski 2022-02-01 08:20:16 +01:00
parent 03b38f7f66
commit eda224bd55
2 changed files with 10 additions and 10 deletions

View File

@ -31,12 +31,12 @@ import {
INopeRpcManager, INopeRpcManager,
INopeStatusInfo, INopeStatusInfo,
TValidAsssignmentChecker, TValidAsssignmentChecker,
ValidSelectorFunction, ValidSelectorFunction
} from "../../types/nope"; } from "../../types/nope";
import { import {
INopeInstanceManager, INopeInstanceManager,
TConstructorCallback, TConstructorCallback,
TGenerateWrapperCallback, TGenerateWrapperCallback
} from "../../types/nope/nopeInstanceManager.interface"; } from "../../types/nope/nopeInstanceManager.interface";
import { NopeConnectivityManager } from "../ConnectivityManager"; import { NopeConnectivityManager } from "../ConnectivityManager";
import { NopeRpcManager } from "../RpcManager/NopeRpcManager"; import { NopeRpcManager } from "../RpcManager/NopeRpcManager";
@ -665,13 +665,13 @@ export class NopeInstanceManager implements INopeInstanceManager {
} }
// See interface description // See interface description
public async createInstance<I extends INopeModule = IGenericNopeModule>( public async createInstance<I = IGenericNopeModule>(
description: Partial<IInstanceCreationMsg>, description: Partial<IInstanceCreationMsg>,
options: { options: {
selector?: ValidSelectorFunction; selector?: ValidSelectorFunction;
assignmentValid?: TValidAsssignmentChecker; assignmentValid?: TValidAsssignmentChecker;
} = {} } = {}
): Promise<I> { ): Promise<I & IGenericNopeModule> {
// Define the Default Description // Define the Default Description
// which will lead to an error. // which will lead to an error.
const _defDescription: IInstanceCreationMsg = { const _defDescription: IInstanceCreationMsg = {
@ -785,7 +785,7 @@ export class NopeInstanceManager implements INopeInstanceManager {
const wrapper = (await this._internalWrapperGenerators.get(_type)( const wrapper = (await this._internalWrapperGenerators.get(_type)(
this._core, this._core,
definedInstance.description definedInstance.description
)) as I; )) as IGenericNopeModule;
if (this._logger?.enabledFor(DEBUG)) { if (this._logger?.enabledFor(DEBUG)) {
this._logger.debug( this._logger.debug(
@ -799,7 +799,7 @@ export class NopeInstanceManager implements INopeInstanceManager {
usedBy: [_description.dispatcherId], usedBy: [_description.dispatcherId],
}); });
return wrapper; return wrapper as I & IGenericNopeModule;
} }
throw Error("No internal generator Available!"); throw Error("No internal generator Available!");

View File

@ -9,13 +9,13 @@
import { INopeCore, INopeModule } from "."; import { INopeCore, INopeModule } from ".";
import { import {
IAvailableInstancesMsg, IAvailableInstancesMsg,
IInstanceCreationMsg, IInstanceCreationMsg
} from "./nopeCommunication.interface"; } from "./nopeCommunication.interface";
import { INopeStatusInfo } from "./nopeConnectivityManager.interface"; import { INopeStatusInfo } from "./nopeConnectivityManager.interface";
import { IMapBasedMergeData } from "./nopeHelpers.interface"; import { IMapBasedMergeData } from "./nopeHelpers.interface";
import { import {
IGenericNopeModule, IGenericNopeModule,
INopeModuleDescription, INopeModuleDescription
} from "./nopeModule.interface"; } from "./nopeModule.interface";
import { INopeObservable } from "./nopeObservable.interface"; import { INopeObservable } from "./nopeObservable.interface";
import { ValidSelectorFunction } from "./nopeRpcManager.interface"; import { ValidSelectorFunction } from "./nopeRpcManager.interface";
@ -136,13 +136,13 @@ export interface INopeInstanceManager {
* @return {Promise<I>} * @return {Promise<I>}
* @memberof INopeInstanceManager * @memberof INopeInstanceManager
*/ */
createInstance<I extends INopeModule = IGenericNopeModule>( createInstance<I = IGenericNopeModule>(
description: Partial<IInstanceCreationMsg>, description: Partial<IInstanceCreationMsg>,
options?: { options?: {
selector?: ValidSelectorFunction; selector?: ValidSelectorFunction;
assignmentValid?: TValidAsssignmentChecker; assignmentValid?: TValidAsssignmentChecker;
} }
): Promise<I>; ): Promise<I & IGenericNopeModule>;
/** /**
* Creates Wrappers for the Type of the given element. * Creates Wrappers for the Type of the given element.