Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | 1x 1x 1x 1x 1x 1x | import { Class } from "../Class"; import { ChildInterface } from "./ChildInterface"; /** * @class ChildClass * @description This class extends the base Class and implements the ChildInterface. * @summary Generic class extending Class and implementing ChildInterface with additional functionality. * It provides a generic implementation with additional properties and methods. * * @param {unknown} arg1 - First argument of unknown type * @param {string} arg2 - Second argument as string * * @template T - The generic type parameter * @extends {Class} * @implements {ChildInterface<T>} */ export class ChildClass<T> extends Class implements ChildInterface<T> { /** * @description A private property of generic type T. * @template {T} * @summary Stores the first constructor argument for later use. * @private * @type {T} */ private prop2?: T; constructor(arg1: T, arg2: string) { super(arg1, arg2); this.prop2 = arg1; } /** * @description This method overrides the base class method. * @summary Asynchronous method that returns a string after a series of type assertions. * * @template V - The generic type parameter * @return {Promise<string>} A Promise that resolves to a string * @override */ override async method<V>(): Promise<string> { return "ok" as unknown as V as unknown as string; } /** * @description This method implements the method2 from ChildInterface. * @summary Method that throws an error with a message that includes the input argument. * * @param {T} arg1 - The input argument of generic type T * @return {Promise<string>} A Promise that always rejects with an error * @throws {Error} Always throws an error with a message including arg1 */ method2(arg1: T): Promise<string> { throw new Error("error" + arg1); } } |