Skip to content

Instantly share code, notes, and snippets.

View hisasann's full-sized avatar
🔖
I aspire to become a bookseller.

Yoshiyuki Hisamatsu hisasann

🔖
I aspire to become a bookseller.
View GitHub Profile
import ts, { factory } from "typescript";
export function transformerFactory(context: ts.TransformationContext) {
function visitNode(node: ts.Node): ts.Node {
const newNode = ts.visitEachChild(node, visitNode, context);
if (
ts.isJsxOpeningElement(newNode) ||
ts.isJsxSelfClosingElement(newNode)
) {
return appendSourceMapAttribute(newNode.getSourceFile(), newNode);