(value: unknown, componentName: string)
| 82 | } |
| 83 | |
| 84 | const 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 | |
| 104 | interface IProps { |
| 105 | [props: string]: unknown; |
no outgoing calls
no test coverage detected
searching dependent graphs…