You probably want to put this in your repo and run it via npx
and tsx
as such:
First make sure you have the dependencies with npm/yarn/pnpm. You need ignore
, lodash
and yargs
npx tsx src/scripts/serialize-repo.ts
function foo(a) { | |
console.log(a.b) | |
} | |
foo({}) |
function power2(a) { | |
return a * a; | |
} | |
power2('string') |
/** | |
* Create an input element | |
*/ | |
function createInput(type: 'text', value: string): HTMLInputElement; | |
function createInput(type: 'checkbox', value: boolean): HTMLInputElement; | |
function createInput(type, value) { | |
// code | |
} |
const input = createInput('checkbox', 'false') |
/** | |
* Create an input element | |
* @param {string} type | |
* @param {string|boolean} value | |
* @return {HTMLInputElement} | |
*/ | |
function createInput(type, value) { | |
const el = document.createElement('input'); | |
el.type = type; | |
if (type === 'checkbox') { |
import * as React from 'react'; | |
import { computed } from 'mobx'; | |
import { inject, observer, Provider } from 'mobx-react'; | |
import { fromPromise } from 'mobx-utils'; | |
import {StaticRouter} from 'react-router-dom'; | |
import { Request, Response } from 'express'; | |
import * as ReactDOM from 'react-dom/server'; | |
interface Item { | |
weight: number; |
import * as React from 'react'; | |
import { RouteComponentProps } from 'react-router-dom'; | |
interface LoadableProps<T> { | |
loader: (props: RouteComponentProps<T>) => (() => Promise<React.ComponentType<T>> | React.ComponentType<T>); | |
loading: React.ComponentType<T>; | |
} | |
export function Loadable<T>(loadableProps: LoadableProps<T>) { | |
return class LoadableComponent extends React.Component<RouteComponentProps<T>, { ResultComponent: React.ComponentType<T> }> { |
declare module 'mobx-remotedev' { | |
/** | |
* Connect MobX Remote Dev | |
* | |
* @param store observable or class to be monitored. In case you want to change its values | |
* (to time travel or cancel actions), you should export its result as in the example | |
* above (so we can extend the class). | |
* @param config Configuration | |
* | |
* @return store |
import {merge} from 'lodash'; | |
import {autorun} from 'mobx'; | |
// TODO: find a good polyfill for this | |
declare const URLSearchParams; | |
const routeMatcher = require("route-matcher").routeMatcher; | |
const createBrowserHistory = require('history/createBrowserHistory').default; | |
/* | |
* A store have to implement these two getters to be routable |