Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@js-bits/enumerate

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@js-bits/enumerate - npm Package Compare versions

Comparing version 1.0.8 to 1.0.9

types/unique-symbols.ts

2

package.json
{
"name": "@js-bits/enumerate",
"version": "1.0.8",
"version": "1.0.9",
"description": "Easy to use, Symbol-based enum implementation",

@@ -5,0 +5,0 @@ "keywords": [

/* eslint-disable @typescript-eslint/no-unused-vars */
import type { Add, Multiply } from '@js-bits/typedef-utils/math';
import type { UniqueSymbols } from './unique-symbols';

@@ -45,11 +46,2 @@ type ToUnion<T extends unknown[]> = T[number];

// workaround for https://github.com/microsoft/TypeScript/issues/37469
const UniqueSymbol: unique symbol = Symbol('UniqueSymbol');
export type SymbolValue<Type extends Converter> = Type extends SymbolConstructor
? typeof UniqueSymbol
: Type extends SymbolConstructor['for']
? typeof UniqueSymbol
: never;
export type Index<Keys extends string[], Multiplier extends number = 1> = {

@@ -63,2 +55,15 @@ [I in keyof Keys]: [Keys[I], Multiply<I, Multiplier>];

export type SymbolValue<
Type extends Converter,
Key extends string,
Keys extends string[],
// "Type instantiation is excessively deep and possibly infinite" error
// Workaround https://www.angularfix.com/2022/01/why-am-i-getting-instantiation-is.html
Map extends { [key: string]: keyof UniqueSymbols } = Key extends string ? IndexMap<ToUnion<Index<Keys>>> : never
> = Type extends SymbolConstructor
? UniqueSymbols[Map[Key]]
: Type extends SymbolConstructor['for']
? UniqueSymbols[Map[Key]]
: never;
export type NumberValue<

@@ -65,0 +70,0 @@ Type extends Converter,

@@ -36,9 +36,6 @@ /* eslint-disable @typescript-eslint/no-unused-vars */

// workaround for https://github.com/microsoft/TypeScript/issues/37469
const UniqueSymbol: unique symbol = Symbol('UniqueSymbol');
export type SymbolValue<Type extends Converter> = Type extends SymbolConstructor
? typeof UniqueSymbol
? symbol
: Type extends SymbolConstructor['for']
? typeof UniqueSymbol
? symbol
: never;

@@ -45,0 +42,0 @@

@@ -14,3 +14,3 @@ /* eslint-disable @typescript-eslint/no-unused-vars */

type EnumValues<Type extends Converter, Key extends string, Keys extends string[]> =
| SymbolValue<Type>
| SymbolValue<Type, Key, Keys>
| StringValue<Type, Key>

@@ -17,0 +17,0 @@ | NumberValue<Type, Key, Keys>

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc