1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
|
/// <reference path='fourslash.ts' />
////interface I1 {
//// a: number;
//// b: string;
//// c: 1;
//// d: "d";
//// e: "e1" | "e2";
//// f(x: number, y: number): void;
//// g: (x: number, y: number) => void;
////}
////interface I2 {
//// a: unknown;
//// b: any;
////}
////const a: I1 = {};
////const b: I2 = {};
////class C {
//// public c: I1 = {};
////}
////function fn1(foo: I2 = {}) {}
////function fn2(a: I1) {}
////fn2({});
verify.codeFixAll({
fixId: "fixMissingProperties",
fixAllDescription: ts.Diagnostics.Add_all_missing_properties.message,
newFileContent:
`interface I1 {
a: number;
b: string;
c: 1;
d: "d";
e: "e1" | "e2";
f(x: number, y: number): void;
g: (x: number, y: number) => void;
}
interface I2 {
a: unknown;
b: any;
}
const a: I1 = {
a: 0,
b: "",
c: 1,
d: "d",
e: "e1",
f: function(x: number, y: number): void {
throw new Error("Function not implemented.");
},
g: function(x: number, y: number): void {
throw new Error("Function not implemented.");
}
};
const b: I2 = {
a: undefined,
b: undefined
};
class C {
public c: I1 = {
a: 0,
b: "",
c: 1,
d: "d",
e: "e1",
f: function(x: number, y: number): void {
throw new Error("Function not implemented.");
},
g: function(x: number, y: number): void {
throw new Error("Function not implemented.");
}
};
}
function fn1(foo: I2 = {
a: undefined,
b: undefined
}) {}
function fn2(a: I1) {}
fn2({
a: 0,
b: "",
c: 1,
d: "d",
e: "e1",
f: function(x: number, y: number): void {
throw new Error("Function not implemented.");
},
g: function(x: number, y: number): void {
throw new Error("Function not implemented.");
}
});`
});
|