ts-toolbelt
Advanced tools
Comparing version 9.5.3 to 9.5.4-test.1614866345270
@@ -5,2 +5,18 @@ # Changelog | ||
### [9.5.4](https://github.com/millsp/ts-toolbelt/compare/v9.5.1...v9.5.4) (2021-03-04) | ||
### Bug Fixes | ||
* **f.narrow:** fix variance and array inference ([4c7618d](https://github.com/millsp/ts-toolbelt/commit/4c7618d77b07d6b8c6dfd5087aa85a073bf57db3)) | ||
* **f.narrow:** variance ([866ecd7](https://github.com/millsp/ts-toolbelt/commit/866ecd76744fc38244d85e7ef7b4bb90105cf7eb)) | ||
* **fn:** allow for curried in compose ([2bc5604](https://github.com/millsp/ts-toolbelt/commit/2bc560446916b423977c25e396b4f1f310b6c03f)) | ||
### Others | ||
* cleanup ([6f23f2e](https://github.com/millsp/ts-toolbelt/commit/6f23f2ec79145a0545eb45d15d50d0363a119b12)) | ||
* **release:** 9.5.2 ([ec4a953](https://github.com/millsp/ts-toolbelt/commit/ec4a953cabe6c4d704c0dca5f37d1dc630de047b)) | ||
* **release:** 9.5.3 ([0836f6e](https://github.com/millsp/ts-toolbelt/commit/0836f6e8187287a0c86f249e4e552d68a44e4f60)) | ||
### [9.5.3](https://github.com/millsp/ts-toolbelt/compare/v9.5.1...v9.5.3) (2021-03-02) | ||
@@ -7,0 +23,0 @@ |
import { Boolean } from '../Boolean/_Internal'; | ||
export declare type If<B extends Boolean, Then, Else = never> = { | ||
0: Else; | ||
1: Then; | ||
}[B]; | ||
export declare type If<B extends Boolean, Then, Else = never> = B extends 1 ? Then : Else; |
@@ -16,2 +16,2 @@ /** | ||
*/ | ||
export declare type Narrowable = string | number | bigint | boolean; | ||
export declare type Narrowable = string | number | bigint | boolean | []; |
@@ -1,16 +0,11 @@ | ||
import { Cast } from '../Any/Cast'; | ||
import { Extends } from '../Any/Extends'; | ||
import { If } from '../Any/If'; | ||
import { Narrowable } from './_Internal'; | ||
/** | ||
* Basic type helper | ||
* @hidden | ||
*/ | ||
declare type NarrowRaw<A> = [] | (A extends Narrowable ? A : never) | ({ | ||
declare type NarrowRaw<A> = (A extends Narrowable ? A : never) | ({ | ||
[K in keyof A]: NarrowRaw<A[K]>; | ||
}); | ||
/** | ||
* Enforce proper variance | ||
* @hidden | ||
*/ | ||
declare type NarrowVar<A, N = NarrowRaw<A>> = N | Cast<A, N>; | ||
/** | ||
* Prevent type widening on generic function parameters | ||
@@ -23,3 +18,3 @@ * @param A to narrow | ||
* | ||
* declare function foo<A extends any[]>(x: F.Narrow<A>): A; | ||
* declare function foo<A extends any[]>(x: F.Narrow<A | []>): A; | ||
* declare function bar<A extends object>(x: F.Narrow<A>): A; | ||
@@ -34,3 +29,3 @@ * | ||
*/ | ||
declare type Narrow<A extends any> = NarrowVar<A>; | ||
declare type Narrow<A extends any> = NarrowRaw<If<Extends<A, any[]>, A | [], A>>; | ||
export { Narrow }; |
{ | ||
"name": "ts-toolbelt", | ||
"version": "9.5.3", | ||
"version": "9.5.4-test.1614866345270", | ||
"description": "TypeScript's largest utility library", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
249413
6028
1