Skip to content

Commit a0bb1e0

Browse files
committed
validateTemplateParams: improve type
1 parent 175811b commit a0bb1e0

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/utils/validateTemplateParams/validateTemplateParams.spec.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@ import { it, expect } from '@jest/globals';
22
import { validateTemplateParams } from './validateTemplateParams';
33

44
it('should fail on wrong type', () => {
5-
expect(() => validateTemplateParams('variable' as unknown as Record<string, unknown>)).toThrow(
6-
'The template params have to be the object.',
7-
);
8-
expect(() => validateTemplateParams([] as unknown as Record<string, unknown>)).toThrow(
5+
expect(() => validateTemplateParams('variable')).toThrow(
96
'The template params have to be the object.',
107
);
8+
expect(() => validateTemplateParams([])).toThrow('The template params have to be the object.');
119
});
1210

1311
it('should successfully pass the validation', () => {

src/utils/validateTemplateParams/validateTemplateParams.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export const validateTemplateParams = (templateParams?: Record<string, unknown>) => {
1+
export const validateTemplateParams = (templateParams?: unknown) => {
22
// eslint-disable-next-line @typescript-eslint/no-base-to-string
33
if (templateParams && templateParams.toString() !== '[object Object]') {
44
throw 'The template params have to be the object. Visit https://www.emailjs.com/docs/sdk/send/';

0 commit comments

Comments
 (0)