The way how it is defined as a callable ITestDefinition interface makes it impossible for TS to infer the type of the done callback.
declare var it: Mocha.ITestDefinition;
interface ITestDefinition {
(expectation: string, assertion?: () => void): ITest;
(expectation: string, assertion?: (done: MochaDone) => void): ITest;
only(expectation: string, assertion?: () => void): ITest;
only(expectation: string, assertion?: (done: MochaDone) => void): ITest;
skip(expectation: string, assertion?: () => void): void;
skip(expectation: string, assertion?: (done: MochaDone) => void): void;
timeout(ms: number): void;
}
Doing
it('whatever', done => {
});
yields
src/test/dbgp.ts(24,53): error TS7006: Parameter 'done' implicitly has an 'any' type.
This used to work. Now we have to do
it('whatever', (done: MochaDone) => {
});
The way how
itis defined as a callableITestDefinitioninterface makes it impossible for TS to infer the type of thedonecallback.Doing
yields
This used to work. Now we have to do