@@ -156,9 +156,15 @@ export interface Crypto {
156156 * (36 characters), not a bare hexadecimal string. The `"bytes"` format
157157 * returns the 16 UUID bytes, including the version and variant bits.
158158 */
159- randomUUIDv4 < Format extends "hex" | "bytes" = "hex" > ( options ?: {
160- readonly format ?: Format | undefined
159+ randomUUIDv4 ( options ?: {
160+ readonly format ?: "hex" | undefined
161+ } ) : Effect . Effect < string , PlatformError . PlatformError >
162+ randomUUIDv4 < Format extends "hex" | "bytes" > ( options : {
163+ readonly format : Format
161164 } ) : Effect . Effect < Format extends "bytes" ? Uint8Array : string , PlatformError . PlatformError >
165+ randomUUIDv4 ( options ?: {
166+ readonly format ?: "hex" | "bytes" | undefined
167+ } ) : Effect . Effect < string | Uint8Array , PlatformError . PlatformError >
162168
163169 /**
164170 * Generates a cryptographically secure UUIDv7 using the `Clock` timestamp.
@@ -169,9 +175,15 @@ export interface Crypto {
169175 * (36 characters), not a bare hexadecimal string. The `"bytes"` format
170176 * returns the 16 UUID bytes, including the timestamp, version and variant bits.
171177 */
172- randomUUIDv7 < Format extends "hex" | "bytes" = "hex" > ( options ?: {
173- readonly format ?: Format | undefined
178+ randomUUIDv7 ( options ?: {
179+ readonly format ?: "hex" | undefined
180+ } ) : Effect . Effect < string , PlatformError . PlatformError >
181+ randomUUIDv7 < Format extends "hex" | "bytes" > ( options : {
182+ readonly format : Format
174183 } ) : Effect . Effect < Format extends "bytes" ? Uint8Array : string , PlatformError . PlatformError >
184+ randomUUIDv7 ( options ?: {
185+ readonly format ?: "hex" | "bytes" | undefined
186+ } ) : Effect . Effect < string | Uint8Array , PlatformError . PlatformError >
175187
176188 /**
177189 * Generates a cryptographically secure ULID string.
@@ -309,12 +321,12 @@ export const make = (
309321 }
310322 return buffer
311323 } ) ,
312- randomUUIDv4 : ( ( options ) =>
324+ randomUUIDv4 : ( ( options ?: { readonly format ?: "hex" | "bytes" | undefined } ) =>
313325 Effect . sync ( ( ) => {
314326 const bytes = Uuid . v4Bytes ( randomBytesUnsafe ( 16 ) )
315327 return options ?. format === "bytes" ? bytes : Uuid . stringify ( bytes )
316328 } ) ) as Crypto [ "randomUUIDv4" ] ,
317- randomUUIDv7 : ( ( options ) =>
329+ randomUUIDv7 : ( ( options ?: { readonly format ?: "hex" | "bytes" | undefined } ) =>
318330 Effect . clockWith ( ( clock ) => {
319331 const bytes = Uuid . v7Bytes ( clock . currentTimeMillisUnsafe ( ) , randomBytesUnsafe ( 16 ) )
320332 return Effect . succeed ( options ?. format === "bytes" ? bytes : Uuid . stringify ( bytes ) )
0 commit comments