2017-12-07 21:14:18 +01:00
|
|
|
/// <reference path='fourslash.ts' />
|
|
|
|
|
|
|
|
// @noImplicitAny: true
|
2018-05-16 21:28:27 +02:00
|
|
|
// @strictNullChecks: true
|
2017-12-07 21:14:18 +01:00
|
|
|
|
|
|
|
////function f(x, y) {
|
|
|
|
//// x += 0;
|
|
|
|
//// y += "";
|
|
|
|
////}
|
|
|
|
////
|
|
|
|
////function g(z) {
|
|
|
|
//// return z * 2;
|
|
|
|
////}
|
2018-05-16 21:28:27 +02:00
|
|
|
////
|
|
|
|
////let x = null;
|
|
|
|
////function h() {
|
|
|
|
//// if (!x) x = 2;
|
|
|
|
////}
|
2017-12-07 21:14:18 +01:00
|
|
|
|
|
|
|
verify.codeFixAll({
|
|
|
|
fixId: "inferFromUsage",
|
2018-03-28 03:21:21 +02:00
|
|
|
fixAllDescription: "Infer all types from usage",
|
2017-12-07 21:14:18 +01:00
|
|
|
newFileContent:
|
|
|
|
`function f(x: number, y: string) {
|
|
|
|
x += 0;
|
|
|
|
y += "";
|
|
|
|
}
|
|
|
|
|
|
|
|
function g(z: number) {
|
|
|
|
return z * 2;
|
2018-05-16 21:28:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
let x: number | null = null;
|
|
|
|
function h() {
|
|
|
|
if (!x) x = 2;
|
2017-12-07 21:14:18 +01:00
|
|
|
}`,
|
|
|
|
});
|