MCPcopy Create free account
hub / github.com/adobe/react-spectrum / Type

Function Type

packages/dev/docs/src/types.js:65–160  ·  view source on GitHub ↗
({type})

Source from the content-addressed store, hash-verified

63export const LinkContext = React.createContext();
64
65export function Type({type}) {
66 let links = useContext(TypeContext);
67
68 if (!type) {
69 return null;
70 }
71
72 switch (type.type) {
73 case 'any':
74 case 'null':
75 case 'undefined':
76 case 'void':
77 case 'unknown':
78 case 'never':
79 return <Keyword {...type} />;
80 case 'this':
81 return <Keyword {...type} />;
82 case 'symbol':
83 return <Symbol {...type} />;
84 case 'identifier':
85 return <Identifier {...type} />;
86 case 'string':
87 if (type.value) {
88 return <StringLiteral {...type} />;
89 }
90
91 return <Keyword {...type} />;
92 case 'number':
93 if (type.value) {
94 return <NumberLiteral {...type} />;
95 }
96
97 return <Keyword {...type} />;
98 case 'boolean':
99 if (type.value) {
100 return <BooleanLiteral {...type} />;
101 }
102
103 return <Keyword {...type} />;
104 case 'union':
105 return <UnionType {...type} />;
106 case 'intersection':
107 return <IntersectionType {...type} />;
108 case 'application':
109 return <TypeApplication {...type} />;
110 case 'typeOperator':
111 return <TypeOperator {...type} />;
112 case 'function':
113 return <FunctionType {...type} />;
114 case 'parameter':
115 return <Parameter {...type} />;
116 case 'link':
117 return <LinkType {...type} />;
118 case 'interface':
119 return <InterfaceType {...type} />;
120 case 'object':
121 if (type.properties) {
122 return <ObjectType {...type} />;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected