You might find io-ts [1] interesting. It allows to write composable parsers that do both runtime checks and have correct result types.
Opt-in runtime checks for SQL queries are also on the roadmap for PgTyped. You are welcome to open an issue to track our progress there if you think this feature will be useful for you.