Add types for lifecycle events.

Replace preUserStop with preStop.
Replace "based" with "passed".

After that, LGTM.