JS: Use type info and type tracking in jQuery

This commit is contained in:
Asger F
2019-08-28 12:21:08 +01:00
parent abdf7ce223
commit fb181c2d14
9 changed files with 210 additions and 41 deletions

View File

@@ -1,3 +1,9 @@
| tracking.js:7:5:7:24 | this.elm.html('foo') | html |
| tracking.js:14:5:14:17 | e.html('foo') | html |
| tracking.js:18:7:18:15 | $('#foo') | $ |
| ts_global_types.ts:3:5:3:17 | e.html('foo') | html |
| ts_global_types.ts:7:1:7:9 | $('#foo') | $ |
| ts_import.ts:5:5:5:17 | e.html('foo') | html |
| tst2.js:2:1:2:7 | jq("a") | $ |
| tst.js:1:1:1:3 | $() | $ |
| tst.js:2:1:2:8 | jQuery() | $ |

View File

@@ -1,3 +1,9 @@
| tracking.js:7:5:7:24 | this.elm.html('foo') | tracking.js:7:19:7:23 | 'foo' |
| tracking.js:14:5:14:17 | e.html('foo') | tracking.js:14:12:14:16 | 'foo' |
| tracking.js:18:7:18:15 | $('#foo') | tracking.js:18:9:18:14 | '#foo' |
| ts_global_types.ts:3:5:3:17 | e.html('foo') | ts_global_types.ts:3:12:3:16 | 'foo' |
| ts_global_types.ts:7:1:7:9 | $('#foo') | ts_global_types.ts:7:3:7:8 | '#foo' |
| ts_import.ts:5:5:5:17 | e.html('foo') | ts_import.ts:5:12:5:16 | 'foo' |
| tst2.js:2:1:2:7 | jq("a") | tst2.js:2:4:2:6 | "a" |
| tst.js:3:1:3:9 | $("<a/>") | tst.js:3:3:3:8 | "<a/>" |
| tst.js:7:1:7:14 | $("<br>", doc) | tst.js:7:3:7:8 | "<br>" |

View File

@@ -0,0 +1,5 @@
interface JQuery {}
declare module 'jquery' {
export = JQuery;
}

View File

@@ -0,0 +1,18 @@
class C {
constructor(elm) {
this.elm = elm;
}
doSomething() {
this.elm.html('foo');
}
/**
* @param {JQuery} e
*/
doSomethingWithTypes(e) {
e.html('foo');
}
}
new C($('#foo'));

View File

@@ -0,0 +1,7 @@
class MyClass {
foo2(e: JQuery) {
e.html('foo');
}
}
$('#foo');

View File

@@ -0,0 +1,7 @@
import jQuery = require('jquery');
class MyClass {
foo3(e: jQuery) {
e.html('foo');
}
}

View File

@@ -0,0 +1 @@
{"include": ["."]}