[Web API type definition issue] Mark navigator.serviceWorker as an optional property
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 38/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 停滞
- 技術スタック
- typescript
- 領域
- frontend
調査の方向性
issue にはソースファイルもテストも指定されていません。まず generator が Navigator と ServiceWorker をどのように表現しているかを確認し、宣言を変更する前に、リンク先の TypeScript issue と既存の議論を読んでください。生成された型が報告されたオプショナルな挙動を反映し、関連する検証に合格すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Summary
navigator.serviceWorker may be undefined in some secure contexts, like IABs and Firefox Private Mode
Expected vs. Actual Behavior
navigator.serviceWorker.register()
Expected: throw a TypeScript error; serviceWorker may be undefined
Actual: no TypeScript error
Playground Link
No response
Browser Support
- This API is supported in at least two major browser engines (not two Chromium-based browsers).
Have Tried The Latest Releases
- This issue applies to the latest release of TypeScript.
- This issue applies to the latest release of
@types/web.
Additional Context
I am requesting a reconsideration of marking navigator.serviceWorker as optional.
The previous issue opened in 2023 on the TypeScript repository has been labeled as "Working as Intended" under the explanation by Ryan Cavanaugh: (https://github.com/microsoft/TypeScript/issues/52044#issuecomment-1372844081)
Quoting:
APIs like these are marked non-optional for convenience, since it's extremely plausible that your script runs only in secure contexts as an invariant.
Based on his comment, it appears to me that it had been misunderstood that serviceWorker is undefined in non-secure contexts, while the point is that it may be undefined even in secure contexts.
Examples include but are not limited to:
- Firefox's private mode
- Some in-app browsers, especially those on iOS.
In-app browser usage is not insignificant!
~62% of global web traffic comes from mobile devices, and, according to eMarketer, ~88% of the time people spend in their mobile devices is used on apps. Apps today incorporate IABs for the purposes of authentication, advertisement, and more. IAB usage is at its peak in social media and messaging apps.
Given the high usage of IABs. serviceWorker not being an optional property of navigator is anything but convenient.
- 主要言語
- TypeScript
- スター
- 740
- フォーク
- 474
- 平均マージ
- 2日 8時間
- マージ済み PR(30日)
- 15
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoft/TypeScript-DOM-lib-generator のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
microsoft/TypeScript-DOM-lib-generator#2554 · コメント 6 件 ·
-
lib.d.ts bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
lib.d.ts bug
難易度 1/5 1時間未満 初心者へのやさしさ 68/100
microsoft/TypeScript-DOM-lib-generator#2154 · リアクション 1 件 ·
-
lib.d.ts bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
microsoft/TypeScript-DOM-lib-generator#2107 · コメント 5 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
microsoft/TypeScript-DOM-lib-generator#1675 · コメント 2 件 · リアクション 1 件 ·
microsoft/TypeScript-DOM-lib-generator の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
copse-dev/agent-pane#2953 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
bug clawsweeper:linked-pr-open clawsweeper:needs-live-repro clawsweeper:no-new-fix-pr impact:message-loss issue-rating: 🐚 platinum hermit P2 regression
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
calcite-components needs triage refactor
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
Esri/calcite-design-system#15203 ·