npm install --save @types/react-elm-components
This package contains type definitions for react-elm-components (https://github.com/evancz/react-elm).
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-elm-components.
import React = require("react");
interface Props {
src: Elm.Elm18Node | Elm.Elm19Node;
flags?: Record<string, any>;
ports?: (ports: Elm.Ports) => void;
}
declare class Elm extends React.Component<Props> {}
declare namespace Elm {
interface Elm18Node {
embed: (node: HTMLElement, flags?: any) => any;
}
interface Elm19Node {
init: ({ node, flags }: { node: HTMLElement; flags: any }) => any;
}
interface SenderPort<Data> {
send: (data: Data) => void;
}
interface ReceiverPort<Value> {
subscribe: (callback: (value: Value) => void) => void;
}
interface Ports {
[x: string]: SenderPort<any> | ReceiverPort<any>;
}
}
export = Elm;
- Last updated: Tue, 16 Apr 2024 15:28:48 GMT
- Dependencies: @types/react
These definitions were written by Johannes Kvamme.