1

Suppose I have the following ambient type declaration:

// index.d.ts
declare namespace admin {
  namespace auth {
    function doSomething();
  }
}

I can consume this as follows:

// caller.ts
import * as admin from './index';

admin.auth.doSomething();

Is there a way to split the d.ts file into two with no impact on the caller? Ideally I'd like to move the nested namespace auth to its own file auth.d.ts.

1 Answer 1

1

Following seems to work:

// index.d.ts
import auth as _auth from './auth';

declare namesapce admin {
  export import auth = _auth;
}

Then in another file:

// auth.d.ts
export namespace auth {
  function doSomething();
}
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.