Skip to content

Commit

Permalink
refactor: move files
Browse files Browse the repository at this point in the history
  • Loading branch information
unional committed Sep 27, 2023
1 parent b8c0bc4 commit d677a79
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 192 deletions.
5 changes: 5 additions & 0 deletions .changeset/moody-badgers-refuse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"type-plus": major
---

Remove `StrictBigintType` and `NotStrictBigintType`
18 changes: 18 additions & 0 deletions type-plus/ts/bigint/is_not_strict_bigint.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import type { IsAnyOrNever } from '../mix_types/is_any_or_never.js'
import type { $Else, $SelectionBranch, $Then } from '../type_plus/branch/selection.js'

/**
* Is the type `T` not exactly `bigint`.
*
* ```ts
* type R = IsNotStrictBigint<bigint> // false
*
* type R = IsNotStrictBigint<1n> // true
* type R = IsNotStrictBigint<number> // true
* type R = IsNotStrictBigint<bigint | boolean> // true
* type R = IsNotStrictBigint<unknown> // true
* ```
*/

export type IsNotStrictBigint<T, Then = true, Else = false> = IsAnyOrNever<
T, $SelectionBranch> extends infer R ? R extends $Then ? Then : R extends $Else ? [bigint] extends [T] ? ([T] extends [bigint] ? (`${T}` extends `${number}` ? Then : Else) : Then) : Then : never : never
18 changes: 18 additions & 0 deletions type-plus/ts/bigint/is_strict_bigint.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import type { IsAnyOrNever } from '../mix_types/is_any_or_never.js'
import type { $Else, $SelectionBranch, $Then } from '../type_plus/branch/selection.js'

/**
* Is the type `T` exactly `bigint`.
*
* ```ts
* type R = IsStrictBigint<bigint> // true
*
* type R = IsStrictBigint<1n> // false
* type R = IsStrictBigint<number> // false
* type R = IsStrictBigint<bigint | boolean> // false
* type R = IsStrictBigint<unknown> // false
* ```
*/

export type IsStrictBigint<T, Then = true, Else = false> = IsAnyOrNever<
T, $SelectionBranch> extends infer R ? R extends $Then ? Else : R extends $Else ? [bigint] extends [T] ? ([T] extends [bigint] ? (`${T}` extends `${number}` ? Else : Then) : Else) : Else : never : never
55 changes: 0 additions & 55 deletions type-plus/ts/bigint/strict_bigint_type.not_bigint_type.spec.ts

This file was deleted.

55 changes: 0 additions & 55 deletions type-plus/ts/bigint/strict_bigint_type.spec.ts

This file was deleted.

75 changes: 0 additions & 75 deletions type-plus/ts/bigint/strict_bigint_type.ts

This file was deleted.

8 changes: 2 additions & 6 deletions type-plus/ts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,8 @@ export { assertType } from './assertion/assert_type.js'
export type { StringToBigint } from './bigint/cast.js'
export type * from './bigint/is_bigint.js'
export type * from './bigint/is_not_bigint.js'
export type {
IsNotStrictBigint,
IsStrictBigint,
NotStrictBigintType,
StrictBigintType
} from './bigint/strict_bigint_type.js'
export type * from './bigint/is_strict_bigint.js'
export type * from './bigint/is_not_strict_bigint.js'
export type { BooleanType, IsBoolean, IsNotBoolean, NotBooleanType } from './boolean/boolean_type.js'
export type { FalseType, IsFalse, IsNotFalse, NotFalseType } from './boolean/false_type.js'
export type {
Expand Down
2 changes: 1 addition & 1 deletion type-plus/ts/testing/test_type.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { IsAny } from '../any/is_any.js'
import type { IsArray } from '../array/array_type.js'
import type { IsBigint } from '../bigint/is_bigint.js'
import type { IsStrictBigint } from '../bigint/strict_bigint_type.js'
import type { IsStrictBigint } from '../bigint/is_strict_bigint.js'
import type { IsBoolean } from '../boolean/boolean_type.js'
import type { IsFalse } from '../boolean/false_type.js'
import type { IsStrictBoolean } from '../boolean/strict_boolean_type.js'
Expand Down

0 comments on commit d677a79

Please sign in to comment.