oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
74.36k stars 2.78k forks source link

Cannot find name 'Long' #4644

Closed diavrank closed 1 year ago

diavrank commented 1 year ago

What version of Bun is running?

1.0.0+822a00c4d508b54f650933a73ca5f4a3af9a7983

What platform is your computer?

Darwin 22.6.0 arm64 arm

What steps can reproduce the bug?

Create a project in Nestjs

Run the project with: NODE_ENV=localdev nest start --exec "bun run"

Have some classes in the project where some of their properties has the data type Long.

For example:

class Superhero {
      public failoverVersion: Long; //  error TS2304: Cannot find name 'Long'.
}

What is the expected behavior?

It shouldn't mark any errors as it is working well with Nodejs 18 and yarn.

What do you see instead?

Found 9 error(s). (All of them related to the Long data type)

Additional information

Framework: Nestjs 8.4.6

Typescript module type: commonjs TS target: es2020

sirenkovladd commented 1 year ago

Can you show where you found this type or in which template it is? I couldn't find it in nest

diavrank commented 1 year ago

It's a type used in the project where I work. To fix it I had to follow these instructions https://stackoverflow.com/a/58159116 but I'm not sure if Bun should support this data type.

Electroid commented 1 year ago

Bun does not come with this, you'll need to bun install @types/long and use the workaround you linked.