
my site where i keep links for self-taught software engineer study! hand picked interesting links, resources etc
- Tweets31
- Following131
- Followers2
- Likes0

ALT // OPTION 1: Type the return statement async function getUser() { const res = await fetch("user"); return res.json() as User; } // OPTION 2: Type the function's signature async function getUser(): Promise<User> { const res = await fetch("user"); return res.json(); } // OPTION 3: Type both the return and the function async function getUser(): Promise<User> { const res = await fetch("user"); return res.json() as User; }

ALT // In "plain" testing-library, this asserts the Submit button exists: page.getByRole("button", { name: "Submit" }); // In Playwright, getByRole doesn't assert, so I have to wrap it in expect. // Is there a more elegant way to check for existance than this? await expect(page.getByRole("button", { name: "Submit" })).toHaveCount(1);



















