Home > OS >  TypeScript A<B> as function return type
TypeScript A<B> as function return type

Time:12-12

What does Model<IAlbum> mean in the following function.

export const getAlbumModel = (): Model<IAlbum> => {
  
};

I couldn't find anything in the docs regarding this.

CodePudding user response:

It means that your function returns an object which is an instance of the generic class Model with type parameter IAlbum.

See https://www.typescriptlang.org/docs/handbook/functions.html and https://www.typescriptlang.org/docs/handbook/2/generics.html

  • Related