Skip to content

Add types for fetchpriority on link and script elements #10394

@oscarhermoso

Description

@oscarhermoso

Describe the problem

Encountering red squiggles on fetchpriority, even though it's a valid attribute

It's annoying in this context because there's no way to suppress the error without applying // @ts-nocheck to the whole file (please correct me if I'm wrong)

<svelte:head>
    <script
        src="https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit"
        async
        on:load={() => {
            script_loaded = true;
        }}
        fetchpriority="low"></script>
<!--    ^^^^^^^^^^^^^^ 
        Object literal may only specify known properties, and '"fetchpriority"' does not 
        exist in type 'HTMLProps<"script", HTMLAttributes<any>>'.js(2353) -->
</svelte:head>

Screenshot from 2024-02-05 08-32-28

Describe the proposed solution

Add type support for the fetchpriority attribute on HTMLScriptElement. May as well add it for HTMLLinkElement while we are in the space too.

(Support for HTMLImageElement was already added here)

Browser support is solid, except for FireFox 🙂

Importance

nice to have

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions