Revision 0.34.48 (#6)

* Support Sparse Array Validation

* ChangeLog

* Version
This commit is contained in:
sinclairzx81
2026-01-23 17:59:38 +09:00
committed by GitHub
parent 3b0f4ea060
commit 11f18ac6e9
7 changed files with 39 additions and 6 deletions

View File

@@ -183,4 +183,19 @@ describe('compiler/Array', () => {
],
})
})
// ----------------------------------------------------------------
// Issue: https://github.com/sinclairzx81/typebox/issues/1519
// ----------------------------------------------------------------
it('Should correctly handle sparse arrays 1', () => {
const T = Type.Array(Type.String())
const V = []
V[10] = 'hello'
Fail(T, V)
})
it('Should correctly handle sparse arrays 2', () => {
const T = Type.Array(Type.Union([Type.String(), Type.Undefined()]))
const V = []
V[10] = 'hello'
Ok(T, V)
})
})