Expand constraint suggestion related span and add quick fix (#49481)

* Expand constraint suggestion related span and add quick fix

* Remove circular constraint suggestions

* Add error code

* Style feedback and new error code in quickfix
This commit is contained in:
Wesley Wigham
2022-06-15 10:35:51 -07:00
committed by GitHub
parent eb4b8a4d2e
commit ba38fe1df2
80 changed files with 336 additions and 13 deletions

View File

@@ -0,0 +1,17 @@
/// <reference path="fourslash.ts" />
// @Filename: file.ts
////function f<T>(x: T) {
//// const y: `${number}` = x/**/;
////}
goTo.marker("");
verify.codeFix({
index: 0,
description: "Add `extends` constraint.",
newFileContent: {
"/tests/cases/fourslash/file.ts":
`function f<T extends \`$\{number}\`>(x: T) {
const y: \`$\{number}\` = x;
}`
}
});

View File

@@ -0,0 +1,21 @@
/// <reference path="fourslash.ts" />
// @Filename: file.ts
////interface Fn<T extends string> {
////}
////
////function m<T>(x: Fn<T/**/>) {
////}
goTo.marker("");
verify.codeFix({
index: 0,
description: "Add `extends` constraint.",
newFileContent: {
"/tests/cases/fourslash/file.ts":
`interface Fn<T extends string> {
}
function m<T extends string>(x: Fn<T>) {
}`
}
});