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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T08:52:08+00:00 2026-06-15T08:52:08+00:00

There are people that are writing Backbone applications using a Backbone.d.ts. There are two

  • 0

There are people that are writing Backbone applications using a Backbone.d.ts. There are two use cases I want to discuss.

  1. Creating backbone applications with modules using an AMD loader (or CommonJS I suppose as well)
  2. Creating backbone applications using plain JS

For those in camp 1, it is necessary that the backbone module be defined as external so that the module is able to be imported and included in the define() wrapper.

For those in camp 2, it is necessary that the backbone module be defined as internal module in order to use the intellisense and not require the use of an import statement / define() wrapper.

Question: Is there some other way to define the module so that it can be used in both cases?


I don’t really want to have to create a fork just so that you can have either

// required for those using import (1)
declare module "Backbone" { 

or

// required for those not using import (2) and backbone already exists in the global scope
declare module Backbone {

and still be able to get along with your code/intellisense.

  • 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-15T08:52:10+00:00Added an answer on June 15, 2026 at 8:52 am

    This can’t be done using just one .d.ts file because the compiler needs to know what kind of module system you’re using for backbone in order to know what kind of code to generate. You could be mixing and matching internal and external modules within a single file and there’s no way to guess correctly which you were using for backbone in particular.

    You might be able to use interface declarations to make it so that you can declare the majority of stuff in exactly one place and have a “backbone-internal.d.ts” and “backbone-external.d.ts” file that referenced that common declaration file, but the extent to which you could do that would depend on exactly what the surface area of the API looked like.

    TL;DR: Camp 1 and Camp 2 are not mutually exclusive, even within the same file.

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

Sidebar

Related Questions

Are there any good applications that people use with the MongoDB database to make
I want to test the phpDocumentor-alpha, and there's a problem that some people seems
I am using ActionScript3, I am writing a class that extends Bitmap, I want
When it comes to password security there are things that people agree on like
I had this doubt for sometime now, some people say that there's no such
For people out there using Haxe , what makes it useful for you? Reading
There are some people in my office who insist on using cute stationery and
There's 12 million posts already and people seem to be using things as a
I am writing a CakePHP 1.2 app. I have a list of people that
I'm writing a windows application that lets people do something akin to screencasting. One

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.