JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1280
  • Score
    100M100P100Q106012F
  • License MIT

TypeScript definitions for preact-i18n

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@types/preact-i18n) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    Installation

    npm install --save @types/preact-i18n

    Summary

    This package contains type definitions for preact-i18n (https://github.com/synacor/preact-i18n).

    Details

    Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/preact-i18n.

    index.d.ts

    import { Component, ComponentChild, Context, h, JSX, VNode } from "preact";
    
    interface IntlContext {
        intl: {
            definition: {};
            mark: boolean;
            scope: string;
        };
    }
    
    interface IntlProviderProps {
        children: JSX.Element | JSX.Element[];
        definition?: {} | undefined;
        mark?: boolean | undefined;
        scope?: string | undefined;
    }
    
    interface LocalizerProps {
        children: JSX.Element | JSX.Element[];
    }
    interface TextProps {
        children?: string | undefined;
        id: string;
        fields?: {} | undefined;
        plural?: number | undefined;
    }
    
    export const IntlContext: Context<IntlContext>;
    
    export function IntlProvider(props: IntlProviderProps): JSX.Element;
    
    export function Text(props: TextProps): JSX.Element;
    
    export function MarkupText(props: TextProps): JSX.Element;
    
    export function Localizer(props: LocalizerProps): JSX.Element;
    
    export function translate(
        id: string,
        scope: string,
        dictionary: {},
        fields?: {},
        plural?: number,
        fallback?: string,
    ): string;
    
    export function useText(
        mapping: { [key: string]: string | JSX.Element } | string | JSX.Element,
    ): { [key: string]: string };
    
    // eslint-disable-next-line @definitelytyped/no-unnecessary-generics
    export function withText<Props, Context = IntlContext>(mapping: {}): (
        Child: ComponentChild,
        // eslint-disable-next-line @definitelytyped/no-unnecessary-generics
    ) => new(props?: Props, context?: Context) => any;
    
    export function intl(Child: Component, options?: { scope?: string | undefined; definition?: {} | undefined }): VNode;
    
    declare enum Intl {
        intl,
        IntlContext,
        IntlProvider,
        Text,
        MarkupText,
        Localizer,
        withText,
        useText,
        translate,
    }
    
    export default Intl;
    

    Additional Details

    • Last updated: Tue, 07 Nov 2023 09:09:39 GMT
    • Dependencies: preact

    Credits

    These definitions were written by Lukas Tetzlaff, and Sascha Zarhuber.