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

  • Home
  • SEARCH
  • 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 8731315
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T09:12:31+00:00 2026-06-13T09:12:31+00:00

I can’t seem to get any import to work when the module isn’t defined

  • 0

I can’t seem to get any import to work when the module isn’t defined as a string. What is going on?

test.ts

import b = module('Backbone')

Does not work:
backbone.d.ts

declare module Backbone {

    export class Events {
    ...

Works:
backbone.d.ts

declare module "Backbone" {

    export class Events {
    ...

Edit 1:

FYI From 10.1.4

An AmbientModuleIdentification with a StringLiteral declares an external module. This type of declaration is permitted only in the global module. The StringLiteral must specify a top-level external module name. Relative external module names are not permitted

I don’t understand how it’s useful to not specify it as the string literal format as found here and here. It works if you use ///<reference... without a string literal module but I’m trying to generate AMD modules that depend on these libraries so I need the import to work. Am I the minority and I have to go and modify each .d.ts to be the string literal version?

Edit 2:

Declaring a module using a string literal requires that your import is an exact match if that string literal. You can no longer use relative or absolute paths to the location of this module/module definition even if it is not located in the same directory as the file trying to import it. This makes it that a ///<reference and an import are required but produces a module with tsc --module AMD that was exactly looking for (path to module is as dictated by the module string literal "Backbone").

For example.

+- dep/
   |- backbone.d.ts
|- test.ts

backbone.d.ts:

declare module "Backbone" {
    export class Events {

Works: test.ts:

///<reference path="../dep/backbone.d.ts" />
import b = module('Backbone')

// generates
// define(["require", "exports", 'Backbone']

Does not work: test.ts:

import b = module('./dep/Backbone')

Note that this works as well…

declare module "libs/Backbone" {
...
///<reference path="dep/backbone.d.ts" />
import b = module('libs/Backbone')
...
// generates
define(["require", "exports", 'libs/Backbone']
  • 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-13T09:12:32+00:00Added an answer on June 13, 2026 at 9:12 am

    When you write this:

    declare module Backbone {
    

    It means you have already a module which is in the global scope (so you can immeadiately use it, no import is required). But when you write this:

    declare module "Backbone" {
    

    It means you specify how the imported module (import … = module(“…”)) will look.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can any one tell, how to get the result of LINQ query contains group
Does anyone know how can I replace this 2 symbol below from the string
Can i get the source code for a WAMP stack installer somewhere? Any help
Can I change the field public virtual ClassOne ClassOne { get; set; } to
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
Can anybody tell what is the best(easy) way to sort the following string 'index'
Can someone please explain why this doesn't work? MyClass myClass1 = new MyClass(); object
Can someone tell me how does the imdb app manage to play trailers on
Can't seem to figure out what's wrong with the simple getJSON call below. It's
Can anyone explain me what's going on? I use this method - (BOOL)shouldAutorotateToInterfaceOrientation:( UIInterfaceOrientation)interfaceOrientation

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.