Using Typescript type definition from another file

Viewed 755

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

1 Answers

So for anyone searching:

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

Related