Hello, I am trying to break my overrides out to be...
# support-questions-legacy
b
Hello, I am trying to break my overrides out to be more modular, but I am having trouble typing them.
Copy code
ts
import { db } from '@db/index';
import { users, profiles } from '@db/schema';

const thirdPartySignInUpOverride =
  (originalImplementation) => async (input) => {
    let response = await originalImplementation.thirdPartySignInUp(input);

    if (response.status === 'OK') {
      let { id, emails } = response.user;
      console.log('USER SIGNED UP', id);
      await db.transaction(async (trx) => {
        await trx.insert(users).values({
          id,
          email: emails[0],
        });
        await trx.insert(profiles).values({
          userId: id,
        });
      });

      // This is the response from the OAuth 2 provider that contains their tokens or user info.
      let providerAccessToken = response.oAuthTokens['access_token'];
      let firstName =
        response.rawUserInfoFromProvider.fromUserInfoAPI!['first_name'];

      if (
        response.createdNewRecipeUser &&
        response.user.loginMethods.length === 1
      ) {
        // TODO: Post sign up logic
      } else {
        // TODO: Post sign in logic
      }
    }
    return response;
  };

export default thirdPartySignInUpOverride;
I am really not sure of what the
originalImplementation
type should be. I have tried creating an interface from ThirdPartyPasswordless recipe, but that didn't work at all. Any ideas? Edit: Found a way to type using RecipeInterface. Not sure if this is documented? I had to search in discord and got lucky
r
hey @bolg55 the type is RecipeInterface. I think you can import it from supertokens-node/recipe/thirdpartyemailpassword/types (assuming that you are using thirdpartyemailpassword as the recipe)
11 Views