Description
Go 1.26 introduced errors.AsType. It would be nice to have a Testify equivalent.
Use case
Previously, I might have:
var syntaxErr *json.SyntaxError
require.ErrorAs(t, err, &syntaxErr)
Now, with Go 1.26, I could write this:
_, ok := errors.AsType[*json.SyntaxError](err)
require.True(t, ok)
That removes the allocation, but loses details on failure.
Proposed solution
I'd like to be able to write:
require.ErrorAsType[*json.SyntaxError](t, err)
Description
Go 1.26 introduced
errors.AsType. It would be nice to have a Testify equivalent.Use case
Previously, I might have:
Now, with Go 1.26, I could write this:
That removes the allocation, but loses details on failure.
Proposed solution
I'd like to be able to write: