mirror of
https://github.com/zoriya/typebox.git
synced 2026-05-29 09:23:08 +00:00
@@ -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)
|
||||
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@sinclair/typebox",
|
||||
"version": "0.33.11",
|
||||
"version": "0.33.12",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@sinclair/typebox",
|
||||
"version": "0.33.11",
|
||||
"version": "0.33.12",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@arethetypeswrong/cli": "^0.13.2",
|
||||
|
||||
+1
-1
@@ -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",
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user