Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Nov 28 21:36

    foxdonut on meiosis-one

    Meiosis Cell (compare)

  • Nov 28 20:57

    foxdonut on meiosis-one

    Meiosis Cell (compare)

  • Nov 05 01:24

    foxdonut on meiosis-one

    working on meiosis one (compare)

  • Nov 05 01:01

    foxdonut on meiosis-one

    working on meiosis one (compare)

  • Nov 05 00:04

    foxdonut on meiosis-one

    working on meiosis one (compare)

  • Oct 31 23:54

    foxdonut on meiosis-one

    working on meiosis one (compare)

  • Oct 17 23:13

    foxdonut on meiosis-one

    working on meiosis one (compare)

  • Oct 17 21:47

    foxdonut on meiosis-one

    working on meiosis one (compare)

  • Oct 17 14:55

    foxdonut on meiosis-one

    working on meiosis one (compare)

  • Oct 17 14:37

    foxdonut on meiosis-one-exp

    (compare)

  • Oct 17 14:37

    foxdonut on meiosis-one

    working on meiosis one (compare)

  • Oct 17 14:16

    foxdonut on meiosis-one-exp

    working on meiosis one (compare)

  • Oct 17 01:49

    foxdonut on meiosis-one-exp

    (compare)

  • Oct 15 14:10

    dependabot[bot] on npm_and_yarn

    (compare)

  • Oct 15 14:09

    foxdonut on master

    Bump ansi-regex from 5.0.0 to 5… Merge pull request #146 from fo… (compare)

  • Oct 15 14:09
    foxdonut closed #146
  • Oct 15 14:09
    dependabot[bot] labeled #146
  • Oct 15 14:09
    dependabot[bot] opened #146
  • Oct 15 14:09

    dependabot[bot] on npm_and_yarn

    Bump ansi-regex from 5.0.0 to 5… (compare)

  • Oct 15 14:08

    dependabot[bot] on npm_and_yarn

    (compare)

Constantin Angheloiu
@cmnstmntmn
const { states, update, actions } = meiosis.mergerino.setup<State, Actions>({
  stream,
  merge,
  app,
});
Type '<S extends object>(source: S, ...patches: MultipleTopLevelPatch<S>[]) => S' is not assignable to type '(state: State, patch: MergerinoPatch<State>) => State'.
  Types of parameters 'patches' and 'patch' are incompatible.
    Type 'MergerinoPatch<State>' is not assignable to type 'MultipleTopLevelPatch<State>'.
      Type 'MergerinoObjectPatch<State>' is not assignable to type 'MultipleTopLevelPatch<State>'.
        Type 'MergerinoObjectPatch<State>' is not assignable to type 'ObjectPatch<State>'.
          Types of property 'temperature' are incompatible.
            Type 'MergerinoPatch<{ air: Temperature; water: Temperature; }> | ((a: { air: Temperature; water: Temperature; }) => { ...; } | null | undefined) | null | undefined' is not assignable to type '{ air: Temperature; water: Temperature; } | FunctionPatch<{ air: Temperature; water: Temperature; }> | ObjectPatch<{ air: Temperature; water: Temperature; }> | undefined'.
              Type 'null' is not assignable to type '{ air: Temperature; water: Temperature; } | FunctionPatch<{ air: Temperature; water: Temperature; }> | ObjectPatch<{ air: Temperature; water: Temperature; }> | undefined'.  TS2322
Fred Daoud
@foxdonut
hi @cmnstmntmn :wave: I will try to have a look today
Constantin Angheloiu
@cmnstmntmn
ty @foxdonut ;)
Fred Daoud
@foxdonut
@cmnstmntmn here is a gist
Constantin Angheloiu
@cmnstmntmn
awesome! ty @foxdonut
Fred Daoud
@foxdonut
welcome!
Som Shekhar
@shekharsom_twitter
Is there a way to clear state in a mergerino/meiosis pattern? I know about using undefined to remove a certain property but sometimes, I intend to reset the whole object .
Fred Daoud
@foxdonut
@shekharsom_twitter with mergerino you can use update(() => ({ yourInitialState: 'here' }))
Som Shekhar
@shekharsom_twitter

@shekharsom_twitter with mergerino you can use update(() => ({ yourInitialState: 'here' }))

ah... nice... thanks...

Fred Daoud
@foxdonut
welcome!
Fred Daoud
@foxdonut
@/all Naming is hard. Does anyone have any suggestions for a shorter name to replace FunctionPatch? This is a type of Meiosis patch, along with Mergerino and Immer
So far all I can think of is FnPatch, but maybe someone has an idea for an altogether different name for a function patch.
Geovanny Junio
@geovannyjs
fp?
Fred Daoud
@foxdonut
I associate that to functional programming and worry that it would be confusing
Arthur Clemens
@arthurclemens:matrix.org
[m]
Why do you need a shorter name?
Fred Daoud
@foxdonut
@arthurclemens:matrix.org with the TypeScript types that I am currently working on, the names are getting long..
Arthur Clemens
@arthurclemens:matrix.org
[m]
“FunctionPatch” is not a long name for a TS type
Patrik Johnson
@orbitbot
:point_up_2:
Agree that "fp" is already overloaded and doesn't really describe anything out of context
Fred Daoud
@foxdonut
@arthurclemens:matrix.org I agree, but it's because it's combined with other things.. for example FunctionPatchesMeiosisOneActionConstructor
Arthur Clemens
@arthurclemens:matrix.org
[m]
You could split it up with namespaces
Fred Daoud
@foxdonut
ooh that's a good idea
thanks Arthur
Arthur Clemens
@arthurclemens:matrix.org
[m]
Doesn't have to be literal namespaces. I am also using this method:
// auth.ts
export type SessionName = string;

// index.ts
export * as Auth from './auth';

// use:
import { Auth } from 'types';

const sessionName: Auth.SessionName  = 'guest';
Fred Daoud
@foxdonut
:thumbsup:
Constantin Angheloiu
@cmnstmntmn
hey, did you play with wasm in production :d ?
Fred Daoud
@foxdonut
me? no..
Fred Daoud
@foxdonut

I'm stuck on a TypeScript problem..

Type '{ [x: string]: MergerinoPatch<S[K]>; }' is not assignable to type 'MergerinoObjectPatch<S>'

where I have:

export type MergerinoObjectPatch<S> = {
  [K in keyof S]?: MergerinoPatch<S[K]> | ((a: S[K]) => S[K] | null | undefined) | null | undefined;
};

The object I am trying to assign to MergerinoObjectPatch<S> is { [prop]: patch }, prop is of type K extends keyof S, and patch is of type MergerinoPatch<S[K]>

for completeness:

export type MergerinoFunctionPatch<S> = (state: S) => S;

export type MergerinoPatch<S> = MergerinoFunctionPatch<S> | MergerinoObjectPatch<S>;

anyone have any idea how I can resolve this TS error?

Fred Daoud
@foxdonut
what I don't understand is that it says that prop is prop: K extends keyof S
but then in the error it says { [x: string]: ...
why does it think that prop is string instead of a keyof S..
P.S. even if I use MergerinoPatch instead of MergerinoObjectPatch, I get the same error.
Arthur Clemens
@arthurclemens:matrix.org
[m]
Does your IDE give any hints?
Could you use ReturnType<typeof X>?
Does it become clearer when you use Record instead of [x: string] ?
Fred Daoud
@foxdonut

@arthurclemens:matrix.org actually those are the hints given to me by VS Code

I will try ReturnType and Record and report back, thank you for your help Arthur

Fred Daoud
@foxdonut
@arthurclemens:matrix.org with ReturnType and Parameters I am getting closer, thanks again :thumbsup:
Constantin Angheloiu
@cmnstmntmn
hei there
i'm building sort of a small app that's going to be included inside a shopify shrop as an them app extension
any ideea how i could make the app behave like a library .. with public methods
<div id="app" data-state-total="12.32" data-state-has-rounded="false" data-state-has-donation="false" data-action-on-cart-update=""></div>
i could pass them like that .. but i don't really like it
Constantin Angheloiu
@cmnstmntmn
:d solved
now i'm looking to return some events from the app to the outside world
i should do this by using effects?
Constantin Angheloiu
@cmnstmntmn
so far i'm having this
Constantin Angheloiu
@cmnstmntmn
oh, i passed the events to the actions .. and i'm using from inside the action const actions = app.Actions(update, events);
is it ok to have sometinh like this:
export const Actions = (update, events) => ({
  increment: (amount) => update({
    count: x => {
      let result = x + 1;

      events.onCounterUpdate(result)

      return result
  }}),
});
Constantin Angheloiu
@cmnstmntmn

oh .. i found a nicer way

      return states.map((state) => {
        integration.state(state);
        render(App({ state, actions }), document.querySelector(domNode));
      });

where integration.state is a function that is subscribed to the stream