MCPcopy Create free account
hub / github.com/callstack/linaria / warnIfInvalid

Function warnIfInvalid

packages/react/src/styled.ts:84–102  ·  view source on GitHub ↗
(value: unknown, componentName: string)

Source from the content-addressed store, hash-verified

82}
83
84const warnIfInvalid = (value: unknown, componentName: string) => {
85 if (process.env.NODE_ENV !== 'production') {
86 if (
87 typeof value === 'string' ||
88 // eslint-disable-next-line no-self-compare,no-restricted-globals
89 (typeof value === 'number' && isFinite(value))
90 ) {
91 return;
92 }
93
94 const stringified =
95 typeof value === 'object' ? JSON.stringify(value) : String(value);
96
97 // eslint-disable-next-line no-console
98 console.warn(
99 `An interpolation evaluated to '${stringified}' in the component '${componentName}', which is probably a mistake. You should explicitly cast or transform the value to a string.`
100 );
101 }
102};
103
104interface IProps {
105 [props: string]: unknown;

Callers 1

renderFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…