refactor(upgrade): ensure compatibility with typescript strict flag (#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 #30993
This commit is contained in:
parent
0139b11227
commit
5bd12c5aa1
|
@ -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;
|
||||
|
|
|
@ -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));
|
||||
}));
|
||||
|
|
|
@ -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()) {
|
||||
|
@ -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 !;
|
||||
|
|
Loading…
Reference in New Issue