|
| 1 | +--- |
| 2 | +title: "2022-04-13のJS: TypeScript 4.7 Beta、RedwoodJS 1.0、Sanitizer API" |
| 3 | +author: "azu" |
| 4 | +layout: post |
| 5 | +date : 2022-04-12T22:59:47.573Z |
| 6 | +category: JSer |
| 7 | +tags: |
| 8 | +- Tools |
| 9 | +- TypeScript |
| 10 | +- React |
| 11 | +- testing |
| 12 | +- book |
| 13 | + |
| 14 | +--- |
| 15 | + |
| 16 | +JSer.info #587 - TypeScript 4.7 Betaがリリースされました。 |
| 17 | + |
| 18 | +- [Announcing TypeScript 4.7 Beta - TypeScript](https://devblogs.microsoft.com/typescript/announcing-typescript-4-7-beta/) |
| 19 | + |
| 20 | +TypeScript 4.5 Betaで導入されNightlyでテストされていた、Node.jsのECMAScript Moduleサポートを再び有効化されています。 |
| 21 | +これに関連して`package.json`の`exports`フィールドのサポート、`"module": "nodenext"`、`.mts`/`cts`の拡張子のサポートが追加されています。 |
| 22 | +また、Node.jsではファイルがモジュールかどうかは`package.json`の`module`フィールドなどによって暗黙的に異なります。 |
| 23 | +そのため、ファイルがモジュールかどうかを判定方法を制御できる`moduleDetection`オプションも追加して、強制的(`force`)にモジュールとして認識させることもできるようになっています。 |
| 24 | + |
| 25 | +- [Add moduleDetection compiler flag to allow for changing how modules are parsed by weswigham · Pull Request #47495 · microsoft/TypeScript](https://github.com/microsoft/TypeScript/pull/47495) |
| 26 | + |
| 27 | +型推論の改善として、Compuatedプロパティに対するコントロールフロー解析の改善、オブジェクトにおける関数の型推論の改善が含まれています。 |
| 28 | + |
| 29 | +Genericsの型を指定したaliasを定義できる Instantiation Expressionsをサポート。 |
| 30 | + |
| 31 | +```ts |
| 32 | +const ErrorMap = Map<string, Error>; |
| 33 | +``` |
| 34 | + |
| 35 | +- [Add moduleDetection compiler flag to allow for changing how modules are parsed by weswigham · Pull Request #47495 · microsoft/TypeScript](https://github.com/microsoft/TypeScript/pull/47495) |
| 36 | + |
| 37 | +`infer`に対する`extends`での推論条件の追加をサポート、型が共変(`in`)/反変(`out`)/不変(`in out`)なのかを指定できるアノテーションを追加されています。 |
| 38 | + |
| 39 | +- [Optional variance annotations by ahejlsberg · Pull Request #48240 · microsoft/TypeScript](https://github.com/microsoft/TypeScript/pull/48240) |
| 40 | + |
| 41 | +モジュール解決持の探索方法をカスタマイズする`moduleSuffixes`オプションの追加、`import type`とReference Commentで`resolution-mode`を指定できるようになっています。 |
| 42 | + |
| 43 | +---- |
| 44 | + |
| 45 | +[Making of: The Sanitizer API (Nullcon 2022) - Google スライド](https://docs.google.com/presentation/d/1eLmIZkY7auD8xT-Q6AzBKM_ASFHH8Z5fMyfeoSbSH-k/view#slide=id.g82761e80df_0_1948)というスライドでは、[HTML Sanitizer API](https://wicg.github.io/sanitizer-api/)という策定中/実装中のウェブ標準について紹介されています。 |
| 46 | + |
| 47 | +信頼できないHTML文字列のインジェクトするときに、そのHTML文字列をサニタイズしてXSSを防止するためのAPIです。 |
| 48 | +最初は、HTML文字列をサニタイズしてHTML文字列を返すAPIとして進められていました、HTMLのパースモードの違いなどからパイパスする方法があることが発見されました。(HTML文字列という文字列のフラグメントに対するサニタイズは安全にはできないと分かった) |
| 49 | + |
| 50 | +そのため、`innerHTML`とよく似た`setHTML`という新しいAPIが策定され、このAPIにsanitizerを渡す形に変更された話が書かれています。 |
| 51 | + |
| 52 | +- [Sanitizer API creating mock context-element can cause XSS when used in different context · Issue #42 · WICG/sanitizer-api](https://github.com/WICG/sanitizer-api/issues/42) |
| 53 | +- [1669945 - Sanitizer bypass if the sanitized markup is assigned to srcdoc](https://bugzilla.mozilla.org/show_bug.cgi?id=1669945) |
| 54 | + |
| 55 | + |
| 56 | +---- |
| 57 | + |
| 58 | +<h1 class="site-genre">ヘッドライン</h1> |
| 59 | + |
| 60 | +---- |
| 61 | + |
| 62 | +## Astro 1.0 Beta Release | Astro |
| 63 | +[astro.build/blog/astro-1-beta-release/](https://astro.build/blog/astro-1-beta-release/ "Astro 1.0 Beta Release | Astro") |
| 64 | +<p class="jser-tags jser-tag-icon"><span class="jser-tag">JavaScript</span> <span class="jser-tag">Tools</span> <span class="jser-tag">ReleaseNote</span></p> |
| 65 | + |
| 66 | +Astro 1.0 betaリリース。 |
| 67 | +2022年6月8日に正式リリースの予定。 |
| 68 | + |
| 69 | + |
| 70 | +---- |
| 71 | + |
| 72 | +## Announcing Rome Formatter |
| 73 | +[rome.tools/blog/2022/04/05/rome-formatter-release](https://rome.tools/blog/2022/04/05/rome-formatter-release "Announcing Rome Formatter") |
| 74 | +<p class="jser-tags jser-tag-icon"><span class="jser-tag">JavaScript</span> <span class="jser-tag">Rust</span> <span class="jser-tag">Tools</span> <span class="jser-tag">ReleaseNote</span></p> |
| 75 | + |
| 76 | +Rustに書き直されたRomeのFormatterがリリースされた。 |
| 77 | +Prettierの挙動をベースにしていて、opt-inで構文エラーのコードに対する整形も対応している。 |
| 78 | + |
| 79 | + |
| 80 | +---- |
| 81 | + |
| 82 | +## Release v8.0.0 · cucumber/cucumber-js |
| 83 | +[github.com/cucumber/cucumber-js/releases/tag/v8.0.0](https://github.com/cucumber/cucumber-js/releases/tag/v8.0.0 "Release v8.0.0 · cucumber/cucumber-js") |
| 84 | +<p class="jser-tags jser-tag-icon"><span class="jser-tag">JavaScript</span> <span class="jser-tag">testing</span> <span class="jser-tag">ReleaseNote</span></p> |
| 85 | + |
| 86 | +Cucumber.js 8.0.0リリース。 |
| 87 | + |
| 88 | + |
| 89 | +---- |
| 90 | + |
| 91 | +## Announcing RedwoodJS 1.0 and $1M Funding |
| 92 | +[tom.preston-werner.com/2022/04/04/redwood-v1-and-funding.html](https://tom.preston-werner.com/2022/04/04/redwood-v1-and-funding.html "Announcing RedwoodJS 1.0 and $1M Funding") |
| 93 | +<p class="jser-tags jser-tag-icon"><span class="jser-tag">JavaScript</span> <span class="jser-tag">library</span> <span class="jser-tag">ReleaseNote</span> <span class="jser-tag">React</span> <span class="jser-tag">GraphQL</span> <span class="jser-tag">prisma</span> <span class="jser-tag">jest</span></p> |
| 94 | + |
| 95 | +React/GraphQL/Prisma/Jest/Storybookを組み合わせたアプリケーションフレームワークであるRedwoodJS 1.0リリース。 |
| 96 | + |
| 97 | +- [Redwood 1.0.0-rc.final is Available 🚀 - Announcements / Releases and Upgrade Guides - RedwoodJS Community](https://community.redwoodjs.com/t/redwood-1-0-0-rc-final-is-available/2902 "Redwood 1.0.0-rc.final is Available 🚀 - Announcements / Releases and Upgrade Guides - RedwoodJS Community") |
| 98 | + |
| 99 | +---- |
| 100 | + |
| 101 | +## Announcing TypeScript 4.7 Beta - TypeScript |
| 102 | +[devblogs.microsoft.com/typescript/announcing-typescript-4-7-beta/](https://devblogs.microsoft.com/typescript/announcing-typescript-4-7-beta/ "Announcing TypeScript 4.7 Beta - TypeScript") |
| 103 | +<p class="jser-tags jser-tag-icon"><span class="jser-tag">TypeScript</span> <span class="jser-tag">ReleaseNote</span></p> |
| 104 | + |
| 105 | +TypeScript 4.7 betaリリース。 |
| 106 | +Node.jsのECMAScript Moduleサポートを再び有効化、`moduleDetection`オプションの追加。 |
| 107 | +Compuatedプロパティに対するコントロールフロー解析の改善、オブジェクトにおける関数の型推論の改善。Genericsの型を指定したaliasを定義できる Instantiation Expressionsをサポート。 |
| 108 | +`infer`に対する`extends`での推論条件の追加をサポート、型が共変(`in`)/反変(`out`)/不変(`in out`)なのかを指定できるアノテーションを追加。 |
| 109 | +モジュール解決持の探索方法をカスタマイズする`moduleSuffixes`オプションの追加、`import type`とReference Commentで`resolution-mode`を指定できるように。 |
| 110 | + |
| 111 | + |
| 112 | +---- |
| 113 | + |
| 114 | +## Release Notes for Safari Technology Preview 143 | WebKit |
| 115 | +[webkit.org/blog/12563/release-notes-for-safari-technology-preview-143/](https://webkit.org/blog/12563/release-notes-for-safari-technology-preview-143/ "Release Notes for Safari Technology Preview 143 | WebKit") |
| 116 | +<p class="jser-tags jser-tag-icon"><span class="jser-tag">safari</span> <span class="jser-tag">ReleaseNote</span></p> |
| 117 | + |
| 118 | +Safari Technology Preview 143リリース。 |
| 119 | +CSS Container Queriesの改善、CSS Cascade Layersの改善。Web Animation APIの改善。 |
| 120 | +Permissions APIをデフォルトで有効化、`inert`属性をデフォルトで有効化。 |
| 121 | + |
| 122 | +- [HTMLElement.inert - Web API | MDN](https://developer.mozilla.org/ja/docs/Web/API/HTMLElement/inert "HTMLElement.inert - Web API | MDN") |
| 123 | + |
| 124 | +---- |
| 125 | + |
| 126 | +## Turborepo 1.2 | Turborepo |
| 127 | +[turborepo.org/blog/turbo-1-2-0](https://turborepo.org/blog/turbo-1-2-0 "Turborepo 1.2 | Turborepo") |
| 128 | +<p class="jser-tags jser-tag-icon"><span class="jser-tag">monorepo</span> <span class="jser-tag">Tools</span> <span class="jser-tag">ReleaseNote</span></p> |
| 129 | + |
| 130 | +Turborepot 1.2リリース。 |
| 131 | +対象をフィルターできる`--filter`フラグの追加、`--dry-run`フラグの追加。 |
| 132 | +パフォーマンスの改善、キャッシュの整合性をHMACで検証できる`signature`オプションの追加など |
| 133 | + |
| 134 | + |
| 135 | +---- |
| 136 | + |
| 137 | +## Release v8.0.0-rc.0 · reduxjs/react-redux |
| 138 | +[github.com/reduxjs/react-redux/releases/tag/v8.0.0-rc.0](https://github.com/reduxjs/react-redux/releases/tag/v8.0.0-rc.0 "Release v8.0.0-rc.0 · reduxjs/react-redux") |
| 139 | +<p class="jser-tags jser-tag-icon"><span class="jser-tag">React</span> <span class="jser-tag">redux</span> <span class="jser-tag">library</span> <span class="jser-tag">ReleaseNote</span></p> |
| 140 | + |
| 141 | +React-Redux v8.0.0-rc.0リリース。 |
| 142 | +`@types/react-readux`に存在した`DefaultRootState`の型定義を削除など |
| 143 | + |
| 144 | + |
| 145 | +---- |
| 146 | + |
| 147 | +## goldbergyoni/javascript-testing-best-practices: 📗🌐 🚢 Comprehensive and exhaustive JavaScript & Node.js testing best practices (April 2022) |
| 148 | +[github.com/goldbergyoni/javascript-testing-best-practices](https://github.com/goldbergyoni/javascript-testing-best-practices "goldbergyoni/javascript-testing-best-practices: 📗🌐 🚢 Comprehensive and exhaustive JavaScript & Node.js testing best practices (April 2022)") |
| 149 | +<p class="jser-tags jser-tag-icon"><span class="jser-tag">JavaScript</span> <span class="jser-tag">testing</span> <span class="jser-tag">news</span></p> |
| 150 | + |
| 151 | +JavaScriptのテストについてのドキュメント。 テストの構造、バックエンド、フロントエンド、CIなどについて書かれているjavascript-testing-best-practicesがアップデートされた |
| 152 | + |
| 153 | + |
| 154 | +---- |
| 155 | + |
| 156 | +## Release 2.0.0-beta.0 · vercel/swr |
| 157 | +[github.com/vercel/swr/releases/tag/2.0.0-beta.0](https://github.com/vercel/swr/releases/tag/2.0.0-beta.0 "Release 2.0.0-beta.0 · vercel/swr") |
| 158 | +<p class="jser-tags jser-tag-icon"><span class="jser-tag">React</span> <span class="jser-tag">library</span> <span class="jser-tag">ReleaseNote</span></p> |
| 159 | + |
| 160 | +SWR 2.0.0-beta.0リリース。 |
| 161 | +リモートの副作用のあるリクエストを扱う`useSWRMutation`の追加。 |
| 162 | +破壊的な変更としてFetcherには複数の引数として展開しないように変更など |
| 163 | + |
| 164 | + |
| 165 | +---- |
| 166 | +<h1 class="site-genre">アーティクル</h1> |
| 167 | + |
| 168 | +---- |
| 169 | + |
| 170 | +## 04.01.2022 - TypeScript/How the compiler compiles |
| 171 | +[www.huy.rocks/everyday/04-01-2022-typescript-how-the-compiler-compiles](https://www.huy.rocks/everyday/04-01-2022-typescript-how-the-compiler-compiles "04.01.2022 - TypeScript/How the compiler compiles") |
| 172 | +<p class="jser-tags jser-tag-icon"><span class="jser-tag">TypeScript</span> <span class="jser-tag">article</span></p> |
| 173 | + |
| 174 | +TypeScript CompilerがどうやってTypeScritのコードをコンパイル、エラーを報告しているかについての解説記事 |
| 175 | + |
| 176 | + |
| 177 | +---- |
| 178 | + |
| 179 | +## ECMAScript proposal “Change Array by copy”: four new non-destructive Array methods |
| 180 | +[2ality.com/2022/04/change-array-by-copy.html](https://2ality.com/2022/04/change-array-by-copy.html "ECMAScript proposal “Change Array by copy”: four new non-destructive Array methods") |
| 181 | +<p class="jser-tags jser-tag-icon"><span class="jser-tag">ECMAScript</span> <span class="jser-tag">proposal</span> <span class="jser-tag">article</span></p> |
| 182 | + |
| 183 | +ECMAScript Proposal Stage 3のChange Array by copyについて。 |
| 184 | +Arrayのメソッドには破壊的なメソッドが混ざっていたが、それに対応する非破壊的なメソッドを追加するProposal |
| 185 | + |
| 186 | + |
| 187 | +---- |
| 188 | +<h1 class="site-genre">スライド、動画関係</h1> |
| 189 | + |
| 190 | +---- |
| 191 | + |
| 192 | +## Making of: The Sanitizer API (Nullcon 2022) - Google スライド |
| 193 | +[docs.google.com/presentation/d/1eLmIZkY7auD8xT-Q6AzBKM\_ASFHH8Z5fMyfeoSbSH-k/view#slide=id.g82761e80df\_0\_1948](https://docs.google.com/presentation/d/1eLmIZkY7auD8xT-Q6AzBKM_ASFHH8Z5fMyfeoSbSH-k/view#slide=id.g82761e80df_0_1948 "Making of: The Sanitizer API (Nullcon 2022) - Google スライド") |
| 194 | +<p class="jser-tags jser-tag-icon"><span class="jser-tag">DOM</span> <span class="jser-tag">API</span> <span class="jser-tag">security</span> <span class="jser-tag">slide</span></p> |
| 195 | + |
| 196 | +Sanitizer APIについてのスライド。 |
| 197 | +DOM XSSを防ぐSanitizer APIがサニタイズしたHTML文字列を返すAPIではない理由、`setHTML` APIについて |
| 198 | + |
| 199 | +- [Sanitizer API creating mock context-element can cause XSS when used in different context · Issue #42 · WICG/sanitizer-api](https://github.com/WICG/sanitizer-api/issues/42 "Sanitizer API creating mock context-element can cause XSS when used in different context · Issue #42 · WICG/sanitizer-api") |
| 200 | +- [1669945 - Sanitizer bypass if the sanitized markup is assigned to srcdoc](https://bugzilla.mozilla.org/show_bug.cgi?id=1669945 "1669945 - Sanitizer bypass if the sanitized markup is assigned to srcdoc") |
| 201 | + |
| 202 | +---- |
| 203 | +<h1 class="site-genre">サイト、サービス、ドキュメント</h1> |
| 204 | + |
| 205 | +---- |
| 206 | + |
| 207 | +## antfu/vue-starport: 🛰 Shared component across routes with animations |
| 208 | +[github.com/antfu/vue-starport](https://github.com/antfu/vue-starport "antfu/vue-starport: 🛰 Shared component across routes with animations") |
| 209 | +<p class="jser-tags jser-tag-icon"><span class="jser-tag">Vue</span> <span class="jser-tag">library</span></p> |
| 210 | + |
| 211 | +ページをまたいでで同じコンポーネントを表示、遷移アニメーションを行うVueコンポーネント。 |
| 212 | +共有するコンポーネントをRootに引き上げることで、ページ間で同じコンポーネントのインスタンスを維持している。 |
| 213 | + |
| 214 | + |
| 215 | +---- |
| 216 | +<h1 class="site-genre">ソフトウェア、ツール、ライブラリ関係</h1> |
| 217 | + |
| 218 | +---- |
| 219 | + |
| 220 | +## AgnosticUI/agnosticui: AgnosticUI is a set of UI primitives that start their lives in clean HTML and CSS. These standards compliant components are then copied to our framework implementations in: React, Vue 3, Angular, and Svelte. |
| 221 | +[github.com/agnosticui/agnosticui](https://github.com/agnosticui/agnosticui "AgnosticUI/agnosticui: AgnosticUI is a set of UI primitives that start their lives in clean HTML and CSS. These standards compliant components are then copied to our framework implementations in: React, Vue 3, Angular, and Svelte.") |
| 222 | +<p class="jser-tags jser-tag-icon"><span class="jser-tag">UI</span> <span class="jser-tag">library</span></p> |
| 223 | + |
| 224 | +UIコンポーネントフレームワーク。 |
| 225 | +プレーンなJSからも利用でき、React/Angular/Svelte/Vueなどの各種UIフレームワーク向けのパッケージも公開されている。 |
| 226 | + |
| 227 | + |
| 228 | +---- |
| 229 | +<h1 class="site-genre">書籍関係</h1> |
| 230 | + |
| 231 | +---- |
| 232 | + |
| 233 | +## プロを目指す人のためのTypeScript入門 安全なコードの書き方から高度な型の使い方まで:書籍案内|技術評論社 |
| 234 | +[gihyo.jp/book/2022/978-4-297-12747-3](https://gihyo.jp/book/2022/978-4-297-12747-3 "プロを目指す人のためのTypeScript入門 安全なコードの書き方から高度な型の使い方まで:書籍案内|技術評論社") |
| 235 | +<p class="jser-tags jser-tag-icon"><span class="jser-tag">TypeScript</span> <span class="jser-tag">book</span></p> |
| 236 | + |
| 237 | +2022年4月22日発売 |
| 238 | +TypeScriptの入門書 |
| 239 | + |
| 240 | + |
| 241 | +---- |
0 commit comments