Skip to content

Can't override app.start if RepositoryMixin used: TS2425 #8079

@mgabeler-lee-6rs

Description

@mgabeler-lee-6rs

Steps to reproduce

  1. Create an app that uses RepositoryMixin
  2. Try to override the application start method

Current Behavior

error TS2425: Class '... & RestApplication' defines instance member property 'start', but extended class 'Application' defines it as instance member function.

Expected Behavior

It should compile!

It used to compile just fine in older releases.

Link to reproduction sandbox

  1. clone https://github.com/mgabeler-lee-6rs/lb4-bugs
  2. run npm run build

Additional information

Playing around with the mixins:

  • BootMixin(RestApplication) -- OK
    • BootMixin re-declares the start member
  • BootMixin(RepositoryMixin(RestApplication)) -- fails
  • RepositoryMixin(BootMixin(RestApplication)) -- fails

Looking through the history of repository.mixin.ts, the only thing I see that I could point to as a probable cause for this is https://github.com/loopbackio/loopback-next/pull/5394/files#diff-11574932d711bedee7d0693e1b5f50ebfd143a78cc62e36bb31ea5e0e711140c

Overriding application.start is "documented as OK" if you will, insofar as the hello-world example uses it almost exactly the way my repro does, the difference being that hello-world doesn't have the repos mixin: https://github.com/loopbackio/loopback-next/blob/master/examples/hello-world/src/application.ts#L23

Related Issues

Nothing found yet

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions