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
Closed

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

wants to merge 1 commit into from

Conversation

Goodwine
Copy link

@Goodwine Goodwine 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 a team as code owners March 14, 2019 01:05
@Goodwine
Copy link
Author

@jermowery

@JoostK
Copy link
Member

JoostK commented Mar 18, 2019

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

@Goodwine
Copy link
Author

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.

@@ -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:
Copy link
Member

Choose a reason for hiding this comment

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

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

Copy link
Author

Choose a reason for hiding this comment

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

Done

@mhevery mhevery added the area: core Issues related to the framework runtime label Mar 19, 2019
@ngbot ngbot bot added this to the needsTriage milestone Mar 19, 2019
@Goodwine
Copy link
Author

Ping :)

@mhevery mhevery added action: merge The PR is ready for merge by the caretaker target: major This PR is targeted for the next major release labels Apr 2, 2019
@ngbot
Copy link

ngbot bot 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.

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
@jasonaden
Copy link
Contributor

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 new-types-for-injector branch April 4, 2019 22:37
DeveloperFromUkraine pushed a commit to DeveloperFromUkraine/angular that referenced this pull request Apr 11, 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 angular#26491

PR Close angular#29295
wKoza pushed a commit to wKoza/angular that referenced this pull request Apr 17, 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 angular#26491

PR Close angular#29295
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker area: core Issues related to the framework runtime cla: yes target: major This PR is targeted for the next major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants