@eslint-react/tools
Advanced tools
Comparing version 1.20.2-next.2 to 1.20.2-next.3
@@ -1,137 +0,2 @@ | ||
import * as Data from 'effect/Data'; | ||
export { Data }; | ||
import * as Either from 'effect/Either'; | ||
export { Either as E }; | ||
import * as Equal from 'effect/Equal'; | ||
export { Equal }; | ||
import * as Function$1 from 'effect/Function'; | ||
export { Function$1 as F }; | ||
import * as MutableRef from 'effect/MutableRef'; | ||
export { MutableRef as MutRef }; | ||
import * as Option from 'effect/Option'; | ||
export { Option as O }; | ||
export * from 'effect/Predicate'; | ||
import * as Ref from 'effect/Ref'; | ||
export { Ref }; | ||
/** | ||
* @since 0.4.0 | ||
*/ | ||
type Cast<X, Y> = X extends Y ? X : Y; | ||
/** | ||
* @since 0.0.1 | ||
* @template T The type to get the union from | ||
* @example | ||
* type Result = UnionFromTuple<['foo', 'bar', 1]> | ||
* Result = 'foo' | 'bar' | 1 | ||
*/ | ||
type UnionFromTuple<T> = T extends (infer U)[] ? U : never; | ||
/** | ||
* @since 0.0.1 | ||
* @template T The type to get the intersection from | ||
* @example | ||
* type Result = IntersectionFromTuple<['foo', 'bar', 1]> | ||
* Result = 'foo' & 'bar' & 1 | ||
*/ | ||
type UnionToIntersection<U> = (U extends unknown ? (k: U) => void : never) extends (k: infer I) => void ? I : never; | ||
/** | ||
* @since 0.0.1 | ||
*/ | ||
type Remap<T> = { | ||
[P in keyof T]: T[P]; | ||
}; | ||
/** | ||
* @since 0.0.1 | ||
*/ | ||
type Pretty<T> = { | ||
[P in keyof T]: T[P]; | ||
} & {}; | ||
/** | ||
* This should only be used for defining generics which extend any kind of JS | ||
* array under the hood, this includes arrays *AND* tuples (of the form [x, y], | ||
* and of the form [x, ...y[]], etc...), and their readonly equivalent. This | ||
* allows us to be more inclusive to what functions can process. | ||
* @example map<T extends ArrayLike>(items: T) { ... } | ||
* | ||
* We would've named this `ArrayLike`, but that's already used by typescript... | ||
* @see This was inspired by the type-definition of Promise.all (https://github.com/microsoft/TypeScript/blob/1df5717b120cddd325deab8b0f2b2c3eecaf2b01/src/lib/es2015.promise.d.ts#L21) | ||
*/ | ||
type IterableContainer<T = unknown> = readonly [] | ReadonlyArray<T>; | ||
/** | ||
* Returns the element type of an array. | ||
* @since 0.4.0 | ||
* @template T type of the array elements. | ||
* @param arr The array to get the element type from. | ||
* @returns The element type of the array. | ||
*/ | ||
type ArrayElement<A> = A extends readonly (infer T)[] ? T : never; | ||
/** | ||
* A record with loose keys. | ||
* @template T The type of the values. | ||
* @since 0.4.0 | ||
*/ | ||
type LooseRecord<T> = Record<PropertyKey, T>; | ||
/** | ||
* Infers embedded primitive type of any type | ||
* @since 0.0.1 | ||
* @param T Type to infer | ||
* @returns Embedded type of {@link TType} | ||
* @example | ||
* type Result = Narrow<['foo', 'bar', 1]> | ||
* @see https://twitter.com/hd_nvim/status/1578567206190780417 | ||
*/ | ||
type Narrow<TType> = (TType extends [] ? [] : never) | (TType extends bigint | boolean | number | string ? TType : never) | (TType extends Function ? TType : never) | { | ||
[K in keyof TType]: Narrow<TType[K]>; | ||
}; | ||
/** | ||
* Infers embedded primitive type of any type | ||
* Same as `as const` but without setting the object as readonly and without needing the user to use it. | ||
* @since 0.0.1 | ||
* @param a Value to infer | ||
* @returns Value with embedded type inferred | ||
* @example | ||
* const result = narrow(['foo', 'bar', 1]) | ||
*/ | ||
declare const narrow: <TType>(a: Narrow<TType>) => Narrow<TType>; | ||
/** | ||
* @param a The value to infer. | ||
* @since 0.0.1 | ||
* @returns The value with the type inferred. | ||
*/ | ||
declare const asConst: <const T>(a: T) => T; | ||
/** | ||
* This is an enhanced version of the typeof operator to check the type of more complex values. | ||
* In this case we just mind about arrays and objects. We can add more on demand. | ||
* @param t the value to be checked | ||
* @returns the type of the value | ||
*/ | ||
declare function typeOf(t: unknown): "array" | "object" | (string & {}); | ||
type EntriesEntryForKey<T, Key extends keyof T> = Key extends number | string ? [key: `${Key}`, value: Required<T>[Key]] : never; | ||
type EntriesEntry<T> = Pretty<{ | ||
[P in keyof T]-?: EntriesEntryForKey<T, P>; | ||
}[keyof T]>; | ||
declare function entries<T extends {}>(data: T): Array<EntriesEntry<T>>; | ||
declare function entries(): <T extends {}>(data: T) => Array<EntriesEntry<T>>; | ||
type FromEntriesEntry<Key extends PropertyKey = PropertyKey, Value = unknown> = readonly [ | ||
key: Key, | ||
value: Value | ||
]; | ||
type FromEntries<Entries> = Entries extends readonly [ | ||
infer First, | ||
...infer Tail | ||
] ? FromEntriesTuple<First, Tail> : Entries extends readonly [...infer Head, infer Last] ? FromEntriesTuple<Last, Head> : Entries extends IterableContainer<FromEntriesEntry> ? FromEntriesArray<Entries> : "ERROR: Entries array-like could not be inferred"; | ||
type FromEntriesTuple<E, Rest> = E extends FromEntriesEntry ? FromEntries<Rest> & Record<E[0], E[1]> : "ERROR: Array-like contains a non-entry element"; | ||
type FromEntriesArray<Entries extends IterableContainer<FromEntriesEntry>> = string extends AllKeys<Entries> ? Record<string, Entries[number][1]> : number extends AllKeys<Entries> ? Record<number, Entries[number][1]> : symbol extends AllKeys<Entries> ? Record<symbol, Entries[number][1]> : FromEntriesArrayWithLiteralKeys<Entries>; | ||
type FromEntriesArrayWithLiteralKeys<Entries extends IterableContainer<FromEntriesEntry>> = { | ||
[P in AllKeys<Entries>]?: ValueForKey<Entries, P>; | ||
}; | ||
type AllKeys<Entries extends IterableContainer<FromEntriesEntry>> = Extract<Entries[number], FromEntriesEntry>[0]; | ||
type ValueForKey<Entries extends IterableContainer<FromEntriesEntry>, K extends PropertyKey> = (Extract<Entries[number], FromEntriesEntry<K>> extends never ? Entries[number] : Extract<Entries[number], FromEntriesEntry<K>>)[1]; | ||
declare function fromEntries<Entries extends IterableContainer<FromEntriesEntry>>(entries: Entries): Pretty<FromEntries<Entries>>; | ||
declare function fromEntries(): <Entries extends IterableContainer<FromEntriesEntry>>(entries: Entries) => Pretty<FromEntries<Entries>>; | ||
declare function zip<T>(arr1: readonly T[]): Array<[T]>; | ||
declare function zip<T, U>(arr1: readonly T[], arr2: readonly U[]): Array<[T, U]>; | ||
declare function zip<T, U, V>(arr1: readonly T[], arr2: readonly U[], arr3: readonly V[]): Array<[T, U, V]>; | ||
declare function zip<T, U, V, W>(arr1: readonly T[], arr2: readonly U[], arr3: readonly V[], arr4: readonly W[]): Array<[T, U, V, W]>; | ||
export { type ArrayElement, type Cast, type IterableContainer, type LooseRecord, type Narrow, type Pretty, type Remap, type UnionFromTuple, type UnionToIntersection, asConst, entries, fromEntries, narrow, typeOf, zip }; | ||
export { } |
{ | ||
"name": "@eslint-react/tools", | ||
"version": "1.20.2-next.2", | ||
"description": "ESLint React's std library and primitives.", | ||
"version": "1.20.2-next.3", | ||
"description": "Tools for ESLint React monorepo.", | ||
"homepage": "https://github.com/rel1cx/eslint-react", | ||
@@ -38,3 +38,2 @@ "bugs": { | ||
"devDependencies": { | ||
"effect": "^3.11.8", | ||
"tsup": "^8.3.5", | ||
@@ -45,3 +44,2 @@ "@workspace/configs": "0.0.0" | ||
"build": "tsup", | ||
"build:docs": "typedoc", | ||
"lint:publish": "publint", | ||
@@ -48,0 +46,0 @@ "lint:type": "tsc --noEmit" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2
2179
2
2