Skip to content

Commit 33dd7ba

Browse files
committed
chore(types): use generic TypeGuardFunction type
1 parent bba21a6 commit 33dd7ba

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/parse.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { EJSON } from 'bson';
22
import { Base64 } from 'js-base64';
33
import { decompress } from 'lz4js';
4+
import type { TypeGuardFunction } from './types.js';
45

5-
export type ParseTypeGuardFunction<T> = (obj: any) => obj is T;
66
export type ParseReviverFunction = (this: any, key: string, value: any) => any;
77

88
export type ParseOptions = {
@@ -73,7 +73,7 @@ export function parse<T = any>(
7373
text: string,
7474
reviver?: ParseReviverFunction | ParseOptions | null,
7575
options?: ParseOptions,
76-
typeGuard?: ParseTypeGuardFunction<T>,
76+
typeGuard?: TypeGuardFunction<T>,
7777
): T {
7878
let _reviver: ParseReviverFunction | undefined = undefined;
7979
if (typeof reviver === 'function') {

src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export type TypeGuardFunction<T> = (obj: any) => obj is T;

0 commit comments

Comments
 (0)