I suspect that TypeScript is (wisely) adhering to Curly's Law, and Typescript is a transpiler, not an object validator. That said, I also think that typescript interfaces would make for lousy object validation, because interfaces have a (wonderfully) limited vocabulary and can't validate against shapes that other programmers may use to distinguish objects, such as array length, number of properties, pattern properties, etc.
When consuming objects from non-typescript code, I use a JSONSchema validation package, such as AJV, for run-time validation, and a .d.ts file generator (such as DTSgenerator or DTS-generator) to compile TypeScript type definitions from my JSONshcema.
The major caveat is that because JSONschemata are capable of describing shapes that cannot be distinguished by typescript (such as patternProperties), it's not a one-to-one translation from JSON schema to .t.ds, and you may have to do some hand editing of generated .d.ts files when using such JSON schemata.
That said, because other programmers may use properties like array length to infer object type, I'm in the habit of distinguishing types that could be confused by the TypeScript compiler using enum's to prevent the transpiler from accepting use of one type in place of the other, like so:
[MyTypes.yaml]
definitions:
type-A:
type: object
properties:
type:
enum:
- A
foo:
type: array
item: string
maxLength: 2
type-B:
type: object
properties:
type:
enum:
- B
foo:
type: array
item: string
minLength: 3
items: number
Which generates a .d.ts
file like so:
[MyTypes.d.ts]
interface typeA{
type: "A";
foo: string[];
}
interface typeB{
type: "B";
foo: string[];
}