Error during compilation, Incompatible argument type: Required type: \Magento\Framework\DB\Adapter\AdapterInterface.

We can be resolved Compile time error by below way, The error looks like when running compilation command,

Incompatible argument type: Required type: \Magento\Framework\DB\Adapter\AdapterInterface. Actual type: string; File:
app/code/Rbj/CustomForm/Model/ResourceModel/Customform/Grid/Collection.php
[Magento\Framework\Validator\Exception]
Error during compilation

Solutions:

From Magento 2.2.* version we need to pass full class name in__construct()  instead of $connection = null as di argument in Collection.php file.

Replace, $connection = null argument with \Magento\Framework\DB\Adapter\AdapterInterface $connection = null  in __construct() parameter.

Run again command,
php bin/magento setup:di:compile
an error will be gone.