Skip to content

Commit

Permalink
fix(eks): remove 'const' from NodeType enum (#1970)
Browse files Browse the repository at this point in the history
'const enums' are inlined at the usage site by TypeScript and so the
generated type will not be in the JavaScript source code in the
assembly, even though the declaration will be there.

This leads to "symbol not found" errors upon trying to load it.

https://www.typescriptlang.org/docs/handbook/enums.html#const-enums

Fixes #1969
  • Loading branch information
rix0rrr authored and RomainMuller committed Mar 7, 2019
1 parent b529ad7 commit ac52989
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-eks/lib/ami.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const LATEST_KUBERNETES_VERSION = '1.11';
/**
* Whether the worker nodes should support GPU or just normal instances
*/
export const enum NodeType {

This comment has been minimized.

Copy link
@sam-goodwin

sam-goodwin Mar 7, 2019

Contributor

Should we create a lint/jsii rule to prevent this in the future?

This comment has been minimized.

Copy link
@rix0rrr

rix0rrr Mar 8, 2019

Author Contributor

Already did

export enum NodeType {
/**
* Normal instances
*/
Expand Down Expand Up @@ -121,4 +121,4 @@ function parseTable(contents: string): {[type: string]: {[region: string]: strin
[NodeType.GPU]: gpuTable,
[NodeType.Normal]: normalTable
};
}
}

0 comments on commit ac52989

Please sign in to comment.