<p dir="auto">Maybe there's some really easy way to make this work in TS that I'm not seeing.</p>
<p dir="auto">I want to load jQuery as an AMD module, not as a global. <code class="notranslate">jquery.d.ts</code>as currently defined does not export a jquery external module. Instead it defines the $ and jQuery variables as global variables.</p>
<p dir="auto">Is there a simple way to declare an external module that has the same signature as JQueryStatic?</p>
<p dir="auto">If not, is it possible to change jquery.d.ts to support external module loading?</p>
<p dir="auto">Here's how I have it working so far. The problem is I have to manually copy the whole JQueryStatic definition into jquery.d.ts. I don't want to do this. I want to take advantage of your work. Is there something I should do differently, or something that should be changed in jquery-1.8.d.ts?</p>
<p dir="auto">folders</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="public/
  components/
    DefinitelyTyped/ (etc)
lib/
  jquery.d.ts
main.ts
config.js"><pre class="notranslate"><code class="notranslate">public/
  components/
    DefinitelyTyped/ (etc)
lib/
  jquery.d.ts
main.ts
config.js
</code></pre></div>
<p dir="auto">config.js</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="requirejs.config({
    paths: {
        'lib/jquery: 'path/to/jquery/lib',
    }
})"><pre class="notranslate"><code class="notranslate">requirejs.config({
    paths: {
        'lib/jquery: 'path/to/jquery/lib',
    }
})
</code></pre></div>
<p dir="auto">main.ts</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="import $ = module(&quot;lib/jquery&quot;)
console.log(&quot;HI&quot;, $.ajax)"><pre class="notranslate"><code class="notranslate">import $ = module("lib/jquery")
console.log("HI", $.ajax)
</code></pre></div>
<p dir="auto">lib/jquery.d.ts</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="///&lt;reference path=&quot;../components/DefinitelyTyped/Definitions/jquery-1.8.d.ts&quot; /&gt;

declare module &quot;lib/jquery&quot; {
    export function ajax(settings: JQueryAjaxSettings): JQueryXHR;
    export function ajax(url: string, settings?: JQueryAjaxSettings): JQueryXHR;

    export function (selector: string, context?: any): JQuery;
    export function (element: Element): JQuery;
    export function (object: { }): JQuery;
    export function (elementArray: Element[]): JQuery;
    export function (object: JQuery): JQuery;
    export function (func: Function): JQuery;
    export function (array: any[]): JQuery;
    export function (): JQuery;
}"><pre class="notranslate"><code class="notranslate">///&lt;reference path="../components/DefinitelyTyped/Definitions/jquery-1.8.d.ts" /&gt;

declare module "lib/jquery" {
    export function ajax(settings: JQueryAjaxSettings): JQueryXHR;
    export function ajax(url: string, settings?: JQueryAjaxSettings): JQueryXHR;

    export function (selector: string, context?: any): JQuery;
    export function (element: Element): JQuery;
    export function (object: { }): JQuery;
    export function (elementArray: Element[]): JQuery;
    export function (object: JQuery): JQuery;
    export function (func: Function): JQuery;
    export function (array: any[]): JQuery;
    export function (): JQuery;
}
</code></pre></div>
<p dir="auto">In the <code class="notranslate">package.json</code> for this package, currently there is:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&quot;dependencies&quot;: {
    &quot;@types/react&quot;: &quot;*&quot;
},"><pre class="notranslate"><code class="notranslate">"dependencies": {
    "@types/react": "*"
},
</code></pre></div>
<p dir="auto">It would be better to use <a href="https://docs.npmjs.com/misc/semver#caret-ranges-123-025-004" rel="nofollow">carat ranges</a> than the current wildcard for <code class="notranslate">@types/react</code> in the <code class="notranslate">package.json</code> for this package, because otherwise say for example the user is on React 15, and React 16 is released, and thus then the <code class="notranslate">@types/react</code> version is 16, causing this error:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="node_modules/@types/react-select/node_modules/@types/react/index.d.ts
(3422,13): error TS2403: Subsequent variable declarations must have the same type.  Variable 'a' must be of type 'DetailedHTMLProps&lt;AnchorHTMLAttributes&lt;HTMLAnchorElement&gt;, HTMLAnchorElement&gt;', but here has type 'DetailedHTMLProps&lt;AnchorHTMLAttributes&lt;HTMLAnchorElement&gt;, HTMLAnchorElement&gt;"><pre class="notranslate"><code class="notranslate">node_modules/@types/react-select/node_modules/@types/react/index.d.ts
(3422,13): error TS2403: Subsequent variable declarations must have the same type.  Variable 'a' must be of type 'DetailedHTMLProps&lt;AnchorHTMLAttributes&lt;HTMLAnchorElement&gt;, HTMLAnchorElement&gt;', but here has type 'DetailedHTMLProps&lt;AnchorHTMLAttributes&lt;HTMLAnchorElement&gt;, HTMLAnchorElement&gt;
</code></pre></div>
<ul dir="auto">
<li>[x ] I tried using the <code class="notranslate">@types/react-select</code> package and had problems.</li>
<li>[ x] I tried using the latest stable version of tsc. <a href="https://www.npmjs.com/package/typescript" rel="nofollow">https://www.npmjs.com/package/typescript</a></li>
</ul>
<p dir="auto">Using: ts-loader: Using typescript@2.4.2</p>
<ul dir="auto">
<li>Authors: <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/Hesquibet/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/Hesquibet">@Hesquibet</a>, <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/giladgray/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/giladgray">@giladgray</a>, <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/iebaker/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/iebaker">@iebaker</a>, <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/tdreyno/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/tdreyno">@tdreyno</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/skirsdeda/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/skirsdeda">@skirsdeda</a>, @vujevits, <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/devrelm/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/devrelm">@devrelm</a>, <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/MartynasZilinskas/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/MartynasZilinskas">@MartynasZilinskas</a></li>
</ul>