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
import React from 'react' | |
/** | |
* Custom hook to set single properties on state objects. | |
* | |
* e.g. | |
* const [state, setState] = useState({ name: 'John Doe' }) | |
* const setProp = useSetProp(setState) | |
* | |
* const setName = setProp('name') |
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
"resolutions": { | |
"**/@typescript-eslint/eslint-plugin": "^4.2.0", | |
"**/@typescript-eslint/parser": "^4.2.0", | |
"**/eslint-plugin-react-hooks": "^4.1.2" | |
} |
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
import React from 'react' | |
import { isError, useDependentState } from '../util' | |
import Bulma from '../bulma' | |
export type ValidatedValue< | |
TValue, | |
TRequired extends boolean | |
> = TRequired extends true ? TValue : TValue | null | |
export interface ValidatedInputProps<TValue, TRequired extends boolean> { |
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
type Tagged<T extends string> = { | |
type: T | |
} | |
export function switchExp< | |
T extends Tagged<string>, | |
M extends { [P in T['type']]: T extends Tagged<P> ? (t: T) => any : never } | |
>(value: T, map: M): ReturnType<M[keyof M]> { | |
return map[value.type as keyof M](value) | |
} |
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
export interface Spec<K extends string, T> { | |
ctr: (raw: string) => T, | |
key: K, | |
match: RegExp | |
} | |
type Data<T, D> = { | |
type: T | |
} & { [P in keyof D]: D[P] }; |
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
module Util.MVU | |
open Fable.Core | |
open Fable.React | |
type Dispatch<'msg> = 'msg -> unit | |
type Sub<'msg> = Dispatch<'msg> -> unit | |
type Cmd<'msg> = Sub<'msg> list |
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
/** | |
* Map discriminated union based on its tag value. | |
* Possible tag values are mapped to expressions | |
* that return a transformation of the original value. | |
* Each value is exhaustive checked such that a mapping | |
* has to be provided for each one. | |
* | |
* e.g. | |
* | |
* type Union = |
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
#!/usr/bin/env node | |
/** | |
* Script for scafolding a React + TypeScript app using | |
* ParcelJS as a bundler. | |
* | |
* - TypeScript | |
* - React | |
* - ParcelJS | |
* - Sass |
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
module 'draft-js-plugins-editor' { | |
import React from 'react'; | |
import { | |
CompositeDecorator, | |
DraftEditorCommand, | |
Editor, | |
EditorProps, | |
EditorState | |
} from 'draft-js'; |
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
// launch.json | |
{ | |
"type": "node", | |
"request": "launch", | |
"name": "Server build and debug", | |
"useWSL": true, | |
"program": "${workspaceFolder}/server/js/src/app.ts", | |
"cwd": "${workspaceFolder}/server", | |
"preLaunchTask": "npm-buildserver", | |
"outFiles": [ |