Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: PathRouteBuilder#any discards their exactRoute #26

Merged
merged 2 commits into from
Jan 15, 2022

Conversation

acid-chicken
Copy link
Contributor

@acid-chicken acid-chicken commented Jan 11, 2022

Consider the following code,

import { Path } from "rocon/react";

const anyThenExactRoutes = Path()
  .any("id", {
    action: ({ id }) => `id is ${id.slice(0, 8)}`,
  })
  .exact({
    action: () => "I am root",
  });

const exactThenAnyRoutes = Path()
  .exact({
    action: () => "I am root",
  })
  .any("id", {
    action: ({ id }) => `id is ${id.slice(0, 8)}`,
  });

console.log(`any then exact: ${anyThenExactRoutes.exactRoute}
exact then any: ${exactThenAnyRoutes.exactRoute}`);

both anyThenExactRoutes and exactThenAnyRoutes have an exactRoute property on the type level, but...

Expected behavior

any then exact: [Object object]
exact then any: [Object object]

Actual behavior

any then exact: [Object object]
exact then any: undefined

@uhyo
Copy link
Owner

uhyo commented Jan 12, 2022

Thank you very much!!! 🥺

However the new test has failed and apparently there is still a problem in types. I will take a look when I have time, but it'd be extremely nice if you could take a look too.

Copy link
Owner

@uhyo uhyo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! ❤️

@uhyo uhyo merged commit 00008dc into uhyo:master Jan 15, 2022
hachibeeDI pushed a commit to hachibeeDI/rocon that referenced this pull request May 27, 2022
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.

2 participants