Skip to content

refactor(core): export Constructor from @loopback/context#617

Closed
virkt25 wants to merge 1 commit into
masterfrom
refactor-export
Closed

refactor(core): export Constructor from @loopback/context#617
virkt25 wants to merge 1 commit into
masterfrom
refactor-export

Conversation

@virkt25

@virkt25 virkt25 commented Oct 5, 2017

Copy link
Copy Markdown
Contributor

Description

Enables it's use in extension / application development without a dependency on @loopback/context

Related issues

Checklist

  • New tests added or existing tests modified to cover all changes
  • Code conforms with the style
    guide

Enables it's use in extension / application development without a dependency on @loopback/context

@bajtos bajtos left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, extensions should not depend on @loopback/core, but on @loopback/context only. Is it possible to achieve that?

If not, then I am ok with this change. It may be better to (re)export everything fomr @loopback/context in such case:

export * from '@loopback/context';

@virkt25

virkt25 commented Oct 5, 2017

Copy link
Copy Markdown
Contributor Author

It is most certainly possible to use @loopback/context. My reason was that we require inject from core and it seemed weird to me to require Constructor from context. (I was just trying to keep the developer experience simple). That said more I think about it, it’s probably better to keep this separate since I think only extension developers would be using this and not application developers.

@bajtos

bajtos commented Oct 5, 2017

Copy link
Copy Markdown
Member

My reason was that we require inject from core and it seemed weird to me to require Constructor from context. (I was just trying to keep the developer experience simple).

Can we import both inject and Constructor from context then?

Not a big deal, I'll leave it up to you to make the final decision.

@virkt25

virkt25 commented Oct 12, 2017

Copy link
Copy Markdown
Contributor Author

Closing to avoid promoting re-exporting types not needed for Application Development. The currently re-exported functions are ok as they avoid requiring an Application Developer to import Context just to get started.

Best practice for extension developers will be to import them directly from @loopback/Context.

@virkt25 virkt25 closed this Oct 12, 2017
@virkt25 virkt25 removed the review label Oct 12, 2017
@bajtos
bajtos deleted the refactor-export branch June 5, 2018 07:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants