-
-
Notifications
You must be signed in to change notification settings - Fork 476
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
Manual type declarations in openapi-fetch #1424
Conversation
🦋 Changeset detectedLatest commit: 3347010 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@@ -3,7 +3,7 @@ import { afterEach, beforeAll, describe, expect, it, vi } from "vitest"; | |||
// @ts-expect-error | |||
import createFetchMock from "vitest-fetch-mock"; | |||
import createClient from "../src/index.js"; | |||
import type { paths } from "./v1.d.js"; | |||
import type { paths } from "./fixtures/api.js"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved into /fixtures/
folder for cleanup
@@ -7,6 +7,7 @@ | |||
"lib": ["ESNext", "DOM"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fun fact: I originally wanted to add allowJs: true
to TSConfig, however, that broke everything—it tries to infer types from .js
files and ignores .d.ts
. So fortunately no change is necessary, and TypeScript likes .d.ts
just as much as the original .ts
|
||
This will ask if it’s a `patch`, `minor`, or `major` change ([semver](https://semver.org/)), along with a plain description of what you did. Commit this new file along with the rest of your PR, and during the next release this will go into the official changelog! | ||
|
||
## Opening a Pull Request |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not actually rewritten; just moved several sections out of the “Opening a Pull Request” heading and into a “Writing Code” heading
Deploying with Cloudflare Pages
|
Changes
Splits
index.ts
(runtime + types) into manualindex.js
andindex.d.ts
files. Added this section to the CONTRIBUTING docs to explain why:This is an internal change—tests still pass—but it will make some upcoming changes much, much easier.
How to Review
Checklist
docs/
updated (if necessary)pnpm run update:examples
run (only applicable for openapi-typescript)