Skip to content

Attempt to inject a service into a job gives a typescript error #1

@JanStevens

Description

@JanStevens

Package version

0.4.2

Describe the bug

Hi,

Following example

class ImInjectable {
  constructor(protected example: string) {}

  async execute() {
    console.log(this.example)
  }
}

@inject()
class ExampleJob extends Job<{ example: string }> {
  constructor(protected example: ImInjectable) {
    super()
  }

  async execute() {
    await this.example.execute()
  }
}

ExampleJob.dispatch({ example: 'test' })

This gives me a typescript error looking like
Image

When I remove the inject it all works fine

Reproduction repo

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions