npm.io
2.0.4 • Published 2 years ago

@types/ink-gradient

Licence
MIT
Version
2.0.4
Deps
1
Size
4 kB
Vulns
0
Weekly
0
Stars
51.4K

Installation

npm install --save @types/ink-gradient

Summary

This package contains type definitions for ink-gradient (https://github.com/sindresorhus/ink-gradient).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/ink-gradient.

index.d.ts

import * as React from "react";

// This needs to be updated when TypeScript enhances their support for mutual
// exclusivity in properties. This edit I made will now throw errors when
// a user gives both of the mutually exclusive props.

type Without<T, U> = { [P in Exclude<keyof T, keyof U>]?: never };
type XOR<T, U> = T | U extends object ? (Without<T, U> & U) | (Without<U, T> & T) : T | U;

interface PropsName {
    name:
        | "cristal"
        | "teen"
        | "mind"
        | "morning"
        | "vice"
        | "passion"
        | "fruit"
        | "instagram"
        | "atlas"
        | "retro"
        | "summer"
        | "pastel"
        | "rainbow";
}

// note, object[] in this case refers to objects interpretable by tinycolor2
interface PropsColor {
    colors: string[] | object[];
}

type GradientProps = XOR<PropsName, PropsColor> & { children: React.ReactNode };

declare const Gradient: React.FC<GradientProps>;
export = Gradient;

Additional Details

  • Last updated: Tue, 07 Nov 2023 0337 GMT
  • Dependencies: @types/react

Credits

These definitions were written by aaronleopold.