Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement β†’
Sign In

@nasriya/atomix

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nasriya/atomix - npm Package Compare versions

Comparing version
1.0.21
to
1.0.22
+59
-4
dist/@types/docs/docs.d.ts

@@ -216,6 +216,12 @@ export type { Mime, FileExtension } from "../domains/http/mimes/mimes";

*
* ⚠️ Unlike `Partial<T>`, this utility makes **only the key optional**, not the value.
* That means you can omit the property entirely, but you **cannot explicitly assign `undefined`**
* unless `undefined` is already part of the value type.
* ⚠️ Unlike `Partial<T>`, which makes both keys and their values optional (allowing `undefined`),
* this utility makes **only the keys optional** β€” the value types remain unchanged.
* This means:
* - You may omit the property entirely.
* - You **cannot** assign `undefined` explicitly to the property,
* unless `undefined` is already part of the original value type.
*
* If you want to allow both keys and values to be optional (i.e., values can be `undefined`),
* consider using {@link OptionalLoose}.
*
* @template T The original object type.

@@ -240,3 +246,3 @@ * @template I A union of keys from `T` that should remain required. Defaults to `never`.

* const u1: WithId = { id: '123' }; // βœ… valid
* const u2: WithId = { id: '123', name: undefined }; // ❌ invalid unless `name: string | undefined`
* const u2: WithId = { id: '123', name: undefined }; // ❌ invalid unless `name` includes `undefined`
*

@@ -255,3 +261,52 @@ * type AllOptional = Optional<User>;

} & {
[P in keyof T as P extends I ? never : P]?: undefined extends T[P] ? T[P] : Exclude<T[P], undefined>;
}>;
/**
* Similar to `Partial<T>`, but allows excluding some keys from being made optional.
*
* Creates a new type from `T` where:
* - Keys **included** in the union `I` remain **required** (if they are).
* - Keys **not included** in `I` become optional **including their value types**,
* meaning the property can be omitted **or** assigned `undefined`.
* - If `I` is not provided (defaults to `never`), all keys behave like `Partial<T>`,
* i.e., all keys become optional and values can be `undefined`.
*
* This utility is useful when you want partial objects but want to ensure
* some keys are always present and required.
*
* @template T The original object type.
* @template I A union of keys from `T` that should remain required. Defaults to `never`.
*
* @example
* type User = {
* id: string;
* name: string;
* email: string;
* };
*
* type WithIdRequired = OptionalLoose<User, 'id'>;
* // Equivalent to:
* // {
* // id: string;
* // name?: string | undefined;
* // email?: string | undefined;
* // }
*
* const u1: WithIdRequired = { id: '123' }; // βœ… valid
* const u2: WithIdRequired = { id: '123', name: undefined }; // βœ… valid
*
* type AllPartial = OptionalLoose<User>;
* // All keys are optional and values can be undefined.
* // {
* // id?: string | undefined;
* // name?: string | undefined;
* // email?: string | undefined;
* // }
*
* @since 1.0.22
*/
export type OptionalLoose<T, I extends keyof T = never> = Prettify<{
[P in keyof T as P extends I ? P : never]: T[P];
} & {
[P in keyof T as P extends I ? never : P]?: T[P];
}>;
+1
-1

@@ -5,2 +5,2 @@ import atomix from './atomix';

export { currencies } from './data/currencies';
export type { Objects, DeepReadonly, Prettify, Brand, LooseToStrict, RequiredStrict, Optional, Mime, FileExtension, RRType, TracerouteHop, PortCheckOptions, IPGeolocation, JSONObject, Stringified, NonEmptyArray, AccessPermissions, PathAccessPermissions, AccessOptions, DiscoverHostsOptions, StringPaddingOptions, Serializable, RandomOptions, BaseQueueTask, TasksQueueOptions, AddTasksBaseOptions, EventHandler, AddHandlerOptions, InputSanitizationOptions, FieldRuleMap, SanitizedResult, SanitizationViolation, } from './docs/docs';
export type { Objects, DeepReadonly, Prettify, Brand, LooseToStrict, RequiredStrict, Optional, OptionalLoose, Mime, FileExtension, RRType, TracerouteHop, PortCheckOptions, IPGeolocation, JSONObject, Stringified, NonEmptyArray, AccessPermissions, PathAccessPermissions, AccessOptions, DiscoverHostsOptions, StringPaddingOptions, Serializable, RandomOptions, BaseQueueTask, TasksQueueOptions, AddTasksBaseOptions, EventHandler, AddHandlerOptions, InputSanitizationOptions, FieldRuleMap, SanitizedResult, SanitizationViolation, } from './docs/docs';
{
"name": "@nasriya/atomix",
"version": "1.0.21",
"version": "1.0.22",
"description": "Composable helper functions for building reliable systems",

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