ocket8888 commented on code in PR #7585:
URL: https://github.com/apache/trafficcontrol/pull/7585#discussion_r1272797836


##########
experimental/traffic-portal/server.config.ts:
##########
@@ -202,6 +204,12 @@ function isConfig(c: unknown): c is ServerConfig {
        if (typeof((c as {trafficOps: unknown}).trafficOps) !== "string") {
                throw new Error("'trafficOps' must be a string");
        }
+       if (!Object.prototype.hasOwnProperty.call(c, "tpv1Url")) {
+               throw new Error("'tpv1Url' is required");
+       }
+       if (typeof((c as {tpv1Url: unknown}).tpv1Url) !== "string") {
+               throw new Error("'tpv1Url' must be a string");
+       }

Review Comment:
   These blocks can be combined into a single check that doesn't need `as` if 
you import `hasProperty` from our utils package and use that. Probably also 
occurs elsewhere in the PR, and definitely in the code at large.



-- 
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]

Reply via email to