solid-start icon indicating copy to clipboard operation
solid-start copied to clipboard

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

Open AirBorne04 opened this issue 1 year ago • 5 comments

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • [X] 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)

AirBorne04 avatar May 05 '24 11:05 AirBorne04

🦋 Changeset detected

Latest commit: 6814bf0b921ac1bb2e85007c99804dda87017c7c

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

changeset-bot[bot] avatar May 05 '24 11:05 changeset-bot[bot]

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

ryansolid avatar Jun 18 '24 22:06 ryansolid

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 avatar Jun 19 '24 11:06 AirBorne04

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.

ryansolid avatar Jul 03 '24 17:07 ryansolid

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.

AirBorne04 avatar Jul 04 '24 07:07 AirBorne04