5

I have a Typescript definition ./src/@types/moduleA/moduleA.d.ts which contains:

declare module 'moduleA' {
  export interface Transaction {...}
}

And I want to use it in another type definition file ./src/@types/moduleB/moduleB.d.ts like this:

///<reference path="../moduleA/moduleA.d.ts" />

declare module 'moduleB' {
  export class MyClass {
    constructor(private transaction: Transaction) {}
  }
}

But I'm getting Cannot find name 'Transaction'.ts. Why? Do I have to import it as well?

Thank you

2
  • Probably you have to do moduleA.Transaction Commented Feb 28, 2020 at 9:26
  • I have tried it as well, but didn't help.. Commented Feb 28, 2020 at 11:44

1 Answer 1

4

So for anyone searching:

only import { Transaction } from 'moduleA'; should be used.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.