Skip to content

Commit

Permalink
chore: apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: axel7083 <[email protected]>
  • Loading branch information
benoitf and axel7083 authored Jan 19, 2024
1 parent b31f107 commit 3096934
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/backend/src/models/AIConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export interface AIConfig {

export function isString(value: unknown): value is string {
// eslint-disable-next-line no-null/no-null
return (value !== undefined && value !== null && typeof value === 'string') || value instanceof String;
return (!!value && typeof value === 'string') || value instanceof String;
}

export function assertString(value: unknown): string {
Expand Down
6 changes: 2 additions & 4 deletions packages/shared/src/messages/MessageProxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ type UnaryRPC = (...args: unknown[]) => Promise<unknown>;
export function isMessageRequest(content: unknown): content is IMessageRequest {
return (
// eslint-disable-next-line no-null/no-null
content !== undefined && content !== null && typeof content === 'object' && 'id' in content && 'channel' in content
!!content && typeof content === 'object' && 'id' in content && 'channel' in content
);
}

Expand Down Expand Up @@ -210,9 +210,7 @@ export class RpcBrowser {

isSubscribedMessage(content: any): content is ISubscribedMessage {
return (
content !== undefined &&
// eslint-disable-next-line no-null/no-null
content !== null &&
!!content &&
'id' in content &&
'body' in content &&
this.subscribers.has(content.id)
Expand Down

0 comments on commit 3096934

Please sign in to comment.