saasquatch / bunshi

Molecule pattern for jotai, valtio, zustand, nanostores, xstate, react and vue
https://www.bunshi.org/
MIT License
230 stars 17 forks source link

Improve types of ScopeTuple #12

Closed mrjackdavis closed 9 months ago

mrjackdavis commented 2 years ago

Description of the change

Fixes #11 by making a new inferable scope type.

I tried to edit ScopeTuple, but it's used in so many places and would've been a breaking change so I went for this approach

Type of change

Links

N/A

Checklists

Development

Paperwork

Code review

loganvolkers commented 1 year ago

I've been trying to incorporate this code and add tests via https://github.com/ai/check-dts but it doesn't seem to work as you describe.

import { ScopeTuple, createScope, InferableScope } from "../";
const myScope = createScope<string|undefined>(undefined);

// Two type errors here
const myTuple2:InferableScope<string|undefined> = [myScope, "Foo"];

What am I missing in your implementation?

loganvolkers commented 9 months ago

@mrjackdavis with the recent changes in Bunshi 2.1 it might not be relevant anymore.

Sorry that this PR sat around for so long. If you provide some context, I can add some Vitest type checks

mrjackdavis commented 9 months ago

All good 👍