Richard
04/29/2022, 12:22 PMJason Kleinberg
04/29/2022, 5:53 PMJason Kleinberg
04/29/2022, 5:56 PMRichard
04/30/2022, 6:42 PMRichard
04/30/2022, 6:44 PMItâd be a good spot for a decorator if you use classes.Not using classes! But I agree, the validation could well be wrapped; will need to understand different use cases of different resolvers a bit better though. Thanks, really appreciate it. đ
Jason Kleinberg
04/30/2022, 6:52 PMJason Kleinberg
04/30/2022, 6:53 PMJason Kleinberg
04/30/2022, 6:54 PMRichard
04/30/2022, 7:00 PMJason Kleinberg
04/30/2022, 7:05 PMRichard
04/30/2022, 7:09 PMRichard
04/30/2022, 7:09 PMRichard
04/30/2022, 7:10 PMRichard
04/30/2022, 7:10 PMJason Kleinberg
04/30/2022, 7:11 PMJason Kleinberg
04/30/2022, 7:11 PMJason Kleinberg
04/30/2022, 7:13 PMJason Kleinberg
04/30/2022, 7:14 PMJason Kleinberg
04/30/2022, 7:32 PMvalidator
on the resolver-argument (args
), which is expected to either
⢠throw an error when the resolver-argument doesnât pass the tests
⢠do nothing otherwise.2. Use the now type-assured
args
in the defined resolver.
3. Update the name of the function to note it is a validated version of the handler
function.Jason Kleinberg
04/30/2022, 7:32 PMRichard
04/30/2022, 7:36 PMJason Kleinberg
04/30/2022, 7:37 PMJason Kleinberg
04/30/2022, 7:38 PMTypeCheck
, which asserts that a value is a given type.Jason Kleinberg
04/30/2022, 7:38 PMtype TypeCheck<T> = (typeName: string, value: unknown) => asserts value is T
Richard
04/30/2022, 7:39 PMJason Kleinberg
04/30/2022, 7:39 PMRichard
04/30/2022, 7:39 PMRichard
04/30/2022, 7:40 PMJason Kleinberg
04/30/2022, 7:40 PMRichard
04/30/2022, 7:40 PMJason Kleinberg
04/30/2022, 7:40 PMRichard
04/30/2022, 7:41 PMRichard
04/30/2022, 7:41 PMRichard
04/30/2022, 7:41 PMJason Kleinberg
04/30/2022, 7:43 PMarg
variable, and assuming when the validator passes, that it is the correct type.Richard
04/30/2022, 7:43 PMJason Kleinberg
04/30/2022, 7:44 PMJason Kleinberg
04/30/2022, 7:44 PMJason Kleinberg
04/30/2022, 7:45 PMArgumentsValidated
.Richard
04/30/2022, 7:46 PMJason Kleinberg
04/30/2022, 7:47 PMJason Kleinberg
04/30/2022, 7:48 PM