Skip to content

Commit

Permalink
Merge pull request #108 from andnp/Fix-KeysByType
Browse files Browse the repository at this point in the history
Fix keys by type
  • Loading branch information
andnp authored Jun 25, 2019
2 parents 92a9ca8 + 5905cf5 commit b166733
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 62 deletions.
51 changes: 0 additions & 51 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ test('Can get all keys between objects', t => {
assert<got, expected>(t);
assert<expected, got>(t);
});

```

### AllRequired
Expand All @@ -80,7 +79,6 @@ test('Can make all fields of options object required (not optional and not nulla
assert<got, expected>(t);
assert<expected, got>(t);
});

```

### CombineObjects
Expand All @@ -102,7 +100,6 @@ test('Can combine two objects (without pesky & in vscode)', t => {
assert<got, expected>(t);
assert<expected, got>(t);
});

```

### DeepPartial
Expand Down Expand Up @@ -169,7 +166,6 @@ test('Can get a deep partial object with functions', t => {
assert<got, expected>(t);
assert<expected, got>(t);
});

```

### DeepReadonly
Expand Down Expand Up @@ -216,7 +212,6 @@ test('Can make an object with functions readonly', t => {
assert<got, expected>(t);
assert<expected, got>(t);
});

```

### DiffKeys
Expand All @@ -234,7 +229,6 @@ test('Can get all keys that are different between objects', t => {
assert<gotA, 'x'>(t);
assert<gotB, 'z'>(t);
});

```

### GetKey
Expand All @@ -259,7 +253,6 @@ test('Will get `never` if key does not exist', t => {
assert<got, expected>(t);
assert<expected, got>(t);
});

```

### HasKey
Expand All @@ -280,7 +273,6 @@ test('Can get an object with only shared properties', t => {
assert<got, expected>(t);
assert<expected, got>(t);
});

```

### KeysByType
Expand All @@ -299,7 +291,6 @@ test('Can filter object keys by right side type', t => {
assert<got, expected>(t);
assert<expected, got>(t);
});

```

### Merge
Expand Down Expand Up @@ -329,7 +320,6 @@ test('Can merge an object containing all strings as keys', t => {
assert<got, expected>(t);
assert<expected, got>(t);
});

```

### ObjectKeys
Expand All @@ -353,7 +343,6 @@ test('Can turn an object into another object', t => {
assert<got, expected>(t);
assert<expected, got>(t);
});

```

### Omit
Expand All @@ -369,7 +358,6 @@ test('Can omit keys from an object', t => {
assert<got, expected>(t);
assert<expected, got>(t);
});

```

### Optional
Expand All @@ -384,7 +372,6 @@ test('Can make properties optional', t => {
assert<got, expected>(t);
assert<expected, got>(t);
});

```

### Overwrite
Expand All @@ -403,7 +390,6 @@ test('Can overwrite properties on an object', t => {
assert<got2, expected>(t);
assert<expected, got2>(t);
});

```

### PlainObject
Expand Down Expand Up @@ -433,7 +419,6 @@ test('Can make certain fields of options object required', t => {
assert<got2, expected2>(t);
assert<got3, expected3>(t);
});

```

### SharedKeys
Expand All @@ -449,7 +434,6 @@ test('Can get keys that are same between objects', t => {
assert<got, expected>(t);
assert<expected, got>(t);
});

```

### StrictUnion
Expand All @@ -474,7 +458,6 @@ test('disallow union members with mixed properties', t => {
assert<isStrict<nonStrictUnion>, 'No'>(t);

});

```

### StringKeys
Expand All @@ -500,7 +483,6 @@ test('Can get a union of all values in an object', t => {
assert<got, expected>(t);
assert<expected, got>(t);
});

```

### UnionKeys
Expand All @@ -517,7 +499,6 @@ test('Can get all keys between objects in a union', t => {
assert<got, expected>(t);
assert<expected, got>(t);
});

```

## Utils
Expand Down Expand Up @@ -557,7 +538,6 @@ test("cannot be used to prevent a distributive conditional from distributing", t
assert<Test, "Yes" | "No">(t);
assert<"Yes" | "No", Test>(t);
});

```

### NoInfer
Expand All @@ -573,7 +553,6 @@ test('Will not infer based on second argument', t => {
assert<typeof x, 'hi'>(t);
assert<typeof x, number>(t);
});

```

### Nominal
Expand All @@ -586,7 +565,6 @@ test('Can make a new nominal type', t => {
// TODO: improve once negative testing is in place
assert<Id, Nominal<string, 'id'>>(t);
});

```

### Nullable
Expand All @@ -604,7 +582,6 @@ test('Will make a type not nullable', t => {

assert<got, string>(t);
});

```

### PromiseOr
Expand All @@ -616,7 +593,6 @@ test('Will give back a promise containing given type union the type itself', t =

assert<got, expected>(t);
});

```

### UnionToIntersection
Expand All @@ -640,7 +616,6 @@ test('Union of Objects', t => {

assert<got, expected>(t);
});

```

## Functions
Expand All @@ -659,7 +634,6 @@ test('Can define the type of a function that takes any arguments', t => {
assert<got, expected>(t);
assert<got2, expected2>(t);
});

```

### ArgsAsTuple
Expand All @@ -681,7 +655,6 @@ test("Can get a tuple of function's argument types", t => {
assert<ArgsAsTuple<F2>, E2>(t);
assert<ArgsAsTuple<F3>, E3>(t);
});

```

### ConstructorFunction
Expand All @@ -693,7 +666,6 @@ test('Can build a constructor type for a type', t => {

assert<Constructor, typeof Thing>(t);
});

```

### OverwriteReturn
Expand All @@ -708,8 +680,6 @@ test('Can change return type of a function', t => {
assert<got, expected>(t);
assert<expected, got>(t);
});


```

### Predicate
Expand All @@ -721,7 +691,6 @@ test('Can build a predicate function with single known argument type', t => {

assert<PredFunc, expected>(t);
});

```

## Strings
Expand All @@ -737,7 +706,6 @@ test('Can remove a string from a union of strings', t => {
assert<DropString<b, 'hey' | 'there'>, never>(t);
assert<DropString<a, 'hi' | 'there'>, never>(t);
});

```

### StringEqual
Expand All @@ -752,7 +720,6 @@ test('Can check that two unions of strings are equal', t => {
assert<StringEqual<b, a>, True>(t);
assert<StringEqual<b, c>, False>(t);
});

```

### UnionContains
Expand All @@ -773,7 +740,6 @@ test('Can get the intersection of tuple values', t => {
assert<got, expected>(t);
assert<expected, got>(t);
});

```

### Length
Expand All @@ -789,7 +755,6 @@ test('Can get the length of a tuple', t => {
assert<gotX, 2>(t);
assert<gotT, 4>(t);
});

```

### UnionizeTuple
Expand All @@ -804,7 +769,6 @@ test('Can get a union of all values in tuple', t => {
assert<got, expected>(t);
assert<expected, got>(t);
});

```

## Numbers
Expand All @@ -816,7 +780,6 @@ test('Can add two numbers', t => {
type fifty = Add<12, 38>;
assert<fifty, 50>(t);
});

```

### IsOne
Expand All @@ -828,7 +791,6 @@ test('Can check if a number is one', t => {
assert<notOne, False>(t);
assert<one, True>(t);
});

```

### IsZero
Expand All @@ -840,7 +802,6 @@ test('Can check if a number is zero', t => {
assert<notZero, False>(t);
assert<zero, True>(t);
});

```

### Next
Expand All @@ -856,7 +817,6 @@ test('Can check if two numbers are equal', t => {
assert<notEqual, False>(t);
assert<equal, True>(t);
});

```

### Numbers
Expand All @@ -870,7 +830,6 @@ test('Can get a number as a string', t => {
type str = NumberToString<22>;
assert<str, '22'>(t);
});

```

### Prev
Expand All @@ -884,7 +843,6 @@ test('Can subtract two numbers', t => {
type ten = Sub<22, 12>;
assert<ten, 10>(t);
});

```

## Conditionals
Expand All @@ -904,7 +862,6 @@ test('Conditions can be based on AND', t => {
assert<gotTF, string>(t);
assert<gotTT, number>(t);
});

```

### If
Expand All @@ -918,7 +875,6 @@ test('Can assign type conditionally', t => {
assert<gotF, string>(t);
assert<gotT, number>(t);
});

```

### Nand
Expand All @@ -930,7 +886,6 @@ test('Conditions can be based on NAND', t => {
assert<Nand<True, False>, True>(t);
assert<Nand<False, False>, True>(t);
});

```

### Not
Expand All @@ -944,7 +899,6 @@ test('Conditional logic can be inversed with NOT', t => {
assert<gotF, number>(t);
assert<gotT, string>(t);
});

```

### Or
Expand All @@ -962,7 +916,6 @@ test('Conditions can be based on OR', t => {
assert<gotTF, number>(t);
assert<gotTT, number>(t);
});

```

### Xor
Expand All @@ -974,7 +927,6 @@ test('Conditions can be based on XOR', t => {
assert<Xor<True, False>, True>(t);
assert<Xor<False, False>, False>(t);
});

```

## Predicates
Expand Down Expand Up @@ -1049,7 +1001,6 @@ test('Can check if an object contains a key', t => {
t.fail();
}
});

```

### objectKeys
Expand All @@ -1067,7 +1018,6 @@ test('Can get keys of an object', t => {

t.deepEqual(keys, ['a', 'b']);
});

```

### Readonly
Expand Down Expand Up @@ -1098,6 +1048,5 @@ test('Can generate a tagged object', t => {
assert<typeof expected, typeof got>(t);

});

```

Loading

0 comments on commit b166733

Please sign in to comment.