Mirza
06/14/2022, 12:53 PMIdentityPoolId: auth.cognitoIdentityPoolId,
error:
property) IdentityPoolId: string | undefined
Type 'string | undefined' is not assignable to type 'string | CfnOutputProps'.
Type 'undefined' is not assignable to type 'string | CfnOutputProps'.ts(2322)
Derek Kershner
06/14/2022, 1:31 PMundefined
errors mean you need to institute a type guard or a fallbackDerek Kershner
06/14/2022, 1:32 PMif (!theThing) {
throw new Error("Nope")
}
// no longer undefined down here
This is true in JS too, just nothing to tell you so.Derek Kershner
06/14/2022, 1:32 PMsetting: theThing ?? "ThisInstead"
Derek Kershner
06/14/2022, 1:38 PMMirza
06/14/2022, 1:38 PMDerek Kershner
06/14/2022, 1:39 PMMirza
06/14/2022, 1:40 PMif (!auth.cognitoIdentityPoolId) {
throw new Error("auth.cognitoIdentityPoolId not defined")
}
// Show the auth resources in the output
stack.addOutputs({
Region: app.region,
UserPoolId: auth.userPoolId,
IdentityPoolId: auth.cognitoIdentityPoolId,
UserPoolClientId: auth.userPoolClientId,
});
And that did indeed resolve the issue. Thank you @Derek Kershner, will also pay more attention to versions.thdxr
06/14/2022, 1:53 PMMirza
06/14/2022, 2:03 PMMirza
06/14/2022, 2:03 PM