ethanniser / next-typesafe-url

Fully typesafe, JSON serializable, and zod validated URL search params, dynamic route params, and routing for NextJS.
https://next-typesafe-url.dev
MIT License
362 stars 16 forks source link

Fix ambient .d.ts file import violations. #91

Closed lelabo-m closed 5 months ago

lelabo-m commented 5 months ago

In issue #81, I explained that imports outside of the declare module scope violated the rules of ambient .d.ts files and the issues that comes with it. In PR #85, I made some changes to the import order, but I forgot that relative import where also forbidden.

In #87, @chungweileong94 suggested to change the import style.

This PR refactor generateTypes.ts once again to change the _next-typesafe-url_.d.ts generation with the following changes:

interface DynamicRouter {
   '/items/[id]': InferRoute<import('./src/app/items/[id]/routeType')>;
}
chungweileong94 commented 5 months ago

Look about right to me👏

ethanniser commented 5 months ago

Will review tonight, but for now can you add a changeset?

Thanks for the contribution

lelabo-m commented 5 months ago

Sorry, but I am not sure what you mean?

Should I bump the version and add a paragraph to the changelog? I see something about changeset in the package, I will try to understand what it is...

chungweileong94 commented 5 months ago

I see something about changeset in the package, I will try to understand what it is...

Yes, this project is using changesets to manage the release + changelog. You can just run npx changesets, and follow the steps to add your change summary.

ethanniser commented 5 months ago

^^ yep thanks for explainaing to clarify this would be a patch change just run pnpm changeset write a description of the change and commit the file it generates

lelabo-m commented 5 months ago

I added a commit with the changeset with a thanks to @chungweileong94.

ethanniser commented 5 months ago

something came up will not be able to review tonight- hopefully tomorrow thanks for understanding

lelabo-m commented 5 months ago

No problem. Happy to help. Take care.

ethanniser commented 5 months ago

looks great thanks so much

ethanniser commented 5 months ago

now live in 4.0.6!