2018-10-09 19:38:46 +02:00
|
|
|
/// <reference path='fourslash.ts' />
|
|
|
|
|
|
|
|
// @allowJs: true
|
|
|
|
// @checkJs: true
|
|
|
|
// @noImplicitAny: true
|
|
|
|
// @Filename: important.js
|
|
|
|
|
|
|
|
////function foo([|a, m, x|]) {
|
|
|
|
//// a.b.c;
|
|
|
|
////
|
|
|
|
//// var numeric = 0;
|
|
|
|
//// numeric = m.n();
|
|
|
|
////
|
|
|
|
//// x.y.z
|
|
|
|
//// x.y.z.push(0);
|
|
|
|
//// return x.y.z
|
|
|
|
////}
|
|
|
|
|
2018-10-25 00:34:15 +02:00
|
|
|
verify.codeFix({
|
|
|
|
description: "Infer parameter types from usage",
|
2018-11-02 23:39:27 +01:00
|
|
|
index: 0,
|
2018-10-25 00:34:15 +02:00
|
|
|
newFileContent:
|
2018-10-09 19:38:46 +02:00
|
|
|
`/**
|
2020-04-22 20:28:11 +02:00
|
|
|
* @param {{ b: { c: any; }; }} a
|
2018-10-09 19:38:46 +02:00
|
|
|
* @param {{ n: () => number; }} m
|
|
|
|
* @param {{ y: { z: number[]; }; }} x
|
|
|
|
*/
|
|
|
|
function foo(a, m, x) {
|
|
|
|
a.b.c;
|
|
|
|
|
|
|
|
var numeric = 0;
|
|
|
|
numeric = m.n();
|
|
|
|
|
|
|
|
x.y.z
|
|
|
|
x.y.z.push(0);
|
|
|
|
return x.y.z
|
2018-10-25 00:34:15 +02:00
|
|
|
}`,
|
|
|
|
});
|