From e50ce2eb14b3c6b85096092183e447563694174b Mon Sep 17 00:00:00 2001 From: Jakub Jirutka Date: Mon, 19 Oct 2020 23:18:22 +0200 Subject: [PATCH] Types: fixed index types in modules. Fixes the following type errors: Property ''xxx'' of type 'NjsByteString | undefined' is not assignable to string index type 'NjsStringLike'.ts(2411) While string index signatures are a powerful way to describe the "dictionary" pattern, they also enforce that all properties match their return type. --- ts/ngx_http_js_module.d.ts | 6 +++--- ts/ngx_stream_js_module.d.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ts/ngx_http_js_module.d.ts b/ts/ngx_http_js_module.d.ts index d29b1385..0440b7f4 100644 --- a/ts/ngx_http_js_module.d.ts +++ b/ts/ngx_http_js_module.d.ts @@ -39,7 +39,7 @@ interface NginxHeadersIn { readonly 'Warning'?: NjsByteString; readonly 'X-Forwarded-For'?: NjsByteString; - readonly [prop: string]: NjsByteString; + readonly [prop: string]: NjsByteString | undefined; } interface NginxHeadersOut { @@ -76,7 +76,7 @@ interface NginxHeadersOut { 'Set-Cookie'?: NjsStringLike[]; - [prop: string]: NjsStringLike | NjsStringLike[]; + [prop: string]: NjsStringLike | NjsStringLike[] | undefined; } interface NginxVariables { @@ -229,7 +229,7 @@ interface NginxVariables { readonly 'upstream_trailer_'?: NjsByteString; readonly 'uri'?: NjsByteString; - [prop: string]: NjsStringLike; + [prop: string]: NjsStringLike | undefined; } interface NginxSubrequestOptions { diff --git a/ts/ngx_stream_js_module.d.ts b/ts/ngx_stream_js_module.d.ts index 47799ba2..67e24dfa 100644 --- a/ts/ngx_stream_js_module.d.ts +++ b/ts/ngx_stream_js_module.d.ts @@ -66,7 +66,7 @@ interface NginxStreamVariables { readonly 'time_iso8601'?: NjsByteString; readonly 'time_local'?: NjsByteString; - [prop: string]: NjsByteString; + [prop: string]: NjsByteString | undefined; } interface NginxStreamCallbackFlags { -- 2.47.3