typescript-tuple
Advanced tools
Comparing version 3.0.0-rc.0 to 3.1.0-rc.0
@@ -168,1 +168,6 @@ import * as utils from './utils'; | ||
export declare type LongestTuple<TupleSet extends [any[], ...any[][]]> = utils.LongestTuple<TupleSet>; | ||
/** | ||
* Filter tuple elements thats match the mask | ||
* @example FilterTuple<[1, 2, true, '3'], string | number> → [1, 2, "3"] | ||
*/ | ||
export declare type FilterTuple<TupleSet extends any[], Mask> = utils.FilterTuple<TupleSet, Mask>; |
@@ -125,1 +125,4 @@ import { Extends, Equal } from 'typescript-compare'; | ||
}[TupleSet extends [] ? 'empty' : 'nonEmpty']; | ||
export declare type FilterTuple<Tuple extends any[], Mask> = ConcatMultiple<{ | ||
[K in keyof Tuple]: Tuple[K] extends Mask ? [Tuple[K]] : []; | ||
}>; |
{ | ||
"name": "typescript-tuple", | ||
"version": "3.0.0-rc.0", | ||
"version": "3.1.0-rc.0", | ||
"description": "Generics to work with tuples in TypeScript", | ||
@@ -35,3 +35,3 @@ "main": "index.js", | ||
"devDependencies": { | ||
"typescript": "^3.1.1", | ||
"typescript": "~3.1.1", | ||
"tslint": "^5.11.0", | ||
@@ -38,0 +38,0 @@ "tslint-config-standard": "^8.0.1", |
@@ -349,4 +349,16 @@ # TypeScript Tuple | ||
### `FilterTuple` | ||
```typescript | ||
import { FilterTuple } from 'typescript-tuple' | ||
type Foo = FilterTuple<[1, '1'], number> // Expect: [1] | ||
const foo: Foo = [1] | ||
type Bar = FilterTuple<[1, '1', null, true], 1 | '1' | true> // Expect: [1, '1', true] | ||
const bar: Bar = [1, '1', true] | ||
``` | ||
## License | ||
[MIT](https://git.io/fA2d9) @ [Hoàng Văn Khải](https://github.com/KSXGitHub) |
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
59233
10
307
364