typescript-char is a lightweight, type-definition-only library providing a TypeScript enumeration for common character codes. Its primary purpose is to eliminate 'magic numbers' in code, enhancing readability and maintainability when dealing with character-based operations, such as in parsers, lexers, or character stream processing. The library currently stands at version 0.0.0, indicating a pre-release or unversioned state. As a 'header-only' library, it consists solely of a `.d.ts` file, meaning it introduces no runtime JavaScript code or overhead. Its release cadence is effectively non-existent, with no updates since 2017. Key differentiators include its zero-runtime footprint and its focus purely on providing type-safe, named constants for character codes within a TypeScript environment, allowing direct usage of `Char.OpenBrace` instead of numerical literals like `123`.
npm install typescript-charVerified import paths — ran on the pinned version, not inferred.
Demonstrates importing the `Char` enumeration and using its constants for character codes, including converting a code back to its string representation.
Use with caution in production environments. Consider vendoring the `.d.ts` file or pinning to a specific commit if stability is critical.
Do not attempt to instantiate `Char` at runtime or use `require()`. It is purely for type-checking and compile-time constant resolution. Use `import Char from 'typescript-char'` in TypeScript files.
Evaluate alternatives if active maintenance, broader character support (e.g., full Unicode), or compatibility with very recent TypeScript features are required.
Ensure `typescript-char` is listed in your `devDependencies` and `node_modules` is accessible. Verify your `tsconfig.json` includes `node_modules` in `typeRoots` or `include` paths, and `moduleResolution` is set appropriately (e.g., `NodeNext` or `Node`).
This library only provides types. If you need runtime character codes, you must either define them as `const` enums (which are inlined) or use direct magic numbers in your JavaScript output, which defeats the purpose of this library for runtime values. This library is for compile-time type safety.
No dependency data recorded yet.