Revision 0.32.8 (#728)

- Clone Default Annotation on Assignment
This commit is contained in:
sinclairzx81
2024-01-10 21:01:39 +09:00
committed by GitHub
parent 8e1bc047fb
commit 7ea2956763
5 changed files with 61 additions and 39 deletions
+15
View File
@@ -68,4 +68,19 @@ describe('value/create/Object', () => {
z: 3,
})
})
// ----------------------------------------------------------------
// Mutation
// ----------------------------------------------------------------
// https://github.com/sinclairzx81/typebox/issues/726
it('Should clone defaults on assignment - no mutation', () => {
const T = Type.Object(
{
x: Type.Number(),
},
{ default: { x: 1 } },
)
const V = Value.Create(T)
V.x = 123
Assert.IsEqual(T.default, { x: 1 })
})
})