Skip to content
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

Move RequestEventLocals type definition into a namespace to make the retyping easier for users #1469

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

AirBorne04
Copy link
Contributor

@AirBorne04 AirBorne04 commented May 5, 2024

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Other... Type changes that require minor adjustments

What is the current behavior?

When defining a RequestEventLocals type for a custom app typescript does not pickup the types until it the file also contains a top level import/export.

What is the new behavior?

Now instead of declare module we declare a namespace that does not confuse typescript and makes sure the global.d.ts is interpreted as an augmentation module (not ambient as before)

Other information

Related to #1466 unfortunately this would require current users to re-config their typings. (from module to namespace)

Copy link

changeset-bot bot commented May 5, 2024

🦋 Changeset detected

Latest commit: f026426

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@solidjs/start Patch

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

@ryansolid
Copy link
Member

I haven't touched this one since it is marked as draft. Are there more changes, or things that need to be verified?

@AirBorne04
Copy link
Contributor Author

AirBorne04 commented Jun 19, 2024

hi @ryansolid mainly looking for approval, and adjustment on the docs side? Any thoughts?

I have tested again today, since its been a while, it all looks good still. The one docs adjustment that we would need is to now define the RequestEventLocals in the project like this:

declare module App {
  interface RequestEventLocals {
    myNumber: number
    someString: string
  }
}

Also added this into the todomvc example app for further reference.

@AirBorne04 AirBorne04 marked this pull request as ready for review June 21, 2024 07:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants