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
| https://apps.apple.com/us/app/pianoteq-8/id1642344241 |
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
| import { useQuery, UseQueryOptions } from "@tanstack/react-query"; | |
| import { type ReactNode } from "react"; | |
| interface SuspenseQuery<TData> { | |
| queryOption: UseQueryOptions<T>; | |
| fallback?: ReactNode; | |
| pending?: ReactNode; | |
| children: (data: TData) => ReactNode; | |
| } |
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
| /** | |
| * Generate random string with specified length | |
| * Each generated letter will be from A to Z | |
| * | |
| * 65 = A | |
| * 90 = Z | |
| * A-Z = 25 | |
| * | |
| * @param length | |
| */ |
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
| export const enum PadOrder { | |
| Ascending, | |
| Descending, | |
| } | |
| export function pad( | |
| value: string, | |
| paddingChar: string, | |
| totalLength: number, | |
| accumulator: (p: string, v: string) => string |
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
| import type { RestApi } from './RestApi' | |
| /** | |
| * Immutable fluent fetch API | |
| * | |
| * @param baseUrl | |
| * @param urls | |
| * @param headers | |
| * @param params | |
| */ |
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
| export interface RestApi { | |
| url(url: string): this | |
| post(body?: BodyInit | null): Promise<Response> | |
| get(): Promise<Response> | |
| auth(value: string): this | |
| headers(key: string, value: string): this |
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
| import { Dispatch, useMemo, useReducer } from 'react' | |
| // useStateReducer action type | |
| type ActionType<S> = Partial<S> | ((params: S) => Partial<S>) | |
| // useStateReducer reducer type | |
| type Reducer<S> = (state: S, action: ActionType<S>) => S | |
| // Default reducer. Override the old value with the action | |
| export function stateReducer<S>(state: S, action: ActionType<S>): S { |
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 FetchParams = Parameters<typeof fetch> | |
| type FetchReturn = ReturnType<typeof fetch> | |
| export function fetchRetry( | |
| input: FetchParams[0], | |
| init?: FetchParams[1], | |
| retry: number = 0, | |
| delayMs: number = 1000 | |
| ): FetchReturn { | |
| return fetch(input, init).catch(error => { |
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
| // eslint-disable-next-line | |
| export type Prettify<T> = { [K in keyof T]: T[K] } & {} | |
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
| // https://github.com/total-typescript/shoehorn | |
| export type NoInfer<T> = [T][T extends any ? 0 : never]; | |
| export type DeepPartial<T> = T extends (...args: any[]) => unknown | |
| ? T | undefined | |
| : T extends object | |
| ? T extends ReadonlyArray<infer ItemType> | |
| ? ItemType[] extends T | |
| ? readonly ItemType[] extends T | |
| ? ReadonlyArray<DeepPartial<ItemType | undefined>> | |
| : Array<DeepPartial<ItemType | undefined>> |
NewerOlder