Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat(@types/chrome): enum parameters support additional string literal type #72610

@rxliuli

Description

@rxliuli

For example, in the following code, action.type is required to be an enum value, but the enum value browser.declarativeNetRequest.RuleActionType.MODIFY_HEADERS does not exist in Safari, so I wonder if it is possible to support string literal parameters. Although this package is indeed the type for Chrome, considering it has been widely used in the development of cross-platform extensions for Chrome/Firefox/Safari, maybe it can be directly modified here?

browser.declarativeNetRequest.updateDynamicRules({
  addRules: [
    {
      id: 1,
      action: {
        type: browser.declarativeNetRequest.RuleActionType.MODIFY_HEADERS,
        responseHeaders: [],
      },
      condition: {
        resourceTypes: [
          browser.declarativeNetRequest.ResourceType.XMLHTTPREQUEST,
        ],
      },
    },
  ],
})

Image

Related issue: wxt-dev/wxt#1589

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions