MCPcopy Index your code
hub / github.com/plotly/dash / getPropsForClassComponent

Function getPropsForClassComponent

dash/extract-meta.js:494–519  ·  view source on GitHub ↗
(typeSymbol, source, defaultProps)

Source from the content-addressed store, hash-verified

492 };
493
494 const getPropsForClassComponent = (typeSymbol, source, defaultProps) => {
495 const childs = source.getChildAt(0);
496 let stop;
497
498 for (let i = 0, n = childs.getChildCount(); i < n && !stop; i++) {
499 const c = childs.getChildAt(i);
500 if (!ts.isClassDeclaration(c)) continue;
501
502 if (!c.heritageClauses) continue;
503
504 for (const clause of c.heritageClauses) {
505 if (clause.token !== ts.SyntaxKind.ExtendsKeyword) continue;
506 const t = clause.types[0];
507 const propType = t.typeArguments[0];
508
509 const type = checker.getTypeFromTypeNode(propType);
510
511 return getProps(
512 type.getProperties(),
513 typeSymbol,
514 [],
515 defaultProps
516 );
517 }
518 }
519 };
520
521 const getDefaultPropsValues = properties =>
522 properties.reduce((acc, p) => {

Callers 1

gatherComponentsFunction · 0.85

Calls 2

getPropertiesMethod · 0.80
getPropsFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…