next-on-pages icon indicating copy to clipboard operation
next-on-pages copied to clipboard

Update README.md to add 'declare global' to env.d.ts

Open OpenSource03 opened this issue 1 year ago • 2 comments

Add declare global to internal-packages/next-dev/README.md so people can better understand what they need to do. Just declaring interface is not sufficient and got me confused as I'm not used to working with env.d.ts files, and I'm sure there are other people who would find themselves confused.

OpenSource03 avatar Feb 13 '24 20:02 OpenSource03

⚠️ No Changeset found

Latest commit: fd1cb843a2419107c25dd47f2b360d7a7909e368

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

changeset-bot[bot] avatar Feb 13 '24 20:02 changeset-bot[bot]

Thank you very much for the PR @OpenSource03 🙂

Declaring the interface in a declaration file in the global scope (as indicated in the readme) should work, you can see it working by creating a new Next.js application using this C3 prerelease (https://github.com/cloudflare/workers-sdk/pull/5009):

npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/7893611368/npm-package-create-cloudflare-5009 --no-auto-update --framework next

I just tested there and it all looks good to me.

The declare global becomes necessary if your declaration file is in a module scope (e.g. if the file has any imports/exports) then in that case you would need to use declare global

So I think that the current readme is correct... but I guess maybe we could clarify better the above? 🤔

dario-piotrowicz avatar Feb 14 '24 00:02 dario-piotrowicz

Closing this PR due to the inactivity + my earlier comment 👆

dario-piotrowicz avatar Jun 30 '24 17:06 dario-piotrowicz