Skip to content

Commit

Permalink
refactor(upgrade): ensure compatibility with typescript strict flag (a…
Browse files Browse the repository at this point in the history
…ngular#30993)

As part of FW-1265, the `@angular/upgrade` package is made compatible
with the TypeScript `--strict` flag. Read more about the strict flag [here](https://www.typescriptlang.org/docs/handbook/compiler-options.html)

PR Close angular#30993
  • Loading branch information
devversion authored and sabeersulaiman committed Sep 6, 2019
1 parent e761291 commit 2ccd491
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
4 changes: 1 addition & 3 deletions packages/upgrade/src/common/src/angular1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,7 @@ export interface ITranscludeFunction {
// If one argument is provided, then it's assumed to be the cloneAttachFn.
(cloneAttachFn?: ICloneAttachFunction): IAugmentedJQuery;
}
export interface ICloneAttachFunction {
(clonedElement: IAugmentedJQuery, scope: IScope): any;
}
export interface ICloneAttachFunction { (clonedElement: IAugmentedJQuery, scope: IScope): any; }
export type IAugmentedJQuery = Node[] & {
on?: (name: string, fn: () => void) => void;
data?: (name: string, value?: any) => any;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export function createWithEachNg1VersionFn(setNg1: typeof setAngularJSGlobal) {
delete win.angular;
});

methodsToPatch.forEach(method => win[method](function() {
methodsToPatch.forEach(method => win[method](function(this: unknown) {
// Run the captured callbacks. (Async callbacks not supported.)
methodCallbacks[method].forEach(cb => cb.call(this));
}));
Expand Down
6 changes: 3 additions & 3 deletions packages/upgrade/src/dynamic/src/upgrade_adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -537,8 +537,8 @@ export class UpgradeAdapter {
function(testabilityDelegate: ITestabilityService) {
const originalWhenStable: Function = testabilityDelegate.whenStable;
// Cannot use arrow function below because we need the context
const newWhenStable = function(callback: Function) {
originalWhenStable.call(this, function() {
const newWhenStable = function(this: unknown, callback: Function) {
originalWhenStable.call(this, function(this: unknown) {
const ng2Testability: Testability =
upgradeAdapter.moduleRef !.injector.get(Testability);
if (ng2Testability.isStable()) {
Expand Down Expand Up @@ -670,7 +670,7 @@ class ParentInjectorPromise {
*/
export class UpgradeAdapterRef {
/* @internal */
private _readyFn: ((upgradeAdapterRef?: UpgradeAdapterRef) => void)|null = null;
private _readyFn: ((upgradeAdapterRef: UpgradeAdapterRef) => void)|null = null;

public ng1RootScope: IRootScopeService = null !;
public ng1Injector: IInjectorService = null !;
Expand Down

0 comments on commit 2ccd491

Please sign in to comment.