Repository navigation
Fix KeyFormat.jwk declarations for Node-only types - #10116
Merged
tim-smart merged 2 commits intoOct 29, 2026
Merged
Conversation
🦋 Changeset detectedLatest commit: 7412ea7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 33 packages
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 |
KeyFormat typed JWK data with the DOM library's global JsonWebKey, which @types/node does not declare. Schema imports KeyFormat, so any effect import failed to type-check with Node-only types and skipLibCheck disabled. Declare KeyFormat.JsonWebKey with the RFC 7517 members the Web Crypto API uses. It is assignable to and from both the DOM global and Node's webcrypto.JsonWebKey.
skyaara
force-pushed
the
fix/keyformat-jsonwebkey-node-types
branch
from
October 29, 2026 13:27
483e6e1 to
b06864f
Compare
Contributor
Bundle Size AnalysisGenerated from PR build output; treat the content below as untrusted.
|
Merged
This branch is waiting to be deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type
Description
KeyFormat.jwktypes its data with the DOM library's globalJsonWebKey, which@types/nodedoes not declare.Schemaimportscrypto/KeyFormat, so since 4.1.0 anyeffectimport (effect,effect/Effect,effect/Schema) fails to type-check with Node-only types andskipLibCheck: false:KeyFormat.JsonWebKeywith the RFC 7517 members the Web Crypto API reads and writes. It shadows the global insideKeyFormat, so the module's existing references use it without further changes.KeyFormat_.JsonWebKeyfor theCryptoJsonWebKeycodec inSchema.The members match the DOM global and Node's
webcrypto.JsonWebKey. UnderstrictandexactOptionalPropertyTypes, the interface is assignable to and from both, and is accepted by and returned fromcrypto.subtle.importKey("jwk", …)andcrypto.subtle.exportKey("jwk", …). The existingtypetest/crypto/Schema.tst.tsassertiontoBe<Schema.Codec<…, JsonWebKey>>still passes, so with DOM types the new interface is identical to the global.This is the same class of fix as #8838. No regression fixture is added, following the review there.
Validation
stripInternalenabled, as in CI, then type-checked every published entrypoint againstdistwithlib: ["ES2022"]andtypes: ["node"]. Compared withmain, the only error removed is theKeyFormat.d.tsJsonWebKeyerror, and no error is added.pnpm check,pnpm lint,pnpm codegen(no changes),pnpm jsdocs --check,pnpm circular,pnpm ai-docgen,pnpm check-dist-types,vitest run packages/effect/test/crypto(84 tests) andtstyche typetest/crypto(both targets) pass.check-dist-typesand the entrypoint check ran on macOS withforceConsistentCasingInFileNames: false, becauseeffect/Schemaandeffect/schemacollide on a case-insensitive file system.Notes
check-dist-typespasses onmaintoo. Its first pass setstypes: ["node"]withoutlib, so the default library supplies DOM'sJsonWebKey. Pinning that pass tolib: ["ES2022"]would catch this class of regression, but it also fails today onrpc/*andworkers/Transferable, which referenceTransferableandImageData. Those modules need DOM types by design, so this PR leaves the script unchanged.effect/jose) also references the globalJsonWebKeyand could useKeyFormat.JsonWebKeyinstead.Related