Skip to content

Script attribute types are treated as having an unknown shape #37

@miwitham

Description

@miwitham

The current type used for ScriptProps is as follows:

export interface ScriptProps {
    src: HTMLScriptElement['src'] | null;
    checkForExisting?: boolean;
    [key: string]: any;
}

Where the type of attributes added to the <script> tag with the exception of the src key are [key: string]: any. As the attributes are specifically added to a <script> tag I believe a better typing might be provided by the following:

type ScriptAttributes = Omit<HTMLScriptElement, 'src'>;

export interface ScriptProps extends ScriptAttributes {
    src: HTMLScriptElement['src'] | null;
    checkForExisting?: boolean;
}

With src omitted for the sake of not stepping on the logic that makes use of the null value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions