diff --git a/packages/core/data/observable/index.ts b/packages/core/data/observable/index.ts index 584e622f66..8f75ff67d0 100644 --- a/packages/core/data/observable/index.ts +++ b/packages/core/data/observable/index.ts @@ -1,4 +1,4 @@ -import { Optional, EndsWith } from '../../utils/typescript-utils'; +import { Optional } from '../../utils/typescript-utils'; /** * Base event data. @@ -160,7 +160,7 @@ export class Observable { * `this` context when the callback is called. Falsy values will be not be * bound. */ - public on(eventName: S, callback: (data: EndsWith) => void, thisArg?: any): void { + public on(eventName: string, callback: (data: EventData) => void, thisArg?: any): void { this.addEventListener(eventName, callback, thisArg); } @@ -175,7 +175,7 @@ export class Observable { * `this` context when the callback is called. Falsy values will be not be * bound. */ - public once(eventName: S, callback: (data: EndsWith) => void, thisArg?: any): void { + public once(eventName: string, callback: (data: EventData) => void, thisArg?: any): void { this.addEventListener(eventName, callback, thisArg, true); } @@ -188,7 +188,7 @@ export class Observable { * @param thisArg An optional parameter which, when set, will be used to * refine search of the correct event listener to be removed. */ - public off(eventName: S, callback?: (data: EndsWith) => void, thisArg?: any): void { + public off(eventName: string, callback?: (data: EventData) => void, thisArg?: any): void { this.removeEventListener(eventName, callback, thisArg); } diff --git a/packages/core/utils/typescript-utils.d.ts b/packages/core/utils/typescript-utils.d.ts index 140e46ffd3..2b7de2fd33 100644 --- a/packages/core/utils/typescript-utils.d.ts +++ b/packages/core/utils/typescript-utils.d.ts @@ -4,12 +4,3 @@ * // returns: { eventName: string; object?: Observable } */ export type Optional = Omit & { [P in K]?: T[P] }; - -/** - * Determines if a string type ends with a specified suffix. - * @example type IsChangeEvent = EndsWith<"propertyNameChange", "Change", true, false> - * // returns: true - * @example type IsChangeEvent = EndsWith<"someEvent", "Change", true, false> - * // returns: false - */ -export type EndsWith = T extends `${infer _}${S}` ? PassType : FailType; \ No newline at end of file