feat(web)!: use bigint for timeouts

This commit is contained in:
ObserverOfTime 2025-08-30 15:54:17 +03:00 committed by Amaan Qureshi
parent 0c5cdcb161
commit dba8446d9e
5 changed files with 27 additions and 28 deletions

View file

@ -289,7 +289,7 @@ export class Parser {
*
* This is set via {@link Parser#setTimeoutMicros}.
*/
getTimeoutMicros(): number {
getTimeoutMicros(): bigint {
return C._ts_parser_timeout_micros(this[0]);
}
@ -302,8 +302,8 @@ export class Parser {
* If parsing takes longer than this, it will halt early, returning `null`.
* See {@link Parser#parse} for more information.
*/
setTimeoutMicros(timeout: number): void {
C._ts_parser_set_timeout_micros(this[0], 0, timeout);
setTimeoutMicros(timeout: bigint): void {
C._ts_parser_set_timeout_micros(this[0], timeout);
}
/** Set the logging callback that a parser should use during parsing. */

View file

@ -56,7 +56,7 @@ export interface QueryOptions {
*
* If query execution takes longer than this, it will halt early, returning an empty array.
*/
timeoutMicros?: number;
timeoutMicros?: bigint;
/**
* A function that will be called periodically during the execution of the query to check
@ -708,7 +708,7 @@ export class Query {
const endIndex = options.endIndex ?? 0;
const matchLimit = options.matchLimit ?? 0xFFFFFFFF;
const maxStartDepth = options.maxStartDepth ?? 0xFFFFFFFF;
const timeoutMicros = options.timeoutMicros ?? 0;
const timeoutMicros = options.timeoutMicros ?? 0n;
const progressCallback = options.progressCallback;
if (typeof matchLimit !== 'number') {
@ -803,7 +803,7 @@ export class Query {
const endIndex = options.endIndex ?? 0;
const matchLimit = options.matchLimit ?? 0xFFFFFFFF;
const maxStartDepth = options.maxStartDepth ?? 0xFFFFFFFF;
const timeoutMicros = options.timeoutMicros ?? 0;
const timeoutMicros = options.timeoutMicros ?? 0n;
const progressCallback = options.progressCallback;
if (typeof matchLimit !== 'number') {