mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-21 05:20:24 +08:00
Simpler typings than #16416 to catch some errors again
This commit is contained in:
16
types/hapi/index.d.ts
vendored
16
types/hapi/index.d.ts
vendored
@@ -826,7 +826,7 @@ export interface RouteAuthAccessConfiguationObject {
|
||||
/**
|
||||
* For context see RouteAdditionalConfigurationOptions > cache
|
||||
*/
|
||||
export type RouteCacheOptions = {
|
||||
export interface RouteCacheOptions {
|
||||
/**
|
||||
* determines the privacy flag included in client-side caching using the 'Cache-Control' header. Values are:
|
||||
* * 'default' - no privacy flag. This is the default setting.
|
||||
@@ -834,17 +834,15 @@ export type RouteCacheOptions = {
|
||||
* * 'private' - mark the response as suitable only for private caching.
|
||||
*/
|
||||
privacy?: 'default' | 'public' | 'private';
|
||||
/** relative expiration expressed in the number of milliseconds since the item was saved in the cache. Cannot be used together with expiresAt. */
|
||||
expiresIn?: number;
|
||||
/** time of day expressed in 24h notation using the 'HH:MM' format, at which point all cache records for the route expire. Cannot be used together with expiresIn. */
|
||||
expiresAt?: string;
|
||||
/** an array of HTTP response status codes (e.g. 200) which are allowed to include a valid caching directive. Defaults to [200]. */
|
||||
statuses?: number[];
|
||||
/** a string with the value of the 'Cache-Control' header when caching is disabled. Defaults to 'no-cache'. */
|
||||
otherwise?: string;
|
||||
} & ({
|
||||
/** relative expiration expressed in the number of milliseconds since the item was saved in the cache. Cannot be used together with expiresAt. */
|
||||
expiresIn: number;
|
||||
} | {
|
||||
/** time of day expressed in 24h notation using the 'HH:MM' format, at which point all cache records for the route expire. Cannot be used together with expiresIn. */
|
||||
expiresAt: string;
|
||||
} | {}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* For context see RouteAdditionalConfigurationOptions > cors
|
||||
|
||||
@@ -30,17 +30,9 @@ cache = {
|
||||
expiresAt: '22:44',
|
||||
};
|
||||
|
||||
cache = {
|
||||
privacy: 'default',
|
||||
statuses: [200, 201],
|
||||
/* typings should cause this to error, but currently does not
|
||||
expiresAt: 5000,
|
||||
*/
|
||||
};
|
||||
|
||||
/* typings should cause this to error, but currently does not
|
||||
// /* typings should cause this to error, but currently does not
|
||||
var cache: Hapi.RouteCacheOptions = {
|
||||
expiresIn: 5000,
|
||||
expiresAt: '22:44',
|
||||
};
|
||||
*/
|
||||
// */
|
||||
|
||||
Reference in New Issue
Block a user