Created
May 12, 2025 15:11
-
-
Save binjospookie/21560e5da38d1fdf96beeb28dd3b0fed to your computer and use it in GitHub Desktop.
kek.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Type the `filterTable` function to take a Table, | |
* a list of column names, and to return a table that | |
* only contains columns with these names. | |
*/ | |
type FilterTable<Table, NameUnion> = TODO; | |
declare type UserTable = [ | |
{ name: 'firstName'; values: string[] }, | |
{ name: 'lastName'; values: string[] }, | |
{ name: 'age'; values: number[] }, | |
]; | |
type res1 = FilterTable<UserTable, 'age'>; | |
type res2 = FilterTable<UserTable, 'firstName' | 'lastName'>; | |
type res3 = FilterTable<UserTable, 'firstName' | 'age'> | |
type res4 = FilterTable<UserTable, ''> |
Author
binjospookie
commented
May 12, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment