Tim Lovell-Smith
Tim Lovell-Smith

Reputation: 16115

Does typescript have a standard type which is the empty interface?

Does typescript have a standard type which is the empty interface? As opposed to any, the type should result in type errors whenever you try to do anything with it - except cast it to a real type/any.

I know you can define it trivially, I just wondered if its already defined by the language.

interface untyped {}

Upvotes: 2

Views: 150

Answers (1)

Ryan Cavanaugh
Ryan Cavanaugh

Reputation: 220884

The empty type in TypeScript is called {}

There are no built-in aliases for it.

Upvotes: 4

Related Questions