Closed matthieusieben closed 7 months ago
The following:
createLocalJWKSet({ keys: [] as readonly string[] } as const)
Generated this error:
The type 'readonly string[]' is 'readonly' and cannot be assigned to the mutable type 'JWK[]'.ts (4104)
Since the JWKS will be cloned by createLocalJWKSet, there should not be any issue with marking the input as readonly.
createLocalJWKSet
IMO this is important as freezing the jwks can prevent any alteration, making the code more consistent and safer.
5.2.0
Other (I will specify below)
types
Note: same goes for:
importJWK
If you wish to make a non-breaking suggestion to the type definitions then by all means please submit a PR. I'm not seeing typing inconveniences as major issues though.
What happened?
The following:
Generated this error:
Since the JWKS will be cloned by
createLocalJWKSet
, there should not be any issue with marking the input as readonly.IMO this is important as freezing the jwks can prevent any alteration, making the code more consistent and safer.
Version
5.2.0
Runtime
Other (I will specify below)
Runtime Details
types
Code to reproduce
Required