Add utility type for the values within a readonly array

This commit is contained in:
thepaperpilot 2022-08-14 01:53:20 -05:00
parent 21eb5409b4
commit e8ba3f1f88

View file

@ -1,5 +1,9 @@
export type WithRequired<T, K extends keyof T> = T & { [P in K]-?: T[P] }; export type WithRequired<T, K extends keyof T> = T & { [P in K]-?: T[P] };
export type ArrayElements<T extends ReadonlyArray<unknown>> = T extends ReadonlyArray<infer S>
? S
: never;
// Reference: // Reference:
// https://stackoverflow.com/questions/7225407/convert-camelcasetext-to-sentence-case-text // https://stackoverflow.com/questions/7225407/convert-camelcasetext-to-sentence-case-text
export function camelToTitle(camel: string): string { export function camelToTitle(camel: string): string {