From ee211466cebd4582d6942a90ec1dbf1a521b9ce3 Mon Sep 17 00:00:00 2001 From: Convly Date: Tue, 31 May 2022 10:08:12 +0200 Subject: [PATCH] Remove 4.7 based features, added some comments --- packages/core/strapi/lib/global.d.ts | 3 +++ .../core/strapi/lib/types/core/attributes/utils.d.ts | 10 +++++----- packages/core/strapi/lib/types/index.d.ts | 5 +++-- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/packages/core/strapi/lib/global.d.ts b/packages/core/strapi/lib/global.d.ts index 1cee8408f9..8750c10772 100644 --- a/packages/core/strapi/lib/global.d.ts +++ b/packages/core/strapi/lib/global.d.ts @@ -41,6 +41,9 @@ declare global { */ type ComponentUIDs = KeysBy; + /** + * Global shorthand to access the `StrapiInterface` type + */ type Strapi = StrapiInterface; } diff --git a/packages/core/strapi/lib/types/core/attributes/utils.d.ts b/packages/core/strapi/lib/types/core/attributes/utils.d.ts index 403d12613c..46f9a56153 100644 --- a/packages/core/strapi/lib/types/core/attributes/utils.d.ts +++ b/packages/core/strapi/lib/types/core/attributes/utils.d.ts @@ -56,16 +56,16 @@ export type GetAttributeValue = | GetTextAttributeValue | GetUIDAttributeValue; -export type GetAttributeValueByKey> = GetAttribute extends infer P extends Attribute ? GetAttributeValue

:never; +export type GetAttributeValueByKey> = GetAttribute extends infer P ? P extends Attribute ? GetAttributeValue

: never : never; export type GetAttributesValues = { // Handle required attributes [key in GetAttributesRequiredKeys]-?: GetAttributeValueByKey; } & { - // Handle optional attributes - [key in GetAttributesOptionalKeys]?: GetAttributeValueByKey; -}; + // Handle optional attributes + [key in GetAttributesOptionalKeys]?: GetAttributeValueByKey; + }; export type GetAttributesRequiredKeys = KeysBy, { required: true }>; export type GetAttributesOptionalKeys = keyof Omit< diff --git a/packages/core/strapi/lib/types/index.d.ts b/packages/core/strapi/lib/types/index.d.ts index 1cf9320d61..480b10d272 100644 --- a/packages/core/strapi/lib/types/index.d.ts +++ b/packages/core/strapi/lib/types/index.d.ts @@ -1,3 +1,4 @@ export * from './core'; -export * from './factories'; -export * from './utils' \ No newline at end of file + +export * as utils from './utils' +export * as factories from './factories'; \ No newline at end of file