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

Types when using reaction() with fireImmediately are wrong during the immediate fire #3

Open
iownbey opened this issue Nov 7, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@iownbey
Copy link
Contributor

iownbey commented Nov 7, 2024

import { observableBox, reaction } from "@fobx/core";

const a = observableBox("b");

reaction(
  () => a.value,
  (newValue, oldValue) => {
    console.log(oldValue);
  },
  {
    fireImmediately: true,
  }
);

in this code snippet, oldValue is marked as having a type of string, even though when it is run, it has a value of undefined.
For these types to be correct, the types must include undefined iff fireImmediately is true.

@jereklas jereklas added the bug Something isn't working label Dec 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants