Closed quintenb closed 2 years ago
I have this script... which works just fine.... but all types are :any. It makes it hard to develop. Am I missing a package?
import { NextApiRequest, NextApiResponse } from "next" const SibApiV3Sdk = require("sib-api-v3-typescript") export default async (req: NextApiRequest, res: NextApiResponse) => { try { const { email } = req.query let apiInstance = new SibApiV3Sdk.ContactsApi() let apiKey = apiInstance.authentications["apiKey"] apiKey.apiKey = "XXXXX" let createContact = new SibApiV3Sdk.CreateContact() createContact.email = email ?? "" createContact.listIds = [11] const result = await apiInstance.createContact(createContact) res.status(200).json({ wtf: "wtf", result }) } catch (error) { res.status(500).json({ error, message: "error" }) } }
I see i mixed up my import.
this worked:
import SibApiV3Sdk from "sib-api-v3-typescript"
I have this script... which works just fine.... but all types are :any. It makes it hard to develop. Am I missing a package?