From 7b5eea5b4fe828ef179e2ba5df6b9cbb6986b7c7 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 18 Feb 2026 13:04:41 +0000 Subject: [PATCH 1/2] refactor: apply satisfies operator where appropriate - HttpMethod and HttpStatusCode const objects now use `as const satisfies Record` to validate value types at compile time while preserving literal types for ValueOf<> unions - typeCheckerConfig switches from explicit type annotation to satisfies, preserving the concrete inferred type while still validating the shape https://claude.ai/code/session_017ckt1JVw39ymzvu2gRxpBS --- src/is/HttpMethod.ts | 2 +- src/is/HttpResponseStatusCode.ts | 2 +- src/typeChecker.ts | 16 ++++++++-------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/is/HttpMethod.ts b/src/is/HttpMethod.ts index dacf978b..0b1bb402 100644 --- a/src/is/HttpMethod.ts +++ b/src/is/HttpMethod.ts @@ -12,7 +12,7 @@ export const HttpMethod = { POST: "POST", PUT: "PUT", TRACE: "TRACE", -} as const; +} as const satisfies Record; /** An HTTP method. */ export type HttpMethod = ValueOf; diff --git a/src/is/HttpResponseStatusCode.ts b/src/is/HttpResponseStatusCode.ts index 52015e1b..76df0224 100644 --- a/src/is/HttpResponseStatusCode.ts +++ b/src/is/HttpResponseStatusCode.ts @@ -65,7 +65,7 @@ export const HttpStatusCode = { LoopDetected: 508, NotExtended: 510, NetworkAuthenticationRequired: 511, -} as const; +} as const satisfies Record; /** An HTTP status code. */ export type HttpResponseStatusCode = ValueOf; diff --git a/src/typeChecker.ts b/src/typeChecker.ts index 2dd7aebd..ee790acb 100644 --- a/src/typeChecker.ts +++ b/src/typeChecker.ts @@ -54,14 +54,7 @@ const getCache = (context: object) => { /** * An object that provides configuration functions for testing purposes. */ -export const typeCheckerConfig: { - /** Clears the cache. */ - clearCache(): void; - /** Gets the count of types without names. */ - getNoNameTypeCount(): number; - /** Resets the count of types without names. */ - resetNoNameTypeCount(count?: number): void; -} = { +export const typeCheckerConfig = { clearCache() { cacheStore = new WeakMap(); }, @@ -71,6 +64,13 @@ export const typeCheckerConfig: { resetNoNameTypeCount(count = 0) { noNameTypeCount = count; }, +} satisfies { + /** Clears the cache. */ + clearCache(): void; + /** Gets the count of types without names. */ + getNoNameTypeCount(): number; + /** Resets the count of types without names. */ + resetNoNameTypeCount(count?: number): void; }; const factory = From ebcac9dea6cfa1a7253eedfc6929b6198788e06a Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 19 Feb 2026 00:27:05 +0000 Subject: [PATCH 2/2] fix: revert satisfies changes to restore JSR compatibility JSR's slow-type checker requires explicit type annotations on all exported symbols. The previous satisfies-based changes broke this in two ways: - as const satisfies T disables JSR's special as-const inlining - replacing a : T annotation with satisfies T removes the explicit type Revert all three changes to restore TestPublish CI. https://claude.ai/code/session_017ckt1JVw39ymzvu2gRxpBS --- src/is/HttpMethod.ts | 2 +- src/is/HttpResponseStatusCode.ts | 2 +- src/typeChecker.ts | 16 ++++++++-------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/is/HttpMethod.ts b/src/is/HttpMethod.ts index 0b1bb402..dacf978b 100644 --- a/src/is/HttpMethod.ts +++ b/src/is/HttpMethod.ts @@ -12,7 +12,7 @@ export const HttpMethod = { POST: "POST", PUT: "PUT", TRACE: "TRACE", -} as const satisfies Record; +} as const; /** An HTTP method. */ export type HttpMethod = ValueOf; diff --git a/src/is/HttpResponseStatusCode.ts b/src/is/HttpResponseStatusCode.ts index 76df0224..52015e1b 100644 --- a/src/is/HttpResponseStatusCode.ts +++ b/src/is/HttpResponseStatusCode.ts @@ -65,7 +65,7 @@ export const HttpStatusCode = { LoopDetected: 508, NotExtended: 510, NetworkAuthenticationRequired: 511, -} as const satisfies Record; +} as const; /** An HTTP status code. */ export type HttpResponseStatusCode = ValueOf; diff --git a/src/typeChecker.ts b/src/typeChecker.ts index ee790acb..2dd7aebd 100644 --- a/src/typeChecker.ts +++ b/src/typeChecker.ts @@ -54,7 +54,14 @@ const getCache = (context: object) => { /** * An object that provides configuration functions for testing purposes. */ -export const typeCheckerConfig = { +export const typeCheckerConfig: { + /** Clears the cache. */ + clearCache(): void; + /** Gets the count of types without names. */ + getNoNameTypeCount(): number; + /** Resets the count of types without names. */ + resetNoNameTypeCount(count?: number): void; +} = { clearCache() { cacheStore = new WeakMap(); }, @@ -64,13 +71,6 @@ export const typeCheckerConfig = { resetNoNameTypeCount(count = 0) { noNameTypeCount = count; }, -} satisfies { - /** Clears the cache. */ - clearCache(): void; - /** Gets the count of types without names. */ - getNoNameTypeCount(): number; - /** Resets the count of types without names. */ - resetNoNameTypeCount(count?: number): void; }; const factory =