From 30c19529cf856b35100e3fc506e65a42516ab180 Mon Sep 17 00:00:00 2001 From: Seb Aebischer Date: Wed, 6 Mar 2024 14:41:08 +0000 Subject: [PATCH] fix: Improve type of `configure` config param This allows IntelliSense to suggest the `dependencies` key (and any other existing config keys) when you are entering the config parameter. The `TMoreConfig` type, which is used to track the addition of arbitrary keys to the Lambda Wrapper config object, was not constrained and so could be inferred as `any`. The type of the `config` param therefore defaulted to `Partial & any`. This is equivalent to `any`, and IntelliSense cannot make suggestions about keys that may be available. By requiring `TMoreConfig` to extend `Partial`, we still allow any object but tell the type system about expected optional keys, so IntelliSense can suggest them. Jira: [ENG-3163] --- src/core/LambdaWrapper.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/LambdaWrapper.ts b/src/core/LambdaWrapper.ts index 15c2238..53ed825 100644 --- a/src/core/LambdaWrapper.ts +++ b/src/core/LambdaWrapper.ts @@ -27,7 +27,7 @@ export default class LambdaWrapper(config: Partial & TMoreConfig): LambdaWrapper { + configure>(config: Partial & TMoreConfig): LambdaWrapper { return new LambdaWrapper(mergeConfig(this.config, config)); }