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 9191093
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T20:36:11+00:00 2026-06-17T20:36:11+00:00

Okay, as I can see you would like to use internal modules in your

  • 0

Okay, as I can see you would like to use internal modules in your project. Well, there was a workaround in TypeScript 0.8.1.1, you could define non exported module (internal) and add imports above it. In 0.8.2 it seems that this doesn’t work anymore. Only option I see here would be to completely omit import syntax and use standard require for node modules. I don’t know if this is a good idea but please, share your opinions. I know that using import syntax will make module external (language specification), but that wasn’t true in 0.8.1.1, bug maybe?

In TypeScript 0.8.1.1 this worked and doesn’t work in 0.8.2 anymore:

import path = module('path');
import fs = module('fs');
module SomeNamespace.Controller {
    export class Index {
        ...
    }
}

I could reference file including above code using reference syntax on top of file in other internal modules and normally call:

var ctrl = new SomeNamespace.Controller.Index;
ctrl.index();

It seems that in 0.8.2 this is the only way what it works for internal modules:

var path = require('path');
var fs = require('fs');
module SomeNamespace.Controller {
    export class Index {
        ...
    }
}

Are there any other possibilities to mix internal modules with Node.js modules? Is there something wrong with above require usage (it compiles and runs okay …)?

  • 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-17T20:36:12+00:00Added an answer on June 17, 2026 at 8:36 pm

    I think that TypeScript 0.8.2 takes us closer to the specification.

    The syntax:

    import x = module('SomeModule');
    

    Is specifically an ExternalModuleReference in the TypeScript Language Specification.

    An internal module would be imported using:

    ///<reference path="SomeModule.ts" />
    import x = SomeModule;
    

    But importing an internal module won’t generate you a require statement in your JavaScript.

    Taken from TypeScript Language Specification 0.8 – 9.2.2 Import Declarations

    ImportDeclaration:

    import Identifier = ModuleReference ;
    

    ModuleReference:

    ExternalModuleReference
    ModuleName
    

    ExternalModuleReference:

    module ( StringLiteral )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay at first I thought this would be pretty straightforward. But I can't think
Creating a browser based single-page browser based RIA. Would like to make use of
I would like to know if the app icon on the iPhone can be
Okay, so let me see if I can make this as concise as possible.
Okay, in windows forms you can use .refresh() to cause a redraw event on
I would like to see some code/tutorials on reading an excel spreadsheet (a calender)
Okay, I just can't get my head around multi-threading scenarios properly. Sorry for asking
Okay I'll try describe this the best way I can. I have a chat
Okay I've been doing JS merges for some time now and still can't figure
Okay, so I want to have a generic method that can read data from

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.