ts-plus / typescript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Diagnostics: warn when tags implies that method should be exported

mattiamanzati opened this issue · comments

Given some tag (like operator) that implies the method should be exported, it would be neat a diagnostic that pins to the function and says "hey, this should be exported!"

Given this example took me a while to figure out the export was missing:

/**
 * @tsplus type Widget
 * @tsplus companion WidgetOps
 */
export class Widget<R, A> {
  constructor(public readonly render: (r: R) => A) {}
}

/**
 * @tsplus operator Widget +
 */
function add<R, A>(a: Widget<R, A>, b: Widget<R, A>): Widget<R, A> {
  return 1 as any;
}

declare const div: Widget<unknown, void>;
declare const div2: Widget<unknown, void>;

const res = div + div2;

cc @0x706b