Skip to content

Commit

Permalink
fix(typescript): JWTExpired error TS2417
Browse files Browse the repository at this point in the history
  • Loading branch information
panva committed Oct 14, 2021
1 parent 4f7f8a8 commit 373e0e4
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 12 deletions.
31 changes: 31 additions & 0 deletions patches/typedoc-plugin-markdown+3.10.4.patch
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,34 @@ index ba8e5be..d9627dc 100644
-
-{{{reflectionPath}}}
\ No newline at end of file
diff --git a/node_modules/typedoc-plugin-markdown/dist/resources/templates/reflection.hbs b/node_modules/typedoc-plugin-markdown/dist/resources/templates/reflection.hbs
index ce29bc5..3301cfe 100755
--- a/node_modules/typedoc-plugin-markdown/dist/resources/templates/reflection.hbs
+++ b/node_modules/typedoc-plugin-markdown/dist/resources/templates/reflection.hbs
@@ -36,26 +36,6 @@

{{/ifShowTypeHierarchy}}

-{{#if model.implementedTypes}}
-
-## Implements
-
-{{#each model.implementedTypes}}
-- {{{type}}}
-{{/each}}
-
-{{/if}}
-
-{{#if model.implementedBy}}
-
-## Implemented by
-
-{{#each model.implementedBy}}
-- {{{type}}}
-{{/each}}
-
-{{/if}}
-
{{#if model.signatures}}

## Callable
39 changes: 27 additions & 12 deletions src/util/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,33 @@ export class JWTClaimValidationFailed extends JOSEError {
}
}

/**
* An error subclass thrown when a JWT is expired.
*/
export class JWTExpired extends JOSEError implements JWTClaimValidationFailed {
static get code(): 'ERR_JWT_EXPIRED' {
return 'ERR_JWT_EXPIRED'
}

code = 'ERR_JWT_EXPIRED'

/**
* The Claim for which the validation failed.
*/
claim: string

/**
* Reason code for the validation failure.
*/
reason: string

constructor(message: string, claim = 'unspecified', reason = 'unspecified') {
super(message)
this.claim = claim
this.reason = reason
}
}

/**
* An error subclass thrown when a JOSE Algorithm is not allowed per developer preference.
*/
Expand Down Expand Up @@ -191,15 +218,3 @@ export class JWSSignatureVerificationFailed extends JOSEError {

message = 'signature verification failed'
}

/**
* An error subclass thrown when a JWT is expired.
*/
// @ts-expect-error
export class JWTExpired extends JWTClaimValidationFailed {
static get code(): 'ERR_JWT_EXPIRED' {
return 'ERR_JWT_EXPIRED'
}

code = 'ERR_JWT_EXPIRED'
}

0 comments on commit 373e0e4

Please sign in to comment.