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 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?
What is the expected behavior?
What do you see instead?
No response
Additional information
No response