MCPcopy Create free account
hub / github.com/Snapchat/Valdi / isJsxText

Method isJsxText

compiler/companion/src/JSXProcessor.ts:612–625  ·  view source on GitHub ↗
(child: ts.JsxChild)

Source from the content-addressed store, hash-verified

610 }
611
612 private isJsxText(child: ts.JsxChild): boolean {
613 if (!ts.isJsxText(child)) {
614 return false;
615 }
616
617 // Tolerance for `;` and whitespace characters in text, we just ignore them.
618 let value = child.text.replace(/(\s|;)+/, '');
619
620 if (value) {
621 this.onError(child, 'Text elements are not supported in JSX. Use <label/> to render a text node.');
622 }
623
624 return true;
625 }
626
627 private isEmptyJsxExpression(child: ts.JsxChild): boolean {
628 if (!ts.isJsxExpression(child)) {

Callers 4

outputJSXChildrenMethod · 0.95
outputSlotMethod · 0.95

Calls 2

onErrorMethod · 0.95
replaceMethod · 0.65

Tested by

no test coverage detected