Coerce a primitive type to its boxed equivalent.
type A = BoxedPrimitive<string>; // ^? Stringtype B = BoxedPrimitive<number>; // ^? Number
npx atmx add type boxed-primitive
Copy and paste the following method into @/utils/helpers/undefined.ts:
@/utils/helpers/undefined.ts
/*** Coerce a primitive type to its boxed equivalent.** @example* type A = BoxedPrimitive<string> // ^? String* type B = BoxedPrimitive<number> // ^? Number*/export type BoxedPrimitive<T> = T extends string? String: T extends number? Number: T extends boolean ? Boolean : T extends bigint ? BigInt : T extends symbol ? Symbol : T;