typescript-compare
- Version 0.0.2
- Published
- 3.43 kB
- 1 dependency
- MIT license
Install
npm i typescript-compare
yarn add typescript-compare
pnpm add typescript-compare
Overview
TypeScript generics to compare types
Index
Type Aliases
type Any
type Any<Type> = And<prv.Extends<Type, 0>, prv.Extends<Type, 1>>;
type Compare
type Compare<A, B, Options extends Compare.Options = Compare.Options.Default> = If< Extends<A, B>, If< Extends<B, A>, Options['equal' | 'broaderRight' | 'broaderLeft'], Options['broaderRight'] >, If<Extends<B, A>, Options['broaderLeft'], Options['mismatch']>>;
type Equal
type Equal<A, B> = Or< And<Any<A>, Any<B>>, And<And<NotAny<A>, NotAny<B>>, And<Extends<A, B>, Extends<B, A>>>>;
type Extends
type Extends<A, B> = Or<Any<B>, If<Any<A>, Any<B>, prv.Extends<A, B>>>;
type NotAny
type NotAny<Type, True = true, False = true> = Not<Any<Type>>;
type NotEqual
type NotEqual<A, B> = Not<Equal<A, B>>;
Namespaces
namespace Compare
namespace Compare {}
interface Options
interface Options {}
property broaderLeft
broaderLeft: any;
property broaderRight
broaderRight: any;
property equal
equal: any;
property mismatch
mismatch: any;
type Strict
type Strict<A, B, Options extends Compare.Options = Compare.Options.Default> = If< Extends<A, B>, If<Extends<B, A>, Options['equal'], Options['broaderRight']>, If<Extends<B, A>, Options['broaderLeft'], Options['mismatch']>>;
namespace Compare.Options
namespace Compare.Options {}
interface Default
interface Default extends Compare.Options {}
property broaderLeft
broaderLeft: 'broaderLeft';
property broaderRight
broaderRight: 'broaderRight';
property equal
equal: 'equal';
property mismatch
mismatch: 'mismatch';
Package Files (1)
Dependencies (1)
Dev Dependencies (2)
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/typescript-compare
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/typescript-compare)
- HTML<a href="https://www.jsdocs.io/package/typescript-compare"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 3360 ms. - Missing or incorrect documentation? Open an issue for this package.