From 26a85939fe1e0164f0b3ff529a4d2c16848c8344 Mon Sep 17 00:00:00 2001 From: Robin Baum Date: Wed, 1 Nov 2023 20:13:01 +0100 Subject: [PATCH] Rename little 't' to 'of' --- src/forEachSqsRecord/index.spec.ts | 10 +++++----- src/parseJson/index.spec.ts | 6 +++--- src/serializeJson/index.spec.ts | 6 +++--- src/types/TypeRef.ts | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/forEachSqsRecord/index.spec.ts b/src/forEachSqsRecord/index.spec.ts index 8f99a7d..f36513e 100644 --- a/src/forEachSqsRecord/index.spec.ts +++ b/src/forEachSqsRecord/index.spec.ts @@ -1,7 +1,7 @@ import { compose, types } from '../core'; import { SQSBatchResponse, SQSEvent, SQSRecord } from 'aws-lambda'; import { forEachSqsRecord } from './index'; -import { t } from '../types/TypeRef'; +import { of } from '../types/TypeRef'; import { mock } from '../types/mock'; import { inject } from '../inject'; @@ -22,7 +22,7 @@ describe('given batchItemFailures are expected', () => { }), forEachSqsRecord({ batchItemFailures: true, - bodyType: t, + bodyType: of, }), )(async (event) => { if (event.record.body.shouldFail) { @@ -45,7 +45,7 @@ describe('given batchItemFailures are expected', () => { // @ts-expect-error forEachSqsRecord({ batchItemFailures: false, - bodyType: t, + bodyType: of, }), )(async (event) => {}); }); @@ -118,7 +118,7 @@ describe('given no batchItemFailures are expected', () => { types>(), forEachSqsRecord({ batchItemFailures: false, - bodyType: t, + bodyType: of, }), )(async (event) => { if (event.record.body.shouldFail) { @@ -140,7 +140,7 @@ describe('given no batchItemFailures are expected', () => { // @ts-expect-error forEachSqsRecord({ batchItemFailures: true, - bodyType: t, + bodyType: of, }), )(async (event) => {}); }); diff --git a/src/parseJson/index.spec.ts b/src/parseJson/index.spec.ts index b655cfd..5b1656b 100644 --- a/src/parseJson/index.spec.ts +++ b/src/parseJson/index.spec.ts @@ -1,7 +1,7 @@ import { APIGatewayProxyEvent } from 'aws-lambda'; import { compose, types } from '../core'; import { parseJson } from './index'; -import { t } from '../types/TypeRef'; +import { of } from '../types/TypeRef'; let handler; const body = { name: 'bob', age: 12 }; @@ -25,7 +25,7 @@ describe('given body type is specified', () => { it('should not throw ts errors', () => { handler = compose( types(), - parseJson(t<{ id: string; description: string }>), + parseJson(of<{ id: string; description: string }>), )(async (event) => { event.jsonBody.id; event.jsonBody.description; @@ -36,7 +36,7 @@ describe('given body type is specified', () => { it('should throw ts error', () => { handler = compose( types(), - parseJson(t<{ id: string; description: string }>), + parseJson(of<{ id: string; description: string }>), )(async (event) => { // @ts-expect-error event.jsonBody.unknown; diff --git a/src/serializeJson/index.spec.ts b/src/serializeJson/index.spec.ts index 7ca0e2b..2bbda31 100644 --- a/src/serializeJson/index.spec.ts +++ b/src/serializeJson/index.spec.ts @@ -2,7 +2,7 @@ import { compose, types } from '../core'; import { APIGatewayEvent } from 'aws-lambda'; import { serializeJson } from './'; import { APIGatewayProxyResult } from '../types/APIGatewayProxyResult'; -import { t } from '../types/TypeRef'; +import { of } from '../types/TypeRef'; describe('given no body type is specified', () => { const createHandler = () => @@ -40,7 +40,7 @@ describe('given body type is specified', () => { const createHandler = () => compose( types>(), - serializeJson(t), + serializeJson(of), )(async (event) => { return { statusCode: 200, @@ -70,7 +70,7 @@ describe('given body type is specified but not returned properly', () => { it('should throw ts error', () => { compose( types>(), - serializeJson(t<{ id: string; description: string }>), + serializeJson(of<{ id: string; description: string }>), // @ts-expect-error )(async (event) => { return { diff --git a/src/types/TypeRef.ts b/src/types/TypeRef.ts index b4ae455..34f6425 100644 --- a/src/types/TypeRef.ts +++ b/src/types/TypeRef.ts @@ -1,2 +1,2 @@ -export const t = () => null as unknown as T; +export const of = () => null as unknown as T; export type TypeRef = () => T;