-
I'm exploring this amazing tool but I'm stuck in a weird error. What I did:1- Created a 2- Created the import { createClient, NormalizeOAS } from "fets";
import type { openapi } from "./openapi";
export const client = createClient<NormalizeOAS<typeof openapi>>({
endpoint: "https://api.spotify.com/v1",
}); 3- Used the client this to the import { NormalizeOAS, OASOutput } from "fets";
import type { openapi } from "./api/openapi";
import { useEffect, useState } from "react";
import { client } from "./api/client";
type Artist = OASOutput<
NormalizeOAS<typeof openapi>,
"/artists/{id}",
"get",
"200"
>;
function App() {
const [artist, setArtist] = useState<Artist>();
useEffect(() => {
client["/artists/{id}"]
.get({
params: { id: "1KCSPY1glIKqW2TotWuXOR" },
headers: {
Authorization: `Bearer ${import.meta.env.VITE_APP_SPOTIFY_TOKEN}}`,
},
})
.then((res) => {
if (res.ok) {
return res.json();
}
throw new Error("Something went wrong");
})
.then((artist) => {
setArtist(artist);
})
.catch((err) => {
console.log(err);
});
}, []);
if (!artist) {
return <>Loading...</>;
}
return <>{artist.name}</>;
}
export default App; It works without any problem, but I have the TS error on VSCode: // Type instantiation is excessively deep and possibly infinite.ts(2589) Is there any solution to this? |
Beta Was this translation helpful? Give feedback.
Answered by
ardatan
Jul 26, 2023
Replies: 1 comment 4 replies
-
Could you reproduce it on CodeSandbox? |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Could you try with the latest version?