Angular 5 → 6 に伴う TypeScript と RxJS の仕様変更まとめ
TypeScript 2.2 → 2.9 の変更点
エラーが起きそうな strict とついているものを太字にした。
- 2.3
- Generators and Iteration for ES5/ES3
- Async Iteration
- Generic parameter defaults
- New
--strict
master option - Enhanced
--init
output - Errors in .js files with
--checkJs
- 2.4
- Dynamic Import Expressions
- String Enums
- Improved inference for generics
- Strict contravariance for callback parameters
- Weak Type Detection
- 2.5
- Optional
catch
clause variables - Type assertion/cast syntax in
checkJs
/@ts-check
mode - Deduplicated and redirected packages
- The
--preserveSymlinks
compiler flag
- Optional
- 2.6
- Strict function types
- –strictFunctionTypes をつけた時だけ
- Cache tagged template objects in modules
- Localized diagnostics on the command line
- Suppress errors in .ts files using ‘// @ts-ignore’ comments
- Faster
tsc --watch
- Write-only references now flagged as unused
- Strict function types
- 2.7
- Constant-named properties
unique symbol
- Strict Class Initialization
- –strictPropertyInitialization をつけた時だけ
- Definite Assignment Assertions
- Fixed Length Tuples
- Improved type inference for object literals
- Improved handling of structurally identical classes and
instanceof
expressions - Type guards inferred from
in
operator - Support for
import d from "cjs"
from CommonJS modules with--esModuleInterop
- Numeric separators
- Cleaner output in
--watch
mode - Prettier
--pretty
output
- 2.8
- Conditional Types
- Distributive conditional types
- Type inference in conditional types
- Predefined conditional types
- Improved control over mapped type modifiers
- Improved
keyof
with intersection types - Better handling for namespace patterns in .js files
- IIFEs as namespace declarations
- Defaulted declarations
- Prototype assignment
- Nested and merged declarations
- Per-file JSX factories
- Locally scoped JSX namespaces
- New
--emitDeclarationOnly
- 2.9
- Support
number
andsymbol
named properties withkeyof
and mapped types - Generic type arguments in JSX elements
- Generic type arguments in generic tagged templates
import
types- Relaxing declaration emit visiblity rules
- Support for
import.meta
- New
--resolveJsonModule
--pretty
output by default- New
--declarationMap
- Support
RxJS 5 → 6 の変更点
https://rxjs-dev.firebaseapp.com/guide/v6/migration
なくなったもの
- Synchronous error handling
- エラーコールバックに変える
- TypeScript prototype operators
- 型が厳格に
- 普通の人はあまり使っていない機能
- オペレータのチェーン
- pipe に変える(方法)
- Observable classes
- Result selectors
変更点
Deprecated なメソッド(変更方法)
- Observable.if
- Observable.throw
- merge
- concat
- combineLatest
- race
- zip
移行手順
- 5.x 系の最新 5.5 にあげて動く状態にする
- 6.x をインストールする。その際、後方互換用の rxjs-compat も一緒に入れる
- rxjs-compat でカバーされない breaking changes に対処
- rxjs-compat でカバーされていた変更に対処し、rxjs-compat を除く
- deprecated になったものに対処する(v7 に上げるまでに必要)
メモ
- ng update で Angular 6 に上げると rxjs-compat も追加される
- 4 の手順は rxjs-tslint コマンドがやってくれる
コメントを残す