Effect-TS / effect

An ecosystem of tools to build robust applications in TypeScript
https://effect.website
MIT License
7.71k stars 245 forks source link

Support union of parameters in functions in `Effect.Tag.Proxy` type #3841

Closed KhraksMamtsov closed 4 weeks ago

KhraksMamtsov commented 1 month ago

Type

Description

Problem

class DemoTag extends Effect.Tag("DemoTag")<DemoTag, {
  readonly fnParamsUnion: (
    ...args: ReadonlyArray<string> | [number] | [false, true]
  ) => number
}>() {
}

DemoTag.fnParamsUnion //  Property 'fnParamsUnion' does not exist on type 'typeof DemoTag'.ts(2339)

Fix: [...infer Args] => infer Args extends ReadonlyArray<any>

Related

changeset-bot[bot] commented 1 month ago

🦋 Changeset detected

Latest commit: 16bbe81a2e573cf088257a1464b4cf19cb6c1134

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 34 packages | Name | Type | | ------------------------------- | ----- | | effect | Patch | | @effect/cli | Patch | | @effect/cluster-browser | Patch | | @effect/cluster-node | Patch | | @effect/cluster-workflow | Patch | | @effect/cluster | Patch | | @effect/experimental | Patch | | @effect/opentelemetry | Patch | | @effect/platform-browser | Patch | | @effect/platform-bun | Patch | | @effect/platform-node-shared | Patch | | @effect/platform-node | Patch | | @effect/platform | Patch | | @effect/printer-ansi | Patch | | @effect/printer | Patch | | @effect/rpc-http | Patch | | @effect/rpc | Patch | | @effect/sql-clickhouse | Patch | | @effect/sql-d1 | Patch | | @effect/sql-drizzle | Patch | | @effect/sql-kysely | Patch | | @effect/sql-libsql | Patch | | @effect/sql-mssql | Patch | | @effect/sql-mysql2 | Patch | | @effect/sql-pg | Patch | | @effect/sql-sqlite-bun | Patch | | @effect/sql-sqlite-node | Patch | | @effect/sql-sqlite-react-native | Patch | | @effect/sql-sqlite-wasm | Patch | | @effect/sql | Patch | | @effect/typeclass | Patch | | @effect/vitest | Patch | | @effect/ai | Patch | | @effect/ai-openai | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

KhraksMamtsov commented 1 month ago

https://github.com/microsoft/TypeScript/issues/45276#issuecomment-2437667385