Skip to content

Commit

Permalink
📝 Note that isReadonlyOf and related are unstable
Browse files Browse the repository at this point in the history
  • Loading branch information
lambdalisue committed Feb 13, 2024
1 parent 55c2c68 commit 8f1b11a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions is/annotation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ type UnwrapOptionalOf<T> = T extends

/**
* Return `true` if the type of predicate function `x` is annotated as `Readonly`
*
* **This is unstable and may be removed in the future.**
*/
export function isReadonly<P extends Predicate<unknown>>(
x: P,
Expand All @@ -105,6 +107,8 @@ export function isReadonly<P extends Predicate<unknown>>(
/**
* Return an `Readonly` annotated type predicate function that returns `true` if the type of `x` is `T`.
*
* **This is unstable and may be removed in the future.**
*
* Note that this function does nothing but annotate the predicate function as `Readonly`.
*
* To enhance performance, users are advised to cache the return value of this function and mitigate the creation cost.
Expand Down Expand Up @@ -141,6 +145,8 @@ type IsReadonlyOfMetadata = {
/**
* Return an `Readonly` un-annotated type predicate function that returns `true` if the type of `x` is `T`.
*
* **This is unstable and may be removed in the future.**
*
* To enhance performance, users are advised to cache the return value of this function and mitigate the creation cost.
*
* ```ts
Expand Down

0 comments on commit 8f1b11a

Please sign in to comment.