Created
November 2, 2023 05:50
-
-
Save RhysSullivan/ce3ac16f0998b82234a25757ca1024ba to your computer and use it in GitHub Desktop.
This file contains 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
function makeBitfieldType<T extends readonly string[]>(values: T) { | |
return customType<{ | |
data: Record<T[number], boolean>; | |
}>({ | |
dataType() { | |
return `int`; | |
}, | |
// @ts-ignore | |
fromDriver(value: number) { | |
return bitfieldToDict(value, values); | |
}, | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment