Skip to content

Conversation

@kwonoj
Copy link
Contributor

@kwonoj kwonoj commented Apr 11, 2025

Attempt to close #59.

Arktype supports a plain, non-string literal wrapped inside of type calls like

type({
  p: {}
})

but can't create chained (union / intersection) from object types like

type({
 p: '{} | undefined' //won't work, '{}' is not resolvable primitives in arktype
})

PR attempts to fix it by changing Object codegen, create a type({}) instead. For the unions and intersections, uses .or() / .intersection() api chain instead of string literal if the left hand expr started with type() calls.

@sinclairzx81
Copy link
Owner

@kwonoj Hi, thanks for the PR

The object mapping with type({ }) looks good. Will roll this update through and published later today.

Thanks again!
S

@sinclairzx81 sinclairzx81 merged commit 26e36a0 into sinclairzx81:main Apr 13, 2025
3 checks passed
@sinclairzx81
Copy link
Owner

Updates published on 0.11.1

You can preview them here https://sinclairzx81.github.io/typebox-workbench/

All the best
S

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ModelToArkType fails to transform { [key: string]: any } | undefined

2 participants