You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When using the construct Assert<type, ThrowError<MyInputError>> the import { MyInputError } from 'somewhere' statement gets removed at compilation time.
Generated code will fail with MyInputError is not defined at runtime.
In the first playground, you can see the import being removed, in the second playground it remains because the InputError class is used directly at line 4: this is the current workaround I found to make it work.
Expected behavior
One can use custom error classes when using Assert without having to create fake statements.
Additional context
ts-runtime-checks: 0.4.1
typescript: 5.2.2 (ESM)
The text was updated successfully, but these errors were encountered:
Describe the bug
When using the construct
Assert<type, ThrowError<MyInputError>>
theimport { MyInputError } from 'somewhere'
statement gets removed at compilation time.Generated code will fail with
MyInputError is not defined
at runtime.Playground link
Compare this playground and this playground
In the first playground, you can see the import being removed, in the second playground it remains because the
InputError
class is used directly at line 4: this is the current workaround I found to make it work.Expected behavior
One can use custom error classes when using
Assert
without having to create fake statements.Additional context
The text was updated successfully, but these errors were encountered: