Skip to content

Type "midi" is not assignable to type "PermissionName" #1758

@martinboue

Description

@martinboue

Description

Existing type PermissionName is missing "midi", actual type:

type PermissionName = "geolocation" | "notifications" | "persistent-storage" | "push" | "screen-wake-lock" | "xr-spatial-tracking";

According to MDN documentation, "midi" value is supported by at least 3 browser engines.

Solution

Add "midi" to PermissionName type here:

"PermissionName": {
"name": "PermissionName",
// This is a subset of the permissions defined in the spec:
// https://w3c.github.io/powerful-features-registry/#registry-table-of-powerful-features
// Please add a feature only when it's supported by multiple engines.
"value": [
// https://developer.mozilla.org/en-US/docs/Web/API/Geolocation_API#browser_compatibility
"geolocation",
// https://developer.mozilla.org/en-US/docs/Web/API/Notifications_API#browser_compatibility
"notifications",
// https://developer.mozilla.org/en-US/docs/Web/API/Storage_API#browser_compatibility
"persistent-storage",
// https://developer.mozilla.org/en-US/docs/Web/API/Push_API#browser_compatibility
"push",
// https://developer.mozilla.org/en-US/docs/Web/API/Screen_Wake_Lock_API#browser_compatibility
"screen-wake-lock",
// WebXR is also actually Blink-only
// https://developer.mozilla.org/en-US/docs/Web/API/WebXR_Device_API#browser_compatibility
"xr-spatial-tracking"
]

Typescript version

5.4.5

Workaround

Force type:

navigator.permissions.query({ name: "midi" as PermissionName })

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