diff --git a/tests/cases/fourslash/annotateWithTypeFromJSDoc21.ts b/tests/cases/fourslash/annotateWithTypeFromJSDoc21.ts new file mode 100644 index 00000000000..b54f83070c4 --- /dev/null +++ b/tests/cases/fourslash/annotateWithTypeFromJSDoc21.ts @@ -0,0 +1,73 @@ +/// +// @strict: true +/////** +//// * @return {number} +//// */ +////function /*1*/f(x, y) { +////} +//// +/////** +//// * @return {number} +//// */ +////function /*2*/g(x, y): number { +//// return 0; +////} +/////** +//// * @param {number} x +//// */ +////function /*3*/h(x: number, y): number { +//// return 0; +////} +//// +/////** +//// * @param {number} x +//// * @param {string} y +//// */ +////function /*4*/i(x: number, y: string) { +////} +/////** +//// * @param {number} x +//// * @return {boolean} +//// */ +////function /*5*/j(x: number, y): boolean { +//// return true; +////} + +verify.not.applicableRefactorAvailableAtMarker('2'); +verify.not.applicableRefactorAvailableAtMarker('3'); +verify.not.applicableRefactorAvailableAtMarker('4'); +verify.not.applicableRefactorAvailableAtMarker('5'); +verify.applicableRefactorAvailableAtMarker('1'); +verify.fileAfterApplyingRefactorAtMarker('1', +`/** + * @return {number} + */ +function f(x, y): number { +} + +/** + * @return {number} + */ +function g(x, y): number { + return 0; +} +/** + * @param {number} x + */ +function h(x: number, y): number { + return 0; +} + +/** + * @param {number} x + * @param {string} y + */ +function i(x: number, y: string) { +} +/** + * @param {number} x + * @return {boolean} + */ +function j(x: number, y): boolean { + return true; +}`, 'Annotate with type from JSDoc', 'annotate'); diff --git a/tests/cases/fourslash/annotateWithTypeFromJSDoc22.ts b/tests/cases/fourslash/annotateWithTypeFromJSDoc22.ts new file mode 100644 index 00000000000..d00705848c6 --- /dev/null +++ b/tests/cases/fourslash/annotateWithTypeFromJSDoc22.ts @@ -0,0 +1,14 @@ +/// +// @strict: true +//// +/////** @param {Object} sb +//// * @param {Object} ns */ +////function /*1*/f(sb, ns) { +////} +verify.applicableRefactorAvailableAtMarker('1'); +verify.fileAfterApplyingRefactorAtMarker('1', +` +/** @param {Object} sb + * @param {Object} ns */ +function f(sb: { [s: string]: boolean; }, ns: { [n: number]: string; }) { +}`, 'Annotate with type from JSDoc', 'annotate'); diff --git a/tests/cases/fourslash/annotateWithTypeFromJSDoc3.ts b/tests/cases/fourslash/annotateWithTypeFromJSDoc3.ts index 57ae42b93a3..9413e6046c9 100644 --- a/tests/cases/fourslash/annotateWithTypeFromJSDoc3.ts +++ b/tests/cases/fourslash/annotateWithTypeFromJSDoc3.ts @@ -20,9 +20,6 @@ verify.fileAfterApplyingRefactorAtMarker('1', * @param alpha - the other best parameter * @param {*} beta - I have no idea how this got here */ -function f(x: number, y: { - a: string; - b: Date; -}, z: string, alpha, beta: any) { +function f(x: number, y: { a: string; b: Date; }, z: string, alpha, beta: any) { }`, 'Annotate with type from JSDoc', 'annotate'); diff --git a/tests/cases/fourslash/annotateWithTypeFromJSDoc4.ts b/tests/cases/fourslash/annotateWithTypeFromJSDoc4.ts index 795ac8b5fd3..ad06bbbc699 100644 --- a/tests/cases/fourslash/annotateWithTypeFromJSDoc4.ts +++ b/tests/cases/fourslash/annotateWithTypeFromJSDoc4.ts @@ -23,7 +23,5 @@ verify.fileAfterApplyingRefactorAtMarker('5', * @param {number?} gamma * @param {number!} delta */ -function f(x: any, y: any, z: number | undefined, alpha: number[], beta: (this: { - a: string; -}, arg1: string, arg2: number) => boolean, gamma: number | null, delta: number) { +function f(x: any, y: any, z: number | undefined, alpha: number[], beta: (this: { a: string; }, arg1: string, arg2: number) => boolean, gamma: number | null, delta: number) { }`, 'Annotate with type from JSDoc', 'annotate');