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
So the IAssert that gets exported isn't the type of Assert.
I can only reach and extend the IAssert type, which doesn't affect the IAssert$1 type, which means there's no (valid, type-safe) way to actually inject anything into Assert.
I've attempted to inject custom assertions before and always assumed it was me doing something wrong, but I'm pretty sure something isn't right with this type relationship - it appears to be backwards? Or something.
I can get around it for now with (Assert as any).valid = valid - it works, but it doesn't type-check.
I think, since the exported IAssert inherits from the internal IAssert, the internal one would need to be exported as well?
It might be a good idea to rename one of the IAssert types to clarify the fact that one defines the available assertions, while the other defines the combined API with Tester members that gets provided to the tests?
The text was updated successfully, but these errors were encountered:
It looks like there's a problem, possibly with the compiled
.d.ts
file.In my test-harness I'm trying to add a custom assertion:
Looking at the declaration of
Assert
, it'sdeclare const Assert: IAssert$1
- whereIAssert$1
apparently is/was the types imported here:zora/zora/src/types/index.d.ts
Line 2 in 149a368
That type contains the built-in standard assertions:
zora/assert/src/index.d.ts
Lines 30 to 33 in 149a368
So there are two different
IAssert
, and that's probably why the compiler renames one toIAssert$1
, which isn't exported.The
IAssert
that gets renamed toIAssert$1
is the one used to type-hint the built-in standard assertions:zora/assert/src/index.d.ts
Line 70 in 149a368
But that's not the type that gets exported:
zora/zora/src/types/index.d.ts
Line 18 in 149a368
So the
IAssert
that gets exported isn't the type ofAssert
.I can only reach and extend the
IAssert
type, which doesn't affect theIAssert$1
type, which means there's no (valid, type-safe) way to actually inject anything intoAssert
.I've attempted to inject custom assertions before and always assumed it was me doing something wrong, but I'm pretty sure something isn't right with this type relationship - it appears to be backwards? Or something.
I can get around it for now with
(Assert as any).valid = valid
- it works, but it doesn't type-check.I think, since the exported
IAssert
inherits from the internalIAssert
, the internal one would need to be exported as well?It might be a good idea to rename one of the
IAssert
types to clarify the fact that one defines the available assertions, while the other defines the combined API withTester
members that gets provided to the tests?The text was updated successfully, but these errors were encountered: