Giter Site home page Giter Site logo

Comments (10)

0xMALVEE avatar 0xMALVEE commented on June 16, 2024 1

@0xMALVEE, thanks to show your solution 🙋🏻‍♂️

Just bringing it from MySQL2 documentation for TypeScript:

## Usage
You can import **MySQL2** in two ways:
- By setting the `esModuleInterop` option to `true` in `tsconfig.json`
```ts
import mysql from 'mysql2';
import mysql from 'mysql2/promise';
```
- By setting the `esModuleInterop` option to `false` in `tsconfig.json`
```ts
import * as mysql from 'mysql2';
import * as mysql from 'mysql2/promise';
```

@wellwelwel thanks. I didn't knew that tsconfig property exists haha. 🤯

from node-mysql2.

0xMALVEE avatar 0xMALVEE commented on June 16, 2024

idk why mysql2 is saying it's undefined. I rm -r node_modules and install again same thing.

from node-mysql2.

0xMALVEE avatar 0xMALVEE commented on June 16, 2024

@sidorares @wellwelwel @jmordica

from node-mysql2.

wellwelwel avatar wellwelwel commented on June 16, 2024

Hey @0xMALVEE, can you share a basic repro as text/code block?

Knowing more about your context can help (some practical usage for databaseProvider and useFactory or where they are called, for example) 🙋🏻‍♂️

from node-mysql2.

0xMALVEE avatar 0xMALVEE commented on June 16, 2024

Hey @0xMALVEE, can you share a basic repro as text/code block?

Knowing more about your context can help (some practical usage for databaseProvider and useFactory or where they are called, for example) 🙋🏻‍♂️

Basically a nest js mono repo. it only doing problem with mysql2 , all other npm packages work just fine. Even I put it on main.ts same giving undefined other then useFactory.
image

from node-mysql2.

wellwelwel avatar wellwelwel commented on June 16, 2024

When isolating NestJS and MySQL2, do you get the same error? If so, please share it. With a repro, I can get the same error to test it.

Sorry @0xMALVEE, I can't reproduce your code as an image 😕

from node-mysql2.

0xMALVEE avatar 0xMALVEE commented on June 16, 2024

When isolating NestJS and MySQL2, do you get the same error? If so, please share it. With a repro, I can get the same error to test it.

Sorry @0xMALVEE, I can't reproduce your code as an image 😕

aight let me prepair for you.

from node-mysql2.

0xMALVEE avatar 0xMALVEE commented on June 16, 2024

@wellwelwel hey I posted in nest js discord as well. just checked seems like they gave a solution , was a problem with my import. it's working now. had to import * as . but in drizzle docs they didn't mention this seems out outdated drizzle docs.
image

image

from node-mysql2.

0xMALVEE avatar 0xMALVEE commented on June 16, 2024

import problem. drizzle docs outdated.

from node-mysql2.

wellwelwel avatar wellwelwel commented on June 16, 2024

@0xMALVEE, thanks to show your solution 🙋🏻‍♂️


Just bringing it from MySQL2 documentation for TypeScript:

## Usage
You can import **MySQL2** in two ways:
- By setting the `esModuleInterop` option to `true` in `tsconfig.json`
```ts
import mysql from 'mysql2';
import mysql from 'mysql2/promise';
```
- By setting the `esModuleInterop` option to `false` in `tsconfig.json`
```ts
import * as mysql from 'mysql2';
import * as mysql from 'mysql2/promise';
```

from node-mysql2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.