types-ramda
Advanced tools
Comparing version 0.29.2 to 0.29.3
@@ -34,2 +34,8 @@ import { A, M } from 'ts-toolbelt'; | ||
/** | ||
* A conditional type to use with default values. (defaultTo, propOr, etc) | ||
* <created by @lax4mike> | ||
*/ | ||
export type DefaultTo<Fallback, Value> = (Value extends (null | undefined) ? Fallback | Exclude<Value, null | undefined> : Value); | ||
/** | ||
* Represents all objects evolvable with Evolver E | ||
@@ -106,2 +112,16 @@ * @param E | ||
/** | ||
* A Functor - a simple type representing a Functor that used `map` is the method prop name | ||
*/ | ||
export type FunctorMap<A> = { | ||
map<B>(fn: (a: A) => B): FunctorMap<B>; | ||
}; | ||
/** | ||
* A FantasyLand Functor - a simple type representing a Functor wiih the fantasy-land specific prop name | ||
*/ | ||
export type FunctorFantasyLand<A> = { | ||
['fantasy-land/map']<B>(fn: (a: A) => B): FunctorFantasyLand<B>; | ||
}; | ||
/** | ||
* R.any dispatches to `.any` of the second argument, if present. | ||
@@ -340,3 +360,3 @@ * This type infers the type of the first argument of that method and returns it | ||
// https://github.com/piotrwitek/utility-types/blob/df2502ef504c4ba8bd9de81a45baef112b7921d0/src/mapped-types.ts#L351-L362 | ||
export type ObjectHavingSome<Key extends string> = { | ||
export type ObjectHavingSome<Key extends PropertyKey> = { | ||
[K in Key]: { [P in K]: unknown }; | ||
@@ -420,2 +440,8 @@ }[Key]; | ||
/** | ||
* When you have a union type, `keyof T` is not sufficient | ||
* <created by @harris-miller> | ||
*/ | ||
export type KeysOfUnion<T> = T extends infer U ? keyof U : never; | ||
/** | ||
* If `T` is a union, `T[keyof T]` (cf. `map` and `values` in `index.d.ts`) contains the types of object values that are common across the union (i.e., an intersection). | ||
@@ -492,2 +518,22 @@ * Because we want to include the types of all values, including those that occur in some, but not all members of the union, we first define `ValueOfUnion`. | ||
/** | ||
* When you have `gt = <T extends Ord>(a: T, b: T) => boolean`, `a` and `b` are different strings, and `T` defaults to `string | ||
* However, `gt = <T extends Ord>(a: T) => (b: T) => boolean`, because `a` is evaluated without `b`, `T` is the literal of `a` | ||
* `WidenLiteral` exists to go from a literal type to its base type, eg | ||
* * `"foobar"` -> `string` | ||
* * `1` -> `number` | ||
* * `true` -> `boolean | ||
* @see https://stackoverflow.com/a/56333836/10107466 | ||
* | ||
* <created by @harris-miller> | ||
*/ | ||
export type WidenLiterals<T> = | ||
T extends boolean | ||
? boolean | ||
: T extends string | ||
? string | ||
: T extends number | ||
? number | ||
: T; | ||
/** | ||
* Recursively Update a deep property from a given path | ||
@@ -494,0 +540,0 @@ * |
{ | ||
"name": "types-ramda", | ||
"version": "0.29.2", | ||
"version": "0.29.3", | ||
"description": "Dedicated types library for ramda", | ||
@@ -5,0 +5,0 @@ "author": "Harris Miller <harrismillerconsulting@gmail.com>", |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
242686
6638