Skip to content

Commit

Permalink
Revision 0.33.12 (#1000)
Browse files Browse the repository at this point in the history
* Version + Formatting

* ChangeLog
  • Loading branch information
sinclairzx81 authored Sep 18, 2024
1 parent 928ebd9 commit 0ed2071
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
6 changes: 6 additions & 0 deletions changelog/0.33.0.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
### 0.33.0
- [Revision 0.33.12](https://github.com/sinclairzx81/typebox/pull/999)
- [998](https://github.com/sinclairzx81/typebox/issues/998) Avoid losing precision when converting to bigints
- [Revision 0.33.11](https://github.com/sinclairzx81/typebox/pull/994)
- [993](https://github.com/sinclairzx81/typebox/issues/993) Prevent mutation on union values during Convert
- [Revision 0.33.10](https://github.com/sinclairzx81/typebox/pull/991)
- [907](https://github.com/sinclairzx81/typebox/issues/907) Add package.json metadata to specify possible side effect modules
- [Revision 0.33.9](https://github.com/sinclairzx81/typebox/pull/984)
- [887](https://github.com/sinclairzx81/typebox/issues/887) Generate Nested Intersect Errors
- [Revision 0.33.8](https://github.com/sinclairzx81/typebox/pull/983)
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sinclair/typebox",
"version": "0.33.11",
"version": "0.33.12",
"description": "Json Schema Type Builder with Static Type Resolution for TypeScript",
"keywords": [
"typescript",
Expand Down
2 changes: 1 addition & 1 deletion src/value/convert/convert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ function TryConvertBoolean(value: unknown) {
return IsValueTrue(value) ? true : IsValueFalse(value) ? false : value
}
function TryConvertBigInt(value: unknown) {
const truncateInteger = (value: string) => value.split('.')[0];
const truncateInteger = (value: string) => value.split('.')[0]
return IsStringNumeric(value) ? BigInt(truncateInteger(value)) : IsNumber(value) ? BigInt(value | 0) : IsValueFalse(value) ? BigInt(0) : IsValueTrue(value) ? BigInt(1) : value
}
function TryConvertString(value: unknown) {
Expand Down
8 changes: 4 additions & 4 deletions test/runtime/value/convert/bigint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,22 @@ describe('value/convert/BigInt', () => {
it('Should convert bigint from string 5', () => {
const T = Type.BigInt()
const R = Value.Convert(T, '12345678901234567890')
Assert.IsEqual(R, BigInt("12345678901234567890"))
Assert.IsEqual(R, BigInt('12345678901234567890'))
})
it('Should convert bigint from string 6', () => {
const T = Type.BigInt()
const R = Value.Convert(T, '-12345678901234567890')
Assert.IsEqual(R, BigInt("-12345678901234567890"))
Assert.IsEqual(R, BigInt('-12345678901234567890'))
})
it('Should convert bigint from string 7', () => {
const T = Type.BigInt()
const R = Value.Convert(T, '12345678901234567890.123')
Assert.IsEqual(R, BigInt("12345678901234567890"))
Assert.IsEqual(R, BigInt('12345678901234567890'))
})
it('Should convert bigint from string 8', () => {
const T = Type.BigInt()
const R = Value.Convert(T, '-12345678901234567890.123')
Assert.IsEqual(R, BigInt("-12345678901234567890"))
Assert.IsEqual(R, BigInt('-12345678901234567890'))
})
it('Should convert bitint from number 1', () => {
const T = Type.BigInt()
Expand Down

0 comments on commit 0ed2071

Please sign in to comment.