问题
I am working on an Durandal spa and would like to write new code in typescript.
Is there a way to mix amd modules with typescript classes? This an example of an amd module. I removed some code from the module to make it more readable.
define(['durandal/app', 'durandal/system', 'config', 'amplify'],
function (app, system, config, amplify) {
var exports = {};
var init = function () {
...
};
var onRequestError = function(response, status) {
...
};
exports.getTablePresentation = function (lemmaId, languageKey) {
...
};
exports.getSuggestions = function (searchdirection, term, level) {
...
};
init();
return exports;
});
I am using VS Code as my editor. In tsconfig.json I have set allowJs = true and this is the import syntax I am trying to use.
import * as config from '../config.js';
export class AppSecurity {}
来源:https://stackoverflow.com/questions/42552364/using-amd-modules-with-typescript