Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9274793
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T16:26:07+00:00 2026-06-18T16:26:07+00:00

There are numerous StackOverflow questions that touch on this subject, but either aren’t quite

  • 0

There are numerous StackOverflow questions that touch on this subject, but either aren’t quite the same as what I’m attempting, or are for previous versions of TypeScript.

I’m working on a rather large TypeScript project, and have a given module broken up across multiple files, not quite one per class.

In 0.8.0, this worked fine:

//* driver.ts *//
/// <reference path="express.d.ts"/>
/// <reference path="a.ts"/>
/// <reference path="b.ts"/>

.

//* a.ts *//
/// <reference path="driver.ts"/>
module m {
  import express = module("express");

  export class a {
    A: m.b;
    A2: express.ServerResponse;
  }
}

.

//* b.ts *//
/// <reference path="driver.ts"/>
module m {
  export class b {
      B: number;
  }
}

In 0.8.1, I had to change a.ts with the export import trick:

//* a.ts *//
/// <reference path="driver.ts"/>
module m {
  export import express = module("express");

  export class a {
    A: m.b;
    A2: express.ServerResponse;
  }
}

In 0.8.2, however, imports can no longer be within the module declaration, so a.ts has changed to:

//* a.ts *//
/// <reference path="driver.ts"/>
import express = module("express");
module m {

  export class a {
    A: m.b;
    A2: express.ServerResponse;
  }
}

which now gives an error because a.ts does not see the extension of the module in b.ts.

What I understand:

  • a.ts has become an external module, because of the import statement.
  • removing the import in a.ts allows a and b and my module to merge together fine.
  • changing the import to a require statement loses the type definitions in express.d.ts

What I don’t understand:

  • Is there really no way for me to get around this without merging all of my module files together?

I apologize if this is answered elsewhere — just link me there — but none of the other similar issues seem to answer this definitively.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T16:26:09+00:00Added an answer on June 18, 2026 at 4:26 pm

    This is what I make of your situation.

    Your modules…

    You need to name your file after your module, so a.ts, should actually be m.ts and should contain something like…

    import express = module('express');
    
    export class a {
        A: b;
        A2: express.ServerResponse;
    }
    
    export class b {
        B: number;
    }
    

    You shouldn’t be using reference statements here.

    When you are running code on nodejs, you can’t really split your code across multiple files because the file itself is your module – when you import m = module('m'); it will look for m.js. What you can do is organise your files in a folder structure.

    import x = module('m/x'); // m/x.js
    import y = module('m/y'); // m/y.js
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There are numerous questions on SO similiar to this but not exactly as far
There are numerous examples of how to do this in native Objective-C but I
There are numerous questions on the usage of super() but none of them appears
Background: There are numerous PHP addons out there that have some nice ideas, but
there are numerous entries on this subject all with very different answers and given
There are numerous discussions here that have addressed issues that seem related to this
This is directly inspired by this question . There are numerous references/statements that bitwise
We host our own private NuGet Feed. I've noticed that when there are numerous
There is a column that exists in 2 tables. In table 1, this column
There are nice SO question and answers about this issue, but these options didn't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.