Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
pauldambra committed Nov 18, 2024
1 parent 5096dd8 commit 26fbddb
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/utils/type-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@ export const isUint8Array = function (x: unknown): x is Uint8Array {
// from a comment on http://dbj.org/dbj/?p=286
// fails on only one very rare and deliberate custom object:
// let bomb = { toString : undefined, valueOf: function(o) { return "function BOMBA!"; }};
export const isFunction = function (f: any): f is (...args: any[]) => any {
export const isFunction = function (x: unknown): x is (...args: any[]) => any {
// eslint-disable-next-line posthog-js/no-direct-function-check
return typeof f === 'function'
return typeof x === 'function'
}

export const isNativeFunction = function (f: any): f is (...args: any[]) => any {
return isFunction(f) && f.toString().indexOf('[native code]') !== -1
export const isNativeFunction = function (x: unknown): x is (...args: any[]) => any {
return isFunction(x) && x.toString().indexOf('[native code]') !== -1
}

// When angular patches functions they pass the above `isNativeFunction` check
export const isAngularZonePatchedFunction = function (f: any): boolean {
if (!isFunction(f)) {
export const isAngularZonePatchedFunction = function (x: unknown): boolean {
if (!isFunction(x)) {
return false
}
const prototypeKeys = Object.getOwnPropertyNames(f.prototype || {})
const prototypeKeys = Object.getOwnPropertyNames(x.prototype || {})
return prototypeKeys.some((key) => key.indexOf('__zone'))
}

Expand Down

0 comments on commit 26fbddb

Please sign in to comment.