Skip to content

Commit

Permalink
format fix
Browse files Browse the repository at this point in the history
  • Loading branch information
angus-c committed Jul 18, 2022
1 parent ea725ea commit fc0ef7a
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions packages/array-group-by/index.tests.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
import groupBy from "./index";
import groupBy from './index';

// OK
const test1: { [key: string]: number[] } = groupBy([6.1, 4.2, 6.3], Math.floor);
const test2: { [key: string]: string[] } = groupBy(
["a", "b", "c", "aa", "bb", "cc"],
['a', 'b', 'c', 'aa', 'bb', 'cc'],
str => str.charAt(0)
);
const test3: { [key: string]: number[][] } = groupBy(
[[1], [2], [1, 2]],
arr => arr.length
);
const test4: {} = groupBy([], () => "a");
const test4: {} = groupBy([], () => 'a');
const test5: { [key: string]: Array<number | string> } = groupBy(
[1, 2, 3, "1", "2"],
[1, 2, 3, '1', '2'],
a => a
);
const test6 = groupBy(["a", "b", "c"], str => Symbol(str));
type K = "a" | "b";
const test6 = groupBy(['a', 'b', 'c'], str => Symbol(str));
type K = 'a' | 'b';
const test7: Record<K, number[]> = groupBy([1, 2, 3], v =>
v % 2 === 0 ? "a" : "b"
v % 2 === 0 ? 'a' : 'b'
);

// Not OK
Expand All @@ -29,7 +29,7 @@ groupBy();
// @ts-expect-error
groupBy({}, Math.floor);
// @ts-expect-error
groupBy("hello", Math.floor);
groupBy('hello', Math.floor);
// @ts-expect-error
groupBy(/hullo/, Math.floor);
// @ts-expect-error
Expand All @@ -38,11 +38,11 @@ groupBy(null, Math.floor);
groupBy(undefined, Math.floor);

// @ts-expect-error
groupBy(["a", "b", "c"], () => {});
groupBy(['a', 'b', 'c'], () => {});
// @ts-expect-error
groupBy(["a", "b", "c"], Math.floor);
groupBy(['a', 'b', 'c'], Math.floor);
// @ts-expect-error
groupBy(["a", "b", "c"], () => null);
groupBy(['a', 'b', 'c'], () => null);
// @ts-expect-error
groupBy([], {});
// @ts-expect-error
Expand All @@ -56,4 +56,4 @@ groupBy([], undefined);
// @ts-expect-error
groupBy([]);
// @ts-expect-error
groupBy<any, "good key">([], () => "bad key");
groupBy<any, 'good key'>([], () => 'bad key');

0 comments on commit fc0ef7a

Please sign in to comment.