Skip to content

[chrome] Add IOS to runtime.PlatformOs enum#74923

Open
rxliuli wants to merge 3 commits into
DefinitelyTyped:masterfrom
rxliuli:chrome/add-ios-platform-os
Open

[chrome] Add IOS to runtime.PlatformOs enum#74923
rxliuli wants to merge 3 commits into
DefinitelyTyped:masterfrom
rxliuli:chrome/add-ios-platform-os

Conversation

@rxliuli
Copy link
Copy Markdown
Contributor

@rxliuli rxliuli commented Apr 27, 2026

Summary

Add IOS = "ios" to chrome.runtime.PlatformOs enum.

Safari on iOS/iPadOS reports runtime.getPlatformInfo().os as "ios", but the type definition was missing this value, causing TypeScript errors when comparing against it.

Reference

🤖 Generated with Claude Code

Safari on iOS/iPadOS reports `runtime.getPlatformInfo().os` as `"ios"`,
but the type definition was missing this value.

Ref: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/PlatformOs#ios

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@typescript-bot
Copy link
Copy Markdown
Contributor

typescript-bot commented Apr 27, 2026

@rxliuli Thank you for submitting this PR!

This is a live comment that I will keep updated.

1 package in this PR

Code Reviews

Because this is a widely-used package, a DT maintainer will need to review it before it can be merged.

You can test the changes of this PR in the Playground.

Status

  • ✅ No merge conflicts
  • ✅ Continuous integration tests have passed
  • 🕐 Most recent commit is approved by a DT maintainer

Once every item on this list is checked, I'll ask you for permission to merge and publish the changes.

Inactive

This PR has been inactive for 15 days — please try to get reviewers!


Diagnostic Information: What the bot saw about this PR
{
  "type": "info",
  "now": "-",
  "pr_number": 74923,
  "author": "rxliuli",
  "headCommitOid": "1beaa3ff686021c56d5281032639f9d3cd7dd32c",
  "mergeBaseOid": "a61c3f39f0e22b0a6abd5208cddc68f06b50450f",
  "lastPushDate": "2026-04-27T03:23:24.000Z",
  "lastActivityDate": "2026-05-10T13:59:50.000Z",
  "hasMergeConflict": false,
  "isFirstContribution": false,
  "tooManyFiles": false,
  "hugeChange": false,
  "tooManyCommits": false,
  "tooManyReviews": false,
  "popularityLevel": "Critical",
  "pkgInfo": [
    {
      "name": "chrome",
      "kind": "edit",
      "files": [
        {
          "path": "types/chrome/index.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/chrome/test/index.ts",
          "kind": "test"
        }
      ],
      "owners": [
        "matthewkimber",
        "otiai10",
        "sreimer15",
        "MatCarlson",
        "ekinsol",
        "echoabstract",
        "spasma",
        "bdbai",
        "JasonXian",
        "usertim",
        "idan315",
        "nicolas377",
        "idosal",
        "fregante",
        "erwanjugand"
      ],
      "addedOwners": [],
      "deletedOwners": [],
      "popularityLevel": "Critical"
    }
  ],
  "reviews": [],
  "mainBotCommentID": 4323929524,
  "ciResult": "pass"
}

@typescript-bot
Copy link
Copy Markdown
Contributor

🔔 @matthewkimber @otiai10 @sreimer15 @matcarlson @ekinsol @EchoAbstract @spasma @bdbai @JasonXian @userTim @idan315 @nicolas377 @idosal @fregante @erwanjugand — please review this PR in the next few days. Be sure to explicitly select Approve or Request Changes in the GitHub UI so I know what's going on.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@typescript-bot typescript-bot added The CI failed When GH Actions fails and removed Untested Change This PR does not touch tests labels Apr 27, 2026
@typescript-bot
Copy link
Copy Markdown
Contributor

@rxliuli The CI build failed! Please review the logs for more information.

Once you've pushed the fixes, the build will automatically re-run. Thanks!

Note: builds that are failing do not end up on the list of PRs for the DT maintainers to review.

@typescript-bot typescript-bot moved this from Waiting for Code Reviews to Needs Author Action in Pull Request Status Board Apr 27, 2026
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@typescript-bot typescript-bot removed the The CI failed When GH Actions fails label Apr 27, 2026
@typescript-bot typescript-bot moved this from Needs Author Action to Waiting for Code Reviews in Pull Request Status Board Apr 27, 2026
@typescript-bot typescript-bot moved this from Waiting for Code Reviews to Needs Maintainer Review in Pull Request Status Board Apr 27, 2026
Comment thread types/chrome/index.d.ts
/** Specifies the Fuchsia operating system. */
FUCHSIA = "fuchsia",
/** Specifies the iOS operating system. */
IOS = "ios",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The official Google Chrome Developers documentation does not list ios in PlatformOs.

It is worth noting that the Mozilla Developer Network documentation does not accurately reflect that of Google Chrome Developers.

Do you have a runtime example that demonstrates its presence?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you test using chrome instead of browser ?

Copy link
Copy Markdown
Contributor Author

@rxliuli rxliuli Apr 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image image

Copy link
Copy Markdown
Contributor

@erwanjugand erwanjugand Apr 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I understand, Safari exposes a chrome alias derived from browser

On iOS, the runtime is not Chromium but WebKit, and @types/chrome is focused around Chromium.

I support adding an ios value to simplify the developer experience, but since this is out of scope for @types/chrome, I would like to get another maintainer’s opinion on this.

Chromium source

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The source seems quite clear IMO, so I agree that this is out of scope for the chrome types. Chrome extensions do not natively work on iOS platforms due to apple's security restrictions (though Apple seems to be experimenting with the idea of adding it sometime in the future).

Copy link
Copy Markdown
Contributor Author

@rxliuli rxliuli May 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mainly because the wxt cross-platform extension framework also depends on this project, that's why I ended up here. I originally submitted a PR at wxt-dev/wxt#2308, and the project author told me to come here instead.
@aklinker1 What do you think — should it still be added in wxt?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose you could use wxt and then the xcode converter to build a safari extension. However if we did support that, we'd need to support the full browser API (see Erwan's comment earlier). I'm personally of the opinion that @types/chrome is specifically for Chromium APIs, and I'm not even too sure we should have exported browser, since that can cause some confusion in what the types are doing. I would personally boot this issue downstream to wxt.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not going to maintain an entire browser API schema separately in WXT, so I you'll either need to patch the package in your extension or ignore the type error @rxliuli

@typescript-bot typescript-bot added the Unreviewed No one showed up to review this PR, so it'll be reviewed by a DT maintainer. label May 8, 2026
@typescript-bot
Copy link
Copy Markdown
Contributor

Re-ping @matthewkimber, @otiai10, @sreimer15, @matcarlson, @ekinsol, @EchoAbstract, @spasma, @bdbai, @JasonXian, @userTim, @idan315, @nicolas377, @idosal, @fregante, @erwanjugand:

This PR has been out for over a week, yet I haven't seen any reviews.

Could someone please give it some attention? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Critical package Unreviewed No one showed up to review this PR, so it'll be reviewed by a DT maintainer.

Projects

Status: Needs Maintainer Review

Development

Successfully merging this pull request may close these issues.

5 participants