I hereby claim:
- I am zoontek on github.
- I am zoontek (https://keybase.io/zoontek) on keybase.
- I have a public key ASAap_lL6Nf_OF1ZJQwaweIV1PFKNLtNkh3qlp6RlR9d0go
To claim this, I am signing this object:
$ brew install gnupg | |
$ brew install pinentry-mac | |
$ echo "pinentry-program $(which pinentry-mac)" >> ~/.gnupg/gpg-agent.conf | |
$ killall gpg-agent |
import { useSyncExternalStore } from "react"; | |
export type Atom<Value> = { | |
get: () => Value; | |
set: (value: Value | ((prevValue: Value) => Value)) => void; | |
subscribe: (callback: (value: Value) => void) => () => void; | |
reset: () => void; | |
}; | |
export const atom = <Value>(initialValue: Value): Atom<Value> => { |
import frenchkiss, { TranslationParams } from "frenchkiss"; | |
const en = { | |
"button.hello": "Hello", | |
}; | |
type TranslationKey = keyof typeof en; | |
const fr: { [key in TranslationKey]: string } = { |
// Libs internal | |
type Segment<T> = { | |
test: (value: unknown) => boolean; | |
parse: (string: string) => T; | |
stringify: (value: T) => string; | |
}; | |
const string: Segment<string> = { | |
test: (value) => typeof value === "string", |
type Key = string | number | symbol; | |
type ExhaustiveMatch<K extends Key, T> = Record<K, T>; | |
type PartialMatch<K extends Key, T> = Partial<Record<K, T>> & { _: T }; | |
export const match = <T, K extends Key = Key>( | |
key: K, | |
map: ExhaustiveMatch<K, T> | PartialMatch<K, T>, | |
): T => (map.hasOwnProperty(key) ? map[key] : (map as PartialMatch<K, T>)._) as T; |
type ReturnType<F> = F extends (...args: any[]) => infer R ? R : any; | |
type MemoizeResolver<F extends (...args: any[]) => any> = ( | |
...args: Parameters<F> | |
) => string; | |
type MemoizedFuntion<F extends (...args: any[]) => any> = (( | |
...args: Parameters<F> | |
) => ReturnType<F>) & { |
I hereby claim:
To claim this, I am signing this object: