I would use:

 anEvent.WhatId?.getSObjectType() == Opportunity.SObjectType

so you avoid the describe call that is relatively expensive (taking a few milliseconds). This is also a cleaner form of the type check: you are comparing two `SObjectType` values. The `?.` avoids a null pointer exception if `WhatId` is ever null.

A benefit of Apex compared to most programming languages is that the names of the database tables (SObjects) and columns (fields) are available as **compile-time checked** enum-like [SObjectType][1] and [SObjectField][2] references. This is for both the platform's standard SObjects **and** any custom SObjects your create. So stick with those rather than using strings.


 [1]: https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Schema_SObjectType.htm
 [2]: https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Schema_SObjectField.htm