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 { Dispatcher } from './store'; | |
export default Vue.component('some-component', { | |
template, | |
created() { | |
this.fetchData(); | |
}, | |
methods: { | |
/** | |
* Fetch our data. |
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
/** | |
* Typings for Folktale data.task | |
*/ | |
declare module 'data.task' { | |
type Action<T> = (t: T) => void; | |
type Func<A, B> = (a: A) => B; | |
class Task<E, A> { | |
constructor( | |
callback: ( |
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
declare module 'control.async' { | |
import Task = require('data.task'); | |
function parallel<E1, A>( | |
tasks: [Task<E1, A>] | |
): Task<E1, [A]>; | |
function parallel<E1, E2, A, B>( | |
tasks: [Task<E1, A>, Task<E2, B>] | |
): Task<E1 | E2, [A, B]>; | |
function parallel<E1, E2, E3, A, B, C>( |
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": [ |
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
#!/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
/** | |
* 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
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
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
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) | |
} |
OlderNewer