Problems

PropTypes Checker

MediumReact Best Practices

Validate props against a type spec. Input: line 1 — spec JSON mapping prop → expected type ("string"|"number"|"boolean"|"array"); line 2 — props JSON. For each spec key (JSON order) with a wrong or missing prop, print Warning: PROP expected TYPE. Print ok if all pass.

Input: two lines. Output: warnings or ok.

Your program reads from stdin and prints to stdout.

Example 1

Input: {"name":"string","count":"number"} {"name":"Ada","count":3}

Output: ok

Hints

ReactPropsValidation
PropTypes Checker | CodeForge AI