TypeScript/tests/cases/fourslash/codeFixInferFromUsageExistingJSDoc.ts

96 lines
2.1 KiB
TypeScript
Raw Normal View History

2018-10-25 01:14:52 +02:00
/// <reference path='fourslash.ts' />
// @allowJs: true
// @checkJs: true
// @noImplicitAny: true
// @strictNullChecks: false
// @Filename: important.js
/////** @param x no types here! */
/////**
//// * 1
//// * @param x a duplicate!
//// * @param y yy
//// */
/////**
//// * 2
//// * @param z zz
//// */
////function f(x) {
//// return x * 1
////}
////
////var o = {
//// /** 1
//// * @return First one
//// */
//// // intrusive comment (should not be deleted)
//// /** 2
//// * @see also
//// */
//// /** 3
//// * @return Second one
//// * @extends {C<number>} nothing really
//// * @class
//// * @this {*} doesn't make sense here
//// * @enum wat
//// */
//// /**
//// * @typedef {number} Meter or something
//// * @typedef {Object} Position Comment!
//// * @property {number} x what a horrible place for a type
//// * @property {number} y please don't do this
//// */
//// /**
//// * @template {string} T postfix comment
//// * @callback Action not sure what this will do
//// * @param {T} thing
//// * @returns {string} oh no
//// */
//// get m() { return undefined }
////}
////o.m = 1
verify.codeFixAll({
fixId: "inferFromUsage",
fixAllDescription: "Infer all types from usage",
newFileContent:
`/**
* 1
* 2
* @param {number} x no types here!
* @param x a duplicate!
* @param y yy
* @param z zz
*/
function f(x) {
return x * 1
}
var o = {
// intrusive comment (should not be deleted)
/**
* 1
* 2
* 3
* @returns {number} First one
Add see tag support (#39760) * Add see tag parser * add baseline * fix symbol resolve * add more case * fix unittests * improve tests and parser * accept baseline * Adopt package-lock.json and npm ci * Add a workflow to update package-lock.json daily * Git ignore package-lock.json and forcibly update in workflow * Update bot email address * Delete extra npm update * Update package-lock.json * Add compactDisplay and signDisplay to NumberFormatOptions (#40039) * Fix typo in (Readonly)Set.keys comment (fixes #40164) (#40176) * fix(26325): use a unique name for reserved words in 'constructor like' function name (#39684) * fix(25770): add diagnostic message for the possible mapped type used as an index (#39973) * fix(31046): add new diagnostic message for incompatible constructor signature (#40073) * Update package-lock.json * Update package-lock.json * Add rename support * Accpet baseline * wip * fix anders * Revert "fix anders" This reverts commit b3178d46184c068b7b83008ad98a52faac1e8a34. * Fix call hierarchy item serialization and server tests (#40348) * Avoid error * accept baseline * Add more tests * Add signature name resolve Co-authored-by: Andrew Casey <andrew.casey@microsoft.com> Co-authored-by: TypeScript Bot <typescriptbot@microsoft.com> Co-authored-by: Neil Kistner <neil.kistner@gmail.com> Co-authored-by: cherryblossom000 <31467609+cherryblossom000@users.noreply.github.com> Co-authored-by: Alexander T <alexander.tarasyuk@outlook.com> Co-authored-by: Erich Gamma <egamma@microsoft.com> Co-authored-by: Andrew Branch <andrewbranch@users.noreply.github.com>
2020-09-09 19:45:09 +02:00
* @see {also}
2018-10-25 01:14:52 +02:00
* @return Second one
* @extends {C<number>} nothing really
* @class
* @this {*} doesn't make sense here
* @enum {wat}
* @typedef {number} Meter or something
* @typedef {Object} Position Comment!
* @property {number} x what a horrible place for a type
* @property {number} y please don't do this
* @template {string} T postfix comment
* @callback Action not sure what this will do
* @param {T} thing
* @returns {string} oh no
*/
get m() { return undefined }
}
o.m = 1`,
});