Skip to content

Commit f17d81b

Browse files
authored
Merge pull request #77 from buildo/fix-types
Remove TextColumns type
2 parents ee679e6 + db21bcf commit f17d81b

File tree

2 files changed

+1
-10
lines changed

2 files changed

+1
-10
lines changed

Diff for: src/Table/createTable.tsx

+1-7
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,6 @@ type SortFn<C extends ReadonlyArray<ColumnType<string, {}, any>>> = (
6666
b: Row<RowType<C>>
6767
) => number;
6868

69-
type TextColumns<C extends readonly any[]> = C extends readonly [infer Head, ...infer Tail]
70-
? Head extends ColumnType<string, {}, LocalizedString>
71-
? [Head, ...TextColumns<Tail>]
72-
: TextColumns<Tail>
73-
: [];
74-
7569
type SortingProps<C extends ReadonlyArray<ColumnType<string, {}, any>>> =
7670
| {
7771
customSorting?: never;
@@ -90,7 +84,7 @@ type SortingProps<C extends ReadonlyArray<ColumnType<string, {}, any>>> =
9084
type Props<C extends ReadonlyArray<ColumnType<string, {}, any>>> = {
9185
columns: C;
9286
data: ReadonlyArray<RowType<C>>;
93-
groupBy?: TextColumns<C>[number]["accessor"];
87+
groupBy?: C[number]["accessor"];
9488
noResultsTitle?: LocalizedString;
9589
noResultsDescription?: LocalizedString;
9690
} & SortingProps<C>;

Diff for: stories/Components/Table.stories.tsx

-3
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,5 @@ export const Grouped = createStory({
260260
}),
261261
] as const,
262262
data: exampleData,
263-
// NOTE(gabro): createStory messes up the type-inference of groupBy, given that this only happens
264-
// in the stories I don't think it's too important to fix properly
265-
// @ts-expect-error
266263
groupBy: "group",
267264
});

0 commit comments

Comments
 (0)