Skip to content

Commit 4462596

Browse files
authored
Merge pull request #1173 from dnicolson/fix-typescript-workflows
Fix TypeScript workflows
2 parents 8db0b67 + 3789b07 commit 4462596

File tree

4 files changed

+37
-36
lines changed

4 files changed

+37
-36
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"test:packages": "npm run test:packages:typings && npm run test:packages:unit --workspaces",
2121
"test:packages:unit": "c8 npm run test:unit --workspaces",
2222
"test:packages:benchmark": "npm run test:benchmark --workspaces",
23-
"test:packages:typings": "tsd --workspaces",
23+
"test:packages:typings": "ls packages | xargs -I {} tsd packages/{}",
2424
"release:tag": "git tag $npm_package_version && git push --tags",
2525
"rm": "npm run lerna:rm:coverage && npm run lerna:rm:node_modules && npm run lerna:rm:lock",
2626
"rm:coverage": "rm -rf coverage --workspaces",

packages/core/index.test-d.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ type EnhanceHandlerType<T, NewReturn> = T extends (
1919
type AWSLambdaHandlerWithoutCallback<TEvent = any, TResult = any> = (
2020
event: TEvent,
2121
context: Context,
22-
) => void | Promise<TResult>;
22+
// eslint-disable-next-line
23+
) => void | Promise<TResult>
2324

2425
type LambdaHandler<TEvent = any, TResult = any> = EnhanceHandlerType<AWSLambdaHandlerWithoutCallback<TEvent, TResult>, TResult>
2526

@@ -63,7 +64,7 @@ expectType<Handler>(handler)
6364
expectAssignable<AWSLambdaHandler<APIGatewayProxyEvent, APIGatewayProxyResult>>(handler)
6465

6566
// Middy handlers third argument is an object containing a abort signal
66-
middy((event, context, { signal }) => expectType<AbortSignal>(signal));
67+
middy((event, context, { signal }) => expectType<AbortSignal>(signal))
6768

6869
// invokes the handler to test that it is callable
6970
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type

packages/util/index.d.ts

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,16 @@ declare class HttpError extends Error {
2929
[key: number]: any
3030
}
3131

32-
declare function createPrefetchClient<Client, ClientOptions>(
32+
declare function createPrefetchClient<Client, ClientOptions> (
3333
options: Options<Client, ClientOptions>
3434
): Client
3535

36-
declare function createClient<Client, ClientOptions>(
36+
declare function createClient<Client, ClientOptions> (
3737
options: Options<Client, ClientOptions>,
3838
request: middy.Request
3939
): Promise<Client>
4040

41-
declare function canPrefetch<Client, ClientOptions>(
41+
declare function canPrefetch<Client, ClientOptions> (
4242
options: Options<Client, ClientOptions>
4343
): boolean
4444

@@ -50,7 +50,7 @@ type InternalOutput<TVariables> = TVariables extends string[]
5050
declare function getInternal<
5151
TContext extends LambdaContext,
5252
TInternal extends Record<string, unknown>
53-
>(
53+
> (
5454
variables: false,
5555
request: middy.Request<unknown, unknown, unknown, TContext, TInternal>
5656
): Promise<{}>
@@ -59,7 +59,7 @@ declare function getInternal<
5959
declare function getInternal<
6060
TContext extends LambdaContext,
6161
TInternal extends Record<string, unknown>
62-
>(
62+
> (
6363
variables: true,
6464
request: middy.Request<unknown, unknown, unknown, TContext, TInternal>
6565
): Promise<DeepAwaited<TInternal>>
@@ -69,79 +69,79 @@ declare function getInternal<
6969
TContext extends LambdaContext,
7070
TInternal extends Record<string, unknown>,
7171
TVars extends keyof TInternal | string
72-
>(
72+
> (
7373
variables: TVars,
7474
request: middy.Request<unknown, unknown, unknown, TContext, TInternal>
7575
): TVars extends keyof TInternal
7676
? Promise<DeepAwaited<{ [_ in SanitizeKey<TVars>]: TInternal[TVars] }>>
7777
: TVars extends string
78-
? IsUnknown<Choose<DeepAwaited<TInternal>, TVars>> extends true
79-
? unknown // could not find the path
80-
: Promise<{
78+
? IsUnknown<Choose<DeepAwaited<TInternal>, TVars>> extends true
79+
? unknown // could not find the path
80+
: Promise<{
8181
[_ in SanitizeKey<TVars>]: Choose<DeepAwaited<TInternal>, TVars>
8282
}>
83-
: unknown // path is not a string or a keyof TInternal
83+
: unknown // path is not a string or a keyof TInternal
8484

8585
// get multiple values
8686
declare function getInternal<
8787
TContext extends LambdaContext,
8888
TInternal extends Record<string, unknown>,
8989
TVars extends Array<keyof TInternal | string>
90-
>(
90+
> (
9191
variables: TVars,
9292
request: middy.Request<unknown, unknown, unknown, TContext, TInternal>
9393
): Promise<
94-
SanitizeKeys<{
95-
[TVar in ArrayValues<TVars>]: TVar extends keyof TInternal
96-
? DeepAwaited<TInternal[TVar]>
97-
: TVar extends string
94+
SanitizeKeys<{
95+
[TVar in ArrayValues<TVars>]: TVar extends keyof TInternal
96+
? DeepAwaited<TInternal[TVar]>
97+
: TVar extends string
9898
? Choose<DeepAwaited<TInternal>, TVar>
9999
: unknown // path is not a string or a keyof TInternal
100-
}>
100+
}>
101101
>
102102

103103
// remap object
104104
declare function getInternal<
105105
TContext extends LambdaContext,
106106
TInternal extends Record<string, unknown>,
107107
TMap extends Record<string, keyof TInternal | string>
108-
>(
108+
> (
109109
variables: TMap,
110110
request: middy.Request<unknown, unknown, unknown, TContext, TInternal>
111111
): Promise<{
112112
[P in keyof TMap]: TMap[P] extends keyof TInternal
113113
? DeepAwaited<TInternal[TMap[P]]>
114114
: TMap[P] extends string
115-
? Choose<DeepAwaited<TInternal>, TMap[P]>
116-
: unknown // path is not a string or a keyof TInternal
115+
? Choose<DeepAwaited<TInternal>, TMap[P]>
116+
: unknown // path is not a string or a keyof TInternal
117117
}>
118118

119-
declare function sanitizeKey<T extends string>(key: T): SanitizeKey<T>
119+
declare function sanitizeKey<T extends string> (key: T): SanitizeKey<T>
120120

121-
declare function processCache<Client, ClientOptions>(
121+
declare function processCache<Client, ClientOptions> (
122122
options: Options<Client, ClientOptions>,
123123
fetch: (request: middy.Request, cachedValues: any) => any,
124124
request?: middy.Request
125-
): { value: any; expiry: number }
125+
): { value: any, expiry: number }
126126

127-
declare function getCache(keys: string): any
127+
declare function getCache (keys: string): any
128128

129-
declare function clearCache(keys?: string | string[] | null): void
129+
declare function clearCache (keys?: string | string[] | null): void
130130

131-
declare function jsonSafeParse(
131+
declare function jsonSafeParse (
132132
string: string,
133133
reviver?: (key: string, value: any) => any
134134
): any
135135

136-
declare function normalizeHttpResponse(
136+
declare function normalizeHttpResponse (
137137
request: any,
138138
fallbackResponse?: any
139139
): any
140140

141-
declare function createError(
141+
declare function createError (
142142
code: number,
143143
message: string,
144144
properties?: Record<string, any>
145145
): HttpError
146146

147-
declare function modifyCache(cacheKey: string, value: any): void
147+
declare function modifyCache (cacheKey: string, value: any): void

packages/util/type-utils.test-d.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ expectType<SanitizeKeyPrefixLeadingNumber<'-abcd'>>('-abcd')
2828
// SanitizeKeyRemoveDisallowedChar
2929
// removes all disallowed chars and replaces them with _
3030
expectType<
31-
SanitizeKeyRemoveDisallowedChar<'1234!@#AA$%^&*()BBB_+{}|:"<>?~CC`-=[D]E\\;,./F'>
31+
SanitizeKeyRemoveDisallowedChar<'1234!@#AA$%^&*()BBB_+{}|:"<>?~CC`-=[D]E\\;,./F'>
3232
>('1234___AA_______BBB___________CC____D_E_____F')
3333

3434
// RemoveAllLeadingUnderscore
@@ -62,16 +62,16 @@ expectType<SanitizeKeys<{ '0key': 0 }>>({ _0key: 0 })
6262
expectType<SanitizeKeys<{ 'api//secret-key0.pem': 0 }>>({
6363
api_secret_key0_pem: 0
6464
})
65-
expectType<SanitizeKeys<{ '0key': 0; 'api//secret-key0.pem': 0 }>>({
65+
expectType<SanitizeKeys<{ '0key': 0, 'api//secret-key0.pem': 0 }>>({
6666
_0key: 0,
6767
api_secret_key0_pem: 0
6868
})
6969

7070
// DeepAwaited
7171
expectType<
72-
DeepAwaited<{
73-
level1: { level2: Promise<Promise<{ innerPromise: Promise<22> }>> }
74-
}>
72+
DeepAwaited<{
73+
level1: { level2: Promise<Promise<{ innerPromise: Promise<22> }>> }
74+
}>
7575
>({
7676
level1: {
7777
level2: {

0 commit comments

Comments
 (0)