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

fix(core): Deprecate TestBed.get(...):any #29290

Closed
wants to merge 1 commit into from

Conversation

Projects
None yet
3 participants
@Goodwine
Copy link
Contributor

commented Mar 13, 2019

Adds an overload to TestBed.get making parameters strongly typed and
deprecated previous signature that accepted types any. The function
still returns any to prevent build breakages, but eventually stronger
type checks will be added so a future Angular version will break builds
due to additional type checks.
See previous breaking change - #13785

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?

get(token: any, default?: any): any

Issue Number: #26491

What is the new behavior?

"Same" signature as Injector.get:

get(token: InjetionToken<T>|Type<T>, default?: T, flags?: InjectorFlags): any

(Instead of returning T, it still returns any) to prevent breaking changes for 8.0, but this will hopefully break on 9.0

Does this PR introduce a breaking change?

  • Yes
  • No

Note that the return type is still any, this will change to be an actual breaking change similar to #13785 in a future major version

Other information

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

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

@Goodwine Goodwine force-pushed the Goodwine:deprecate-testbed-get branch 2 times, most recently from 48bbbec to b5849e5 Mar 13, 2019

@Goodwine

This comment has been minimized.

Copy link
Contributor Author

commented Mar 13, 2019

Note: At head these tests were already failing -

//packages/compiler-cli/test:extract_i18n
//packages/compiler-cli/test:ngc
//packages/compiler-cli/test:ngtools_api
//packages/compiler-cli/test:perform_compile
//packages/compiler-cli/test:perform_watch
//packages/compiler-cli/test/diagnostics:check_types
//packages/compiler-cli/test/diagnostics:expression_diagnostics
//packages/compiler-cli/test/transformers:test
//packages/core/test/bundling/cyclic_import:symbol_test
//packages/core/test/bundling/cyclic_import:test
//packages/core/test/bundling/hello_world:symbol_test
//packages/core/test/bundling/hello_world:test
//packages/core/test/bundling/todo:symbol_test
//packages/core/test/bundling/todo:test
//packages/core/test/bundling/todo_i18n:test
//packages/core/test/bundling/todo_r2:test
//packages/language-service/test:test

@mhevery mhevery self-assigned this Mar 19, 2019

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

// clang-format on
import {ResourceLoader} from '@angular/compiler';
import {ApplicationInitStatus, COMPILER_OPTIONS, Compiler, CompilerOptions, Component, Directive, ErrorHandler, InjectFlags, InjectionToken, Injector, ModuleWithComponentFactories, NgModule, NgModuleFactory, NgZone, Pipe, PlatformRef, Provider, SchemaMetadata, StaticProvider, Type, resolveForwardRef, ɵInjectableDef as InjectableDef, ɵNG_COMPONENT_DEF as NG_COMPONENT_DEF, ɵNG_DIRECTIVE_DEF as NG_DIRECTIVE_DEF, ɵNG_INJECTOR_DEF as NG_INJECTOR_DEF, ɵNG_MODULE_DEF as NG_MODULE_DEF, ɵNG_PIPE_DEF as NG_PIPE_DEF, ɵNgModuleDef as NgModuleDef, ɵNgModuleFactory as R3NgModuleFactory, ɵNgModuleType as NgModuleType, ɵRender3ComponentFactory as ComponentFactory, ɵRender3NgModuleRef as NgModuleRef, ɵcompileComponent as compileComponent, ɵcompileDirective as compileDirective, ɵcompileNgModuleDefs as compileNgModuleDefs, ɵcompilePipe as compilePipe, ɵflushModuleScopingQueueAsMuchAsPossible as flushModuleScopingQueueAsMuchAsPossible, ɵgetInjectableDef as getInjectableDef, ɵpatchComponentDefWithScope as patchComponentDefWithScope, ɵresetCompiledComponents as resetCompiledComponents, ɵstringify as stringify, ɵtransitiveScopesFor as transitiveScopesFor} from '@angular/core';

This comment has been minimized.

Copy link
@mhevery

mhevery Mar 21, 2019

Member

Why did you reformat this? Can you revert?

This comment has been minimized.

Copy link
@Goodwine

Goodwine Apr 3, 2019

Author Contributor

This changed because 2 types were added (InjectFlags, InjectionToken) and the format script updated this "changed lines", a recent patch added clang-off so I guess it's not changing anymore (?)

Anyways, done :)

fix(core): Deprecate TestBed.get(...):any
Adds an overload to TestBed.get making parameters strongly typed and
deprecated previous signature that accepted types `any`. The function
still returns `any` to prevent build breakages, but eventually stronger
type checks will be added so a future Angular version will break builds
due to additional type checks.
See previous breaking change - #13785

Issue #26491

@Goodwine Goodwine force-pushed the Goodwine:deprecate-testbed-get branch from b5849e5 to 4e2620c Apr 3, 2019

@Goodwine

This comment has been minimized.

Copy link
Contributor Author

commented Apr 3, 2019

@mhevery

mhevery approved these changes Apr 4, 2019

@IgorMinar IgorMinar closed this in 609024f Apr 4, 2019

@Goodwine Goodwine deleted the Goodwine:deprecate-testbed-get branch Apr 4, 2019

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

fix(core): Deprecate TestBed.get(...):any (angular#29290)
Adds an overload to TestBed.get making parameters strongly typed and
deprecated previous signature that accepted types `any`. The function
still returns `any` to prevent build breakages, but eventually stronger
type checks will be added so a future Angular version will break builds
due to additional type checks.
See previous breaking change - angular#13785

Issue angular#26491

PR Close angular#29290

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

fix(core): Deprecate TestBed.get(...):any (angular#29290)
Adds an overload to TestBed.get making parameters strongly typed and
deprecated previous signature that accepted types `any`. The function
still returns `any` to prevent build breakages, but eventually stronger
type checks will be added so a future Angular version will break builds
due to additional type checks.
See previous breaking change - angular#13785

Issue angular#26491

PR Close angular#29290

cexbrayat added a commit to cexbrayat/angular that referenced this pull request May 16, 2019

fix(core): remove deprecated annotation for TestBed.get
PR angular#29290 introduced a new `TestBed.get` signature and deprecated the existing one.
This raises a lot of TSLint deprecation warnings in projects using a strict TS config (see angular#29905 for context), so we are temporarily removing the `@deprecated` annotation in favor of a plain text warning until we properly fix it.

Fixes angular#29905
Fixes FW-1336

@cexbrayat cexbrayat referenced this pull request May 16, 2019

Closed

fix(core): remove deprecated annotation for TestBed.get #30514

3 of 14 tasks complete

cexbrayat added a commit to cexbrayat/angular that referenced this pull request May 16, 2019

fix(core): remove deprecated annotation for TestBed.get
PR angular#29290 introduced a new `TestBed.get` signature and deprecated the existing one.
This raises a lot of TSLint deprecation warnings in projects using a strict TS config (see angular#29905 for context), so we are temporarily removing the `@deprecated` annotation in favor of a plain text warning until we properly fix it.

Fixes angular#29905
Fixes FW-1336

cexbrayat added a commit to cexbrayat/angular that referenced this pull request May 17, 2019

fix(core): remove deprecated annotation for TestBed.get
PR angular#29290 introduced a new `TestBed.get` signature and deprecated the existing one.
This raises a lot of TSLint deprecation warnings in projects using a strict TS config (see angular#29905 for context), so we are temporarily removing the `@deprecated` annotation in favor of a plain text warning until we properly fix it.

Fixes angular#29905
Fixes FW-1336

cexbrayat added a commit to cexbrayat/angular that referenced this pull request May 18, 2019

fix(core): temporarily remove @deprecated jsdoc tag for a TextBed.get…
… overload

PR angular#29290 introduced a new `TestBed.get` signature and deprecated the existing one.
This raises a lot of TSLint deprecation warnings in projects using a strict TS config (see angular#29905 for context), so we are temporarily removing the `@deprecated` annotation in favor of a plain text warning until we properly fix it.

Refs angular#29905
Fixes FW-1336

jasonaden added a commit that referenced this pull request May 21, 2019

fix(core): temporarily remove @deprecated jsdoc tag for a TextBed.get…
… overload (#30514)

PR #29290 introduced a new `TestBed.get` signature and deprecated the existing one.
This raises a lot of TSLint deprecation warnings in projects using a strict TS config (see #29905 for context), so we are temporarily removing the `@deprecated` annotation in favor of a plain text warning until we properly fix it.

Refs #29905
Fixes FW-1336

PR Close #30514

jasonaden added a commit that referenced this pull request May 21, 2019

fix(core): temporarily remove @deprecated jsdoc tag for a TextBed.get…
… overload (#30514)

PR #29290 introduced a new `TestBed.get` signature and deprecated the existing one.
This raises a lot of TSLint deprecation warnings in projects using a strict TS config (see #29905 for context), so we are temporarily removing the `@deprecated` annotation in favor of a plain text warning until we properly fix it.

Refs #29905
Fixes FW-1336

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