typescript-to-cli icon indicating copy to clipboard operation
typescript-to-cli copied to clipboard

Aliases

Open hasparus opened this issue 6 years ago • 1 comments

Hi @GuillaumeSalles! I really love the tool and I have a feature proposition for you. What do you think about aliases(/shortcuts)?

How could it look like?

/**
 * Send ships to the specified destination
 *
 * @param destination the ships destination
 * @alias "d"
 * @param numberOfShips the number of ships to send
 * @alias "ships"
 * @param armed whether the ships are equipped with weapons or not
 * @alias "a"
 */
export default function(
  destination: string,
  numberOfShips: number,
  armed: boolean
) {
  console.log(
    `You sent ${numberOfShips} ${armed ? "armed" : ""} ships to ${destination}`
  );
}
./send-ships.js --d Mars --ships 10 --a

hasparus avatar May 22 '19 10:05 hasparus

Hi @hasparus ! I'm glad you like it!

That would be a great feature! Unfortunately, typescript parser does not seem to support @alias keyword (https://github.com/Microsoft/TypeScript/wiki/JSDoc-support-in-JavaScript) so I don't think it's trivial to implement.

This project is not actively maintained, so feel free to fork it or make a PR to add this feature.

GuillaumeSalles avatar May 22 '19 14:05 GuillaumeSalles