Skip to content
This repository was archived by the owner on Aug 3, 2023. It is now read-only.

Commit 476fc67

Browse files
authored
Merge pull request #24 from ksxnodemodules/api-removal
Remove unusable APIs
2 parents b388ada + a669496 commit 476fc67

16 files changed

+2
-847
lines changed

README.md

Lines changed: 0 additions & 144 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,6 @@ type Baz = IsFinite<[0, 1, 2], 'finite', 'infinite'> // Expect: 'finite'
2323
const baz: Baz = 'finite'
2424
```
2525

26-
### `SplitInfiniteTuple`
27-
28-
```typescript
29-
import { SplitInfiniteTuple } from 'typescript-tuple'
30-
type Foo = SplitInfiniteTuple<[0, 1, 2, ...number[]]> // Expect: [[0, 1, 2], number[]]
31-
type FinitePart = Foo[0] // Expect: [0, 1, 2]
32-
type InfinitePart = Foo[1] // Expect: number[]
33-
const foo: Foo = [[0, 1, 2], Array<number>()]
34-
const finitePart: FinitePart = [0, 1, 2]
35-
const infinitePart: InfinitePart = Array<number>()
36-
```
37-
3826
### `First`
3927

4028
```typescript
@@ -59,126 +47,6 @@ type Foo = Tail<['a', 'b', 'c']> // Expect: ['b', 'c']
5947
const foo: Foo = ['b', 'c']
6048
```
6149

62-
### `FirstIndexEqual`
63-
64-
```typescript
65-
import { FirstIndexEqual } from 'typescript-tuple'
66-
67-
type Foo = FirstIndexEqual<'x', ['a', 'x', 'b', 'x']> // Expect: 1
68-
const foo: Foo = 1
69-
70-
type Bar = FirstIndexEqual<'x', ['a', 'b']> // Expect: never
71-
72-
type Baz = FirstIndexEqual<'x', ['a', 'b'], 'not found'> // Expect: 'not found'
73-
const baz: Baz = 'not found'
74-
```
75-
76-
### `FirstIndexSubset`
77-
78-
```typescript
79-
import { FirstIndexSubset } from 'typescript-tuple'
80-
81-
type Foo = FirstIndexSubset<string, [0, 'a', 1, 'b']> // Expect: 1
82-
const foo: Foo = 1
83-
84-
type Bar = FirstIndexSubset<string, [0, 1]> // Expect: never
85-
86-
type Baz = FirstIndexSubset<string, [0, 1], 'not found'> // Expect: 'not found'
87-
const baz: Baz = 'not found'
88-
```
89-
90-
### `FirstIndexSuperset`
91-
92-
```typescript
93-
import { FirstIndexSuperset } from 'typescript-tuple'
94-
95-
type Foo = FirstIndexSuperset<'x', [number, string, 0 | 1, 'x' | 'y']> // Expect: 1
96-
const foo: Foo = 1
97-
98-
type Bar = FirstIndexSuperset<'x', [number, 0 | 1]> // Expect: never
99-
100-
type Baz = FirstIndexSuperset<'x', [number, 0 | 1], 'not found'> // Expect: 'not found'
101-
const baz: Baz = 'not found'
102-
```
103-
104-
### `LastIndexEqual`
105-
106-
```typescript
107-
import { LastIndexEqual } from 'typescript-tuple'
108-
109-
type Foo = LastIndexEqual<'x', ['a', 'x', 'b', 'x']> // Expect: 3
110-
const foo: Foo = 3
111-
112-
type Bar = LastIndexEqual<'x', ['a', 'b']> // Expect: never
113-
114-
type Baz = LastIndexEqual<'x', ['a', 'b'], 'not found'> // Expect: 'not found'
115-
const baz: Baz = 'not found'
116-
```
117-
118-
### `LastIndexSubset`
119-
120-
```typescript
121-
import { LastIndexSubset } from 'typescript-tuple'
122-
123-
type Foo = LastIndexSubset<string, [0, 'a', 1, 'b']> // Expect: 3
124-
const foo: Foo = 3
125-
126-
type Bar = LastIndexSubset<string, [0, 1]> // Expect: never
127-
128-
type Baz = LastIndexSubset<string, [0, 1], 'not found'> // Expect: 'not found'
129-
const baz: Baz = 'not found'
130-
```
131-
132-
### `LastIndexSuperset`
133-
134-
```typescript
135-
import { LastIndexSuperset } from 'typescript-tuple'
136-
137-
type Foo = LastIndexSuperset<'x', [number, string, 0 | 1, 'x' | 'y']> // Expect: 3
138-
const foo: Foo = 3
139-
140-
type Bar = LastIndexSuperset<'x', [number, 0 | 1]> // Expect: never
141-
142-
type Baz = LastIndexSuperset<'x', [number, 0 | 1], 'not found'> // Expect: 'not found'
143-
const baz: Baz = 'not found'
144-
```
145-
146-
### `AllIndexesEqual`
147-
148-
```typescript
149-
import { AllIndexesEqual } from 'typescript-tuple'
150-
151-
type Foo = AllIndexesEqual<'x', ['a', 'x', 'b', 'x']> // Expect: [1, 3]
152-
const foo: Foo = [1, 3]
153-
154-
type Bar = AllIndexesEqual<'x', ['a', 'x', 'b', ...'x'[]]> // Expect: [1, ...3[]]
155-
const bar: Bar = [1, 3, 3, 3, 3]
156-
```
157-
158-
### `AllIndexesSubset`
159-
160-
```typescript
161-
import { AllIndexesSubset } from 'typescript-tuple'
162-
163-
type Foo = AllIndexesSubset<string, [0, 'a', 1, 'b']> // Expect: [1, 3]
164-
const foo: Foo = [1, 3]
165-
166-
type Bar = AllIndexesSubset<string, [0, 'a', 1, ...'b'[]]> // Expect: [1, ...3[]]
167-
const bar: Bar = [1, 3, 3, 3, 3]
168-
```
169-
170-
### `AllIndexesSuper`
171-
172-
```typescript
173-
import { AllIndexesSuper } from 'typescript-tuple'
174-
175-
type Foo = AllIndexesSuper<'x', [number, string, 0 | 1, 'x' | 'y']> // Expect: [1, 3]
176-
const foo: Foo = [1, 3]
177-
178-
type Bar = AllIndexesSuper<'x', [number, string, 0 | 1, ...'x'[]]> // Expect: [1, ...3[]]
179-
const bar: Bar = [1, 3, 3, 3, 3]
180-
```
181-
18250
### `Append`
18351

18452
```typescript
@@ -269,18 +137,6 @@ type Foo = SliceStartQuantity<[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 2, 4> // Expect [2
269137
const foo: Foo = [2, 3, 4, 5]
270138
```
271139

272-
### `SingleTupleSet`
273-
274-
```typescript
275-
import { SingleTupleSet } from 'typescript-tuple'
276-
277-
type Foo = SingleTupleSet<[0, 1, 2]> // Expect [[0], [1], [2]]
278-
const foo: Foo = [[0], [1], [2]]
279-
280-
type Bar = SingleTupleSet<'x'[]> // Expect ['x'][]
281-
const bar: Bar = Array<['x']>()
282-
```
283-
284140
### `FillTuple`
285141

286142
```typescript

lib/index.ts

Lines changed: 0 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,6 @@ import * as utils from './utils'
1010
export type IsFinite<Tuple extends any[], Finite = true, Infinite = false> =
1111
utils.IsFinite<Tuple, Finite, Infinite>
1212

13-
/**
14-
* Split an infinite tuple into a finite tuple and an array
15-
* @example SplitInfiniteTuple<[0, 1, 2, ...number[]]> → [[0, 1, 2], number[]]
16-
*/
17-
export type SplitInfiniteTuple<Tuple extends any[]> = utils.SplitInfiniteTuple<Tuple>
18-
1913
/**
2014
* Get type of first element
2115
* @example First<[0, 1, 2]> → 0
@@ -34,81 +28,6 @@ export type Last<Tuple extends any[]> = utils.Last<Tuple>
3428
*/
3529
export type Tail<Tuple extends any[]> = utils.Tail<Tuple>
3630

37-
/**
38-
* Find index of a type in tuple
39-
* @example FirstIndexEqual<'x', ['a', 'b', 'c', 'x', 'd']> → 3
40-
* @example FirstIndexEqual<'x', ['a', 'b', 'c']> → never
41-
* @example FirstIndexEqual<'x', ['a', 'b', 'c'], 'NotFound'> → 'NotFound'
42-
*/
43-
export type FirstIndexEqual<Type, Tuple extends any[], NotFound = never> =
44-
utils.FirstIndexEqual<Type, Tuple, NotFound>
45-
46-
/**
47-
* Find index of the first element in tuple that satifies a type
48-
* @example FirstIndexSubset<string, [true, false, 'x', 3]> → 2
49-
* @example FirstIndexSubset<string, [true, false, 0, 1]> → never
50-
* @example FirstIndexSubset<string, [true, false, 0, 1], 'NotFound'> → 'NotFound'
51-
*/
52-
export type FirstIndexSubset<Type, Tuple extends any[], NotFound = never> =
53-
utils.FirstIndexSubset<Type, Tuple, NotFound>
54-
55-
/**
56-
* Find index of the first element in tuple that satifies a type
57-
* @example FirstIndexSuperset<5, [boolean, string, number, object]> → 2
58-
* @example FirstIndexSuperset<5, [boolean, string, object]> → never
59-
* @example FirstIndexSuperset<5, [boolean, string, object], 'NotFound'> → 'NotFound'
60-
*/
61-
export type FirstIndexSuperset<Type, Tuple extends any[], NotFound = never> =
62-
utils.FirstIndexSuperset<Type, Tuple, NotFound>
63-
64-
/**
65-
* Find index of a type in tuple
66-
* @example LastIndexEqual<'x', ['a', 'b', 'c', 'x', 'd']> → 3
67-
* @example LastIndexEqual<'x', ['a', 'b', 'c']> → never
68-
* @example LastIndexEqual<'x', ['a', 'b', 'c'], 'NotFound'> → 'NotFound'
69-
*/
70-
export type LastIndexEqual<Type, Tuple extends any[], NotFound = never> =
71-
utils.LastIndexEqual<Type, Tuple, NotFound>
72-
73-
/**
74-
* Find index of the first element in tuple that satifies a type
75-
* @example LastIndexSubset<string, [true, false, 'x', 3]> → 2
76-
* @example LastIndexSubset<string, [true, false, 0, 1]> → never
77-
* @example LastIndexSubset<string, [true, false, 0, 1], 'NotFound'> → 'NotFound'
78-
*/
79-
export type LastIndexSubset<Type, Tuple extends any[], NotFound = never> =
80-
utils.LastIndexSubset<Type, Tuple, NotFound>
81-
82-
/**
83-
* Find index of the first element in tuple that satifies a type
84-
* @example LastIndexSuperset<5, [boolean, string, number, object]> → 2
85-
* @example LastIndexSuperset<5, [boolean, string, object]> → never
86-
* @example LastIndexSuperset<5, [boolean, string, object], 'NotFound'> → 'NotFound'
87-
*/
88-
export type LastIndexSuperset<Type, Tuple extends any[], NotFound = never> =
89-
utils.LastIndexSuperset<Type, Tuple, NotFound>
90-
91-
/**
92-
* Find all indexes of a type in tuple
93-
* @example AllIndexesEqual<'x', ['a', 'b', 'x', 'c', 'x', 'x']> → [2, 4, 5]
94-
*/
95-
export type AllIndexesEqual<Type, Tuple extends any[]> =
96-
utils._IndexesNormalize<utils._AllIndexesEqual<Type, Tuple>>
97-
98-
/**
99-
* Find all indexes of a type in tuple
100-
* @example AllIndexesSubset<string, [0, false, 'a', 1, 'b', 'c']> → [2, 4, 5]
101-
*/
102-
export type AllIndexesSubset<Type, Tuple extends any[]> =
103-
utils._IndexesNormalize<utils._AllIndexesSubset<Type, Tuple>>
104-
105-
/**
106-
* Find all indexes of a type in tuple
107-
* @example AllIndexesSuperset<'x', [number, boolean, string, 0, 'x', 'a' | 'b']> → [2, 4, 5]
108-
*/
109-
export type AllIndexesSuperset<Type, Tuple extends any[]> =
110-
utils._IndexesNormalize<utils._AllIndexesSuperset<Type, Tuple>>
111-
11231
/**
11332
* Add an element to the end of a tuple
11433
* @example Append<[0, 1, 2], 'new'> → [0, 1, 2, 'new']
@@ -165,13 +84,6 @@ export type SliceStartQuantity<
16584
Quantity extends number
16685
> = utils.SliceStartQuantity<Tuple, Start, Quantity>
16786

168-
/**
169-
* Create a set of tuple of single element
170-
* @example SingleTupleSet<[0, 1, 2]> → [[0], [1], [2]]
171-
* @example SingleTupleSet<[0, 1, 2, ...number[]]> → [[0], [1], [2], ...[number][]]
172-
*/
173-
export type SingleTupleSet<Types extends any[]> = utils.SingleTupleSet<Types>
174-
17587
/**
17688
* Fill a tuple of types
17789
* @example FillTuple<[0, 1, 2], 'x'> → ['x', 'x', 'x']

0 commit comments

Comments
 (0)