Hello Everyone! I want to clarify one thing. Curr...
# general
b
Hello Everyone! I want to clarify one thing. Currently, I'm passing a Promise to the chart's "skipCRDRendering" property. My code seems to work, and it looks like that although this property accepts only boolean, internally, it handles the Promises too. Am I right? P.S. I'm using Typescript.
s
How is your code passing the type checks if you are passing a
Promise<boolean>
to a
boolean
? The field should be
Input<boolean>
if it accepts Promises, Outputs, etc. The equality operator is able to be used with Promises, but it won't necessarily give you what you want. For example,
new Promise(()={}) == <true or false>
will both give you
false
b
I just trick the compiler with type casting.
Copy code
// prometheusCrdsExistence: Promise<boolean>;

skipCRDRendering: <boolean><unknown>cluster.crdsInitModule?.prometheusCrdsExistence.then(
    result => { return result }
);
And the promise handling works because of this, if I'm not mistaken