npm.io
1.2.5 • Published 2 years ago

@types/react-async-script

Licence
MIT
Version
1.2.5
Deps
3
Size
4 kB
Vulns
0
Weekly
0
Stars
51.4K

Installation

npm install --save @types/react-async-script

Summary

This package contains type definitions for react-async-script (https://github.com/dozoisch/react-async-script).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-async-script.

index.d.ts

import * as React from "react";
import hoistNonReactStatics = require("hoist-non-react-statics");

interface Options {
    attributes?: { [key: string]: string } | undefined;
    callbackName?: string | undefined;
    globalName?: string | undefined;
    removeOnUnmount?: boolean | undefined;
    scriptId?: string | undefined;
}

/**
 * The Higher order Component function
 *
 * @param url
 * @param options
 */
declare function makeAsyncScript(
    url: string,
    options?: Options,
): <P>(
    Component: React.ComponentType<P>,
) => React.ComponentType<
    & P
    & hoistNonReactStatics.NonReactStatics<React.ComponentType<any>>
    & {
        asyncScriptOnLoad?: (() => void) | undefined;
    }
>;

export = makeAsyncScript;

Additional Details

Credits

These definitions were written by Michalis Zachariadis.