Skip to content

Commit

Permalink
chore: fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
m-radzikowski committed Aug 27, 2023
1 parent 9a56a94 commit 68be775
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
6 changes: 3 additions & 3 deletions packages/core/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,10 @@ declare function middy<
TErr = Error,
TContext extends LambdaContext = LambdaContext,
TInternal extends Record<string, unknown> = {}
>(
> (
handler?:
| MiddlewareHandler<LambdaHandler<TEvent, TResult>, TContext>
| PluginObject,
| MiddlewareHandler<LambdaHandler<TEvent, TResult>, TContext>
| PluginObject,
plugin?: PluginObject
): MiddyfiedHandler<TEvent, TResult, TErr, TContext, TInternal>

Expand Down
18 changes: 9 additions & 9 deletions packages/ssm/index.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import middy from '@middy/core'
import {SSMClient} from '@aws-sdk/client-ssm'
import {captureAWSv3Client} from 'aws-xray-sdk'
import {expectType} from 'tsd'
import ssm, {Context} from '.'
import {JsonValue} from "type-fest";
import {Context as LambdaContext} from "aws-lambda/handler";
import { SSMClient } from '@aws-sdk/client-ssm'
import { captureAWSv3Client } from 'aws-xray-sdk'
import { expectType } from 'tsd'
import ssm, { Context } from '.'
import { JsonValue } from 'type-fest'
import { Context as LambdaContext } from 'aws-lambda/handler'

// use with default options
expectType<middy.MiddlewareObj<unknown, any, Error, Context<undefined>>>(ssm())
Expand All @@ -27,11 +27,11 @@ expectType<middy.MiddlewareObj<unknown, any, Error, Context<typeof options>>>(
ssm(options)
)

expectType<middy.MiddlewareObj<unknown, any, Error, LambdaContext, Record<"lorem" | "ipsum", JsonValue>>>(
expectType<middy.MiddlewareObj<unknown, any, Error, LambdaContext, Record<'lorem' | 'ipsum', JsonValue>>>(
ssm({
fetchData: {
lorem: "/lorem",
ipsum: "/lorem",
lorem: '/lorem',
ipsum: '/lorem'
}
})
)
4 changes: 2 additions & 2 deletions packages/util/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ declare function canPrefetch<Client, ClientOptions> (
options: Options<Client, ClientOptions>
): boolean

type InternalOutput<TVariables> = TVariables extends string[] ? {[key in TVariables[number]]: unknown} : never;
type InternalOutput<TVariables> = TVariables extends string[] ? { [key in TVariables[number]]: unknown } : never

// TODO this can also be "true" to get all variables or an object to remap key names -
// add alternative types to TVariables and extend InternalOutput to infer correct return type
declare function getInternal<TInternal extends Record<string, unknown>, TVariables extends (keyof TInternal)[]> (
declare function getInternal<TInternal extends Record<string, unknown>, TVariables extends Array<keyof TInternal>> (
variables: TVariables,
request: middy.Request<any, any, any, any, TInternal>
): Promise<InternalOutput<TVariables>>
Expand Down

0 comments on commit 68be775

Please sign in to comment.