Skip to content

Commit 577efe8

Browse files
committed
Fix StringSchema.bound method min,max length
1 parent 8e0b7cc commit 577efe8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/types/src/tlv/TlvString.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66

7-
import { InternalError, maxValue, minValue, serialize, UnexpectedDataError } from "#general";
7+
import { InternalError, serialize, UnexpectedDataError } from "#general";
88
import { ValidationDatatypeMismatchError, ValidationOutOfBoundsError } from "../common/ValidationError.js";
99
import { TlvCodec, TlvTag, TlvToPrimitive, TlvType, TlvTypeLength } from "./TlvCodec.js";
1010
import { TlvReader, TlvSchema, TlvWriter } from "./TlvSchema.js";
@@ -60,8 +60,8 @@ export class StringSchema<T extends TlvType.ByteString | TlvType.Utf8String> ext
6060
bound({ minLength, maxLength, length }: LengthConstraints) {
6161
return new StringSchema(
6262
this.type,
63-
length ?? maxValue(this.minLength, minLength),
64-
length ?? minValue(this.maxLength, maxLength),
63+
length ?? minLength ?? this.minLength,
64+
length ?? maxLength ?? this.maxLength,
6565
);
6666
}
6767
}

0 commit comments

Comments
 (0)