Replies: 1 comment
-
Hey! This is a fine idea but definitely out of scope for this project. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi I love this package! It works well and helps me write robust code. It's also very helpful because I'm a project manager for a team of students and it's very easy to write spaghetti code, this helps the end user manage that. I have a proposition though,
One thing that bothers me about Typescript that other languages such as Rust have is robust exception handling. During compile time, I'd like to have tsc tell me that I could have an uncaught exception using types.
An example of the workflow:
So you would be introducing a new enum called
Exception
that changes values for each potential error. Like fs.readFileSync() enum would have the above errors that the end user could handle using a function you also provide. I understand this example wouldn't technically work considering fs.readFileSync would throw an error at runtime and thus stop the process, however something similar to this would be useful. You'd probably have to re-provide every function you add enums for, but there is probably a better way to handle this.I don't think it'd work like the rest of the project because the end user would need to import the enums and that function, but it's food for thought.
Beta Was this translation helpful? Give feedback.
All reactions