'Extract a type from extended interface

I need to extract a type that passed but was never used as a member.

// an interface has a generic input type but does not explicitly use it
interface Box<Type> {
  name: string,
}

// there is some interface that extends Box
interface NumberBox extends Box<number> {
  
}

// I need to get the type "number" from "NumberBox" and save into a new type
// something like this
// type ContainType = get(NumberBox); // should return number


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source