Is there a way to import or comment on Typescript modules so that AMD external modules are automatically included as dependencies when creating an AMD-compatible module ?:
tsc --module AMD example.ts
I tried to include both files, including the * .d.ts link file, and export the declaration instructions:
///<reference path='./lib/knockout-2.2.d.ts' /> export declare var $; export declare var _; export module example { export class Example { // whatever } }
However, the generated module does not include:
define(["require", "exports"], function(require, exports) { (function (example) { var Example = (function () { function Example() { } return Example; })(); example.Example = Example; })(exports.example || (exports.example = {})); var example = exports.example; })
I would like to avoid creating "fake" modules here.
It seems like a good solution and use would be to directly import AMD modules:
var $ = import('jquery');
but I do not know how this is possible.
Edit:
And I also tried this approach mentioned here: Import Typescript module using only the environment definition for use in amd
import knockout = module("./lib/knockout-2.2.d.ts"); ...
but get the following compiler errors:
example.ts(1,32): The name '"./lib/knockout-2.2.d.ts"' does not exist in the current scope example.ts(1,32): A module cannot be aliased to a non-module type
requirejs typescript
7zark7
source share