Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
Signed-off-by: Matteo Collina <[email protected]>
  • Loading branch information
mcollina committed Nov 9, 2024
1 parent ec369ec commit b24d565
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/mysql/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ function validateMySqlUrl(urlString: string) {
}
}

function parseNullable<T, R>(value: T, parser: (value: T) => R): R | null {
function parseNullable<T, R>(value: T, parser: (value: NonNullable<T>) => R): R | null {
if (value == null) {
return null;
}
Expand All @@ -249,7 +249,7 @@ function parseNullable<T, R>(value: T, parser: (value: T) => R): R | null {

function getTinyIntParser(
mode: 'boolean' | 'number',
): (f: {string(): string}) => any {
): (f: {string(): string | null}) => any {
switch (mode) {
case 'number':
return (f) => parseNullable(f.string(), (s) => parseInt(s, 10));
Expand All @@ -259,7 +259,7 @@ function getTinyIntParser(
}
function getBigIntParser(
mode: 'string' | 'number' | 'bigint',
): (f: {string(): string}) => any {
): (f: {string(): string | null}) => any {
switch (mode) {
case 'number':
return (f) => parseNullable(f.string(), (s) => parseInt(s, 10));
Expand All @@ -272,7 +272,7 @@ function getBigIntParser(
function getDateParser(
mode: 'string' | 'date-object',
timeZone: 'local' | 'utc',
): (f: {string(): string}) => any {
): (f: {string(): string | null}) => any {
switch (mode) {
case 'string':
return (f) => f.string();
Expand Down Expand Up @@ -313,7 +313,7 @@ function getDateParser(
function getDateTimeParser(
mode: 'string' | 'date-object',
timeZone: 'local' | 'utc',
): (f: {string(): string; buffer(): Buffer}) => any {
): (f: {string(): string | null; buffer(): Buffer | null}) => any {
switch (mode) {
case 'string':
return (f) => f.string();
Expand Down

0 comments on commit b24d565

Please sign in to comment.