From: Jakub Jirutka Date: Mon, 19 Oct 2020 21:18:22 +0000 (+0200) Subject: Types: fixed index types in modules. X-Git-Url: http://www.kaiwu.me/postgresql/commit/?a=commitdiff_plain;h=e50ce2eb14b3c6b85096092183e447563694174b;p=njs.git 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. --- 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 {