oven-sh / bun

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

Didn't support Typescript5 Decorator #8149

Closed grapewheel closed 1 month ago

grapewheel commented 10 months ago

What version of Bun is running?

1.0.6+969da088f5db3258a803ec186012e30f992829b4

What platform is your computer?

Linux 6.6.11-1-lts x86_64 unknown (archlinux)

What steps can reproduce the bug?

function DI<T extends new (...args: any[]) => any>(
  target: T,
  context: ClassDecoratorContext<T>
) {
  if (context.kind !== "class") throw "The DI only used in a Class";
  return target;
}

console.log("loading di...");

@DI
export default class Master {
  async hello() {
    return new Response("Hello world");
  }
}

console.log("loaded di...");

/**
* import Master from './master'
* just run below:
* loading di...
*/

What is the expected behavior?

/**
* import Master from './master'
* run below:
* loading di...
* loaded di...
*/

What do you see instead?

No response

Additional information

No response

sirenkovladd commented 9 months ago

Duplicate of https://github.com/oven-sh/bun/issues/4122