Comments (5)
The important part is this can't impact the return type of the function that returns it. It is intended that redirect is always thrown or returned as it doesn't do the redirect but returns the redirect. So in a sense the code that is incorrect here would never work anyway. The fact is never
is odd but it is a TypeScript trick. We could I suppose make it always throw as well but we did this to give more control. If void
works without impacting types would consider it.
from solid-router.
Yes it is more like, createRedirect
🌝 but yeah I see the intention now. Redirecting the actual type of the redirect function, could pollute the return type and caller scope may behave incorrect and bring type-level complications.
I just tried void
, it gets unionized to the return type but that's alright I guess.
Although, I'm just a starter and don't know all the cases yet to use the redirect function, maybe action
and cache
or any other wrapper function could strip out redirect type from the return type by using infer
from solid-router.
Related Issues (20)
- <A> Component causes incorrect error message when used outside of a <Route /> HOT 3
- [Bug] MemoryRouter - `set()` can't change the page
- `useLocation().state` does not get updated on history back HOT 1
- [Bug?]: Unable to use `ErrorBoundary` when throwing Error from cached function in combination with `load` HOT 5
- action always trigger on form submit
- Slow performance matching route with localeCompare HOT 2
- Route load results in inconsistent revalidation behaviour HOT 2
- Why not just export useRouter and useRoute? HOT 2
- Error: <A> and 'use' router primitives can be only used inside a Route. HOT 3
- SSR no matching exports HOT 1
- location.state undefined with HashRouter on v0.13.3 HOT 4
- useIsRouting returning true from SSR and causing Suspense issues HOT 2
- HTML anchors with unicode id hash could not trigger page jump HOT 2
- A component isActive subpath match incorrect
- `useCurrentMatches` is not reactive
- Crash when server function throws redirect and wrapped in createAsync HOT 3
- `window.location` holds incorrect value on initial client-side render HOT 1
- Actions called in onMount (or first run effect) are destroyed by start process, and do not receive values nor errors HOT 4
- In the new version, Route is imported as a type rather than a method. HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from solid-router.