I have a TypeScript project that uses a custom wrapper over chrome.runtime.sendMessage to send messages. This custom wrapper makes sure the messages are formatted correctly, are safe, etc.
However there is a lot of turnaround of devs in the codebase and new devs often try to use chrome.runtime.sendMessage directly (and not the wrapper).
Is there any way I can display a warning, either at compile time or in their IDE, when they try to access that method?
You can use type annotation, below is an example used to avoid new Buffer(number) for Node.js
interface BufferConstructor {
/**
* Allocates a new buffer of {size} octets.
*
* @param size count of octets to allocate.
* @deprecated since v10.0.0 - Use `Buffer.alloc()` instead (also see `Buffer.allocUnsafe()`).
*/
new (size: number): Buffer;
}
If you use it, The IDE will give you a warning:

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With