-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
open-telemetry/opentelemetry-js
#4865Labels
Description
Is there an existing issue for this?
- I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- I have reviewed the documentation https://docs.sentry.io/
- I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/nestjs
SDK Version
8.1.3.0
Framework Version
10.0.3
Link to Sentry event
No response
SDK Setup/Reproduction Example
import * as Sentry from '@sentry/node';
Sentry.init({
dsn: 'X',
});
async function bootstrap() {
const app = await NestFactory.create(AppModule);
const { httpAdapter } = app.get(HttpAdapterHost);
Sentry.setupNestErrorHandler(app, new BaseExceptionFilter(httpAdapter));
...
await app.listen(4000);
}
bootstrap();
Steps to Reproduce
- Use a custom Type which makes all properties of a type required:
export type Complete<T> = {
[P in keyof Required<T>]: Pick<T, P> extends Required<Pick<T, P>>
? T[P]
: T[P] | undefined;
};in
export function UpdateContext<
Model extends BaseModel,
Dto extends Complete<Type<ContextAwareInput<GqlQueryContext>>>,
>(dto: Dto) {
@ArgsType()
class Context extends ContextAwareInput<GqlQueryContext> {
@Field(() => ID)
id: Model['id'];
@Field(() => dto)
dto: Dto;
}
return Context as Type<UpdateContext<Model, Dto>>;
}and
async updateTreatment(
@Update(UpdateInput) context: UpdateContext<Model, UpdateInput>
) {
const entity = await this.service.findOneByContext(context);
if (!entity) throw new NotFoundGqlError('Treatment not found');
return this.service.updateByContext(entity, context);
}-
Install
@sentry/node -
run
nest build
Expected Result
NestJs builds without Problems
Actual Result
The SDK expects the silently added __wrapped-property to be defined and Typescript throws the following Error:
TS2345: Argument of type 'typeof UpdateTreatmentInput' is not assignable to parameter of type 'Complete<Type<ContextAwareInput<GqlQueryContext>>>'.
Property '__wrapped' is optional in type 'typeof UpdateTreatmentInput' but required in type 'Complete<Type<ContextAwareInput<GqlQueryContext>>>'.
Metadata
Metadata
Assignees
Labels
Projects
Status
No status