From a6f4b3487cf5ef9230417108b07ad73a74d9fa0e Mon Sep 17 00:00:00 2001 From: Danny Banks Date: Tue, 3 Jan 2023 13:35:20 -0800 Subject: [PATCH] fix(types): adding missing format helpers (#834) --- lib/common/formatHelpers/getTypeScriptType.js | 4 ++-- lib/common/formatHelpers/iconsWithPrefix.js | 2 +- lib/common/formatHelpers/minifyDictionary.js | 2 +- types/FormatHelpers.d.ts | 7 +++++++ 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/common/formatHelpers/getTypeScriptType.js b/lib/common/formatHelpers/getTypeScriptType.js index 93c8276dc..435e27015 100644 --- a/lib/common/formatHelpers/getTypeScriptType.js +++ b/lib/common/formatHelpers/getTypeScriptType.js @@ -30,12 +30,12 @@ const { unique } = require('../../utils/es6_'); * }).join('\n'); * } * }); - *``` + *``` * @param {*} value A value to check the type of. * @return {String} A valid name for a TypeScript type. * */ - function getTypeScriptType(value) { +function getTypeScriptType(value) { if (Array.isArray(value)) return getArrayType(value) if (typeof value === 'object') return getObjectType(value) if (['string', 'number', 'boolean'].includes(typeof value)) return typeof value diff --git a/lib/common/formatHelpers/iconsWithPrefix.js b/lib/common/formatHelpers/iconsWithPrefix.js index 61c7b0fef..81ae0cf65 100644 --- a/lib/common/formatHelpers/iconsWithPrefix.js +++ b/lib/common/formatHelpers/iconsWithPrefix.js @@ -32,7 +32,7 @@ * }); * ``` */ - function iconsWithPrefix(prefix, allTokens, options) { +function iconsWithPrefix(prefix, allTokens, options) { return allTokens.filter(function(token) { return token.attributes.category === 'content' && token.attributes.type === 'icon'; }) diff --git a/lib/common/formatHelpers/minifyDictionary.js b/lib/common/formatHelpers/minifyDictionary.js index 2335a77f7..64b538c66 100644 --- a/lib/common/formatHelpers/minifyDictionary.js +++ b/lib/common/formatHelpers/minifyDictionary.js @@ -26,7 +26,7 @@ * }); * ``` */ - function minifyDictionary(obj) { +function minifyDictionary(obj) { if (typeof obj !== 'object' || Array.isArray(obj)) { return obj; } diff --git a/types/FormatHelpers.d.ts b/types/FormatHelpers.d.ts index f8ab8774f..98623d072 100644 --- a/types/FormatHelpers.d.ts +++ b/types/FormatHelpers.d.ts @@ -12,6 +12,7 @@ */ import { Dictionary } from './Dictionary'; +import { DesignToken } from './DesignToken'; import { TransformedToken } from './TransformedToken'; import { File } from './File'; @@ -56,4 +57,10 @@ export interface FormatHelpers { ) => (token: TransformedToken) => string; fileHeader: (args: FileHeaderArgs) => string; formattedVariables: (args: FormattedVariablesArgs) => string; + minifyDictionary: (dictionary: object) => object; + getTypeScriptType: (value: unknown) => string; + iconsWithPrefix: (prefix: string, allTokens: DesignToken[], options: object) => string; + sortByReference: (dictionary: Dictionary) => string; + sortByName: (a: DesignToken, b: DesignToken) => number; + setSwiftFileProperties: (options: object, objectType: string, transformGroup: string) => string; } \ No newline at end of file