Skip to content

Conversation

@LiamMartens
Copy link

Mostly non breaking

Description

Created a new proposal for Itty Router v4 to support route param type inferrence. The only breaking change would be for users who are passing generics to their route handlers I believe (ie: Router().get<>) because the path now has to extends string for type inference to work.

Feedback welcome of course

Related Issue

#150

Type of Change (select one and follow subtasks)

  • Documentation (README.md)
  • Maintenance or repo-level work (e.g. linting, build, tests, refactoring, etc.)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
    • I have included test coverage
  • Breaking change (fix or feature that would cause existing functionality/userland code to not work as expected)
    • Explain why a breaking change is necessary: Type inference would never work without generic string params
  • This change requires (or is) a documentation update
    • I have added necessary local documentation (if appropriate)
    • I have added necessary itty.dev documentation (if appropriate)

@LiamMartens
Copy link
Author

I also saw yarn.lock was updated - but also I saw their are 2 conflicting lockfiles - npm and yarn - wasn't sure which one was the right one - might be worth setting a packageManager in the package.json

@kwhitley
Copy link
Owner

So I love trying to get inference on route params, but not at the price of a breaking change. v4.x is new enough that yet another [breaking] change in the TS signatures this soon would probably be a sign of general instability in the platform.

@kwhitley kwhitley added the discussion Let's discuss label Dec 14, 2023
@kwhitley
Copy link
Owner

So unless we can get this in without impacting (in a breaking manner) the existing types, I'm leaning towards closing this for now... 😞

@kwhitley
Copy link
Owner

Closing this for now... there are more heavily typed approaches to solving this, but itty aims to be the lightweight version of all the heavy approaches.

@kwhitley kwhitley closed this Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

discussion Let's discuss

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants