Recursive KeyOf (#382)

This commit is contained in:
sinclairzx81
2023-04-14 13:11:35 +09:00
committed by GitHub
parent ae503c5549
commit 5f641c13ae
9 changed files with 114 additions and 13 deletions
+12
View File
@@ -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'>()
}