mirror of
https://github.com/oven-sh/bun
synced 2026-02-14 12:51:54 +00:00
Bun implements sync function for sql.options.pass[word]
This commit is contained in:
4
packages/bun-types/bun.d.ts
vendored
4
packages/bun-types/bun.d.ts
vendored
@@ -1384,14 +1384,14 @@ declare module "bun" {
|
||||
* Database password for authentication
|
||||
* @default ""
|
||||
*/
|
||||
password?: string | (() => Promise<string>) | undefined;
|
||||
password?: string | (() => MaybePromise<string>) | undefined;
|
||||
|
||||
/**
|
||||
* Database password for authentication (alias for password)
|
||||
* @deprecated Prefer {@link password}
|
||||
* @default ""
|
||||
*/
|
||||
pass?: string | (() => Promise<string>) | undefined;
|
||||
pass?: string | (() => MaybePromise<string>) | undefined;
|
||||
|
||||
/**
|
||||
* Name of the database to connect to
|
||||
|
||||
8
packages/bun-types/deprecated.d.ts
vendored
8
packages/bun-types/deprecated.d.ts
vendored
@@ -14,16 +14,16 @@ declare module "bun" {
|
||||
): void;
|
||||
}
|
||||
|
||||
/** @deprecated Use {@link SQL.Query} */
|
||||
/** @deprecated Use {@link SQL.Query Bun.SQL.Query} */
|
||||
type SQLQuery<T = any> = SQL.Query<T>;
|
||||
|
||||
/** @deprecated Use {@link SQL.TransactionContextCallback} */
|
||||
/** @deprecated Use {@link SQL.TransactionContextCallback Bun.SQL.TransactionContextCallback} */
|
||||
type SQLTransactionContextCallback<T> = SQL.TransactionContextCallback<T>;
|
||||
|
||||
/** @deprecated Use {@link SQL.SavepointContextCallback} */
|
||||
/** @deprecated Use {@link SQL.SavepointContextCallback Bun.SQL.SavepointContextCallback} */
|
||||
type SQLSavepointContextCallback<T> = SQL.SavepointContextCallback<T>;
|
||||
|
||||
/** @deprecated Use {@link SQL.Options} */
|
||||
/** @deprecated Use {@link SQL.Options Bun.SQL.Options} */
|
||||
type SQLOptions = SQL.Options;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1339,7 +1339,7 @@ function decodeIfValid(value) {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
function loadOptions(o) {
|
||||
function loadOptions(o: Bun.SQL.Options) {
|
||||
var hostname,
|
||||
port,
|
||||
username,
|
||||
|
||||
@@ -200,6 +200,15 @@ expectType(await queryNum.execute()).is<number>();
|
||||
expectType(await queryNum.raw()).is<number>();
|
||||
expectType(await queryNum.values()).is<number>();
|
||||
|
||||
expectType<Bun.SQL.Options>({
|
||||
password: () => "hey",
|
||||
pass: async () => "hey",
|
||||
});
|
||||
|
||||
expectType<Bun.SQL.Options>({
|
||||
password: "hey",
|
||||
});
|
||||
|
||||
expectType(sql({ name: "Alice", email: "alice@example.com" })).is<
|
||||
Bun.SQL.Helper<{
|
||||
name: string;
|
||||
|
||||
Reference in New Issue
Block a user