What is `export type` in Typescript?

Solution 1:

This is a type alias - it's used to give another name to a type.

In your example, feline will be the type of whatever cat is.

Here's a more full fledged example:

interface Animal {
    legs: number;
}

const cat: Animal = { legs: 4 };

export type feline = typeof cat;

feline will be the type Animal, and you can use it as a type wherever you like.

const someFunc = (cat: feline) => {
    doSomething();
};

export simply exports it from the file. It's the same as doing this:

type feline = typeof cat;

export {
    feline
};