...

/

Quiz: Three Biggest Features in TypeScript 5.0

Quiz: Three Biggest Features in TypeScript 5.0

Test yourself on what you’ve learned about the biggest features of TypeScript 5.0 in this chapter.

We'll cover the following...
Technical Quiz
1.

What does the context parameter represent in the @deprecated decorator?

const deprecated = <This, Arguments extends any[], ReturnValue>(
  target: (this: This, ...args: Arguments) => ReturnValue,
  context: ClassMethodDecoratorContext<
    This,
    (this: This, ...args: Arguments) => ReturnValue
  >,
) => {
  const methodName = String(context.name);

  function replacementMethod(this: This, ...args: Arguments): ReturnValue { 
    console.warn(`Warning: '${methodName}' is deprecated.`);
    return target.call(this, ...args);
  }
  
  return replacementMethod;
};
A.

The replacement method for the decorated function

B.

Metadata about the decorated method

C.

The target method being decorated

D.

The current instance of the class


1 / 9
...