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:
Error during compilation
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.