Skip to content

Commit d011524

Browse files
committed
refactor(@angular-devkit/architect): remove usage of isPromise
The isPromise utility was only used in one place in create-job-handler.ts. It has been replaced with an inline check for thenables. The utility is now marked as deprecated in @angular-devkit/core.
1 parent 652c0fd commit d011524

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

packages/angular_devkit/architect/src/jobs/create-job-handler.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* found in the LICENSE file at https://angular.dev/license
77
*/
88

9-
import { BaseException, JsonValue, isPromise, logging } from '@angular-devkit/core';
9+
import { BaseException, JsonValue, logging } from '@angular-devkit/core';
1010
import {
1111
Observable,
1212
Observer,
@@ -27,6 +27,11 @@ import {
2727
JobOutboundMessageKind,
2828
} from './api';
2929

30+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
31+
function isPromise(obj: any): obj is Promise<any> {
32+
return !!obj && typeof obj.then === 'function';
33+
}
34+
3035
export class ChannelAlreadyExistException extends BaseException {
3136
constructor(name: string) {
3237
super(`Channel ${JSON.stringify(name)} already exist.`);

packages/angular_devkit/core/src/utils/lang.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
/**
1212
* Determine if the argument is shaped like a Promise
13+
*
14+
* @deprecated Use `typeof obj?.then === 'function'` instead.
1315
*/
1416
// eslint-disable-next-line @typescript-eslint/no-explicit-any
1517
export function isPromise(obj: any): obj is Promise<any> {

0 commit comments

Comments
 (0)