Improve types of testing utilities and fix some types in unit test code (#26122)

* Improve type of DeepPartial and make mergeObjects handle Sets/Maps properly

* Fix linting

* Remove undefined fields from menu_cloud_trial.test

* Prevent importing the wrong version of DeepPartial
Этот коммит содержится в:
Harrison Healey
2024-02-13 11:48:13 -05:00
коммит произвёл GitHub
родитель bdce9f42d8
Коммит daab9d5ff5
43 изменённых файлов: 303 добавлений и 292 удалений

Просмотреть файл

@@ -16,6 +16,9 @@ export type IDMappedObjects<E extends {id: string}> = RelationOneToOne<E, E>;
export type DeepPartial<T> = {
// For each field of T, make it optional and...
[K in keyof T]?:
// If that field is a Set or a Map, don't go further
T[K] extends Set<any> ? T[K] :
T[K] extends Map<any, any> ? T[K] :
// If that field is an object, make it a deep partial object
T[K] extends object ? DeepPartial<T[K]> :
// Else if that field is an optional object, make that a deep partial object