Skip to content

Instantly share code, notes, and snippets.

View mateuszsokola's full-sized avatar

Mateush mateuszsokola

View GitHub Profile
const webpack = {
entry: './src/client/index.tsx',
output: {
filename: 'target/bundle.js',
},
devtool: 'source-map',
resolve: {
extensions: ['.ts', '.tsx', '.js', '.json'],
},
module: {
{
"compilerOptions": {
"outDir": "./target/",
"sourceMap": true,
"skipLibCheck": true,
"noImplicitAny": true,
"module": "commonjs",
"target": "es5",
"jsx": "react"
},
import * as React from "react";
export default class Hello extends React.Component {
render() {
return <h1>Hello!</h1>;
}
}
import * as React from "react";
import * as ReactDOM from "react-dom";
import Hello from "./components/Hello";
ReactDOM.render(
<Hello />,
document.getElementById("app")
);
/**
* Transpiles TypeScript to JavaScript code.
*
* @link https://github.com/facebook/jest/blob/master/examples/typescript/preprocessor.js
* @copyright 2004-present Facebook. All Rights Reserved.
*/
const tsc = require('typescript');
const tsConfig = require('./tsconfig.json');
module.exports = {
{
"name": "open-joblist",
...
"jest": {
"setupFiles": [
"<rootDir>/test-shim.js",
"<rootDir>/test-setup.js"
],
"moduleFileExtensions": [
"ts",
type State = {
numbers: Array<number>;
}
const initialState:State = {
numbers: [1, 2, 3, 4, 5, 6]
};
const { numbers } = initialState;
// without immutable
initialState.numbers = numbers.filter((num:number):boolean => {
return num % 2 === 0;
})
console.log('after update:', initialState);
// after update: { numbers: [ 2, 4, 6 ] }
import { curryRight, flow, join } from "lodash";
import split from "./split";
import reverse from "./reverse";
/**
* Thousand Regular Expression
*/
const thousandRegExp:RegExp = /[0-9]{1,3}/g;
/**
* @param {string} string
* @param {RegExp} pattern
*/
export default function split(string:string, pattern: RegExp):Array<string> {
return string.match(pattern) || [];
}