MCPcopy Index your code
hub / github.com/adobe/react-spectrum / processType

Function processType

scripts/compareAPIs.js:362–512  ·  view source on GitHub ↗
(value)

Source from the content-addressed store, hash-verified

360// mirrors dev/docs/src/types.js for the most part
361// "rendering" our types to a string instead of React components
362function processType(value) {
363 if (!value) {
364 console.trace('UNTYPED', value);
365 return 'UNTYPED';
366 }
367 if (Object.keys(value).length === 0) {
368 return '{}';
369 }
370 if (value.type === 'any') {
371 return 'any';
372 }
373 if (value.type === 'null') {
374 return 'null';
375 }
376 if (value.type === 'undefined') {
377 return 'undefined';
378 }
379 if (value.type === 'void') {
380 return 'void';
381 }
382 if (value.type === 'unknown') {
383 return 'unknown';
384 }
385 if (value.type === 'never') {
386 return 'never';
387 }
388 if (value.type === 'this') {
389 return 'this';
390 }
391 if (value.type === 'symbol') {
392 return 'symbol';
393 }
394 if (value.type === 'identifier') {
395 return value.name;
396 }
397 if (value.type === 'string') {
398 if (value.value) {
399 return `'${value.value}'`;
400 }
401 return 'string';
402 }
403 if (value.type === 'number') {
404 return 'number';
405 }
406 if (value.type === 'boolean') {
407 return 'boolean';
408 }
409 if (value.type === 'union') {
410 return value.elements.map(processType).join(' | ');
411 }
412 if (value.type === 'intersection') {
413 return `(${value.types.map(processType).join(' & ')})`;
414 }
415 if (value.type === 'application') {
416 let name = value.base.name;
417 if (!name) {
418 name = processType(value.base);
419 }

Callers 1

rebuildInterfacesFunction · 0.70

Calls 3

pushMethod · 0.80
hasMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected