mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
🤖 Merge PR #47620 Added yesql options parameter by @kuuup-at-work
* Added yesql options parameter * Changed yesql version * Fixed Version * Fixed version (again) * Fixed version
This commit is contained in:
parent
4d77858ca4
commit
86283a90d8
7
types/yesql/index.d.ts
vendored
7
types/yesql/index.d.ts
vendored
@ -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 <https://github.com/Sumolari>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@ -14,11 +14,16 @@ declare function readSqlFiles(
|
||||
|
||||
declare namespace readSqlFiles {
|
||||
type AnyParams = Record<string, any>;
|
||||
interface Options {
|
||||
useNullForMissing?: boolean;
|
||||
}
|
||||
function pg<TParams extends object = AnyParams>(
|
||||
query: string,
|
||||
options?: Options
|
||||
): (params: TParams) => { text: string; values: Array<TParams[keyof TParams]> };
|
||||
function mysql<TParams extends object = AnyParams>(
|
||||
query: string,
|
||||
options?: Options
|
||||
): (params: TParams) => { sql: string; values: Array<TParams[keyof TParams]> };
|
||||
}
|
||||
|
||||
|
||||
@ -24,3 +24,6 @@ interface QueryParams {
|
||||
yesql.mysql<QueryParams>('')(); // $ExpectError
|
||||
yesql.mysql<QueryParams>('')({ id: 'string-id' }); // $ExpectError
|
||||
yesql.mysql<QueryParams>('')({ id: 123, name: 'foo' }); // $ExpectType { sql: string; values: (string | number)[]; }
|
||||
|
||||
yesql.pg('', { useNullForMissing: true })({}); // $ExpectType { text: string; values: any[]; }
|
||||
yesql.pg('', { useNullForMissing: 1 })({}); // $ExpectError
|
||||
|
||||
Loading…
Reference in New Issue
Block a user