Skip to content

Commit a8666ce

Browse files
author
MohamedAliBouhaouala
committed
fix: refine nlp pattern type check
1 parent 89c46e9 commit a8666ce

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

api/src/chat/schemas/types/pattern.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,13 @@ export type NlpPatternMatchResult = {
6565
matchedPattern: NlpPattern[];
6666
};
6767

68-
export function isNlpPattern(
69-
pattern: unknown,
70-
): pattern is { entity: string; match: 'entity' | 'value' } {
68+
export function isNlpPattern(pattern: NlpPattern) {
7169
return (
7270
(typeof pattern === 'object' &&
7371
pattern !== null &&
7472
'entity' in pattern &&
7573
'match' in pattern &&
76-
(pattern as any).match === 'entity') ||
77-
(pattern as any).match === 'value'
74+
pattern.match === 'entity') ||
75+
pattern.match === 'value'
7876
);
7977
}

0 commit comments

Comments
 (0)