Skip to content

Commit

Permalink
Improve/fix next-dev types support (#726)
Browse files Browse the repository at this point in the history
* fix the `setupDevPlatform`'s `options` parameter not being optional

* update `package.json` to properly export the typescript types
  • Loading branch information
dario-piotrowicz authored Apr 30, 2024
1 parent beec78a commit 31c2627
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 12 deletions.
9 changes: 9 additions & 0 deletions .changeset/slimy-toys-lie.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
'@cloudflare/next-on-pages': patch
---

update `package.json` to properly export the typescript types

the current types are declared in the `package.json` via `typesVersions`
such don't seem to get picked up correctly by all package managers, to for
the types use the `package.json` `exports` field instead
5 changes: 5 additions & 0 deletions .changeset/swift-garlics-flash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@cloudflare/next-on-pages': patch
---

fix the `setupDevPlatform`'s `options` parameter not being optional
2 changes: 1 addition & 1 deletion internal-packages/next-dev/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export * from './deprecated';
* @param options options how the function should operate and if/where to persist the platform data
*/
export async function setupDevPlatform(
options: GetPlatformProxyOptions,
options?: GetPlatformProxyOptions,
): Promise<void> {
const continueSetup = shouldSetupContinue();
if (!continueSetup) return;
Expand Down
19 changes: 8 additions & 11 deletions packages/next-on-pages/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,14 @@
"version": "1.11.1",
"bin": "./bin/index.js",
"exports": {
".": "./dist/api/index.js",
"./next-dev": "./dist/next-dev/index.cjs"
},
"typesVersions": {
"*": {
".": [
"./dist/api/index.d.ts"
],
"next-dev": [
"./dist/next-dev/index.d.ts"
]
".": {
"import": "./dist/api/index.js",
"types": "./dist/api/index.d.ts"
},
"./next-dev": {
"import": "./dist/next-dev/index.cjs",
"require": "./dist/next-dev/index.cjs",
"types": "./dist/next-dev/index.d.ts"
}
},
"scripts": {
Expand Down

0 comments on commit 31c2627

Please sign in to comment.