mirror of
https://github.com/zoriya/typebox.git
synced 2026-06-01 02:28:24 +00:00
Recursive KeyOf (#382)
This commit is contained in:
@@ -79,3 +79,15 @@ import { Type } from '@sinclair/typebox'
|
||||
Expect(K2).ToInfer<'y' | 'z'>()
|
||||
}
|
||||
}
|
||||
{
|
||||
const T = Type.Recursive((Self) =>
|
||||
Type.Object({
|
||||
a: Type.String(),
|
||||
b: Type.String(),
|
||||
c: Type.String(),
|
||||
d: Type.Array(Self),
|
||||
}),
|
||||
)
|
||||
const K = Type.KeyOf(T)
|
||||
Expect(K).ToInfer<'a' | 'b' | 'c' | 'd'>()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user