0
votes

I have the following code:

export interface Chapter {
    title: string,
    path: string
}

export type TableOfContents: Chapter[]

But I am getting the following error:

[ts] 'Chapter' only refers to a type, but is being used as a value here. [2693]

I would like to export the interface Chapter, and then the type TableOfContents which is an array of chapters.

What am I doing wrong?

1

1 Answers

5
votes

To create a type alias you have to use = not :.

export type TableOfContents = Chapter[]

You can see the difference in the TypeScript playground.