This file contains hidden or 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
const webpack = { | |
entry: './src/client/index.tsx', | |
output: { | |
filename: 'target/bundle.js', | |
}, | |
devtool: 'source-map', | |
resolve: { | |
extensions: ['.ts', '.tsx', '.js', '.json'], | |
}, | |
module: { |
This file contains hidden or 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
Show hidden characters
{ | |
"compilerOptions": { | |
"outDir": "./target/", | |
"sourceMap": true, | |
"skipLibCheck": true, | |
"noImplicitAny": true, | |
"module": "commonjs", | |
"target": "es5", | |
"jsx": "react" | |
}, |
This file contains hidden or 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 * as React from "react"; | |
export default class Hello extends React.Component { | |
render() { | |
return <h1>Hello!</h1>; | |
} | |
} |
This file contains hidden or 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 * as React from "react"; | |
import * as ReactDOM from "react-dom"; | |
import Hello from "./components/Hello"; | |
ReactDOM.render( | |
<Hello />, | |
document.getElementById("app") | |
); |
This file contains hidden or 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
/** | |
* 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 = { |
This file contains hidden or 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
{ | |
"name": "open-joblist", | |
... | |
"jest": { | |
"setupFiles": [ | |
"<rootDir>/test-shim.js", | |
"<rootDir>/test-setup.js" | |
], | |
"moduleFileExtensions": [ | |
"ts", |
This file contains hidden or 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 State = { | |
numbers: Array<number>; | |
} | |
const initialState:State = { | |
numbers: [1, 2, 3, 4, 5, 6] | |
}; | |
const { numbers } = initialState; |
This file contains hidden or 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
// without immutable | |
initialState.numbers = numbers.filter((num:number):boolean => { | |
return num % 2 === 0; | |
}) | |
console.log('after update:', initialState); | |
// after update: { numbers: [ 2, 4, 6 ] } |
This file contains hidden or 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 { curryRight, flow, join } from "lodash"; | |
import split from "./split"; | |
import reverse from "./reverse"; | |
/** | |
* Thousand Regular Expression | |
*/ | |
const thousandRegExp:RegExp = /[0-9]{1,3}/g; |
This file contains hidden or 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
/** | |
* @param {string} string | |
* @param {RegExp} pattern | |
*/ | |
export default function split(string:string, pattern: RegExp):Array<string> { | |
return string.match(pattern) || []; | |
} |