jomarko commented on code in PR #2351:
URL:
https://github.com/apache/incubator-kie-tools/pull/2351#discussion_r1609263726
##########
packages/dmn-editor/src/normalization/normalize.ts:
##########
@@ -17,11 +17,22 @@
* under the License.
*/
+import { DmnLatestModel } from "@kie-tools/dmn-marshaller";
import { getNewDmnIdRandomizer } from "../idRandomizer/dmnIdRandomizer";
import { addMissingImportNamespaces } from
"../mutations/addMissingImportNamespaces";
import { State } from "../store/Store";
-export function normalize(model: State["dmn"]["model"]) {
+export type Normalized<T> = WithRequiredDeep<T, "@_id">;
+
+export type WithRequiredDeep<T, K extends keyof any> = T extends undefined
Review Comment:
Do we need to `export` this type? It is used only internally in this file I
think.
##########
packages/dmn-editor/src/normalization/normalize.ts:
##########
@@ -17,11 +17,22 @@
* under the License.
*/
+import { DmnLatestModel } from "@kie-tools/dmn-marshaller";
import { getNewDmnIdRandomizer } from "../idRandomizer/dmnIdRandomizer";
import { addMissingImportNamespaces } from
"../mutations/addMissingImportNamespaces";
import { State } from "../store/Store";
-export function normalize(model: State["dmn"]["model"]) {
+export type Normalized<T> = WithRequiredDeep<T, "@_id">;
+
+export type WithRequiredDeep<T, K extends keyof any> = T extends undefined
+ ? T
+ : T extends Array<infer U>
+ ? Array<WithRequiredDeep<U, K>>
+ : { [P in keyof T]: WithRequiredDeep<T[P], K> } /** */ & (K extends keyof T
//
Review Comment:
```suggestion
: { [P in keyof T]: WithRequiredDeep<T[P], K> } & (K extends keyof T
```
?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]