tscc
tscc copied to clipboard
libraries with double quoted properties cause syntax errors in externs
I've had this problem before, but I'm installing the latest version of pdfjs, and for whatever reason this library has lots of these quoted properties in its type definitions.
Here is an example source d.ts file: https://github.com/StirlingMarketingGroup/StirlingMarketingGroup/blob/master/plus/v2/node_modules/pdfjs-dist/types/src/display/draw_layer.d.ts
export class DrawLayer {
static get _svgFactory(): any;
static "__#27@#setBox"(element: any, { x, y, width, height }?: {
x?: number | undefined;
y?: number | undefined;
width?: number | undefined;
height?: number | undefined;
}): void;
constructor({ pageIndex }: {
pageIndex: any;
});
pageIndex: any;
setParent(parent: any): void;
highlight(outlines: any, color: any, opacity: any, isPathUpdatable?: boolean): {
id: number;
clipPathId: string;
};
highlightOutline(outlines: any): number;
finalizeLine(id: any, line: any): void;
updateLine(id: any, line: any): void;
removeFreeHighlight(id: any): void;
updatePath(id: any, line: any): void;
updateBox(id: any, box: any): void;
show(id: any, visible: any): void;
rotate(id: any, angle: any): void;
changeColor(id: any, color: any): void;
changeOpacity(id: any, opacity: any): void;
addClass(id: any, className: any): void;
removeClass(id: any, className: any): void;
remove(id: any): void;
destroy(): void;
#private;
}
And this generates a block like this in the externs:
/**
* @public
* @param {?} element
* @param {(undefined|{x: (undefined|number), y: (undefined|number), width: (undefined|number), height: (undefined|number)})=} __1
* @return {void}
*/
node_modules$pdfjs$0019dist$types$src$display$draw_layer$_d$_ts.DrawLayer"__#27@#setBox" = function(element, __1) {};
I've tried looking for where these externs are generated, but it seems it might be in tsickle itself, which I guess is no longer being maintained :/
So I'm not sure if this is another thing we could potentially patch via tscc?