Typescript Error when creating MySQL db pool
Hi Everyone,
I'm getting the following error when creating a database:
I'm using the following code:
(cont'd in following message ...)
11 Replies
My dependencies are:
I created the DB types using kysely-codegen:
I'm still very new with typescript - how can I get the type MysqlPool to map to Pool ?
Or am I doing something else wrong?
TIA for any assistance,
d
Hey š
Can you share your
tsconfig.json
?
can you share the entire typescript error?Sure!
Full error:
Don't you love it when you search for the solution to a problem for a couple of days and find the answer immediately after posting asking for assistance!! š š³
I have found the answer here: https://lucia-auth.com/guidebook/kysely
Turns out that createPool() does not return the pool - you have to access its pool property:
Thanks for looking in š
Lucia
Using Kysely
hmm mysql2 might have introduced a breaking change there
need to investigate
OK, keep us posted - will be interesting to see what you discover.
Thanks for this, and Kysely!! š
Actually, something is strange - returning .pool gets rid of the error, but it is not listed as a property in the intellisense.
Like I said, I'm still new to typescript, so I don't know whether this is expected.
Tried to add screenshots, but it failed. Will try again later.
thank @koskimas šš»
Your example doesn't error in TypeScript playground https://tsplay.dev/w8659m
TS Playground - An online editor for exploring TypeScript and JavaS...
The Playground lets you write TypeScript or JavaScript online in a safe and sharable way.
I have a feeling svelte kit not having
skipLibCheck: true
in its tsconfig.json
causes this
They are breaking things after a LOT of time of inactivity over at mysql2GitHub
chore: deprecate
OkPacket
type and changedRows
property by well...Just showing how this appears for final user:
https://github.com/sidorares/node-mysql2/pull/2087/files#diff-060fa38f61c034c79cb5a1181100b2be6573abd6df6b3b06481b8d7b714199e0 -> https://github.com/sidorares/node-mysql2/pull/2087/files#diff-dc79f011c56f6ff43dbd4a64f19a61cf0be81b265aacdc22484dc9cb366c6dbf
might have broken this
GitHub
fix: change from .ts files to .d.ts by wellwelwel Ā· Pull Request #2...
See:
#2086
reproduce error from #2086
reproduce error from sveltejs/language-tools#2068
resolve new conflicts on current tests
add these errors to CI Test
create declarations for:
.../Ex...