문제

The code runs, but the compile error is driving me nuts.

I have got the following line in my .ts file. Unfortunately the LINQ library does not yet have a d.ts file. So it's causing compile error, even though the javascript runs as designed.

import linq = require('linq');

Which is defined already in require.js bootstrap as follow:

define('linq', ['jquery','linq'], function($,linq) {
    return Enumerable; });

I don't need typescript to act like it knows more than the coder. If that's the case might as well throw it aside and stick with native javascript. Again the code works, but the compile check does not.

Any idea how to fix my code or tell the ts compiler to get outta the way?

도움이 되었습니까?

해결책

Just do the following

declare module 'linq'{
   var foo:any;
   export = foo;
}

in a new .d.ts and then you are good to go.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top