Victor Garcia
05/12/2022, 4:39 PMTS2322: Type 'Api<{ userPoolAuthorizer: { type: "user_pool"; userPool: { id: string; clientIds: string[]; }; }; }>' is not assignable to type 'Api<Record<string, ApiAuthorizer>>'.
Types of property 'createFunctionIntegration' are incompatible.
Type '(scope: Construct, routeKey: string, routeProps: ApiFunctionRouteProps<"userPoolAuthorizer">, postfixName: string) => HttpRouteIntegration' is not assignable to
type '(scope: Construct, routeKey: string, routeProps: ApiFunctionRouteProps<string>, postfixName: string) => HttpRouteIntegration'.
Types of parameters 'routeProps' and 'routeProps' are incompatible.
Type 'ApiFunctionRouteProps<string>' is not assignable to type 'ApiFunctionRouteProps<"userPoolAuthorizer">'.
Types of property 'authorizer' are incompatible.
Type '"none" | "iam" | Omit<string, "none" | "iam"> | undefined' is not assignable to type '"userPoolAuthorizer" | "none" | "iam" | undefined'.
Type 'Omit<string, "none" | "iam">' is not assignable to type '"userPoolAuthorizer" | "none" | "iam" | undefined'.
Nevermind, turns out Api now takes a generic: Api => Api<{ userPoolAuthorizer: { userPool: { id: string; clientIds: string[] }; type: 'user_pool' } }>
Frank
Victor Garcia
05/13/2022, 3:56 PMprivate readonly api: Api<ApiAuthorizers>;
and then initialising it in the constructor this.api = new Api(this, 'api', {...
.
ApiAuthorizers
is type ApiAuthorizers = { userPoolAuthorizer: { userPool: { id: string; clientIds: string[] }; type: 'user_pool' } };