MCPcopy
hub / github.com/facebook/react / typeName

Function typeName

packages/shared/CheckStringCoercion.js:21–32  ·  view source on GitHub ↗
(value: mixed)

Source from the content-addressed store, hash-verified

19
20// $FlowFixMe[incompatible-return] only called in DEV, so void return is not possible.
21function typeName(value: mixed): string {
22 if (__DEV__) {
23 // toStringTag is needed for namespaced types like Temporal.Instant
24 const hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag;
25 const type =
26 (hasToStringTag && (value: any)[Symbol.toStringTag]) ||
27 (value: any).constructor.name ||
28 'Object';
29 // $FlowFixMe[incompatible-return]
30 return type;
31 }
32}
33
34// $FlowFixMe[incompatible-return] only called in DEV, so void return is not possible.
35function willCoercionThrow(value: mixed): boolean {

Calls

no outgoing calls

Tested by

no test coverage detected