You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to do some type casting when returning data.
So I use the typeCast function that is available on the createPool options
My problem is that the parameter FieldInfo.type is typed as a mariadb.Types which is a enum with values such as TINY = 0x01, // aka TINYINT, 1 byte
But the FieldInfo.type is of type string. Which causes typescript to complain.
Example
constpool=createPool({host: 'localhost',user: 'root',password: '',database: 'testdb',connectionLimit: 5,typeCast: (field: FieldInfo,useDefaultTypeCasting)=>{if(field.type===Types.BIT||field.type===Types.TINY){// we never get here because Types.BIT is a number and field.type is a string 'BIT'returnfield.int()===1;}returnuseDefaultTypeCasting();}});
How to fix.
in typescript for FieldInfo.type introduce new enum that is string based.
The text was updated successfully, but these errors were encountered:
using Typescript.
I want to do some type casting when returning data.
So I use the
typeCast
function that is available on thecreatePool
optionsMy problem is that the parameter
FieldInfo.type
is typed as a mariadb.Types which is a enum with values such asTINY = 0x01, // aka TINYINT, 1 byte
But the FieldInfo.type is of type
string
. Which causes typescript to complain.Example
How to fix.
in typescript for
FieldInfo.type
introduce new enum that is string based.The text was updated successfully, but these errors were encountered: