Replies: 1 comment 2 replies
-
Typescript does not know about the IOC-Bindings at compile time (because they are evaluated at runtime). Therefore you have to create a types declaration file for your custom service like so: contracts/WhateverNameYouWant.d.ts declare module "@ioc:Elastic" {
import { Client as ElasticClient } from "@elastic/elasticsearch"
declare const elasticClient: ElasticClient
export default elasticClient
} Under the hood (in their corresponding packages) Adonis does exactly that for built-in providers. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This is probably something easy to solve but I can't figure out why TypeScript keep saying this when I import my custom provider:
Here is my custom provider:
Beta Was this translation helpful? Give feedback.
All reactions