Skip to content

Commit 55a5f9b

Browse files
committed
API: Validate Function blocks to find missing props
1 parent 1b7953a commit 55a5f9b

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/components/API/API.jsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@ class Function extends React.Component {
66
render() {
77
const since = this.props.since;
88
const children = this.props.children;
9+
10+
const isRunningInDevelopmentMode = process.env.NODE_ENV !== "production";
11+
if (isRunningInDevelopmentMode) {
12+
// Doesn't look like more context can easily be obtained, so let's leave it at that...
13+
const where = location;
14+
const what = `Missing property (since) for (Function) imported from ${where}`;
15+
const message = `${what}`;
16+
if (!since) throw new Error(message);
17+
}
18+
919
const sinceBlock = (since && (
1020
<>
1121
<span className={styles.sinceBlock}>Available since: {since}</span>

0 commit comments

Comments
 (0)