diff --git a/types/yesql/index.d.ts b/types/yesql/index.d.ts index 670a071b93..2f5065ecfd 100644 --- a/types/yesql/index.d.ts +++ b/types/yesql/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for yesql 3.2 +// Type definitions for yesql 4.1 // Project: https://github.com/pihvi/yesql#readme // Definitions by: Lluís Ulzurrun de Asanza Sáez // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -14,11 +14,16 @@ declare function readSqlFiles( declare namespace readSqlFiles { type AnyParams = Record; + interface Options { + useNullForMissing?: boolean; + } function pg( query: string, + options?: Options ): (params: TParams) => { text: string; values: Array }; function mysql( query: string, + options?: Options ): (params: TParams) => { sql: string; values: Array }; } diff --git a/types/yesql/yesql-tests.ts b/types/yesql/yesql-tests.ts index a5e70fbee1..81347f9588 100644 --- a/types/yesql/yesql-tests.ts +++ b/types/yesql/yesql-tests.ts @@ -24,3 +24,6 @@ interface QueryParams { yesql.mysql('')(); // $ExpectError yesql.mysql('')({ id: 'string-id' }); // $ExpectError yesql.mysql('')({ id: 123, name: 'foo' }); // $ExpectType { sql: string; values: (string | number)[]; } + +yesql.pg('', { useNullForMissing: true })({}); // $ExpectType { text: string; values: any[]; } +yesql.pg('', { useNullForMissing: 1 })({}); // $ExpectError