Registry / type-stubs / typescript-logic

typescript-logic

JSON →
library0.0.0jsnpmunverified

This package provides experimental type-level boolean logic primitives using TypeScript's advanced generic system. With a version of `0.0.0` and last published over seven years ago (September 2018), it is in an extremely early, experimental state and is effectively abandoned. There is no established release cadence, and it completely lacks documentation, including a README. Its intended purpose is for advanced TypeScript developers requiring compile-time type validation or metaprogramming, allowing for boolean operations such as AND, OR, and NOT to be performed directly within the type system. This enables the creation of more robust and self-documenting types for intricate conditional logic scenarios, distinguishing itself by offering these utilities as pure type definitions rather than runtime values.

npm install typescript-logic
INSTALL
IMPORT
SIG · TYPESCRIPT-LOGIC
T
typescript-logic
type-stubsjavascriptv0.0.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

True
import type { True } from 'typescript-logic';
import { True } from 'typescript-logic'; const val: True = true;
Type-level constant for 'true'. Always use 'import type' and remember it's a type, not a runtime value.
False
import type { False } from 'typescript-logic';
import { False } from 'typescript-logic'; const val: False = false;
Type-level constant for 'false'. Use 'import type' as it's a type-only construct.
And
import type { And } from 'typescript-logic';
const And = require('typescript-logic').And;
Imports the type-level AND operator. This is a type, not a CommonJS module or runtime value.
Or
import type { Or } from 'typescript-logic';
Imports the type-level OR operator. This package is TypeScript type-only.
Not
import type { Not } from 'typescript-logic';
Imports the type-level NOT operator. Designed for compile-time logic.

Demonstrates basic type-level boolean logic operations (AND, OR, NOT) using generic types.

import type { True, False, And, Or, Not } from 'typescript-logic'; // Define some type-level boolean variables type IsLoggedIn = True; type HasAdminPermissions = False; type IsPremiumUser = True; // Demonstrate type-level AND logic type CanAccessAdminPanel = And<IsLoggedIn, HasAdminPermissions>; // Expected: False // Demonstrate type-level OR logic type CanViewPremiumContent = Or<IsPremiumUser, HasAdminPermissions>; // Expected: True // Demonstrate type-level NOT logic type IsGuest = Not<IsLoggedIn>; // Expected: False // Combine operations type CanPerformCriticalAction = And<IsLoggedIn, Or<HasAdminPermissions, IsPremiumUser>>; // Expected: And<True, Or<False, True>> -> And<True, True> -> True // Verify the results (compile-time assertion) type Test1 = CanAccessAdminPanel extends False ? true : false; const test1Result: Test1 = true; type Test2 = CanViewPremiumContent extends True ? true : false; const test2Result: Test2 = true; type Test3 = IsGuest extends False ? true : false; const test3Result: Test3 = true; type Test4 = CanPerformCriticalAction extends True ? true : false; const test4Result: Test4 = true;
Debug
Known issues
breakingThe package is at version `0.0.0` and was last published over seven years ago. It is highly unstable, experimental, and should not be used in production environments. Significant breaking changes are likely with any future TypeScript version updates, as it relies on internal type system behaviors.
fix
Avoid using this package for new projects or production. Consider type-level utility libraries that are actively maintained and have stable versioning.
affects: >=0.0.0
gotchaThis package is entirely type-level. It provides no runtime JavaScript values or functions. Attempting to `require()` or `import` symbols without the `type` keyword will result in runtime errors or incorrect bundling.
fix
Always use `import type { SymbolName } from 'typescript-logic';` to correctly import type-level constructs.
affects: >=0.0.0
gotchaThe package lacks any official documentation (no README), making its usage, API, and specific behaviors difficult to ascertain without direct code inspection.
fix
Thoroughly inspect the source code or rely on TypeScript's built-in type inference to understand available generics and their proper application.
affects: >=0.0.0
Errors
Common errors & fixes
Cannot find name 'And'.
Attempting to import a type-level generic without the 'import type' syntax or referring to it as a runtime value.
fix
Change `import { And } from 'typescript-logic';` to `import type { And } from 'typescript-logic';`.
Type 'boolean' is not assignable to type 'True'.
Confusing runtime boolean values (`true`, `false`) with their type-level literal counterparts (`True`, `False`).
fix
Ensure you are using the specific type-level constants (`True`, `False`) provided by the library when constructing generic types, rather than raw `true` or `false` boolean literals.
Upgrade
Version history
0.0.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
30 hits · last 30 days
node
26
OpenAI (training)
1
Resources
typescript-logic — npm install typescript-logic · libregistry