Type checking with assert.equal
roginvs opened this issue · 2 comments
roginvs commented
I found with a surprise that assert.equal
have both types as 'any' (even the strictEqual too):
export function equal(actual:any, expected:any, message?:string):void;
Why not do this way:
export function equal<T>(actual: T, expected: T, message?:string):void;
? It is better to catch any errors on compile time, not in the runtime, is not it?
twada commented
@roginvs Thanks for your suggestion.
However, I want power-assert to be completely compliant to Node's standard assert API and do not want users depend on power-assert original API or type definition.
So issues and improvements should be done in Node.js type definition first.
roginvs commented
Thanks, I asked there
DefinitelyTyped/DefinitelyTyped#15162