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
extend type Order {
pay(id: ID!, amount: Float!): Boolean
}
import { IType, IExtendedObservableMap } from "mobx-state-tree"
import { IObservableArray } from "mobx"
type StringContains<S extends string, L extends string> = ({ [K in S]: "true" } & {
[key: string]: "false"
})[L]
interface IJSONSchemaBaseType {
$schema?: string
$id?: string
type StringContains<S extends string, L extends string> = ({ [K in S]: "true" } & {
[key: string]: "false"
})[L]
interface IJSONSchemaNumber {
type: "number"
}
interface IJSONSchemaInteger {
type: "integer"
import * as ts from "typescript"
import * as fs from "fs"
// given an import, returns if it imports the given module.
function createModuleImportMatcher(moduleName: string){
return (node: ts.Node): node is ts.ImportDeclaration =>
ts.isImportDeclaration(node) &&
ts.isStringLiteral(node.moduleSpecifier) &&
node.moduleSpecifier.text === moduleName
}
WITH mov_patologie AS (
SELECT
hh_zcal_movvac.codditt,
hh_zcal_movvac.mv_idcapo AS xx_idcapo,
hh_zcal_testvac.tv_data AS xx_data,
hh_zcal_movvac.mv_codpato AS xx_codpato
FROM hh_zcal_movvac
INNER JOIN hh_zcal_testvac
ON hh_zcal_testvac.codditt = hh_zcal_movvac.codditt
AND hh_zcal_testvac.tv_tipo = hh_zcal_movvac.mv_tipo
import { inject } from "mobx-react";
import * as React from "react";
import { ObjectOmit } from "typelevel-ts"; // We <3 You gcanti
function myInject<A, D extends keyof A>(
mapStoreToProps: (store: any) => Pick<A, D>,
component: React.ComponentType<A>
): React.SFC<ObjectOmit<A, D> & Partial<Pick<A, D>>>{
return inject(mapStoreToProps)(component as any)
}
// This is the store
import fetch from 'node-fetch';
import { types } from 'mobx-state-tree';
const UserModel = types.model(
'UserModel',
{
name: types.string,
bio: types.maybe(types.string),
avatar: types.string
import {createFactory, arrayOf, onPatch, getSnapshot, applySnapshot, onSnapshot, applyPatches, IModelFactory, unionOf, primitiveFactory} from 'mobx-state-tree'
const Patch = createFactory({
op: '',
path: '',
value: ''
})
function createForm(Factory){
const F = createFactory({
import {computed, observable, IObservableArray, extras, BaseAtom, _, intercept, IArrayWillChange, IArrayWillSplice, observe, asFlat} from 'mobx'
import {NodeType, NodeFactory, NodePatch} from '../core/interfaces'
import {Node, getNode} from '../core/node'
import {addHiddenFinalProp, createPatcher} from '../core/utils'
interface ObservableArrayAdministration<T>{
values: T[]
atom: BaseAtom
updateArrayLength(oldLength: number, delta: number)
}
// ...
// initial state
const initialState = {
left: CounterPair.reducer(),
right: CounterPair.reducer(),
count: 0
}
// listen to any action of subcomponents
const appReducer = createReducer(