denoland / denoland/deploy_feedback
[Bug]: emitDecoratorMetadata not respected in Deno Deploy
- Dominant language
- No language data
- Stars
- 79
- Forks
- 5
- PR merge metrics
- No merged PRs in 30d
Description
### Problem description
While `experimentalDecorators` setting in deno.json is now respected since https://github.com/denoland/deno/pull/22521
`emitDecoratorMetadata` is not. Unlike the former issue, it doesn't seem to be an issue with `deno compile`. In fact, compiled deno apps work as expected locally.
This issue makes decorator-based dependency injection not viable in deno apps in Deploy.
### Steps to reproduce
### `deno.json`
```json
{
"compilerOptions": {
"experimentalDecorators": true,
"emitDecoratorMetadata": true
}
}
```
### `server.ts`
```ts
import { Reflect } from 'https://deno.land/x/deno_reflect@v0.2.1/mod.ts';
export type ClassConstructor = new (...args: any[]) => T;
function Annotation() {
return (_: ClassConstructor): void => {};
}
class Custom {
}
@Annotation()
class Test {
constructor(name: string, age: number, custom : Custom) {}
}
Deno.serve((_request: Request) => {
const metadata = Reflect.getMetadata('design:paramtypes', Test);
return new Response(metadata?.map((x: ClassConstructor) => x.name).join(', ') || 'No metadata. But it should output "String, Number, Custom"');
});
```
### Expected behavior
Classes annotated with TC39 decorators should emit metadata that should be made available in `design:paramtypes`.
### Environment
### works in this environment
deno 1.41.1 (release, x86_64-apple-darwin)
v8 12.1.285.27
typescript 5.3.3
### doesn't work in
Deno Deploy (as of March 10th 2024)
### Possible solution
_No response_
### Additional context
_No response_
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by deploying the provided deno.json and server.ts reproduction to Deno Deploy and compare it with the stated working local environment. Confirm whether design:paramtypes metadata is absent for Test; done means the deployed response reports String, Number, Custom as expected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- backend, cloud
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100