My man... if I, the author of my program, was constructing the input, I wouldn't need no validation. Input isn't meant to be constructed by the program's author, it's supposed to be processed...
Construct was not the correct word. The intention was to express that you do need to parse the object into something more specific that captures the properties that you require.
Take for example APIGatewayProxyEvent [1], which has a property `queryStringParameters` with type:
The branded type here means that as soon as you verify that the event has that structure above, and you can assume that it is correct in the code handles these specific cases.
Though as the blog author mentioned in the other chain, the TS compiler is not particularly sound, so it's probably entirely possible to mess the structure and break the type without the compiler knowing about it.
Take for example APIGatewayProxyEvent [1], which has a property `queryStringParameters` with type:
You can then create a branded type like The branded type here means that as soon as you verify that the event has that structure above, and you can assume that it is correct in the code handles these specific cases.Though as the blog author mentioned in the other chain, the TS compiler is not particularly sound, so it's probably entirely possible to mess the structure and break the type without the compiler knowing about it.
[1] https://github.com/DefinitelyTyped/DefinitelyTyped/blob/mast...