Skip to content

Commit

Permalink
ensure all type ids are annotated with unique symbol (#2679)
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-smart committed May 2, 2024
1 parent 74f07b8 commit 2e1cdf6
Show file tree
Hide file tree
Showing 30 changed files with 79 additions and 68 deletions.
11 changes: 11 additions & 0 deletions .changeset/clean-goats-cough.md
@@ -0,0 +1,11 @@
---
"@effect/experimental": patch
"@effect/sql-mssql": patch
"@effect/platform": patch
"effect": patch
"@effect/schema": patch
"@effect/rpc": patch
"@effect/sql": patch
---

ensure all type ids are annotated with `unique symbol`
2 changes: 1 addition & 1 deletion packages/effect/src/FiberHandle.ts
Expand Up @@ -22,7 +22,7 @@ import * as Runtime from "./Runtime.js"
* @since 2.0.0
* @categories type ids
*/
export const TypeId = Symbol.for("effect/FiberHandle")
export const TypeId: unique symbol = Symbol.for("effect/FiberHandle")

/**
* @since 2.0.0
Expand Down
2 changes: 1 addition & 1 deletion packages/effect/src/FiberMap.ts
Expand Up @@ -24,7 +24,7 @@ import * as Runtime from "./Runtime.js"
* @since 2.0.0
* @categories type ids
*/
export const TypeId = Symbol.for("effect/FiberMap")
export const TypeId: unique symbol = Symbol.for("effect/FiberMap")

/**
* @since 2.0.0
Expand Down
2 changes: 1 addition & 1 deletion packages/effect/src/FiberSet.ts
Expand Up @@ -22,7 +22,7 @@ import * as Runtime from "./Runtime.js"
* @since 2.0.0
* @categories type ids
*/
export const TypeId = Symbol.for("effect/FiberSet")
export const TypeId: unique symbol = Symbol.for("effect/FiberSet")

/**
* @since 2.0.0
Expand Down
2 changes: 1 addition & 1 deletion packages/effect/src/Option.ts
Expand Up @@ -28,7 +28,7 @@ export type Option<A> = None<A> | Some<A>
* @category symbols
* @since 2.0.0
*/
export const TypeId = Symbol.for("effect/Option")
export const TypeId: unique symbol = Symbol.for("effect/Option")

/**
* @category symbols
Expand Down
2 changes: 1 addition & 1 deletion packages/effect/src/Readable.ts
Expand Up @@ -12,7 +12,7 @@ import type { NoInfer } from "./Types.js"
* @since 2.0.0
* @category type ids
*/
export const TypeId = Symbol.for("effect/Readable")
export const TypeId: unique symbol = Symbol.for("effect/Readable")

/**
* @since 2.0.0
Expand Down
2 changes: 1 addition & 1 deletion packages/effect/src/Request.ts
Expand Up @@ -283,7 +283,7 @@ export const makeCache = (
* @since 2.0.0
* @category symbols
*/
export const EntryTypeId = Symbol.for("effect/RequestBlock.Entry")
export const EntryTypeId: unique symbol = Symbol.for("effect/RequestBlock.Entry")

/**
* @since 2.0.0
Expand Down
2 changes: 1 addition & 1 deletion packages/effect/src/Subscribable.ts
Expand Up @@ -13,7 +13,7 @@ import type { NoInfer } from "./Types.js"
* @since 2.0.0
* @category type ids
*/
export const TypeId = Symbol.for("effect/Subscribable")
export const TypeId: unique symbol = Symbol.for("effect/Subscribable")

/**
* @since 2.0.0
Expand Down
2 changes: 1 addition & 1 deletion packages/effect/src/TestAnnotation.ts
Expand Up @@ -20,7 +20,7 @@ const TestAnnotationSymbolKey = "effect/TestAnnotation"
/**
* @since 2.0.0
*/
export const TestAnnotationTypeId = Symbol.for(TestAnnotationSymbolKey)
export const TestAnnotationTypeId: unique symbol = Symbol.for(TestAnnotationSymbolKey)

/**
* @since 2.0.0
Expand Down
2 changes: 1 addition & 1 deletion packages/effect/src/TestAnnotationMap.ts
Expand Up @@ -9,7 +9,7 @@ import type * as TestAnnotation from "./TestAnnotation.js"
/**
* @since 2.0.0
*/
export const TestAnnotationMapTypeId = Symbol.for("effect/TestAnnotationMap")
export const TestAnnotationMapTypeId: unique symbol = Symbol.for("effect/TestAnnotationMap")

/**
* @since 2.0.0
Expand Down
2 changes: 1 addition & 1 deletion packages/effect/src/TestAnnotations.ts
Expand Up @@ -20,7 +20,7 @@ import * as TestAnnotationMap from "./TestAnnotationMap.js"
/**
* @since 2.0.0
*/
export const TestAnnotationsTypeId = Symbol.for("effect/TestAnnotations")
export const TestAnnotationsTypeId: unique symbol = Symbol.for("effect/TestAnnotations")

/**
* @since 2.0.0
Expand Down
2 changes: 1 addition & 1 deletion packages/effect/src/TestLive.ts
Expand Up @@ -10,7 +10,7 @@ import * as defaultServices from "./internal/defaultServices.js"
/**
* @since 2.0.0
*/
export const TestLiveTypeId = Symbol.for("effect/TestLive")
export const TestLiveTypeId: unique symbol = Symbol.for("effect/TestLive")

/**
* @since 2.0.0
Expand Down
2 changes: 1 addition & 1 deletion packages/effect/src/TestSized.ts
Expand Up @@ -9,7 +9,7 @@ import * as core from "./internal/core.js"
/**
* @since 2.0.0
*/
export const TestSizedTypeId = Symbol.for("effect/TestSized")
export const TestSizedTypeId: unique symbol = Symbol.for("effect/TestSized")

/**
* @since 2.0.0
Expand Down
4 changes: 2 additions & 2 deletions packages/effect/src/Utils.ts
Expand Up @@ -25,7 +25,7 @@ import type * as Types from "./Types.js"
* @category symbols
* @since 2.0.0
*/
export const GenKindTypeId = Symbol.for("effect/Gen/GenKind")
export const GenKindTypeId: unique symbol = Symbol.for("effect/Gen/GenKind")

/**
* @category symbols
Expand Down Expand Up @@ -717,7 +717,7 @@ function add64(
/**
* @since 3.0.6
*/
export const YieldWrapTypeId = Symbol.for("effect/Utils/YieldWrap")
export const YieldWrapTypeId: unique symbol = Symbol.for("effect/Utils/YieldWrap")

/**
* @since 3.0.6
Expand Down
6 changes: 3 additions & 3 deletions packages/experimental/src/Machine.ts
Expand Up @@ -56,7 +56,7 @@ export {
* @since 1.0.0
* @category type ids
*/
export const TypeId = Symbol.for("@effect/experimental/Machine")
export const TypeId: unique symbol = Symbol.for("@effect/experimental/Machine")

/**
* @since 1.0.0
Expand Down Expand Up @@ -85,7 +85,7 @@ export interface Machine<
* @since 1.0.0
* @category type ids
*/
export const SerializableTypeId = Symbol.for("@effect/experimental/Machine/Serializable")
export const SerializableTypeId: unique symbol = Symbol.for("@effect/experimental/Machine/Serializable")

/**
* @since 1.0.0
Expand Down Expand Up @@ -124,7 +124,7 @@ export interface SerializableMachine<
* @since 1.0.0
* @category type ids
*/
export const ActorTypeId = Symbol.for("@effect/experimental/Machine/Actor")
export const ActorTypeId: unique symbol = Symbol.for("@effect/experimental/Machine/Actor")

/**
* @since 1.0.0
Expand Down
4 changes: 2 additions & 2 deletions packages/experimental/src/Machine/Procedure.ts
Expand Up @@ -13,7 +13,7 @@ import type { Request } from "effect/Request"
* @since 1.0.0
* @category type ids
*/
export const TypeId = Symbol.for("@effect/experimental/Machine/Procedure")
export const TypeId: unique symbol = Symbol.for("@effect/experimental/Machine/Procedure")

/**
* @since 1.0.0
Expand Down Expand Up @@ -57,7 +57,7 @@ export interface Procedure<Request extends TaggedRequest.Any, State, R> extends
* @since 1.0.0
* @category type ids
*/
export const SerializableTypeId = Symbol.for("@effect/experimental/Machine/SerializableProcedure")
export const SerializableTypeId: unique symbol = Symbol.for("@effect/experimental/Machine/SerializableProcedure")

/**
* @since 1.0.0
Expand Down
2 changes: 1 addition & 1 deletion packages/experimental/src/Machine/ProcedureList.ts
Expand Up @@ -11,7 +11,7 @@ import * as Procedure from "./Procedure.js"
* @since 1.0.0
* @category type ids
*/
export const TypeId = Symbol.for("@effect/experimental/Machine/ProcedureList")
export const TypeId: unique symbol = Symbol.for("@effect/experimental/Machine/ProcedureList")

/**
* @since 1.0.0
Expand Down
2 changes: 1 addition & 1 deletion packages/experimental/src/Ndjson.ts
Expand Up @@ -14,7 +14,7 @@ import { dual, pipe } from "effect/Function"
* @since 1.0.0
* @category type ids
*/
export const NdjsonErrorTypeId = Symbol.for("@effect/experimental/Ndjson/NdjsonError")
export const NdjsonErrorTypeId: unique symbol = Symbol.for("@effect/experimental/Ndjson/NdjsonError")

/**
* @since 1.0.0
Expand Down
6 changes: 3 additions & 3 deletions packages/experimental/src/Persistence.ts
Expand Up @@ -21,7 +21,7 @@ import * as TimeToLive from "./TimeToLive.js"
* @since 1.0.0
* @category type ids
*/
export const ErrorTypeId = Symbol.for("@effect/experimental/PersistenceError")
export const ErrorTypeId: unique symbol = Symbol.for("@effect/experimental/PersistenceError")

/**
* @since 1.0.0
Expand Down Expand Up @@ -80,7 +80,7 @@ export class PersistenceBackingError extends RefailError(ErrorTypeId, "Persisten
* @since 1.0.0
* @category type ids
*/
export const BackingPersistenceTypeId = Symbol.for("@effect/experimental/BackingPersistence")
export const BackingPersistenceTypeId: unique symbol = Symbol.for("@effect/experimental/BackingPersistence")

/**
* @since 1.0.0
Expand Down Expand Up @@ -127,7 +127,7 @@ export const BackingPersistence: Context.Tag<BackingPersistence, BackingPersiste
* @since 1.0.0
* @category type ids
*/
export const ResultPersistenceTypeId = Symbol.for("@effect/experimental/ResultPersistence")
export const ResultPersistenceTypeId: unique symbol = Symbol.for("@effect/experimental/ResultPersistence")

/**
* @since 1.0.0
Expand Down
2 changes: 1 addition & 1 deletion packages/experimental/src/SocketServer.ts
Expand Up @@ -10,7 +10,7 @@ import type * as Effect from "effect/Effect"
* @since 1.0.0
* @category type ids
*/
export const SocketServerTypeId = Symbol.for("@effect/experimental/SocketServer")
export const SocketServerTypeId: unique symbol = Symbol.for("@effect/experimental/SocketServer")

/**
* @since 1.0.0
Expand Down
2 changes: 1 addition & 1 deletion packages/platform/src/Http/ClientRequest.ts
Expand Up @@ -22,7 +22,7 @@ import type * as UrlParams from "./UrlParams.js"
* @since 1.0.0
* @category type ids
*/
export const TypeId = Symbol.for("@effect/platform/Http/ClientRequest")
export const TypeId: unique symbol = Symbol.for("@effect/platform/Http/ClientRequest")

/**
* @since 1.0.0
Expand Down
6 changes: 3 additions & 3 deletions packages/platform/src/Http/Cookies.ts
Expand Up @@ -16,7 +16,7 @@ import { TypeIdError } from "../Error.js"
* @since 1.0.0
* @category type ids
*/
export const TypeId = Symbol.for("@effect/platform/Http/Cookies")
export const TypeId: unique symbol = Symbol.for("@effect/platform/Http/Cookies")

/**
* @since 1.0.0
Expand All @@ -43,7 +43,7 @@ export interface Cookies extends Pipeable, Inspectable.Inspectable {
* @since 1.0.0
* @category type ids
*/
export const CookieTypeId = Symbol.for("@effect/platform/Http/Cookies/Cookie")
export const CookieTypeId: unique symbol = Symbol.for("@effect/platform/Http/Cookies/Cookie")

/**
* @since 1.0.0
Expand Down Expand Up @@ -77,7 +77,7 @@ export interface Cookie extends Inspectable.Inspectable {
* @since 1.0.0
* @category type ids
*/
export const ErrorTypeId = Symbol.for("@effect/platform/Http/Cookies/CookieError")
export const ErrorTypeId: unique symbol = Symbol.for("@effect/platform/Http/Cookies/CookieError")

/**
* @since 1.0.0
Expand Down
2 changes: 1 addition & 1 deletion packages/platform/src/Http/Headers.ts
Expand Up @@ -16,7 +16,7 @@ import type { Mutable } from "effect/Types"
* @since 1.0.0
* @category type ids
*/
export const HeadersTypeId = Symbol.for("@effect/platform/Http/Headers")
export const HeadersTypeId: unique symbol = Symbol.for("@effect/platform/Http/Headers")

/**
* @since 1.0.0
Expand Down
2 changes: 1 addition & 1 deletion packages/platform/src/Http/ServerResponse.ts
Expand Up @@ -20,7 +20,7 @@ import type * as UrlParams from "./UrlParams.js"
* @since 1.0.0
* @category type ids
*/
export const TypeId = Symbol.for("@effect/platform/Http/ServerResponse")
export const TypeId: unique symbol = Symbol.for("@effect/platform/Http/ServerResponse")

/**
* @since 1.0.0
Expand Down
6 changes: 3 additions & 3 deletions packages/platform/src/Socket.ts
Expand Up @@ -22,7 +22,7 @@ import { RefailError, TypeIdError } from "./Error.js"
* @since 1.0.0
* @category type ids
*/
export const TypeId = Symbol.for("@effect/platform/Socket")
export const TypeId: unique symbol = Symbol.for("@effect/platform/Socket")

/**
* @since 1.0.0
Expand Down Expand Up @@ -57,7 +57,7 @@ export interface Socket {
* @since 1.0.0
* @category type ids
*/
export const CloseEventTypeId = Symbol.for("@effect/platform/Socket/CloseEvent")
export const CloseEventTypeId: unique symbol = Symbol.for("@effect/platform/Socket/CloseEvent")

/**
* @since 1.0.0
Expand Down Expand Up @@ -95,7 +95,7 @@ export const isCloseEvent = (u: unknown): u is CloseEvent => Predicate.hasProper
* @since 1.0.0
* @category type ids
*/
export const SocketErrorTypeId = Symbol.for("@effect/platform/Socket/SocketError")
export const SocketErrorTypeId: unique symbol = Symbol.for("@effect/platform/Socket/SocketError")

/**
* @since 1.0.0
Expand Down
2 changes: 1 addition & 1 deletion packages/rpc/src/Router.ts
Expand Up @@ -22,7 +22,7 @@ import * as Rpc from "./Rpc.js"
* @since 1.0.0
* @category type ids
*/
export const TypeId = Symbol.for("@effect/rpc/Router")
export const TypeId: unique symbol = Symbol.for("@effect/rpc/Router")

/**
* @since 1.0.0
Expand Down
2 changes: 1 addition & 1 deletion packages/rpc/src/Rpc.ts
Expand Up @@ -25,7 +25,7 @@ import * as Internal from "./internal/rpc.js"
* @since 1.0.0
* @category type ids
*/
export const TypeId = Symbol.for("@effect/rpc/Rpc")
export const TypeId: unique symbol = Symbol.for("@effect/rpc/Rpc")

/**
* @since 1.0.0
Expand Down

0 comments on commit 2e1cdf6

Please sign in to comment.