Open
Description
As suggested at tc39/proposal-type-annotations#202 (comment), I have a proposal for a minimal inline syntax for types. The idea is to consider any comment where the first token is a JsDoc token (without the @
) as a JsDoc comment, and also being in that case the :
an alias to @type
, so it's possible to have an inline syntax with a readibility similar to Typescript or flow. That would make JsDoc expresiveness more alike to https://tsdoc.org/, where there's no need to be so much verbose because most of the information is get from Typescript keywords (in that case, the inline comments):
const num /*:number*/ = 42;
/**
* @param a The first argument
* @param b The second argument
*
* @return The sum of both arguments
*/
function func(a/*:number*/, b/*:number*/)/*:number*/
{
return a + b
}
/*
type A
{
name: string
}
*/
class B /*implements A*/{}
Metadata
Metadata
Assignees
Labels
No labels