-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
74c382f
commit 77f2b25
Showing
6 changed files
with
106 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import type { Equal, Expect, IsUnion, NotEqual } from "npm:type-testing"; | ||
import type { Error, Pets } from "./schemas/petstore.json.ts"; | ||
|
||
import { URLSearchParams } from "../../types/url_search_params.ts"; | ||
|
||
const urlSearchParams = new URLSearchParams<{ limit?: `${number}` }>({ | ||
limit: "10", | ||
}); | ||
const response = await fetch( | ||
`http://petstore.swagger.io/v1/pets?${urlSearchParams.toString()}`, | ||
); | ||
|
||
if (response.ok) { | ||
const json = await response.json(); | ||
type test_IsUnion = Expect<IsUnion<typeof json>>; | ||
type test_IsPetsOrError = Expect<Equal<typeof json, Pets | Error>>; | ||
} | ||
|
||
if (response.status === 200) { | ||
const pets = await response.json(); | ||
type test_IsPets = Expect<Equal<typeof pets, Pets>>; | ||
type test_IsNotError = Expect<NotEqual<typeof pets, Error>>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters