All files / src/namespace/children function.ts

100% Statements 3/3
100% Branches 0/0
100% Functions 1/1
100% Lines 3/3

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                                                              1x 1x 1x    
import { Class } from "../Class";
import { Type } from "../type";
 
/**
 * @function something
 * @description This function is a generic method that extends the Class type.
 * @summary Generic function that logs arguments and returns the context (this) of the function.
 * It logs all provided arguments to the console and returns the context (this) of the function.
 *
 * @template T - Type extending {@link Class}
 * @template V - Type of the arguments
 * @this {T}
 * @param {...V} args - Variable number of arguments of type V
 * @return {Type<T>} Returns the context (this) of the function
 *
 * @example
 * class MyClass extends Class {
 *   myMethod() {
 *     return something.call(this, 'arg1', 'arg2');
 *   }
 * }
 * 
 * const instance = new MyClass();
 * const result = instance.myMethod();
 * // Logs: 'arg1', 'arg2'
 * // result is the instance of MyClass
 *
 * @memberOf module:ts-workspace.Namespace.ChildNamespace
 * @see {@link Class}
 * @see {@link Type}
 */
export function something<T extends Class, V>(this: T, ...args: V[]): Type<T> {
  console.log(...args);
  return this;
}