2017-09-01ãã1ã¶æéã®è¨äºä¸è¦§
Angularãæãã¦ãããã TypeScriptã®å¦ã³ã®ä¸ã§ãä»ã®ã©ã¤ãã©ãªã®åæ å ±ãã©ãæã«å ¥ãããã¯èª¬æããã¦ããã®ã ãã©ãã©ã¤ãã©ãªã¨ãã¦ã©ã®ããã«åæ å ±ãæä¾ããã®ãã¯ãã¾ã説æããã¦ããªããECMAScriptã§æ¸ãããã©ã¤ãã©ãªã«å¾ä»ãã§index.d.tsã â¦
æ¨æ¥ããæ¥æ¬ã«æ¥ã¦ã¾ãã facebook.github.io ãã¦ãçä¸ã®æ«ã«ã©ã¤ã»ã³ã¹ãMITã«ãªã£ãReactã®v16ããªãªã¼ã¹ãããã¨åææã«ãEnzymeãv3ããªãªã¼ã¹ãv3ããsetupã«å¤åãããã¾ããã Working with React 16.x · Enzyme 説æã¨ããã«ãããã©åããã¼ãCâ¦
TypeScriptã®åå¼·ã嵩ãã¦ãä¸åãReactã®ãã©ã¼ã ç»é¢ãä½ãã¨ãã®ããã©ãããã¨ãããã¾ã¨ããå°ããªã©ã¤ãã©ãªãä½ãã¾ããã github.com ä½ãããã©ãããã¨æã£ã¦ãããã¨ããã¨ã ãã©ã¼ã ã®ä¸æçç¶æ ãã©ãã«æã¤ãæ©ããReduxã¹ãã¢ã«æã¤ã®ã¯å¤§ãâ¦
TypeScript 2.1 · TypeScript ãã®TypeScript2.1ã§è¿½å ãããã¨ãã keyofæ¼ç®åããã¾ãã¤ããã¨ããªãã¸ã§ã¯ãã®ããããã£ãç¸ãã®ã«æç¨ã§ããã test ('power of keyof', () => { // è¿å¤ã®in keyofã¨ããåãæ¹ãä»åã®è©±é¡ãä»åNã¯æ¨ã¦åã ãã©ã使â¦
Functions · TypeScript ä¸è¨URLã®æå¾ãé¢æ°ãªã¼ãã¼ãã¼ãï¼è¨äºã®Overloadsé ç®ï¼ãªãè¨èªä»æ§ã«ã¤ãã¦ãã¾ãã¯ä»¥ä¸ã®ãããªã®ããã£ãã¨ãã¾ãã // .tsxãã¡ã¤ã« ã¾ãã¯ãããªã®ããã£ãã¨ãã¾ãã import * as React from 'react'; type P = { messageâ¦
ããã¾ã§Reactã³ã³ãã¼ãã³ããæ¸ãæãã³ã³ãã¼ãã³ãã®ä½¿ããæ¹ãç¸ãããã«prop-typesãç¨ãã¦åçãªãã§ãã¯ããã¦ãã¾ãããTypeScriptã§ã¯ä»£ãã£ã¦éçãªåãã§ãã¯ãå©ç¨ãã¦prop-typesã使ããã¨ãå©ç¨æ¹æ³ãç¸ãã¨ãããã¨ã«ãªã£ã¦ã¾ãããããããâ¦
import * as ReduxActions from 'redux-actions'; import * as Redux from 'redux'; // åã®ç«¶åã¨ã©ã¼ãã§ã interface ExAction extends Redux.Action, ReduxActions.Action<string> {} ç¾å®æã®ç¡ãå®é¨ã®ããã®ãã®ã³ã¼ãã¯ãä»æ¥æç¹ã§ã¯æ®å¿µãªããã³ã³ãã¤ã©ã</string>â¦
medium.com ç´ æ´ãããè¨äºããããã®ãThe hidden powerããç¥ãããexpect(rec.prop).toBe(val)ã®çµã¿åãããããããã£ã®æ°ã ã並ã¹ã¦ã¾ãããã function fn() { return { a: 1, b: true, c: 'hello', d: { d1: 2, d2: false }, e: 3, f: 4 }; } // ä»â¦
ãã¤ããããTypeScriptãã©ã³ã¹ãã¤ã«ã«æ¥µç«¯ã«æéããããããã«ãªã£ã¦ã¾ããããã«ãããDevServerå®è¡ãããã¹ãããã¹ã¦ãã©ã³ã¹ãã¤ã«ãèµ°ãã®ã§ãããé ãã¨éçºã®åæå ¨ã¦ã«å½±é¿ãã¾ããç¹ã«tslintãé ããªã£ãçµæãã¨ãã£ã¿ã§è¦åãã¨ã©ã¼ç®æãä¿®â¦
ã¾ã TypeScriptãæã«é¦´æãã«ã¯æ¸ããéãå°ãªããæ¥ã 失æãå¤ãã type Book = { title: string, vols: [string] }; type BooksPayload = { books: [Book] }; // æ£è§£ã¯ã= { books: Book[ ] }; ãããªã³ã¼ããæ¸ãã¦ãããæå³ã¨ãã¦ã¯Bookã®é åãActioâ¦
redux-actionsãç¨ãã¦ActionCreatorã¨Reducerãæ¸ãã¦ãã¾ãããTypeScriptã«ç§»è¡ãã¦æ¸ãæ¹ãã¡ãã£ã¨å¤ããã¾ããã ããã¾ã§ã¯ActionCreatorãã¾ã¨ãã¦ä½ãcreateActionsã¨ãReducerãã¾ã¨ãã¦ä½ãhandleReducersã便å©ã«ç¨ãã¦ã¾ããããããTypeScriptâ¦
ã§ããã ãå³ããç°å¢ã§æ¸ããæ¹ãããããããã¨ãTypeScriptã®ãã©ã³ã¹ãã¤ã©ãªãã·ã§ã³ãæãstrictã«ãã¾ããããç§ã®ç¾æç¹ã§tsconfig.jsonã§ãstrict: trueã¨ããã®ã¯ææå°æ©ã§ããã tsconfig.jsonã§ãstrict: trueã¨ãã webpack.config.*.tsã§ã'pâ¦
https://github.com/reactjs/redux/tree/master/test/typescript Reduxã®ãªãã¸ããªã®ä¸ãtest/typescriptã«Reduxã§ã®æç¨ãªTypeScriptãµã³ãã«ãããã¾ããå¼·ãåä»ãã§ã®Middlewareã®æ¸ãæ¹ã¨ãåèã«ãªããã®å¤ããã¾ãããããã®ãã¹ãã¯åãããã«ã³ã¼â¦
www.infoq.com ä¸è¨è¨äºããã¾ãã¾èªãã§ç®ã«ããåªæãnoImplicitAnyã Over time, they reached the point of enabling advanced compiler options, such as ânoImplicitAny to prevent the compiler from inferring an any type. advancedã£ã¦ããããªãâ¦
TypeScriptã®8ã¤ãã Productionãããã¾ãã // webpack.config.production.ts import * as path from 'path'; import * as webpack from 'webpack'; export default { entry: './ts/index.tsx', output: { path: path.resolve('static/js'), filename: 'buâ¦
TypeScriptã®7ã¤ãã æç¨ã®WebStormã§TypeScriptãç 究ãã¤ã¤ããã¾ãã§Atomãã¤ã³ã¹ã³ãã¦ãµã³ãã«ãä½ãã¨ãã®æ¸ æ¸ãã©ãããã©ã¼ã ã¨ãã¦ä½¿ã£ã¦è¦ã¾ããã Homebrew-Cask ç§ã¯Homebrewã§NodeãYarnãå ¥ãã¦ã¾ãã®ã§ãAtomããMacOSåãGUIã¤ã³ã¹ãã¼ã©ã¼â¦
TypeScriptã®6ã¤ãã HMRã«ã¯3段éãã£ã¦ãéReactã¢ããªãReactã¢ããªã¨ç¶ãã¦æå¾ã«React+Reduxã¢ããªã«å°éãã¾ãã // /store/Store.ts import { createStore, combineReducers, applyMiddleware } from 'redux'; import { routerReducer as router, rouâ¦
TypeScriptã®5ã¤ããã¾ã ã¾ã ç¶ãã¾ãã $ yarn add react-hot-loader@next $ yarn add @types/webpack-env -D react-hot-loaderã¯3.0.0-beta.7ãå ¥ãã¾ãããããã¦@types/webpack-envãï¼ãããèªåçã«ã¯ä¸çªã¤ãããè¦ã¤ããã®ã«è¦å´ããã // webpack.câ¦
TypeScriptã®4ã¤ãã Lintãã§ããããã¹ããã¡ããã¨ãã£ã¨ããæè¿è¦ããJestããã¦Enzymeã§ããã¾ãã $ yarn add jest enzyme react-test-renderer ts-jest @types/jest -D jestã¨enzymeãå ããä»ã«ã@types/jestãå¿ é ã§ããå¿ é ã§ã¯ãªãã§ãã@types/â¦
TypeScriptã®3ã¤ãã ãã¯ã大人ã®åã¿ã¨ãã¦Lintãè¨å®ãããã¨æãã¾ããES6ã§ã¯Eslintã§Airbnbããã£ã¦ã¾ãããTypeScriptã§ãAirbnbãå¼µãä»ãã¨ãã¾ãã $ yarn add tslint tslint-config-airbnb tslint-react tslint-loader -D ååããã®ã¾ã¾ãTslintâ¦
TypeScriptã®2ã¤ããåè¨äºã®ç¶ãã Webpack DevServerãåããã¦TypeScriptã§æ¸ããReactã¢ããªãåããã¾ãããããã®Webpackã®è¨å®ãTypeScriptã§æ¸ããã¨ãå¯è½ãBabel使ã£ã¦ES6ã§æ¸ããã¨ãã§ãã¾ããã®ã§é©ããã¨ã§ã¯ãªãã $ yarn add ts-node -D yarâ¦
TypeScriptã®Reactã¢ããªãä½ãã«éããä¸çªã·ã³ãã«ãªã®ã¯Webpack DevServerã§å®è¡ã ãããã¨ãããã®ããªã¨æãã¾ããNodeã¨Yarnã¯ãã§ã«å ¥ã£ã¦ããã¨åæã§ããã¨ã¯ããã¹ãã¨ãã£ã¿ï¼WEBãã©ã¦ã¶ã ãã§OKã $ mkdir TsReact $ cd TsReact $ yarn init $ â¦
Labor Dayã®é£ä¼ãå©ç¨ãã¦ãTypeScriptã§Reactéçºç°å¢ãä½ããã¨ããã£ã¦ã¿ã¾ããã (TypeScriptã§æ¸ããReactã¢ããªãã以ä¸åã) Webpack DevServerã§å®è¡ãã æ§æããã³æ¸ãçãã§ãã¯ãã Jest+Enzymeã§ãã¹ããã Webpack DevServerã§HMRå®è¡ãã Weâ¦
Flowã®0.54.0ãåºã¦ãã®ã§ã¢ããã°ã¬ã¼ãããããæåãå¤ãã£ãã # .flowconfig [ignore] .*/sass/* .*/static/* .*/bin/* .*/pkg/* .*/src/* .*/vendor/* [include] [libs] [lints] [options] suppress_comment= \\(.\\|\n\\)*\\flow-suppress esproposalâ¦
Facebook OSSã®è©±é¡ã«è§¦ãã¦ããã¡ã«ãyarnã«ãã¦ã¿ã£ããªã¨ãyarnã®ã©ã¤ã»ã³ã¹ã¯Facebook OSSã®ç¹å¾´ã¨ãªã£ãBSD-3-Clauseã§ã¯ãªãBSD-2-Clauseã§ããã©ãããã¯ãã¨ãªãFacebookãªåãã®åã§ããä»ã¾ã§ãã¼ãºããªãã£ãããå ¥ãæ¿ãã¦ãªãã£ããã©ããããâ¦
Immutable.jsã®åå®ç¾©ã®åãè¾¼ã¿ã§ãããä»å¾ã¯å¿ç¨ãã¦ä»ã®ã©ã¤ãã©ãªãæåã§åãè¾¼ã¿ã§ãããã # .flowconfig [ignore] # .*/node_modules/* ããã¤ãéªéãã¦ã .*/node_modules/eslint-plugin-jsx-a11y/* .*/node_modules/react-event-listener/* .*/sâ¦