0 of 6 problems solved0%
6 of 6

API Merge Label

You can declare the same interface name more than once. TypeScript will merge the declarations. The final interface has all properties from both places. This is called declaration merging.

interface Api {
  version: number;
}
interface Api {
  name: string;
}

You will merge two interface blocks and then build a label string.

Your Task

Describe an API by merging interfaces, then format a label.

  • Declare two interface Api blocks so Api has both version: number and name: string.
  • Implement describeApi(a: Api): string that returns "API v<version> - <name>".
  • Use a single object with both properties in tests to satisfy Api.