Page Contents

Home > @loopback/repository > TypeResolver

TypeResolver type

A type resolver is a function that returns a class representing the type, typically a Model or Entity (e.g. Product).

We use type resolvers to break require() loops when defining relations. The target model (class) is provided via a provider, thus deferring the actual reference to the class itself until later, when both sides of the relation are created as JavaScript classes.


export type TypeResolver<Type extends Object, StaticMembers = Function> = () => Class<Type> & StaticMembers;

References: Class