credo-ts icon indicating copy to clipboard operation
credo-ts copied to clipboard

Assume errors are of type unknown instead of type error

Open TimoGlastra opened this issue 3 years ago • 3 comments

We want to use unknown in catch statements. Before typescript 4.4 any was the default but this is now switched to unknown. Once we have migrated all catch statements to assume error is of type unknown we can upgrade to the new typescript version

We could also use useUnknownInCatchVariables: false in the root tsconfig.build.json for now

TimoGlastra avatar Jan 10 '22 13:01 TimoGlastra

Looks like you've got this fixed in https://github.com/animo/aries-framework-javascript/tree/build/demo-tsconfig Any timeline for when that will be in main?

brianorwhatever avatar Feb 15 '22 23:02 brianorwhatever

Hi @brianorwhatever,

Sadly this hasn't been addressed yet. That PR locks the version of TS to an older version so we don't get the error, but we still need to update all catch statements to assume the errors are of type unknown.

Do you have a specific need for this change?

TimoGlastra avatar Feb 17 '22 09:02 TimoGlastra

I was having troubles getting the demos running but I did the same and locked the ts version and it worked after that so I'm not in a hurry anymore. thanks!

brianorwhatever avatar Feb 17 '22 20:02 brianorwhatever