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

Separate types for readonly Store (Store) and listen-only Event (Event) #847

Closed
igorkamyshev opened this issue Feb 7, 2023 · 2 comments
Closed
Labels
typings Typescript public type definitions issues

Comments

@igorkamyshev
Copy link
Member

igorkamyshev commented Feb 7, 2023

Proposal

  1. Mapped stores should not be modified, we can show it on type level:
const $s1 = createStore(''); // StoreWritable<string>
const $s2 = $s1.map(s => s.length); // Store<number>

sample({
  clock: someEvent,
  target: $s2,
})
// TYPE ERROR

Same for derived events

const derivedEvent = sample({ soure: $s, clock: event }); // Event<string>

sample({
  clock: someEvent,
  target: derivedEvent,
})
// TYPE ERROR
@igorkamyshev igorkamyshev added the RFC Request for Comments label Feb 7, 2023
@sergeysova sergeysova added this to the effector 23.0.0 milestone Feb 7, 2023
@sergeysova sergeysova added typings Typescript public type definitions issues RFC Request for Comments and removed RFC Request for Comments labels Feb 7, 2023
@sergeysova sergeysova changed the title Separate types for readonly Store and listen-only Event Separate types for readonly Store (DerivedStore) and listen-only Event (DerivedEvent) Feb 28, 2023
@sergeysova sergeysova changed the title Separate types for readonly Store (DerivedStore) and listen-only Event (DerivedEvent) Separate types for readonly Store (ReadonlyStore) and listen-only Event (ReadonlyEvent) Jun 10, 2023
@sergeysova sergeysova changed the title Separate types for readonly Store (ReadonlyStore) and listen-only Event (ReadonlyEvent) Separate types for readonly Store (Store) and listen-only Event (Event) Jul 6, 2023
@sergeysova
Copy link
Collaborator

Store renamed into StoreWritable, but ReadonlyStore renamed into Store.

Event renamed into EventCallable, but ReadonlyEvent renamed into Event.

@YanLobat
Copy link
Member

Resolved via #966

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
typings Typescript public type definitions issues
Projects
None yet
Development

No branches or pull requests

3 participants