2018-08-10 02:32:28 +02:00
|
|
|
////interface I {}
|
|
|
|
////
|
|
|
|
////function f<T>(t: T): number {
|
|
|
|
//// return t.foo;
|
|
|
|
////}
|
|
|
|
////
|
|
|
|
////function g<T extends I>(t: T): number {
|
|
|
|
//// return t.bar;
|
|
|
|
////}
|
|
|
|
|
|
|
|
// No code fix for "foo"
|
|
|
|
|
|
|
|
verify.codeFixAvailable([
|
|
|
|
{ description: "Declare property 'bar'" }, { description: "Add index signature for property 'bar'" },
|
|
|
|
])
|
|
|
|
|
|
|
|
verify.codeFix({
|
|
|
|
description: "Declare property 'bar'",
|
|
|
|
index: 0,
|
|
|
|
newFileContent:
|
|
|
|
`interface I {
|
2018-10-23 08:03:09 +02:00
|
|
|
bar: number;
|
2018-08-10 02:32:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function f<T>(t: T): number {
|
|
|
|
return t.foo;
|
|
|
|
}
|
|
|
|
|
|
|
|
function g<T extends I>(t: T): number {
|
|
|
|
return t.bar;
|
|
|
|
}`,
|
|
|
|
});
|