@rbxts/phantom
Advanced tools
Comparing version 0.1.0 to 0.2.0
{ | ||
"name": "@rbxts/phantom", | ||
"description": "Immutable data library for Luau.", | ||
"version": "0.1.0", | ||
"description": "Data manipulation library for Roblox", | ||
"version": "0.2.0", | ||
"scripts": { | ||
"serve": "rojo serve default.project.json", | ||
"serve:tests": "rojo serve tests.project.json", | ||
"serve:bench": "rojo serve benchmarks.project.json", | ||
@@ -14,3 +13,17 @@ "check": "bunx @biomejs/biome check --write", | ||
"typings": "src/index.d.ts", | ||
"files": ["src", "!**/*.spec.luau", "!**/*.bench.luau"], | ||
"files": ["src", "!src/**/*.bench.luau", "!src/jest.config.ts", "!src/**/*.test.ts"], | ||
"keywords": [ | ||
"roblox", | ||
"roblox-ts", | ||
"table", | ||
"object", | ||
"array", | ||
"dictionary", | ||
"record", | ||
"map", | ||
"set", | ||
"immutable", | ||
"manipulation", | ||
"mutation" | ||
], | ||
"repository": { | ||
@@ -20,3 +33,2 @@ "type": "git", | ||
}, | ||
"keywords": ["array", "dictionary", "immutable", "roblox", "table"], | ||
"author": { | ||
@@ -34,9 +46,10 @@ "name": "Ivan Leontev", | ||
}, | ||
"dependencies": { | ||
"@rbxts/compiler-types": "^2.3.0-types.1", | ||
"@rbxts/types": "1.0.787" | ||
}, | ||
"devDependencies": { | ||
"typescript": "^5.6.0-dev.20240801" | ||
"@rbxts/compiler-types": "^3.0.0-types.0", | ||
"@rbxts/types": "^1.0.805", | ||
"@rbxts/jest": "^0.1.0", | ||
"@rbxts/jest-globals": "^0.1.0", | ||
"roblox-ts": "^3.0.0-dev-d1d5486", | ||
"typescript": "^5.7.0-dev.20240913" | ||
} | ||
} |
# rbx-phantom | ||
Immutable data library for Luau. | ||
Data manipulation library for Roblox |
@@ -1,197 +0,78 @@ | ||
export type InferArrayValue<T> = T extends ReadonlyArray<infer Value> | ||
? Value | ||
: never; | ||
import at from "./at"; | ||
import concat from "./concat"; | ||
import deepEquals from "./deepEquals"; | ||
import difference from "./difference"; | ||
import entries from "./entries"; | ||
import equals from "./equals"; | ||
import every from "./every"; | ||
import filter from "./filter"; | ||
import find from "./find"; | ||
import findLast from "./findLast"; | ||
import findWhere from "./findWhere"; | ||
import findWhereLast from "./findWhereLast"; | ||
import flatten from "./flatten"; | ||
import includes from "./includes"; | ||
import isArray from "./isArray"; | ||
import keys from "./keys"; | ||
import map from "./map"; | ||
import pop from "./pop"; | ||
import push from "./push"; | ||
import reduce from "./reduce"; | ||
import reduceRight from "./reduceRight"; | ||
import removeIndices from "./removeIndices"; | ||
import removeValues from "./removeValues"; | ||
import reverse from "./reverse"; | ||
import shift from "./shift"; | ||
import slice from "./slice"; | ||
import some from "./some"; | ||
import symmetricDifference from "./symmetricDifference"; | ||
import toSet from "./toSet"; | ||
import type { InferArrayValue, UnknownArray, AnyArray } from "./types"; | ||
import unshift from "./unshift"; | ||
export type UnknownArray = Array<unknown>; | ||
declare namespace PhantomArray { | ||
export type { InferArrayValue, UnknownArray, AnyArray }; | ||
interface PhantomArrayConstructor { | ||
/** | ||
* @param index 0-based index | ||
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at | ||
*/ | ||
at<T>(this: void, array: ReadonlyArray<T>, index: number): T | undefined; | ||
export { | ||
at, | ||
concat, | ||
deepEquals, | ||
difference, | ||
entries, | ||
equals, | ||
every, | ||
filter, | ||
find, | ||
findLast, | ||
findWhere, | ||
findWhereLast, | ||
flatten, | ||
includes, | ||
isArray, | ||
keys, | ||
map, | ||
pop, | ||
push, | ||
reduce, | ||
reduceRight, | ||
removeIndices, | ||
removeValues, | ||
reverse, | ||
shift, | ||
slice, | ||
some, | ||
symmetricDifference, | ||
toSet, | ||
unshift, | ||
}; | ||
/** | ||
* This function preserves order, so sparse arrays such as { nil, nil, 3 } will become { nil, nil, 3, 4} when concatenated with 4. | ||
* | ||
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/concat | ||
*/ | ||
concat<T>( | ||
this: void, | ||
array: ReadonlyArray<T>, | ||
...values: ReadonlyArray<ReadonlyArray<T> | T | undefined> | ||
): Array<T>; | ||
export function deepClone<TValue>(array: ReadonlyArray<TValue>): Array<TValue>; | ||
/** | ||
* This function will exit early with `false` if any of the values is not an array. | ||
*/ | ||
deepEquals(this: void, ...values: ReadonlyArray<unknown>): boolean; | ||
export function safeFreeze<TValue>(array: ReadonlyArray<TValue>): ReadonlyArray<TValue>; | ||
/** | ||
* Returns an array of values that are in the first array, but not in the other arrays. | ||
*/ | ||
difference<T>( | ||
this: void, | ||
array: ReadonlyArray<T>, | ||
...otherArrays: ReadonlyArray<ReadonlyArray<T>> | ||
): Array<T>; | ||
export function values<TValue>(array: ReadonlyArray<TValue>): Array<TValue>; | ||
entries<T>(this: void, array: ReadonlyArray<T>): ReadonlyArray<[number, T]>; | ||
equals(this: void, ...arrays: ReadonlyArray<unknown>): boolean; | ||
every<T>( | ||
this: void, | ||
array: ReadonlyArray<T>, | ||
predicate: (value: T, index: number, array: ReadonlyArray<T>) => unknown, | ||
): boolean; | ||
filter<T>( | ||
this: void, | ||
array: ReadonlyArray<T>, | ||
filterer: (value: T, index: number, array: ReadonlyArray<T>) => unknown, | ||
): Array<T>; | ||
find<T>( | ||
this: void, | ||
array: ReadonlyArray<T>, | ||
value: T, | ||
from?: number, | ||
): number | undefined; | ||
findLast<T>( | ||
this: void, | ||
array: ReadonlyArray<T>, | ||
value: T, | ||
from?: number, | ||
): number | undefined; | ||
findWhere<T>( | ||
this: void, | ||
array: ReadonlyArray<T>, | ||
predicate: (value: T, index: number, array: ReadonlyArray<T>) => unknown, | ||
from?: number, | ||
): number | undefined; | ||
findWhereLast<T>( | ||
this: void, | ||
array: ReadonlyArray<T>, | ||
predicate: (value: T, index: number, array: ReadonlyArray<T>) => unknown, | ||
from?: number, | ||
): number | undefined; | ||
flatten<T>( | ||
this: void, | ||
array: ReadonlyArray<T>, | ||
depth?: number, | ||
): ReadonlyArray<T>; | ||
includes<T>( | ||
this: void, | ||
array: ReadonlyArray<T>, | ||
value: T, | ||
from?: number, | ||
): boolean; | ||
isArray(this: void, value: unknown): value is ReadonlyArray<unknown>; | ||
keys(this: void, array: ReadonlyArray<unknown>): Array<number>; | ||
map<T, U>( | ||
this: void, | ||
array: ReadonlyArray<T>, | ||
mapper: (value: T, index: number, array: ReadonlyArray<T>) => U, | ||
): Array<U>; | ||
pop<T>(this: void, array: ReadonlyArray<T>, count?: number): Array<T>; | ||
push<T>( | ||
this: void, | ||
array: ReadonlyArray<T>, | ||
...values: ReadonlyArray<T> | ||
): Array<T>; | ||
reduce<T, U>( | ||
this: void, | ||
array: ReadonlyArray<T>, | ||
reducer: ( | ||
accumulator: U, | ||
value: T, | ||
index: number, | ||
array: ReadonlyArray<T>, | ||
) => U, | ||
initialValue?: U, | ||
): U; | ||
reduceRight<T, U>( | ||
this: void, | ||
array: ReadonlyArray<T>, | ||
reducer: ( | ||
accumulator: U, | ||
value: T, | ||
index: number, | ||
array: ReadonlyArray<T>, | ||
) => U, | ||
initialValue?: U, | ||
): U; | ||
removeIndices<T>( | ||
this: void, | ||
array: ReadonlyArray<T>, | ||
...indices: ReadonlyArray<number> | ||
): Array<T>; | ||
removeValues<T>( | ||
this: void, | ||
array: ReadonlyArray<T>, | ||
...values: ReadonlyArray<T> | ||
): Array<T>; | ||
reverse<T>(this: void, array: ReadonlyArray<T>): Array<T>; | ||
shift<T>(this: void, array: ReadonlyArray<T>, count?: number): Array<T>; | ||
shuffle<T>(this: void, array: ReadonlyArray<T>): Array<T>; | ||
slice<T>( | ||
this: void, | ||
array: ReadonlyArray<T>, | ||
from?: number, | ||
to?: number, | ||
): Array<T>; | ||
some<T>( | ||
this: void, | ||
array: ReadonlyArray<T>, | ||
predicate: (value: T, index: number, array: ReadonlyArray<T>) => unknown, | ||
): boolean; | ||
strictIsArray(this: void, value: object): boolean; | ||
symmetricDifference<T>( | ||
this: void, | ||
...values: ReadonlyArray<ReadonlyArray<T>> | ||
): Array<T>; | ||
toSet<T>(this: void, array: ReadonlyArray<T>): Set<T>; | ||
unshift<T>( | ||
this: void, | ||
array: ReadonlyArray<T>, | ||
...values: ReadonlyArray<T> | ||
): Array<T>; | ||
deepClone<T>(this: void, array: ReadonlyArray<T>): Array<T>; | ||
safeFreeze<T>(this: void, array: ReadonlyArray<T>): ReadonlyArray<T>; | ||
values<T>(this: void, array: ReadonlyArray<T>): Array<T>; | ||
deepCompareArray( | ||
this: void, | ||
a: ReadonlyArray<unknown>, | ||
b: ReadonlyArray<unknown>, | ||
): boolean; | ||
export function deepCompareArray(left: ReadonlyArray<unknown>, right: ReadonlyArray<unknown>): boolean; | ||
} | ||
export declare const PhantomArray: PhantomArrayConstructor; | ||
export = PhantomArray; |
@@ -5,6 +5,16 @@ import PhantomArray from "./Array"; | ||
import PhantomSet from "./Set"; | ||
export * from "./Util"; | ||
import PhantomShared from "./Shared"; | ||
import PhantomUtil from "./Util"; | ||
export namespace Phantom { | ||
export { PhantomArray as Array, PhantomMap as Map, PhantomSet as Set, None }; | ||
declare namespace Phantom { | ||
export { | ||
PhantomUtil as Util, | ||
PhantomShared as Shared, | ||
PhantomSet as Set, | ||
PhantomArray as Array, | ||
PhantomMap as Map, | ||
None, | ||
}; | ||
} | ||
export = Phantom; |
@@ -1,106 +0,52 @@ | ||
export type InferMapKey<T> = T extends ReadonlyMap<infer Key, unknown> | ||
? Key | ||
: never; | ||
import deepEquals from "./deepEquals"; | ||
import deepMerge from "./deepMerge"; | ||
import equals from "./equals"; | ||
import every from "./every"; | ||
import filter from "./filter"; | ||
import flatten from "./flatten"; | ||
import flip from "./flip"; | ||
import fromArrays from "./fromArrays"; | ||
import fromEntries from "./fromEntries"; | ||
import has from "./has"; | ||
import includes from "./includes"; | ||
import isMap from "./isMap"; | ||
import map from "./map"; | ||
import merge from "./merge"; | ||
import removeKeys from "./removeKeys"; | ||
import removeValues from "./removeValues"; | ||
import some from "./some"; | ||
import type { AnyMap, InferMapKey, InferMapValue, UnknownMap } from "./types"; | ||
import withKeys from "./withKeys"; | ||
export type InferMapValue<T> = T extends ReadonlyMap<unknown, infer Value> | ||
? Value | ||
: never; | ||
declare namespace PhantomMap { | ||
export type { InferMapKey, InferMapValue, UnknownMap, AnyMap }; | ||
interface PhantomMapConstructor { | ||
deepEquals( | ||
this: void, | ||
...maps: ReadonlyArray<ReadonlyMap<unknown, unknown>> | ||
): boolean; | ||
export { | ||
deepEquals, | ||
deepMerge, | ||
equals, | ||
every, | ||
filter, | ||
flatten, | ||
flip, | ||
fromArrays, | ||
fromEntries, | ||
has, | ||
includes, | ||
isMap, | ||
map, | ||
merge, | ||
removeKeys, | ||
removeValues, | ||
some, | ||
withKeys, | ||
}; | ||
deepMerge<K, V>(...maps: ReadonlyArray<ReadonlyMap<K, V>>): Map<K, V>; | ||
export function keys<TKey>(map: ReadonlyMap<TKey, unknown>): Array<TKey>; | ||
equals(...maps: ReadonlyArray<unknown>): boolean; | ||
export function values<TValue>(map: ReadonlyMap<unknown, TValue>): Array<TValue>; | ||
every<K, V>( | ||
this: void, | ||
map: ReadonlyMap<K, V>, | ||
predicate: (value: V, key: K, map: ReadonlyMap<K, V>) => unknown, | ||
): boolean; | ||
filter<K, V>( | ||
this: void, | ||
map: ReadonlyMap<K, V>, | ||
predicate: (value: V, key: K, map: ReadonlyMap<K, V>) => unknown, | ||
): ReadonlyMap<K, V>; | ||
flatten<K, V>( | ||
this: void, | ||
map: ReadonlyMap<K, V>, | ||
depth?: number, | ||
): ReadonlyMap<K, V>; | ||
flip<K, V>(this: void, map: ReadonlyMap<K, V>): Map<V, K>; | ||
fromArrays<K, V>( | ||
this: void, | ||
keys: ReadonlyArray<K>, | ||
values: ReadonlyArray<V>, | ||
): Map<K, V>; | ||
fromEntries<K, V>(this: void, entries: ReadonlyArray<[K, V]>): Map<K, V>; | ||
has<K>( | ||
this: void, | ||
map: ReadonlyMap<K, unknown>, | ||
...keys: ReadonlyArray<K> | ||
): boolean; | ||
includes<V>(this: void, map: ReadonlyMap<unknown, V>, value: V): boolean; | ||
isMap(this: void, value: unknown): value is ReadonlyMap<unknown, unknown>; | ||
map<K, V, K2, V2>( | ||
this: void, | ||
map: ReadonlyMap<K, V>, | ||
mapper: ( | ||
value: V, | ||
key: K, | ||
map: ReadonlyMap<K, V>, | ||
) => LuaTuple<[newValue: V2, newKey: K2] | [newValue: V2]>, | ||
): Map<K2 | K, V2>; | ||
map<K, V, V2>( | ||
this: void, | ||
map: ReadonlyMap<K, V>, | ||
mapper: (value: V, key: K, map: ReadonlyMap<K, V>) => V2 | undefined, | ||
): Map<K, V2>; | ||
merge<K, V>(this: void, ...maps: ReadonlyArray<ReadonlyMap<K, V>>): Map<K, V>; | ||
removeKeys<K, V>( | ||
this: void, | ||
map: ReadonlyMap<K, V>, | ||
...keys: ReadonlyArray<K> | ||
): Map<K, V>; | ||
removeValues<K, V>( | ||
this: void, | ||
map: ReadonlyMap<K, V>, | ||
...values: ReadonlyArray<V> | ||
): Map<K, V>; | ||
some<K, V>( | ||
this: void, | ||
map: ReadonlyMap<K, V>, | ||
predicate: (value: V, key: K, map: ReadonlyMap<K, V>) => unknown, | ||
): boolean; | ||
withKeys<K, V>( | ||
this: void, | ||
map: ReadonlyMap<K, V>, | ||
...keys: ReadonlyArray<K> | ||
): Map<K, V>; | ||
keys<K>(this: void, map: ReadonlyMap<K, unknown>): Array<K>; | ||
values<V>(this: void, map: ReadonlyMap<unknown, V>): Array<V>; | ||
entries<K, V>(this: void, map: ReadonlyMap<K, V>): Array<[K, V]>; | ||
export function entries<TKey, TValue>(map: ReadonlyMap<TKey, TValue>): Array<[TKey, TValue]>; | ||
} | ||
export declare const PhantomMap: PhantomMapConstructor; | ||
export = PhantomMap; |
@@ -1,9 +0,3 @@ | ||
interface NoneConstructor { | ||
/** | ||
* @hidden | ||
* @deprecated | ||
*/ | ||
readonly _nominal_None: unique symbol; | ||
} | ||
declare const None: unique symbol; | ||
export declare const None: NoneConstructor; | ||
export = None; |
@@ -1,102 +0,47 @@ | ||
export type InferSetValue<T> = T extends ReadonlySet<infer V> ? V : never; | ||
import add from "./add"; | ||
import delete_ from "./delete"; | ||
import difference from "./difference"; | ||
import filter from "./filter"; | ||
import fromArray from "./fromArray"; | ||
import has from "./has"; | ||
import intersection from "./intersection"; | ||
import isSubset from "./isSubset"; | ||
import isSuperset from "./isSuperset"; | ||
import map from "./map"; | ||
import merge from "./merge"; | ||
import symmetricDifference from "./symmetricDifference"; | ||
import type { AnySet, InferSetValue, UnknownSet } from "./types"; | ||
export type UnknownSet = Set<unknown>; | ||
declare namespace PhantomSet { | ||
export type { InferSetValue, UnknownSet, AnySet }; | ||
interface PhantomSetConstructor { | ||
/** | ||
* This function filters out the `undefined` before adding a value. | ||
*/ | ||
add<T>(set: Set<T>, ...values: ReadonlyArray<T | undefined>): Set<T>; | ||
export { | ||
add, | ||
delete_ as delete, | ||
difference, | ||
filter, | ||
fromArray, | ||
has, | ||
intersection, | ||
isSubset, | ||
isSuperset, | ||
map, | ||
merge, | ||
symmetricDifference, | ||
}; | ||
/** | ||
* This function filters out the `undefined` before deleting a value. | ||
*/ | ||
delete<T>( | ||
this: void, | ||
set: ReadonlySet<T>, | ||
...values: ReadonlyArray<T | undefined> | ||
): Set<T>; | ||
export function keys<TValue>(set: ReadonlySet<TValue>): Array<TValue>; | ||
/** | ||
* Returns a set of values that are in the first set, but not in the other sets. | ||
*/ | ||
difference<T>( | ||
this: void, | ||
set: ReadonlySet<T>, | ||
...otherSets: ReadonlyArray<ReadonlySet<T> | undefined> | ||
): Set<T>; | ||
export function values<TValue>(set: ReadonlySet<TValue>): Array<true>; | ||
/** | ||
* Filters a set using a predicate. | ||
* Any items that do not pass the predicate will be removed from the set. | ||
* @param predicate A function that should return either a falsy or truthy value. | ||
*/ | ||
filter<T>( | ||
this: void, | ||
set: ReadonlySet<T>, | ||
predicate: (value: T, set: ReadonlySet<T>) => unknown, | ||
): Set<T>; | ||
export function entries<TValue>(set: ReadonlySet<TValue>): Array<[TValue, true]>; | ||
/** | ||
* This function filters out the `undefined`. | ||
*/ | ||
fromArray<T>(this: void, array: ReadonlyArray<T | undefined>): Set<T>; | ||
has<T>( | ||
this: void, | ||
set: ReadonlySet<T>, | ||
...values: ReadonlyArray<T | undefined> | ||
): boolean; | ||
intersection<T>( | ||
this: void, | ||
...sets: ReadonlyArray<ReadonlySet<T> | undefined> | ||
): Set<T>; | ||
isSubset( | ||
this: void, | ||
subset: ReadonlySet<unknown>, | ||
superset: ReadonlySet<unknown>, | ||
): boolean; | ||
isSuperset( | ||
this: void, | ||
superset: ReadonlySet<unknown>, | ||
subset: ReadonlySet<unknown>, | ||
): boolean; | ||
map<T, R>( | ||
this: void, | ||
set: ReadonlySet<T>, | ||
mapper: (value: T, source: ReadonlySet<T>) => R, | ||
): Set<R>; | ||
merge<T>( | ||
this: void, | ||
...sets: ReadonlyArray<ReadonlySet<T> | undefined> | ||
): Set<T>; | ||
/** | ||
* Returns a set of values that are in the first set, but not in the other sets, and vice versa. | ||
* Simply speaking, this returns a unique entries in the sets provided. | ||
*/ | ||
symmetricDifference<T>( | ||
this: void, | ||
...sets: ReadonlyArray<ReadonlySet<T> | undefined> | ||
): Set<T>; | ||
keys<T>(this: void, set: ReadonlySet<T>): Array<T>; | ||
values<T>(this: void, set: ReadonlySet<T>): Array<true>; | ||
entries<T>(this: void, set: ReadonlySet<T>): Array<[T, true]>; | ||
/** | ||
* Safely freezes the set by using {@link table.isfrozen}. | ||
*/ | ||
safeFreeze<T>(this: void, set: Set<T>): ReadonlySet<T>; | ||
export function safeFreeze<TValue>(set: Set<TValue>): ReadonlySet<TValue>; | ||
toArray: PhantomSetConstructor["keys"]; | ||
export { keys as toArray }; | ||
} | ||
export declare const PhantomSet: PhantomSetConstructor; | ||
export = PhantomSet; |
@@ -1,112 +0,39 @@ | ||
export type InferObjectKey<T> = T extends ReadonlyArray<unknown> | ||
? number | ||
: T extends ReadonlyMap<infer Key, unknown> | ||
? Key | ||
: T extends ReadonlySet<infer Key> | ||
? Key | ||
: T extends object | ||
? keyof T | ||
: never; | ||
import { compare, compareArray, compareTable } from "./compare"; | ||
import deepClone from "./deepClone"; | ||
import { deepCompare, deepCompareArray, deepCompareTable } from "./deepCompare"; | ||
import deepEquals from "./deepEquals"; | ||
import deepFreeze from "./deepFreeze"; | ||
import deepSafeFreeze from "./deepSafeFreeze"; | ||
import entries from "./entries"; | ||
import keys from "./keys"; | ||
import safeFreeze from "./safeFreeze"; | ||
import size from "./size"; | ||
import values from "./values"; | ||
export type InferObjectValue<T> = T extends ReadonlyArray<infer Value> | ||
? Value | ||
: T extends ReadonlyMap<unknown, infer Value> | ||
? Value | ||
: T extends ReadonlySet<unknown> | ||
? true | ||
: T extends object | ||
? T[keyof T] | ||
: never; | ||
declare namespace PhantomShared { | ||
export { | ||
// compare | ||
compare, | ||
compareArray, | ||
compareTable, | ||
// | ||
export type DeepReadonly<T> = T extends ReadonlyArray<infer R> | ||
? DeepReadonlyArray<R> | ||
: T extends Callback | ||
? T | ||
: T extends ReadonlyMap<infer Key, infer Value> | ||
? ReadonlyMap<Key, DeepReadonly<Value>> | ||
: T extends object | ||
? DeepReadonlyObject<T> | ||
: T; | ||
deepClone, | ||
// deepCompare | ||
deepCompare, | ||
deepCompareArray, | ||
deepCompareTable, | ||
// | ||
//export interface DeepReadonlyArray<T> extends ReadonlyArray<DeepReadonly<T>> {} | ||
export type DeepReadonlyArray<T> = _<ReadonlyArray<DeepReadonly<T>>>; | ||
export type DeepReadonlyObject<T> = _<{ | ||
readonly [P in keyof T]: DeepReadonly<T[P]>; | ||
}>; | ||
export type DeepReadonlyMap<T> = T extends ReadonlyMap<infer Key, infer Value> | ||
? ReadonlyMap<Key, DeepReadonly<Value>> | ||
: never; | ||
interface PhantomSharedConstructor { | ||
compare(this: void, a: unknown, b: unknown): boolean; | ||
compareArray( | ||
this: void, | ||
a: ReadonlyArray<unknown>, | ||
b: ReadonlyArray<unknown>, | ||
): boolean; | ||
compareMap( | ||
this: void, | ||
a: ReadonlyMap<unknown, unknown>, | ||
b: ReadonlyMap<unknown, unknown>, | ||
): boolean; | ||
deepClone<T>(this: void, array: ReadonlyArray<T>): Array<T>; | ||
deepClone<K, V>(this: void, map: ReadonlyMap<K, V>): Map<K, V>; | ||
deepClone<T>(this: void, set: ReadonlySet<T>): Set<T>; | ||
deepClone<T extends object>(object: T): T; | ||
deepCompare(this: void, ...values: ReadonlyArray<unknown>): boolean; | ||
deepCompareArray( | ||
this: void, | ||
...arrays: ReadonlyArray<ReadonlyArray<unknown>> | ||
): boolean; | ||
deepCompareMap( | ||
this: void, | ||
...maps: ReadonlyArray<ReadonlyMap<unknown, unknown>> | ||
): boolean; | ||
deepFreeze<T>(this: void, array: ReadonlyArray<T>): DeepReadonlyArray<T>; | ||
deepFreeze<K, V>( | ||
this: void, | ||
map: ReadonlyMap<K, V>, | ||
): ReadonlyMap<K, DeepReadonly<V>>; | ||
deepFreeze<T>(this: void, set: ReadonlySet<T>): ReadonlySet<DeepReadonly<T>>; | ||
deepFreeze<T extends object>(object: T): DeepReadonly<T>; | ||
deepSafeFreeze<T>(this: void, array: ReadonlyArray<T>): DeepReadonlyArray<T>; | ||
deepSafeFreeze<K, V>( | ||
this: void, | ||
map: ReadonlyMap<K, V>, | ||
): ReadonlyMap<K, DeepReadonly<V>>; | ||
deepSafeFreeze<T>( | ||
this: void, | ||
set: ReadonlySet<T>, | ||
): ReadonlySet<DeepReadonly<T>>; | ||
deepSafeFreeze<T extends object>(object: T): DeepReadonly<T>; | ||
entries<T>(this: void, array: ReadonlyArray<T>): Array<[number, T]>; | ||
entries<K, V>(this: void, map: ReadonlyMap<K, V>): Array<[K, V]>; | ||
entries<T>(this: void, set: ReadonlySet<T>): Array<[T, true]>; | ||
entries<T extends object>(object: T): Array<[keyof T, T[keyof T]]>; | ||
keys(this: void, array: ReadonlyArray<unknown>): Array<number>; | ||
keys<K>(this: void, map: ReadonlyMap<K, unknown>): Array<K>; | ||
keys<T>(this: void, set: ReadonlySet<T>): Array<T>; | ||
keys<T extends object, K extends keyof T>(object: T): Array<K>; | ||
safeFreeze<T>(this: void, array: ReadonlyArray<T>): ReadonlyArray<T>; | ||
safeFreeze<K, const V>(this: void, map: ReadonlyMap<K, V>): ReadonlyMap<K, V>; | ||
safeFreeze<T>(this: void, set: ReadonlySet<T>): ReadonlySet<T>; | ||
safeFreeze<T extends object>(this: void, object: T): Readonly<T>; | ||
size(object: object): number; | ||
values<T>(this: void, array: ReadonlyArray<T>): Array<T>; | ||
values<V>(this: void, map: ReadonlyMap<unknown, V>): Array<V>; | ||
values(this: void, set: ReadonlySet<unknown>): Array<true>; | ||
values<T extends object, K extends keyof T>(object: T): Array<T[K]>; | ||
deepEquals, | ||
deepFreeze, | ||
deepSafeFreeze, | ||
entries, | ||
keys, | ||
safeFreeze, | ||
size, | ||
values, | ||
}; | ||
} | ||
export declare const PhantomShared: PhantomSharedConstructor; | ||
export = PhantomShared; |
@@ -1,155 +0,30 @@ | ||
export function strictEqual(...values: ReadonlyArray<unknown>): boolean; | ||
import type { | ||
DeepReadonly, | ||
DeepReadonlyArray, | ||
DeepReadonlyMap, | ||
DeepReadonlyObject, | ||
DeepReadonlySet, | ||
} from "./DeepReadonly"; | ||
import type { Decr, Incr } from "./helpers"; | ||
import type { InferKey, InferValue } from "./Infer"; | ||
import strictEqual from "./strictEqual"; | ||
import type { Tuple } from "./Tuple"; | ||
export type Incr = [ | ||
1, | ||
2, | ||
3, | ||
4, | ||
5, | ||
6, | ||
7, | ||
8, | ||
9, | ||
10, | ||
11, | ||
12, | ||
13, | ||
14, | ||
15, | ||
16, | ||
17, | ||
18, | ||
19, | ||
20, | ||
21, | ||
22, | ||
23, | ||
24, | ||
25, | ||
26, | ||
27, | ||
28, | ||
29, | ||
30, | ||
31, | ||
32, | ||
33, | ||
34, | ||
35, | ||
36, | ||
37, | ||
38, | ||
39, | ||
40, | ||
41, | ||
42, | ||
43, | ||
44, | ||
45, | ||
46, | ||
47, | ||
48, | ||
49, | ||
50, | ||
51, | ||
52, | ||
53, | ||
54, | ||
55, | ||
56, | ||
57, | ||
58, | ||
59, | ||
60, | ||
61, | ||
62, | ||
63, | ||
64, | ||
]; | ||
declare namespace PhantomUtil { | ||
export type { | ||
DeepReadonly, | ||
DeepReadonlyObject, | ||
DeepReadonlyArray, | ||
DeepReadonlyMap, | ||
DeepReadonlySet, | ||
Incr, | ||
Decr, | ||
Tuple, | ||
InferKey, | ||
InferValue, | ||
}; | ||
export type Decr = [ | ||
never, | ||
0, | ||
1, | ||
2, | ||
3, | ||
4, | ||
5, | ||
6, | ||
7, | ||
8, | ||
9, | ||
10, | ||
11, | ||
12, | ||
13, | ||
14, | ||
15, | ||
16, | ||
17, | ||
18, | ||
19, | ||
20, | ||
21, | ||
22, | ||
23, | ||
24, | ||
25, | ||
26, | ||
27, | ||
28, | ||
29, | ||
30, | ||
31, | ||
32, | ||
33, | ||
34, | ||
35, | ||
36, | ||
37, | ||
38, | ||
39, | ||
40, | ||
41, | ||
42, | ||
43, | ||
44, | ||
45, | ||
46, | ||
47, | ||
48, | ||
49, | ||
50, | ||
51, | ||
52, | ||
53, | ||
54, | ||
55, | ||
56, | ||
57, | ||
58, | ||
59, | ||
60, | ||
61, | ||
62, | ||
63, | ||
]; | ||
export { strictEqual }; | ||
} | ||
/** | ||
* Helper type for repetitive types in tuples. | ||
* | ||
* @example | ||
* ```typescript | ||
* type LongTupleType = [number, number, number, number] | ||
* // is the same as | ||
* type ShortTupleType = Tuple<4, number> | ||
* ``` | ||
*/ | ||
export type Tuple< | ||
Length extends number, | ||
Type, | ||
Acc extends Array<Type> = [], | ||
CurrentLength extends number = 0, | ||
> = Length extends CurrentLength | ||
? Acc | ||
: Tuple<Length, Type, [...Acc, Type], Incr[CurrentLength]>; | ||
export = PhantomUtil; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
86660
0
173
1196
6
- Removed@rbxts/compiler-types@^2.3.0-types.1
- Removed@rbxts/types@1.0.787
- Removed@rbxts/compiler-types@2.3.0-types.2(transitive)
- Removed@rbxts/types@1.0.787(transitive)