Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type checks failing after upgrading to version 0.5.1 #24

Closed
WoetDev opened this issue Jul 8, 2024 · 1 comment
Closed

Type checks failing after upgrading to version 0.5.1 #24

WoetDev opened this issue Jul 8, 2024 · 1 comment

Comments

@WoetDev
Copy link

WoetDev commented Jul 8, 2024

Hi

First of all, great work on the package!

I've been using it, but after upgrading to version 0.5.1, all the typechecks that were previously passing started failing and not sure if this was expected behaviour and I need to migrate something or it there's bug/other issue.

I'm receiving the typescript error: Error: Unsafe argument of type 'any' assigned to a parameter of type 'Xior'. @typescript-eslint/no-unsafe-argument everywhere.

An example of what was working before was that I created an instance:

import xior from "xior";

const neonInstance = xior.create({
  baseURL: "https://console.neon.tech/api/v2",
  headers: {
    Accept: "application/json",
    "Content-Type": "application/json",
    Authorization: `Bearer ${process.env.NEON_API_KEY}`,
  },
});

export default neonInstance;

And then add the type as follows when performing a request:

import {
  type NeonApiProjectOperation,
} from "@/types/neonApi";
import neonInstance from "@/utils/neon/neonInstance";

const neonProjectOperation =
        await neonInstance.get<NeonApiProjectOperation>(
          `/projects/${projectId}/operations/${operation.id}`,
        );

const operationData = neonProjectOperation.data.operation;

From the typescript definitions in the project, my guess is that this should still work, but maybe I'm missing that I needed to update something else?

@WoetDev
Copy link
Author

WoetDev commented Jul 8, 2024

Apologies!

Looks like this was caching issue locally in my project.

For anyone else that might come across such an error; I'm using Next.js v14.2.4

I had to manually delete my .next folder locally, after that the local build was working.

@WoetDev WoetDev closed this as completed Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant