Closed lanwin closed 3 years ago
The current example looks like this.
type User = { firstname: string; lastname: string; }; const userDecoder = JsonDecoder.object<User>( { firstname: JsonDecoder.string, lastname: JsonDecoder.string }, 'User' );
But shouldnt it possbile to write something like this?:
const userDecoder = JsonDecoder.object( { firstname: JsonDecoder.string, lastname: JsonDecoder.string }, 'User' ); type User = ExtractDecoderType<typeof userDecoder>;
This way I dont not have to repeat myself.
Hey @lanwin, that's a nice feature to have :) I'll add it in the next release.
Thanks!
This is ready! https://github.com/joanllenas/ts.data.json/releases/tag/v2.1.0
Hu that went fast. Thank you!
The current example looks like this.
But shouldnt it possbile to write something like this?:
This way I dont not have to repeat myself.