Files
typebox/test/static/optional.ts
glm-5.1 bd758c2342 Fork from @sinclair/typebox 0.34.49 as @alkdev/typebox
- Rename package from @sinclair/typebox to @alkdev/typebox
- Update author, repository, and homepage to alkdev
- Remove GitHub workflows, .vscode config, and branding assets
- Update all source, test, example, changelog, and task imports
- Update tsconfig.json path mappings
- Clean up readme header (remove upstream badges/branding)
2026-04-23 13:22:31 +00:00

50 lines
790 B
TypeScript

import { Expect } from './assert'
import { Type, Static } from '@alkdev/typebox'
{
const T = Type.Object({
A: Type.Optional(Type.String()),
})
type T = Static<typeof T>
Expect(T).ToStatic<{
A?: string
}>()
}
// Noop
// prettier-ignore
{
const T = Type.Object({
A: Type.Optional(Type.String(), false),
})
type T = Static<typeof T>
Expect(T).ToStatic<{
A: string
}>()
}
// Additive
// prettier-ignore
{
const T = Type.Object({
A: Type.Optional(Type.String(), true),
})
type T = Static<typeof T>
Expect(T).ToStatic<{
A?: string
}>()
}
// Subtractive
// prettier-ignore
{
const T = Type.Object({
A: Type.Optional(Type.Optional(Type.String()), false)
})
type T = Static<typeof T>
Expect(T).ToStatic<{
A: string
}>()
}