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
| var array = Immutable(["totally", "immutable", {hammer: "Can’t Touch This"}]); | |
| array[1] = "I'm going to mutate you!" | |
| array[1] // "immutable" | |
| array[2].hammer = "hm, surely I can mutate this nested object..." | |
| array[2].hammer // "Can’t Touch This" | |
| for (var index in array) { console.log(array[index]); } | |
| // "totally" |
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
| module.exports = { | |
| getTransformModulePath() { | |
| return require.resolve("react-native-typescript-transformer"); | |
| }, | |
| getSourceExts() { | |
| return ["ts", "tsx"]; | |
| } | |
| }; |
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": { | |
| /* Basic Options */ | |
| "target": "es5" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */, | |
| "module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */, | |
| "lib": ["es2015"], /* Specify library files to be included in the compilation. */ | |
| // "allowJs": true, /* Allow javascript files to be compiled. */ | |
| // "checkJs": true, /* Report errors in .js files. */ | |
| "jsx": "react" /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */, | |
| // "declaration": true, /* Generates corresponding '.d.ts' file. */ |
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
| "scripts": { | |
| ... | |
| "precommit": "lint-staged", | |
| } | |
| ... | |
| "lint-staged": { | |
| "{src,test}/**/*.ts*": [ | |
| "prettier --write", | |
| "git add" | |
| ] |
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
| { "scripts": { "precommit": "pretty-quick --staged" } } |
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 React from 'react' | |
| import App from './App' | |
| import renderer from 'react-test-renderer' | |
| describe('App', () => { | |
| it('should render', () => { | |
| const tree = renderer.create(<App/>).toJSON() | |
| expect(tree).toMatchSnapshot() | |
| }) | |
| }) |
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
| "jest": { | |
| "preset": "react-native", | |
| "moduleFileExtensions": [ | |
| "ts", | |
| "tsx", | |
| "js" | |
| ], | |
| "transform": { | |
| "^.+\\.(js)$": "<rootDir>/node_modules/babel-jest", | |
| "\\.(ts|tsx)$": "<rootDir>/node_modules/ts-jest/preprocessor.js" |
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
| { | |
| "extends": ["tslint:recommended", "tslint-config-prettier", "tslint-react"], | |
| "defaultSeverity": "error", | |
| "jsRules": {}, | |
| "rules": { | |
| "quotemark": [true, "single", "jsx-double"], | |
| "ordered-imports": false, | |
| "object-literal-sort-keys": false, | |
| "arrow-parens": false, | |
| "no-console": [false], |
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
| yarn add --dev typescript | |
| yarn add --dev react-native-typescript-transformer | |
| yarn tsc --init --pretty --jsx react | |
| touch rn-cli.config.js | |
| yarn add --dev @types/react @types/react-native |
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
| watchman watch-del-all | |
| npm start -- --reset-cache |