From 5088d7540ab3470f0030cdc51890e9484fabb21d Mon Sep 17 00:00:00 2001 From: bernardwang Date: Wed, 10 Mar 2021 10:29:25 -0600 Subject: [PATCH] Add typescript defs to flags --- packages/design-system/src/components/flags.js | 12 ------------ packages/design-system/src/components/flags.ts | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 12 deletions(-) delete mode 100644 packages/design-system/src/components/flags.js create mode 100644 packages/design-system/src/components/flags.ts diff --git a/packages/design-system/src/components/flags.js b/packages/design-system/src/components/flags.js deleted file mode 100644 index 90ee6cf062..0000000000 --- a/packages/design-system/src/components/flags.js +++ /dev/null @@ -1,12 +0,0 @@ -// featureFlags.js -const flags = { - ERROR_PLACEMENT_DEFAULT: 'top', -}; - -export function errorPlacementDefault() { - return flags.ERROR_PLACEMENT_DEFAULT; -} - -export function setErrorPlacementDefault(value) { - flags.ERROR_PLACEMENT_DEFAULT = value; -} diff --git a/packages/design-system/src/components/flags.ts b/packages/design-system/src/components/flags.ts new file mode 100644 index 0000000000..0f9dfd8ad2 --- /dev/null +++ b/packages/design-system/src/components/flags.ts @@ -0,0 +1,17 @@ +type errorPlacementValue = 'top' | 'bottom'; +interface flagsType { + ERROR_PLACEMENT_DEFAULT: errorPlacementValue +} + +// featureFlags.js +const flags: flagsType = { + ERROR_PLACEMENT_DEFAULT: 'top', +}; + +export function errorPlacementDefault(): errorPlacementValue { + return flags.ERROR_PLACEMENT_DEFAULT; +} + +export function setErrorPlacementDefault(value: errorPlacementValue): void { + flags.ERROR_PLACEMENT_DEFAULT = value; +}