Skip to content

Conversation

@sumimakito
Copy link
Member

As in TypeScript, Conditional Types are distributive1, this means when:

const context = createContext()
const invokeEventa = defineInvokeEventa<C, A | B>()
const invoke = defineInvoke(context, invokeEventa)

invoke is of type ((req: A, invokeRequest?: unknown) => Promise<C> | (req: B, invokeRequest?: unknown) => Promise<C>), which is unwanted. The expected type should be (req: A | B, invokeRequest?: unknown) => Promise<C>. The fix wraps the type into [T] to avoid this behavior.

This pull request also adds the missing @vitest/coverage-v8 dependency and excludes semver@6.3.1 from trustPolicy. As pnpm does not like the comments in the YAML2, I will write the reason here: electron@39.2.6 (latest ATM) depends on @electron/get@2.0.3 (^2.0.0) which dependes on semver@6.3.1 (^6.2.0).

Footnotes

  1. https://www.typescriptlang.org/docs/handbook/2/conditional-types.html#distributive-conditional-types

  2. https://github.com/pnpm/pnpm/issues/2008

…fineInvoke

Add the missing @vitest/coverage-v8 and exclude semver@6.3.1 from trustPolicy.
@nekomeowww nekomeowww merged commit 5e045d6 into main Dec 12, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants