saasquatch/bunshi

withScope types are hard to use

mrjackdavis opened this issue · 2 comments

Consider the following scenario

type SomeType = {};
const myScope = createScope<SomeType | undefined>(undefined);

// ...
const myScopeThing:SomeType = {};
const myThing = useMolecule(someMolecule,{
  withScope:[myScope,myScopeThing]
})

withScope:[myScope,myScopeThing] throws an error due to the type of ScopeTuple. The first entry of the tuple is expected to be MoleculeScope<SomeType> but is in fact MoleculeScope<SomeType | undefined>.

I would expect this code to work

Thanks for this feedback! I'll try incorporating this into the next version.

Sorry for the slow response.

Addressed in #12