From ebfb522491830ebe2ea78b00e46e4d62190a8486 Mon Sep 17 00:00:00 2001 From: Hiroki Kato Date: Thu, 8 Nov 2018 20:51:26 +0900 Subject: [PATCH] fix(aws-ecs): fix use of published NPM package with TypeScript (#1117) The package previously published would not work with a TypeScript consumer, because the generated `.d.ts` file was missing an import statement due to a bug in the TypeScript compiler. Add an explicit type declaration to work around this issue until it is fixed and released upstream. Reference: https://github.com/Microsoft/TypeScript/issues/26969 --- .../@aws-cdk/aws-ecs/lib/fargate/fargate-task-definition.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/@aws-cdk/aws-ecs/lib/fargate/fargate-task-definition.ts b/packages/@aws-cdk/aws-ecs/lib/fargate/fargate-task-definition.ts index 2c700e03ffd71..475e90faa2d01 100644 --- a/packages/@aws-cdk/aws-ecs/lib/fargate/fargate-task-definition.ts +++ b/packages/@aws-cdk/aws-ecs/lib/fargate/fargate-task-definition.ts @@ -46,7 +46,10 @@ export class FargateTaskDefinition extends TaskDefinition { /** * The configured network mode */ - public readonly networkMode = NetworkMode.AwsVpc; + public readonly networkMode: NetworkMode = NetworkMode.AwsVpc; + // NOTE: Until the fix to https://github.com/Microsoft/TypeScript/issues/26969 gets released, + // we need to explicitly write the type here, as type deduction for enums won't lead to + // the import being generated in the .d.ts file. constructor(parent: cdk.Construct, name: string, props: FargateTaskDefinitionProps = {}) { super(parent, name, {