Reuse toast in custom panel

I would like to create a toast similar to:

image

i was looking at the source and found

import appEvents from 'app/core/app_events';

so i could do:

appEvents.emit(AppEvents.alertError, [error]);

but i always get a error message telling me: Cannot find module ‘app/core/app_events’ or its corresponding type declarations

what do i have to do to use appEvent?

my package.json:
"devDependencies": { "@grafana/data": "7.0.1", "@grafana/toolkit": "7.0.1", "@grafana/ui": "7.0.1", "emotion": "10.0.27" },