Remove 4.7 based features, added some comments

This commit is contained in:
Convly 2022-05-31 10:08:12 +02:00
parent e62efa2a6a
commit ee211466ce
3 changed files with 11 additions and 7 deletions

View File

@ -41,6 +41,9 @@ declare global {
*/
type ComponentUIDs = KeysBy<Schemas, ComponentSchema>;
/**
* Global shorthand to access the `StrapiInterface` type
*/
type Strapi = StrapiInterface;
}

View File

@ -56,16 +56,16 @@ export type GetAttributeValue<T extends Attribute> =
| GetTextAttributeValue<T>
| GetUIDAttributeValue<T>;
export type GetAttributeValueByKey<T extends SchemaUID, U extends GetAttributesKey<T>> = GetAttribute<T, U
> extends infer P extends Attribute ? GetAttributeValue<P>:never;
export type GetAttributeValueByKey<T extends SchemaUID, U extends GetAttributesKey<T>> = GetAttribute<T, U
> extends infer P ? P extends Attribute ? GetAttributeValue<P> : never : never;
export type GetAttributesValues<T extends SchemaUID> = {
// Handle required attributes
[key in GetAttributesRequiredKeys<T>]-?: GetAttributeValueByKey<T, key>;
} & {
// Handle optional attributes
[key in GetAttributesOptionalKeys<T>]?: GetAttributeValueByKey<T, key>;
};
// Handle optional attributes
[key in GetAttributesOptionalKeys<T>]?: GetAttributeValueByKey<T, key>;
};
export type GetAttributesRequiredKeys<T extends SchemaUID> = KeysBy<GetAttributes<T>, { required: true }>;
export type GetAttributesOptionalKeys<T extends SchemaUID> = keyof Omit<

View File

@ -1,3 +1,4 @@
export * from './core';
export * from './factories';
export * from './utils'
export * as utils from './utils'
export * as factories from './factories';