Skip to content

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

Merged
atilafassina merged 16 commits intosolidjs:mainfrom
AirBorne04:main
Jan 23, 2025
Merged

Move RequestEventLocals type definition into a namespace to make the retyping easier for users#1469
atilafassina merged 16 commits intosolidjs:mainfrom
AirBorne04:main

Conversation

@AirBorne04
Copy link
Copy Markdown
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)

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 5, 2024

🦋 Changeset detected

Latest commit: ee0e659

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 Minor

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
Copy Markdown
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
Copy Markdown
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
@ryansolid
Copy link
Copy Markdown
Member

Ok I like it. We probably have to wait for minor given how this could break types. I've broken types on patch releases before but I feel like we should be cautious here.

@AirBorne04
Copy link
Copy Markdown
Contributor Author

Ok I like it. We probably have to wait for minor given how this could break types. I've broken types on patch releases before but I feel like we should be cautious here.

Perfect, I feel the same, I have updated the changeset accordingly.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Oct 31, 2024

@atilafassina
Copy link
Copy Markdown
Member

hey @ryansolid , we just merged #1683 - which should also be a minor.

How about we merge this one too?

@atilafassina atilafassina merged commit 600c115 into solidjs:main Jan 23, 2025
@apatrida
Copy link
Copy Markdown

apatrida commented Feb 26, 2025

This broke the typing in TypeScript in 1.0.0, nothing can be done to use this module and override it.

I note the PR doesn't even show it being used, just an empty shell where it might work.

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.

4 participants