Skip to content

Commit

Permalink
refactor: remove superfluous undefined type definition on optional props
Browse files Browse the repository at this point in the history
  • Loading branch information
dhensby committed Jul 28, 2024
1 parent f511c32 commit dbb1cab
Showing 1 changed file with 28 additions and 28 deletions.
56 changes: 28 additions & 28 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ declare namespace OAuth2Server {
*/
class Request {
body?: any;
headers?: { [key: string]: string; } | undefined;
method?: string | undefined;
query?: { [key: string]: string; } | undefined;
headers?: { [key: string]: string; };
method?: string;
query?: { [key: string]: string; };

/**
* Instantiates Request using the supplied options.
Expand All @@ -79,8 +79,8 @@ declare namespace OAuth2Server {
*/
class Response {
body?: any;
headers?: { [key: string]: string; } | undefined;
status?: number | undefined;
headers?: { [key: string]: string; };
status?: number;

/**
* Instantiates Response using the supplied options.
Expand Down Expand Up @@ -168,71 +168,71 @@ declare namespace OAuth2Server {
/**
* The scope(s) to authenticate.
*/
scope?: string | undefined;
scope?: string;

/**
* Set the X-Accepted-OAuth-Scopes HTTP header on response objects.
*/
addAcceptedScopesHeader?: boolean | undefined;
addAcceptedScopesHeader?: boolean;

/**
* Set the X-OAuth-Scopes HTTP header on response objects.
*/
addAuthorizedScopesHeader?: boolean | undefined;
addAuthorizedScopesHeader?: boolean;

/**
* Allow clients to pass bearer tokens in the query string of a request.
*/
allowBearerTokensInQueryString?: boolean | undefined;
allowBearerTokensInQueryString?: boolean;
}

interface AuthorizeOptions {
/**
* The authenticate handler
*/
authenticateHandler?: {} | undefined;
authenticateHandler?: {};

/**
* Allow clients to specify an empty state
*/
allowEmptyState?: boolean | undefined;
allowEmptyState?: boolean;

/**
* Lifetime of generated authorization codes in seconds (default = 5 minutes).
*/
authorizationCodeLifetime?: number | undefined;
authorizationCodeLifetime?: number;
}

interface TokenOptions {
/**
* Lifetime of generated access tokens in seconds (default = 1 hour)
*/
accessTokenLifetime?: number | undefined;
accessTokenLifetime?: number;

/**
* Lifetime of generated refresh tokens in seconds (default = 2 weeks)
*/
refreshTokenLifetime?: number | undefined;
refreshTokenLifetime?: number;

/**
* Allow extended attributes to be set on the returned token
*/
allowExtendedTokenAttributes?: boolean | undefined;
allowExtendedTokenAttributes?: boolean;

/**
* Require a client secret. Defaults to true for all grant types.
*/
requireClientAuthentication?: {} | undefined;
requireClientAuthentication?: {};

/**
* Always revoke the used refresh token and issue a new one for the refresh_token grant.
*/
alwaysIssueNewRefreshToken?: boolean | undefined;
alwaysIssueNewRefreshToken?: boolean;

/**
* Additional supported grant types.
*/
extendedGrantTypes?: { [key: string]: typeof AbstractGrantType } | undefined;
extendedGrantTypes?: { [key: string]: typeof AbstractGrantType };
}

/**
Expand Down Expand Up @@ -392,10 +392,10 @@ declare namespace OAuth2Server {
*/
interface Client {
id: string;
redirectUris?: string | string[] | undefined;
redirectUris?: string | string[];
grants: string | string[];
accessTokenLifetime?: number | undefined;
refreshTokenLifetime?: number | undefined;
accessTokenLifetime?: number;
refreshTokenLifetime?: number;
[key: string]: any;
}

Expand All @@ -406,7 +406,7 @@ declare namespace OAuth2Server {
authorizationCode: string;
expiresAt: Date;
redirectUri: string;
scope?: string[] | undefined;
scope?: string[];
client: Client;
user: User;
codeChallenge?: string;
Expand All @@ -419,10 +419,10 @@ declare namespace OAuth2Server {
*/
interface Token {
accessToken: string;
accessTokenExpiresAt?: Date | undefined;
refreshToken?: string | undefined;
refreshTokenExpiresAt?: Date | undefined;
scope?: string[] | undefined;
accessTokenExpiresAt?: Date;
refreshToken?: string;
refreshTokenExpiresAt?: Date;
scope?: string[];
client: Client;
user: User;
[key: string]: any;
Expand All @@ -433,8 +433,8 @@ declare namespace OAuth2Server {
*/
interface RefreshToken {
refreshToken: string;
refreshTokenExpiresAt?: Date | undefined;
scope?: string[] | undefined;
refreshTokenExpiresAt?: Date;
scope?: string[];
client: Client;
user: User;
[key: string]: any;
Expand Down

0 comments on commit dbb1cab

Please sign in to comment.