0.1.13 #18
@@ -4,15 +4,16 @@ import { createFileRoute } from "@tanstack/react-router"
|
|||||||
import { GetRandomValues, makeUuid4 } from "@typed/id"
|
import { GetRandomValues, makeUuid4 } from "@typed/id"
|
||||||
import { Console, Effect, Option } from "effect"
|
import { Console, Effect, Option } from "effect"
|
||||||
import { useEffect, useState } from "react"
|
import { useEffect, useState } from "react"
|
||||||
import { PropertyPath } from "reffuse/types"
|
|
||||||
|
|
||||||
|
|
||||||
interface Node {
|
interface Node {
|
||||||
readonly value: string
|
value: string
|
||||||
readonly left?: Node
|
left?: Leaf
|
||||||
readonly right?: Node
|
right?: Leaf
|
||||||
|
}
|
||||||
|
interface Leaf {
|
||||||
|
node: Node
|
||||||
}
|
}
|
||||||
type NodePaths = PropertyPath.Paths<Node>
|
|
||||||
|
|
||||||
|
|
||||||
const makeUuid = Effect.provide(makeUuid4, GetRandomValues.CryptoRandom)
|
const makeUuid = Effect.provide(makeUuid4, GetRandomValues.CryptoRandom)
|
||||||
|
|||||||
@@ -17,9 +17,10 @@ export type ArrayPaths<T extends readonly any[], Seen> = {
|
|||||||
: never
|
: never
|
||||||
|
|
||||||
export type ObjectPaths<T extends object, Seen> = {
|
export type ObjectPaths<T extends object, Seen> = {
|
||||||
[K in keyof T as K extends string | number | symbol ? K : never]:
|
[K in keyof T as K extends string | number | symbol ? K : never]-?:
|
||||||
| [K]
|
NonNullable<T[K]> extends infer V
|
||||||
| [K, ...Paths<T[K], Seen>]
|
? [K] | [K, ...Paths<T[K], Seen>]
|
||||||
|
: never
|
||||||
} extends infer O
|
} extends infer O
|
||||||
? O[keyof O]
|
? O[keyof O]
|
||||||
: never
|
: never
|
||||||
|
|||||||
Reference in New Issue
Block a user