fixes(tsc): typing issue
This commit is contained in:
parent
404735fe22
commit
537cd03bb5
1 changed files with 4 additions and 4 deletions
|
|
@ -39,7 +39,7 @@ export const UserImpl: Omit<IUserDb, keyof Database> = {
|
||||||
return userFromRow(
|
return userFromRow(
|
||||||
this.prepare(
|
this.prepare(
|
||||||
'SELECT * FROM user WHERE name = @name LIMIT 1',
|
'SELECT * FROM user WHERE name = @name LIMIT 1',
|
||||||
).get({ name }),
|
).get({ name }) as (Partial<User> | undefined),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -54,7 +54,7 @@ export const UserImpl: Omit<IUserDb, keyof Database> = {
|
||||||
return userFromRow(
|
return userFromRow(
|
||||||
this.prepare('SELECT * FROM user WHERE id = @id LIMIT 1').get({
|
this.prepare('SELECT * FROM user WHERE id = @id LIMIT 1').get({
|
||||||
id,
|
id,
|
||||||
}) as SqliteReturn,
|
}) as (Partial<User> | undefined),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -71,7 +71,7 @@ export const UserImpl: Omit<IUserDb, keyof Database> = {
|
||||||
return userFromRow(
|
return userFromRow(
|
||||||
this.prepare(
|
this.prepare(
|
||||||
'INSERT OR FAIL INTO user (name, password) VALUES (@name, @password) RETURNING *',
|
'INSERT OR FAIL INTO user (name, password) VALUES (@name, @password) RETURNING *',
|
||||||
).get({ name, password }),
|
).get({ name, password }) as (Partial<User> | undefined),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -154,7 +154,7 @@ async function hashPassword(
|
||||||
*
|
*
|
||||||
* @returns The user if it exists, undefined otherwise
|
* @returns The user if it exists, undefined otherwise
|
||||||
*/
|
*/
|
||||||
function userFromRow(row: Partial<User>): User | undefined {
|
function userFromRow(row?: Partial<User>): User | undefined {
|
||||||
if (isNullish(row)) return undefined;
|
if (isNullish(row)) return undefined;
|
||||||
if (isNullish(row.id)) return undefined;
|
if (isNullish(row.id)) return undefined;
|
||||||
if (isNullish(row.name)) return undefined;
|
if (isNullish(row.name)) return undefined;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue