Ever?
I created this Result type that I use for the return type of several different functions throughout my code.
type Result = {
success: boolean
error?: Error
product?: any
}
The purposes of the functions vary. Some of them produce an object of one type or another. Some of them produce a string. Several of them use try...catch to execute a database (SQLite) query. Thanks to this type, I can handle the return value the same way for all of them. Given the variety of products, I thought that this was a really appropriate use for any.
I was actually pretty proud of myself. This is my first TypeScript project. I think I'm using it properly. Is there a different way that I should be doing this?
I realize that this is just a warning and I can probably ignore it.
I guess this is a linter thing that I can configure away if I find the right option, but I think people smarter than me set this as a sensible default so it means that I'm probably doing it wrong.
I am using Deno for this project, but I'm not sure that's relevant here since this is specifically a TypeScript thing.