I want to switch from JavaScript to TypeScript to help with code management as our project gets bigger. However, we use many libraries like amd Modules, which we do not want to convert to TypeScript.
We still want to import them into TypeScript files, but we also do not want to generate definition files. How can we achieve this?
eg. New TypeScript file:
/// <reference path="../../../../definetelyTyped/jquery.d.ts" /> /// <reference path="../../../../definetelyTyped/require.d.ts" /> import $ = require('jquery'); import alert = require('lib/errorInfoHandler');
Here lib/errorInfoHandler is an amd module included in a huge JavaScript library that we don't want to touch on.
Using the code above, the following errors occur:
Unable to resolve external module ''lib/errorInfoHandler'' Module cannot be aliased to a non-module type.
This really should lead to the following code:
define(["require", "exports", "jquery", "lib/errorInfoHandler"], function(require, exports, $, alert) { ... }
Is there a way to import a JavaScript library into TypeScript as an amd module and use it inside a TypeScript file without creating a definition file?
javascript requirejs typescript
tune2fs Apr 03 '14 at 15:33 2014-04-03 15:33
source share