Identity<T>: T

An identity type.

You can't do:

interface Foo extends typeof Bar {}

But you can do:

interface Foo extends Identity<typeof Bar> {}

Without this type you'd have to do:

interface FooType = typeof Bar;
interface Foo extends FooType {};

We have to do this a lot because we generate complex objects with detailed type information. When exported, TS (as of 5.2) inlines the type of these objects in declarations which makes our declarations massive. To avoid this we create an interface from the type then cast to the interface for export.

Type Parameters

  • T