Skip to content

Commit

Permalink
Add necessary constraints to is-function types for typescript to asse…
Browse files Browse the repository at this point in the history
…rt instanceof

Fixes #65
  • Loading branch information
NilSet committed May 27, 2023
1 parent be45fd5 commit 281dca2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions function.js
Expand Up @@ -167,15 +167,15 @@ export const isString = (s) => s && s.constructor === String
export const isNumber = n => n != null && n.constructor === Number

/**
* @template TYPE
* @template {abstract new (...args: any) => any} TYPE
* @param {any} n
* @param {TYPE} T
* @return {n is InstanceType<TYPE>}
*/
export const is = (n, T) => n && n.constructor === T

/**
* @template TYPE
* @template {abstract new (...args: any) => any} TYPE
* @param {TYPE} T
*/
export const isTemplate = (T) =>
Expand Down

0 comments on commit 281dca2

Please sign in to comment.