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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core): Add "AbstractType<T>" interface #29295

Closed
wants to merge 1 commit into from

Conversation

Projects
None yet
6 participants
@Goodwine
Copy link
Contributor

commented Mar 14, 2019

This new interface will match classes whether they are abstract or
concrete. Casting as AbstractType<MyConcrete> will return a type that
isn't newable. This type will be used to match abstract classes in the
get() functions of Injector and TestBed.
Type isn't used yet so this isn't a breaking change.

Issue #26491

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.io application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

There is no abstract type sugar syntax

Issue Number: #26491

What is the new behavior?

There is now an interface that matches abstract classes just like Type<T> matches concrete classes.
This will be used in the future for Injector.get and TestBed.get to make the former more convenient and the latter more strict

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Added a bunch of TODOs on places I plan to update the get calls with a plan of how will they look like in the future (maybe Angular 9? 馃)

@Goodwine Goodwine requested review from angular/fw-core as code owners Mar 14, 2019

@googlebot googlebot added the cla: yes label Mar 14, 2019

@Goodwine

This comment has been minimized.

Copy link
Contributor Author

commented Mar 14, 2019

@JoostK

This comment has been minimized.

Copy link
Member

commented Mar 18, 2019

Looks like this duplicates #25222, which contains a lot of background info in its thread.

@Goodwine

This comment has been minimized.

Copy link
Contributor Author

commented Mar 18, 2019

This is interesting, IMO this can be submitted before the other PR as a "prework" since it's only adding the type without actually using it, as mentioned on the PR description.

@alxhub

alxhub approved these changes Mar 18, 2019

@@ -69,6 +69,12 @@ export abstract class Injector {
static THROW_IF_NOT_FOUND = _THROW_IF_NOT_FOUND;
static NULL: Injector = new NullInjector();

// TODO(@Goodwine): Redefine get() as:

This comment has been minimized.

Copy link
@alxhub

alxhub Mar 18, 2019

Contributor

We can remove this for now - commented-out code is unnecessary and distracting.

This comment has been minimized.

Copy link
@Goodwine

Goodwine Mar 18, 2019

Author Contributor

Done

@Goodwine Goodwine force-pushed the Goodwine:new-types-for-injector branch from fc9dec2 to 79bb2b5 Mar 18, 2019

@ngbot ngbot bot added this to the needsTriage milestone Mar 19, 2019

@Goodwine

This comment has been minimized.

Copy link
Contributor Author

commented Mar 29, 2019

Ping :)

@ngbot

This comment has been minimized.

Copy link

commented Apr 2, 2019

I see that you just added the PR action: merge label, but the following checks are still failing:
聽聽聽聽failure status "ci/circleci: test_docs_examples_ivy" is failing
聽聽聽聽pending status "google3" is pending
聽聽聽聽pending missing required status "ci/circleci: publish_snapshot"

If you want your PR to be merged, it has to pass all the CI checks.

If you can't get the PR to a green state due to flakes or broken master, please try rebasing to master and/or restarting the CI job. If that fails and you believe that the issue is not due to your change, please contact the caretaker and ask for help.

feat(core): Add "AbstractType<T>" interface
This new interface will match classes whether they are abstract or
concrete. Casting as `AbstractType<MyConcrete>` will return a type that
isn't newable. This type will be used to match abstract classes in the
`get()` functions of `Injector` and `TestBed`.
Type isn't used yet so this isn't a breaking change.

Issue #26491

@Goodwine Goodwine force-pushed the Goodwine:new-types-for-injector branch from 79bb2b5 to 4805221 Apr 2, 2019

@jasonaden

This comment has been minimized.

Copy link
Contributor

commented Apr 2, 2019

Public API approval from @mhevery & merged without presubmit due to type addition only without being used.

@jasonaden jasonaden closed this in afd4a4e Apr 2, 2019

@Goodwine Goodwine deleted the Goodwine:new-types-for-injector branch Apr 4, 2019

DeveloperFromUkraine added a commit to DeveloperFromUkraine/angular that referenced this pull request Apr 11, 2019

feat(core): Add "AbstractType<T>" interface (angular#29295)
This new interface will match classes whether they are abstract or
concrete. Casting as `AbstractType<MyConcrete>` will return a type that
isn't newable. This type will be used to match abstract classes in the
`get()` functions of `Injector` and `TestBed`.
Type isn't used yet so this isn't a breaking change.

Issue angular#26491

PR Close angular#29295

wKoza added a commit to wKoza/angular that referenced this pull request Apr 17, 2019

feat(core): Add "AbstractType<T>" interface (angular#29295)
This new interface will match classes whether they are abstract or
concrete. Casting as `AbstractType<MyConcrete>` will return a type that
isn't newable. This type will be used to match abstract classes in the
`get()` functions of `Injector` and `TestBed`.
Type isn't used yet so this isn't a breaking change.

Issue angular#26491

PR Close angular#29295
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can鈥檛 perform that action at this time.