News for hackers. Stuff that matters.

sondang

Re:Problems with TypeScript on Wednesday January 15, 2020 @09:12PM (#22061071)
You can do:

  if ('error' in result) {
    console.error(result.error); // ok: result inferred as 'Failure' 
  } else {
    doThings(result.value) // ok: result inferred as 'Success<T>'
  }


Even though you used string there, it's pretty type-safe because if you have a typo in your string, the inferred types will propagate other type errors

  if ('errors' in result) { // typo
    console.error(result.errors); // Type error: result inferred as 'never' 
  } else {
    doThings(result.value) // Type error: result inferred as Success<T> | Failure
  }
Re:LocalStack – A fully-functional local AWS cloud stack on Monday November 04, 2019 @05:37AM (#21440383)
I wonder what's the common approach that people use to test AWS-coupled features locally without LocalStack (or test features not supported by LS). Do you have a dedicated AWS environment for this use case, or we're not supposed to run them locally (e.g implementation is mocked on local, and AWS-coupled features are tested on a remote test env)?