Skip to content

Instantly share code, notes, and snippets.

View mattiamanzati's full-sized avatar
💭
undefined is not a function

Mattia Manzati mattiamanzati

💭
undefined is not a function
View GitHub Profile
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>
type Override<T, K extends keyof T, V> = Omit<T, K> & { [N in K]: V }
type AnyStateConfig = {
type: "initial" | "state" | "final"
states: {[K: string]: AnyStateConfig}
}
type EmptyStateConfig = {
type: "state"
import * as t from "io-ts"
import {taskEither, TaskEither} from "fp-ts/lib/TaskEither"
import {Either, either} from "fp-ts/lib/Either"
import { Task } from 'fp-ts/lib/Task';
export type IFieldObserver<T> = (newValue: T) => TaskEither<any, void>
export type IFieldInterceptor<T> = (newValue: T) => TaskEither<any, T>
export interface IDisposer extends TaskEither<void, void>{}
import { Task, task, sequence, array } from "./fp-ts"
import { identity } from "fp-ts/lib/function";
/**
* Gli `Scope` sono strutture di supporto per l'esecuzione sequenziale di `Task` asincroni.
*
* Lo scope si inizializza, si compone di una serie di `let`, `for` e `do` e termina la propria vita a seguito di un `return`.
* Tutte le istruzioni dello `Scope` sono garantite di essere eseguite sequenzialmente.
* @param T Il tipo dei valori dello Scope indicizzato per nome
*/
type True = 'true'
type False = 'false'
type Bool = True | False
type If<B extends Bool, IfTrue, IfFalse> = {
true: IfTrue
false: IfFalse
}[B]
Questo giovedì si terrà il workshop collegato all'Universal JS Day dedicato a React Native!
Il workshop avrà inizio a partire dalle ore 10:00, proseguirà fino alle ore 13:00, si fermerà per una pausa pranzo, e proseguirà dalle ore 14:00 fino alle ore 18:00 circa.
-- Materiale necessario --
- Computer portatile
- Un dispositivo Android o iOS
- Node.js installato
- git installato
- Atom, Visual Studio Code, Sublime Text o un altro editor installato
- Android Studio se si vuole fare la build su Android (non necessario)
import { TaskEither } from "fp-ts/lib/TaskEither";
import * as ts from "typescript";
type SyntaxKindToValueType = {
[ts.SyntaxKind.StringLiteral]: string;
[ts.SyntaxKind.NumericLiteral]: number;
};
type NumericStringToNumer<N extends string> = ({
"8": 8
import * as ts from "typescript";
import { taskEither, TaskEither, left, right } from "fp-ts/lib/TaskEither";
import { task, Task } from "fp-ts/lib/Task";
import { left as eitherLeft, right as _eitherRight, Either } from "fp-ts/lib/Either";
import { sequence } from "fp-ts/lib/Traversable"
import { array } from "fp-ts/lib/Array"
export type INode = ts.StringLiteral | ts.NumericLiteral | ts.BinaryExpression | ts.ExpressionStatement
export type IValue = string | number | boolean | any
import * as ts from "typescript";
import { taskEither, TaskEither, left, right } from "fp-ts/lib/TaskEither";
import { task, Task } from "fp-ts/lib/Task";
import { left as eitherLeft, right as _eitherRight, Either } from "fp-ts/lib/Either";
import { sequence } from "fp-ts/lib/Traversable"
import { array } from "fp-ts/lib/Array"
export type INode = ts.StringLiteral | ts.NumericLiteral | ts.BinaryExpression | ts.ExpressionStatement
export type IValue = string | number | boolean | any
import { Task, task, sequence, array } from "./fp-ts"
import { identity } from "fp-ts/lib/function";
/**
* Gli `Scope` sono strutture di supporto per l'esecuzione sequenziale di `Task` asincroni.
*
* Lo scope si inizializza, si compone di una serie di `let`, `for` e `do` e termina la propria vita a seguito di un `return`.
* Tutte le istruzioni dello `Scope` sono garantite di essere eseguite sequenzialmente.
*/
export interface IScope<T> {
import * as task from "fp-ts/lib/Task"
type IObserve<T> = (newValue: T) => task.Task<any>
type IIntercept<T> = (newValue: T) => task.Task<T>
function createAtom<T>(initialValue: T) {
let storedValue = initialValue
let observers: IObserve<T>[] = []
let interceptors: IIntercept<T>[] = []