Feature/more dynamic unions (#2972)

* with validators

* more dynamic unions

* fixes from v31

* better constructor for dynamic unions

* version bump

* fix build
This commit is contained in:
Aiden McClelland
2025-07-01 17:40:39 -06:00
committed by GitHub
parent 35d2ec8a44
commit 340775a593
21 changed files with 863 additions and 611 deletions

View File

@@ -15,10 +15,10 @@ describe("InputSpec Types", () => {
{ spec: InputSpec.of({}) } as any,
) as any
const someList = await Value.list(test).build({} as any)
if (isValueSpecListOf(someList, "text")) {
someList.spec satisfies ListValueSpecOf<"text">
} else if (isValueSpecListOf(someList, "object")) {
someList.spec satisfies ListValueSpecOf<"object">
if (isValueSpecListOf(someList.spec, "text")) {
someList.spec.spec satisfies ListValueSpecOf<"text">
} else if (isValueSpecListOf(someList.spec, "object")) {
someList.spec.spec satisfies ListValueSpecOf<"object">
} else {
throw new Error(
"Failed to figure out the type: " + JSON.stringify(someList),