LAB / 010

TypeScript / Output boundary comparison

Which invalid inputs escape assertions and object validation?

Completed ·

EXPERIMENT RESULT

GitHub ↗

01 / QUESTION

Which invalid inputs escape assertions and object validation?

METHOD

32 synthetic inputs enter assertion, object, raw JSON and existing Java paths; one saved real response is replayed offline.

RESULT

Assertions falsely accept 22 invalid cases; object validation four; raw JSON and Java agree on 32/32.

OBSERVATIONS

JSON.parse loses duplicate keys; objects also lack raw length. The saved fenced response fails strict parsing and passes explicit adaptation.

CONCLUSION

Static types do not replace runtime contracts; structural validity does not establish semantic correctness.

LIMITATIONS

Deliberate edge cases, not a model error rate. A flat contract, not a general JSON parser. No new API calls.

REPRODUCE

Typecheck, 37 tests and a 32-case differential audit pass; Node 26.8.2, TypeScript 7.0.2, Java 1.8.0_171.

KEEP EXPLORING

Related content

  1. Engineering cases

    Does TypeScript validate model output? A 32-case comparison with Java

    Assertions, unknown and raw JSON: 22 false accepts, four object-validation blind spots and a bounded Java/TypeScript comparison.

    11 MINPublished
  2. Tutorials

    Java LLM Practice II: How to validate model JSON after HTTP 200

    Build a Java 8 output boundary from a real fenced response and three timeouts, with strict validation, a bounded format adapter and reproducible evidence.

    16 MINPublished
  3. PROJECT / 002

    Java LLM Practice

    Five Java 8 demos plus a TypeScript boundary comparison: requests, validation, transactional history and traceable experiments.

    Building

← Back to index