Skip to content

Commit

Permalink
feat: scaffold doc comments
Browse files Browse the repository at this point in the history
  • Loading branch information
tommy-poetic committed Mar 6, 2023
1 parent d238dfc commit d7ae9bf
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions source/is-literal.d.ts
Expand Up @@ -21,18 +21,74 @@ type LiteralChecks<T, LiteralUnionType> = (
>
);

/**
Returns a boolean for whether the given type is a `string` [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types).
@example
```
import type {IsStringLiteral} from 'type-fest';
```
@category Utilities
*/
export type IsStringLiteral<T> = LiteralCheck<T, string>;

/**
Returns a boolean for whether the given type is a `number` or `bigint` [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types).
@example
```
import type {IsNumericLiteral} from 'type-fest';
```
@category Utilities
*/
export type IsNumericLiteral<T> = LiteralChecks<T, Numeric>;

/**
Returns a boolean for whether the given type is a `true` or `false` [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types).
@example
```
import type {IsBooleanLiteral} from 'type-fest';
```
@category Utilities
*/
export type IsBooleanLiteral<T> = LiteralCheck<T, boolean>;

/**
Returns a boolean for whether the given type is a `symbol` [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types).
@example
```
import type {IsLiteral} from 'type-fest';
```
@category Utilities
*/
export type IsSymbolLiteral<T> = LiteralCheck<T, symbol>;

/** Helper type for `IsLiteral`. */
type IsLiteralUnion<T> =
| IsStringLiteral<T>
| IsNumericLiteral<T>
| IsBooleanLiteral<T>
| IsSymbolLiteral<T>;

/**
Returns a boolean for whether the given type is a [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types).
@example
```
import type {IsLiteral} from 'type-fest';
```
@category Utilities
*/
export type IsLiteral<T extends Primitive> = IsNotFalse<IsLiteralUnion<T>>;

0 comments on commit d7ae9bf

Please sign in to comment.