TypeScript/tests/cases/fourslash/annotateWithTypeFromJSDoc3.ts
Andy 24842b4002
When --noUnusedLocals/--noUnusedParameters is disabled, add suggestions instead of errors (#22361)
* When --noUnusedLocals/--noUnusedParameters is disabled, add suggestions instead of errors

* Improve performance: do not add unused suggestion diagnostics unless asking for a suggestion

* Add "unused" flag to diagnostics

* Code review

* reportsUnused -> reportsUnnecessary

* Fix test
2018-04-05 12:33:00 -07:00

32 lines
989 B
TypeScript

/// <reference path='fourslash.ts' />
/////**
//// * @param {number} x - the first parameter
//// * @param {{ a: string, b: Date }} y - the most complex parameter
//// * @param z - the best parameter
//// * @param alpha - the other best parameter
//// * @param {*} beta - I have no idea how this got here
//// */
////function [|f|](x, y, z: string, alpha, beta) {
//// x; y; z; alpha; beta;
////}
verify.getSuggestionDiagnostics([{
message: "JSDoc types may be moved to TypeScript types.",
code: 80004,
}]);
verify.codeFix({
description: "Annotate with type from JSDoc",
newFileContent:
// TODO: GH#22358
`/**
* @param {number} x - the first parameter
* @param {{ a: string, b: Date }} y - the most complex parameter
* @param z - the best parameter
* @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) {
x; y; z; alpha; beta;
}`,
});