Closed
Description
Probably an example without the type guard of #13454.
TypeScript Version: master
Code
declare function f<P, R, S>(process: Supervisor.Process<P, R, S> | Supervisor.Process.Call<P, R, S>): void;
namespace Supervisor {
export type Process<P, R, S> = {
readonly init: Process.Init<S>;
readonly call: Process.Call<P, R, S>;
readonly exit: Process.Exit<S>;
};
export namespace Process {
export type Init<S> = (state: S) => S;
export type Call<P, R, S> = (param: P, state: S) => [R, S] | PromiseLike<[R, S]>;
export type Exit<S> = (state: S, reason: any) => void;
}
}
f<void, void, void>({
init: s => s,
call: (p, s) => <[void, void]>[p, s],
exit: s => void s,
});
Expected behavior:
ok
Actual behavior:
$ node built/local/tsc.js -t es6 index.ts --noImplicitAny
index.ts(16,10): error TS7006: Parameter 'p' implicitly has an 'any' type.
index.ts(16,13): error TS7006: Parameter 's' implicitly has an 'any' type.