Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(di): ability to use newInstance() with interface #1767

Merged
merged 1 commit into from May 18, 2023

Conversation

bigopon
Copy link
Member

@bigopon bigopon commented May 18, 2023

resolves #1765

At the moment, @newInstanceOf doesn't work with interface because it expects an implementation. This creates an inconsistency where all other resolvers/APIs of the container works well with both interface and implementation. Add the ability to support @newInstanceOf/@newInstanceForScope for interface.

Thanks @mt-mshorrosh.

@codecov
Copy link

codecov bot commented May 18, 2023

Codecov Report

Merging #1767 (0a24065) into master (1c9c97c) will increase coverage by 0.02%.
The diff coverage is 96.73%.

@@            Coverage Diff             @@
##           master    #1767      +/-   ##
==========================================
+ Coverage   88.01%   88.04%   +0.02%     
==========================================
  Files         242      242              
  Lines       22555    22546       -9     
  Branches     5163     5163              
==========================================
- Hits        19852    19850       -2     
+ Misses       2703     2696       -7     
Impacted Files Coverage Δ
packages/runtime-html/src/renderer.ts 88.52% <ø> (ø)
...me-html/src/resources/value-converters/sanitize.ts 11.11% <0.00%> (-11.12%) ⬇️
packages/runtime-html/src/utilities.ts 96.87% <ø> (-0.10%) ⬇️
packages/runtime/src/observation/dirty-checker.ts 96.72% <ø> (ø)
.../src/resources/binding-behaviors/update-trigger.ts 75.00% <75.00%> (-1.48%) ⬇️
...ntime-html/src/templating/controller.projection.ts 92.75% <87.50%> (-0.40%) ⬇️
packages/runtime-html/src/templating/children.ts 86.86% <92.85%> (+2.40%) ⬆️
packages/runtime-html/src/templating/controller.ts 88.45% <95.00%> (+0.26%) ⬆️
...s/dialog/src/plugins/dialog/dialog-default-impl.ts 100.00% <100.00%> (ø)
...ckages/dialog/src/plugins/dialog/dialog-service.ts 100.00% <100.00%> (ø)
... and 27 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@bigopon bigopon merged commit a0d39e9 into master May 18, 2023
24 checks passed
@bigopon bigopon deleted the feat/newinstance-interface branch May 18, 2023 10:10
@meishoshorrosh
Copy link

I appreciate your swift efforts here @bigopon!

AureliaEffect pushed a commit that referenced this pull request May 21, 2023
**BREAKING CHANGE:**

* **compiler:** avoid using au class to find targets (#1768) ([0d30998](0d30998)).
* ***:** rename resolveAll -> onResolveAll (#1764) ([fdf0747](fdf0747))

**Features:**

* **di:** ability to use newInstance()/forScope() with interface (#1767) ([a0d39e9](a0d39e9))
* **all:** allow injection of implementation (#1766) ([a60db13](a60db13))
* **templating:** allow deactivate when activating (#1729) ([1c9c97c](1c9c97c))
* **bindable:** support getter/setter (#1753) ([4279851](4279851))
* **ui-virtualization:** enhance implementation & publish package (#1759) ([7a2f17f](7a2f17f)). Thanks [@Lakerfield](https://github.com/Lakerfield)

**Refactorings:**

* ***:** cleanup up unused code & decouple interface from default impl (#1761) ([7a71d43](7a71d43))
* **router:** add warning for unsupported behavior (#1757) ([ce87339](ce87339)). The router used to allow container traversal to
find resources when a string is used as a route to find the corresponding component.
Going forward this will be invalid and resources must be registered either locally
or globally to be routable. A warning is added first so app that accidentally used
this behavior can detect the invalid usages and fix accordingly first. This behavior will be removed in a near future release.
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.

@newInstanceOf decorator doesn't work properly on IHttpClient
2 participants