Add type inference for isFormatTokenLimitError function (#26154)

This commit is contained in:
M-ZubairAhmed 2024-02-08 10:48:53 +00:00 committed by GitHub
parent b2df0086cd
commit 8d742e986b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -24,7 +24,7 @@ const FORMAT_TOKEN_LIMIT = 1000;
const FORMAT_TOKEN_LIMIT_ERROR = 'maximum number of tokens reached';
export function isFormatTokenLimitError(error: unknown) {
return Boolean(error && typeof error === 'object' && 'message' in error && error.message === FORMAT_TOKEN_LIMIT_ERROR);
return Boolean(error && typeof error === 'object' && 'message' in error && (error as Record<string, string>).message === FORMAT_TOKEN_LIMIT_ERROR);
}
// Performs formatting of user posts including highlighting mentions and search terms and converting urls, hashtags,