diff --git a/lib/datasource/cargo/index.ts b/lib/datasource/cargo/index.ts
index 570ffc18625174e313be6b72fadd98bb4cecb4c1..df40165600f5b9d0e1624ee2110c4bdafaae24fa 100644
--- a/lib/datasource/cargo/index.ts
+++ b/lib/datasource/cargo/index.ts
@@ -4,7 +4,7 @@ import { PkgReleaseConfig, ReleaseResult, Release } from '../common';
 
 export async function getPkgReleases({
   lookupName,
-}: PkgReleaseConfig): Promise<ReleaseResult> {
+}: PkgReleaseConfig): Promise<ReleaseResult | null> {
   if (!lookupName) {
     return null;
   }
diff --git a/lib/datasource/common.ts b/lib/datasource/common.ts
index b6373f0c5a7d827432480fe9964519d8b3e41370..435d0c806b515ffac96b57322f1d50410906b77e 100644
--- a/lib/datasource/common.ts
+++ b/lib/datasource/common.ts
@@ -45,7 +45,7 @@ export interface ReleaseResult {
 export type Preset = any;
 
 export interface Datasource {
-  getDigest?(config: DigestConfig, newValue?: string): Promise<string>;
+  getDigest?(config: DigestConfig, newValue?: string): Promise<string | null>;
   getPreset?(packageName: string, presetName?: string): Promise<Preset>;
-  getPkgReleases(config: PkgReleaseConfig): Promise<ReleaseResult>;
+  getPkgReleases(config: PkgReleaseConfig): Promise<ReleaseResult | null>;
 }
diff --git a/lib/datasource/dart/index.ts b/lib/datasource/dart/index.ts
index 432892ddf648af83eec74a7becfa5cbc667dc5db..ab6a10957766ff263b3928a9395638cf21737aee 100644
--- a/lib/datasource/dart/index.ts
+++ b/lib/datasource/dart/index.ts
@@ -4,7 +4,7 @@ import { ReleaseResult, PkgReleaseConfig } from '../common';
 
 export async function getPkgReleases({
   lookupName,
-}: PkgReleaseConfig): Promise<ReleaseResult> {
+}: PkgReleaseConfig): Promise<ReleaseResult | null> {
   let result: ReleaseResult = null;
   const pkgUrl = `https://pub.dartlang.org/api/packages/${lookupName}`;
   interface DartResult {
diff --git a/lib/datasource/docker/index.ts b/lib/datasource/docker/index.ts
index f4085325ce268f9cf87440540023735e63bc4654..7d36addda8813cabed9b0291afb60d54797fc59f 100644
--- a/lib/datasource/docker/index.ts
+++ b/lib/datasource/docker/index.ts
@@ -41,7 +41,7 @@ function getRegistryRepository(lookupName: string, registryUrls: string[]) {
 async function getAuthHeaders(
   registry: string,
   repository: string
-): Promise<OutgoingHttpHeaders> {
+): Promise<OutgoingHttpHeaders | null> {
   try {
     const apiCheckUrl = `${registry}/v2/`;
     const apiCheckResponse = await got(apiCheckUrl, { throwHttpErrors: false });
@@ -225,7 +225,7 @@ async function getManifestResponse(
 export async function getDigest(
   { registryUrls, lookupName }: PkgReleaseConfig,
   newValue?: string
-): Promise<string> {
+): Promise<string | null> {
   const { registry, repository } = getRegistryRepository(
     lookupName,
     registryUrls
@@ -272,7 +272,7 @@ export async function getDigest(
 async function getTags(
   registry: string,
   repository: string
-): Promise<string[]> {
+): Promise<string[] | null> {
   let tags: string[] = [];
   try {
     const cacheNamespace = 'datasource-docker-tags';
@@ -511,7 +511,7 @@ async function getLabels(
 export async function getPkgReleases({
   lookupName,
   registryUrls,
-}: PkgReleaseConfig): Promise<ReleaseResult> {
+}: PkgReleaseConfig): Promise<ReleaseResult | null> {
   const { registry, repository } = getRegistryRepository(
     lookupName,
     registryUrls
diff --git a/lib/datasource/git-tags/index.ts b/lib/datasource/git-tags/index.ts
index 85ac2d11ab13692448e92b54770806f25267c2c6..1941a680b643c70a9893f76da7fec220a5c8f581 100644
--- a/lib/datasource/git-tags/index.ts
+++ b/lib/datasource/git-tags/index.ts
@@ -11,7 +11,7 @@ process.env.GIT_SSH_COMMAND = 'ssh -o BatchMode=yes';
 
 export async function getPkgReleases({
   lookupName,
-}: PkgReleaseConfig): Promise<ReleaseResult> {
+}: PkgReleaseConfig): Promise<ReleaseResult | null> {
   const git = simpleGit();
   try {
     const cachedResult = await renovateCache.get<ReleaseResult>(
diff --git a/lib/datasource/github/index.ts b/lib/datasource/github/index.ts
index 804a785ee201a70ee9cc6b00c872de7a527ae75f..9011e45c3fa65954fbc96754939e0baae95eb17c 100644
--- a/lib/datasource/github/index.ts
+++ b/lib/datasource/github/index.ts
@@ -70,7 +70,10 @@ function getCacheKey(repo: string, type: string) {
   return `${repo}:${type}`;
 }
 
-async function getTagCommit(githubRepo: string, tag: string): Promise<string> {
+async function getTagCommit(
+  githubRepo: string,
+  tag: string
+): Promise<string | null> {
   const cachedResult = await renovateCache.get<string>(
     cacheNamespace,
     getCacheKey(githubRepo, `tag-${tag}`)
@@ -119,7 +122,7 @@ async function getTagCommit(githubRepo: string, tag: string): Promise<string> {
 export async function getDigest(
   { lookupName: githubRepo }: Partial<DigestConfig>,
   newValue?: string
-): Promise<string> {
+): Promise<string | null> {
   if (newValue && newValue.length) {
     return getTagCommit(githubRepo, newValue);
   }
@@ -167,7 +170,7 @@ export async function getDigest(
 export async function getPkgReleases({
   lookupName: repo,
   lookupType,
-}: PkgReleaseConfig): Promise<ReleaseResult> {
+}: PkgReleaseConfig): Promise<ReleaseResult | null> {
   let versions: string[];
   const cachedResult = await renovateCache.get<ReleaseResult>(
     cacheNamespace,
diff --git a/lib/datasource/gitlab/index.ts b/lib/datasource/gitlab/index.ts
index d309275c4f89c0e32ad27a4057f92326427cb9ac..4a63027879659ce53dbc94199c2d4ac41992451f 100644
--- a/lib/datasource/gitlab/index.ts
+++ b/lib/datasource/gitlab/index.ts
@@ -51,7 +51,7 @@ export async function getPkgReleases({
   registryUrls,
   lookupName: repo,
   lookupType,
-}: PkgReleaseConfig): Promise<ReleaseResult> {
+}: PkgReleaseConfig): Promise<ReleaseResult | null> {
   // Use registryUrls if present, otherwise default to publid gitlab.com
   const depHost = is.nonEmptyArray(registryUrls)
     ? registryUrls[0].replace(/\/$/, '')
diff --git a/lib/datasource/go/index.ts b/lib/datasource/go/index.ts
index f1963f09f505ab471a25ac42a3b52b118e688f89..21e5a84f382f442d90d104b49e7aaad4a55cddc8 100644
--- a/lib/datasource/go/index.ts
+++ b/lib/datasource/go/index.ts
@@ -8,7 +8,7 @@ interface DataSource {
   lookupName: string;
 }
 
-async function getDatasource(name: string): Promise<DataSource> {
+async function getDatasource(name: string): Promise<DataSource | null> {
   if (name.startsWith('gopkg.in/')) {
     const [pkg] = name.replace('gopkg.in/', '').split('.');
     if (pkg.includes('/')) {
@@ -72,7 +72,7 @@ async function getDatasource(name: string): Promise<DataSource> {
  */
 export async function getPkgReleases({
   lookupName,
-}: Partial<PkgReleaseConfig>): Promise<ReleaseResult> {
+}: Partial<PkgReleaseConfig>): Promise<ReleaseResult | null> {
   logger.trace(`go.getPkgReleases(${lookupName})`);
   const source = await getDatasource(lookupName);
   if (source && source.datasource === 'github') {
@@ -100,7 +100,7 @@ export async function getPkgReleases({
 export async function getDigest(
   { lookupName }: Partial<DigestConfig>,
   value?: string
-): Promise<string> {
+): Promise<string | null> {
   const source = await getDatasource(lookupName);
   if (source && source.datasource === 'github') {
     // ignore v0.0.0- pseudo versions that are used Go Modules - look up default branch instead
diff --git a/lib/datasource/hex/index.ts b/lib/datasource/hex/index.ts
index 3364512cd9c2c46057cebb30facc51c3ed040e5a..2ad134f20320eaa12d77c7ee606d91ba53b24f53 100644
--- a/lib/datasource/hex/index.ts
+++ b/lib/datasource/hex/index.ts
@@ -18,7 +18,7 @@ interface HexRelease {
 
 export async function getPkgReleases({
   lookupName,
-}: Partial<PkgReleaseConfig>): Promise<ReleaseResult> {
+}: Partial<PkgReleaseConfig>): Promise<ReleaseResult | null> {
   const hexUrl = `https://hex.pm/api/packages/${lookupName}`;
   try {
     const opts = getHostOpts();
diff --git a/lib/datasource/index.ts b/lib/datasource/index.ts
index c677ca1a37ff9aa29d2214e3ac9d740c7e70646a..269f0c9ed803ca74142aa21d2290994ea0c63df8 100644
--- a/lib/datasource/index.ts
+++ b/lib/datasource/index.ts
@@ -93,7 +93,9 @@ function getRawReleases(config: PkgReleaseConfig): Promise<ReleaseResult> {
   return global.repoCache[cacheKey];
 }
 
-async function fetchReleases(config: PkgReleaseConfig): Promise<ReleaseResult> {
+async function fetchReleases(
+  config: PkgReleaseConfig
+): Promise<ReleaseResult | null> {
   const { datasource } = config;
   if (!datasource) {
     logger.warn('No datasource found');
@@ -111,7 +113,10 @@ export function supportsDigests(config: DigestConfig) {
   return !!datasources[config.datasource].getDigest;
 }
 
-export function getDigest(config: DigestConfig, value?: string) {
+export function getDigest(
+  config: DigestConfig,
+  value?: string
+): Promise<string | null> {
   const lookupName = config.lookupName || config.depName;
   const { registryUrls } = config;
   return datasources[config.datasource].getDigest(
diff --git a/lib/datasource/npm/get.ts b/lib/datasource/npm/get.ts
index 7291a848218a05829b91acee21f92ee1deb06a0a..aa7304d1f96aba443b983d9a3918e8399a11fe89 100644
--- a/lib/datasource/npm/get.ts
+++ b/lib/datasource/npm/get.ts
@@ -40,7 +40,9 @@ export interface NpmDependency extends ReleaseResult {
   sourceDirectory?: string;
 }
 
-export async function getDependency(name: string): Promise<NpmDependency> {
+export async function getDependency(
+  name: string
+): Promise<NpmDependency | null> {
   logger.trace(`npm.getDependency(${name})`);
 
   // This is our datastore cache and is cleared at the end of each repo, i.e. we never requery/revalidate during a "run"
diff --git a/lib/datasource/npm/npmrc.ts b/lib/datasource/npm/npmrc.ts
index 7f6fa8e26fa6aeee19909439d8b561188b94e860..832f9372512ac35d6b1b667327e48bff4492c7e1 100644
--- a/lib/datasource/npm/npmrc.ts
+++ b/lib/datasource/npm/npmrc.ts
@@ -3,10 +3,10 @@ import ini from 'ini';
 import { isBase64 } from 'validator';
 import { logger } from '../../logger';
 
-let npmrc: Record<string, any> = null;
+let npmrc: Record<string, any> | null = null;
 let npmrcRaw: string;
 
-export function getNpmrc() {
+export function getNpmrc(): Record<string, any> | null {
   return npmrc;
 }
 
@@ -57,7 +57,7 @@ export function setNpmrc(input?: string) {
   }
 }
 
-function envReplace(value: any, env = process.env) {
+function envReplace(value: any, env = process.env): any {
   // istanbul ignore if
   if (!is.string(value)) {
     return value;
diff --git a/lib/datasource/npm/releases.ts b/lib/datasource/npm/releases.ts
index d2d887d46c61d2179250781d545234add8ac843e..e998dae7a858000b7d516df95578e181db6f4b69 100644
--- a/lib/datasource/npm/releases.ts
+++ b/lib/datasource/npm/releases.ts
@@ -5,7 +5,7 @@ import { PkgReleaseConfig, ReleaseResult } from '../common';
 export async function getPkgReleases({
   lookupName,
   npmrc,
-}: PkgReleaseConfig): Promise<ReleaseResult> {
+}: PkgReleaseConfig): Promise<ReleaseResult | null> {
   if (npmrc) {
     setNpmrc(npmrc);
   }
diff --git a/lib/datasource/nuget/index.ts b/lib/datasource/nuget/index.ts
index 56a1c108ec82baf858e867a621d70b8f0b730b2f..529bdf126ed7c00060c3f86e1733a5f64f44c6bb 100644
--- a/lib/datasource/nuget/index.ts
+++ b/lib/datasource/nuget/index.ts
@@ -33,7 +33,7 @@ export async function getPkgReleases({
   return dep;
 }
 
-function detectFeedVersion(url: string) {
+function detectFeedVersion(url: string): 2 | 3 | null {
   try {
     const parsecUrl = urlApi.parse(url);
     // Official client does it in the same way
diff --git a/lib/datasource/nuget/v2.ts b/lib/datasource/nuget/v2.ts
index 0297b8e4c3e305213c15529bb2cb559f91b2d727..ff362afbe75ae640c33e9a3bcc7fbf29219d2a4a 100644
--- a/lib/datasource/nuget/v2.ts
+++ b/lib/datasource/nuget/v2.ts
@@ -7,7 +7,7 @@ import { ReleaseResult } from '../common';
 export async function getPkgReleases(
   feedUrl: string,
   pkgName: string
-): Promise<ReleaseResult> {
+): Promise<ReleaseResult | null> {
   const dep: ReleaseResult = {
     pkgName,
     releases: null,
diff --git a/lib/datasource/nuget/v3.ts b/lib/datasource/nuget/v3.ts
index 06c3b5b88e5c240e7790a77d2b0de69cf2af53ed..10631ebc9fc32023a5785e4fa994f83bf007c07a 100644
--- a/lib/datasource/nuget/v3.ts
+++ b/lib/datasource/nuget/v3.ts
@@ -13,7 +13,7 @@ export function getDefaultFeed() {
   return defaultNugetFeed;
 }
 
-export async function getQueryUrl(url: string): Promise<string> {
+export async function getQueryUrl(url: string): Promise<string | null> {
   // https://docs.microsoft.com/en-us/nuget/api/search-query-service-resource
   const resourceType = 'SearchQueryService';
   const cacheKey = `${url}:${resourceType}`;
@@ -63,7 +63,7 @@ export async function getPkgReleases(
   registryUrl: string,
   feedUrl: string,
   pkgName: string
-): Promise<ReleaseResult> {
+): Promise<ReleaseResult | null> {
   let queryUrl = `${feedUrl}?q=${pkgName}`;
   if (registryUrl.toLowerCase() === defaultNugetFeed.toLowerCase()) {
     queryUrl = queryUrl.replace('q=', 'q=PackageId:');
diff --git a/lib/datasource/orb/index.ts b/lib/datasource/orb/index.ts
index 61b399be1c8faa06275531bd0dfcf09d6842e5c8..fd0e95547ba0b1c6e7832132e5dd675f4870e594 100644
--- a/lib/datasource/orb/index.ts
+++ b/lib/datasource/orb/index.ts
@@ -16,7 +16,7 @@ interface OrbRelease {
  */
 export async function getPkgReleases({
   lookupName,
-}: PkgReleaseConfig): Promise<ReleaseResult> {
+}: PkgReleaseConfig): Promise<ReleaseResult | null> {
   logger.debug({ lookupName }, 'orb.getPkgReleases()');
   const cacheNamespace = 'orb';
   const cacheKey = lookupName;
diff --git a/lib/datasource/packagist/index.ts b/lib/datasource/packagist/index.ts
index 019323ed29e0bb51a31aa5eff8f9392a9a491420..1259c4d9b9e5722f2dc951149b6f413085195606 100644
--- a/lib/datasource/packagist/index.ts
+++ b/lib/datasource/packagist/index.ts
@@ -39,7 +39,7 @@ interface RegistryMeta {
   packages?: Record<string, RegistryFile>;
 }
 
-async function getRegistryMeta(regUrl: string) {
+async function getRegistryMeta(regUrl: string): Promise<RegistryMeta | null> {
   try {
     const url = URL.resolve(regUrl.replace(/\/?$/, '/'), 'packages.json');
     const opts = getHostOpts(url);
@@ -154,7 +154,7 @@ interface AllPackages {
   includesPackages: Record<string, ReleaseResult>;
 }
 
-async function getAllPackages(regUrl: string): Promise<AllPackages> {
+async function getAllPackages(regUrl: string): Promise<AllPackages | null> {
   let repoCacheResult = global.repoCache[`packagist-${regUrl}`];
   // istanbul ignore if
   if (repoCacheResult) {
@@ -231,7 +231,10 @@ async function packagistOrgLookup(name: string) {
   return dep;
 }
 
-async function packageLookup(regUrl: string, name: string) {
+async function packageLookup(
+  regUrl: string,
+  name: string
+): Promise<ReleaseResult | null> {
   try {
     if (regUrl === 'https://packagist.org') {
       const packagistResult = await packagistOrgLookup(name);
diff --git a/lib/datasource/pypi/index.ts b/lib/datasource/pypi/index.ts
index 08577dac58cc16b3e33ac7e5a0dba3977cb0613d..9ed556dab5c036c5e93ba4ddc49c15de759e8c53 100644
--- a/lib/datasource/pypi/index.ts
+++ b/lib/datasource/pypi/index.ts
@@ -32,7 +32,7 @@ export async function getPkgReleases({
   compatibility,
   lookupName,
   registryUrls,
-}: PkgReleaseConfig): Promise<ReleaseResult> {
+}: PkgReleaseConfig): Promise<ReleaseResult | null> {
   let hostUrls = ['https://pypi.org/pypi/'];
   if (is.nonEmptyArray(registryUrls)) {
     hostUrls = registryUrls;
@@ -59,7 +59,7 @@ async function getDependency(
   depName: string,
   hostUrl: string,
   compatibility: Record<string, string>
-) {
+): Promise<ReleaseResult | null> {
   const lookupUrl = url.resolve(hostUrl, `${depName}/json`);
   try {
     const dependency: ReleaseResult = { releases: null };
@@ -111,7 +111,7 @@ async function getDependency(
 async function getSimpleDependency(
   depName: string,
   hostUrl: string
-): Promise<ReleaseResult> {
+): Promise<ReleaseResult | null> {
   const lookupUrl = url.resolve(hostUrl, `${depName}`);
   try {
     const dependency: ReleaseResult = { releases: null };
@@ -147,7 +147,10 @@ async function getSimpleDependency(
   }
 }
 
-function extractVersionFromLinkText(text: string, depName: string) {
+function extractVersionFromLinkText(
+  text: string,
+  depName: string
+): string | null {
   const prefix = `${depName}-`;
   const suffix = '.tar.gz';
   if (!(text.startsWith(prefix) && text.endsWith(suffix))) {
diff --git a/lib/datasource/rubygems/get-rubygems-org.ts b/lib/datasource/rubygems/get-rubygems-org.ts
index 096dc47c4e5611172eb15f6e7641f1613441e35c..6931ba83d9b2dd35986f646b8257c7615f4cb2ff 100644
--- a/lib/datasource/rubygems/get-rubygems-org.ts
+++ b/lib/datasource/rubygems/get-rubygems-org.ts
@@ -86,7 +86,7 @@ async function syncVersions() {
 
 export async function getRubygemsOrgDependency(
   lookupName: string
-): Promise<ReleaseResult> {
+): Promise<ReleaseResult | null> {
   logger.debug(`getRubygemsOrgDependency(${lookupName})`);
   await syncVersions();
   if (!packageReleases[lookupName]) {
diff --git a/lib/datasource/rubygems/get.ts b/lib/datasource/rubygems/get.ts
index 3fe9d274a64891be0e69e8a5f5384f57468a4714..f5ac5641b3911a3f73c5fb1e75cfca4b6822f3d8 100644
--- a/lib/datasource/rubygems/get.ts
+++ b/lib/datasource/rubygems/get.ts
@@ -56,7 +56,7 @@ const fetch = async ({ dependency, registry, path }) => {
 export const getDependency = async ({
   dependency,
   registry,
-}): Promise<ReleaseResult> => {
+}): Promise<ReleaseResult | null> => {
   try {
     const info = await fetch({ dependency, registry, path: INFO_PATH });
     if (!info) {
diff --git a/lib/datasource/rubygems/releases.ts b/lib/datasource/rubygems/releases.ts
index 34596c224b4ab25096714b6c620aeffe8f5d3c72..01ace2b0f03df56c4335816cecf7f6ff44565a46 100644
--- a/lib/datasource/rubygems/releases.ts
+++ b/lib/datasource/rubygems/releases.ts
@@ -6,7 +6,7 @@ import { PkgReleaseConfig, ReleaseResult } from '../common';
 export async function getPkgReleases({
   lookupName,
   registryUrls,
-}: PkgReleaseConfig): Promise<ReleaseResult> {
+}: PkgReleaseConfig): Promise<ReleaseResult | null> {
   const registries = is.nonEmptyArray(registryUrls) ? registryUrls : [];
 
   for (const registry of registries) {
diff --git a/lib/datasource/rubygems/retriable.ts b/lib/datasource/rubygems/retriable.ts
index 4a55692ef7bd53139a084bb6ba75819b797928f6..cc2baceb7bc439aa45714618406c5b326206a716 100644
--- a/lib/datasource/rubygems/retriable.ts
+++ b/lib/datasource/rubygems/retriable.ts
@@ -11,16 +11,16 @@ import {
 const RETRY_AFTER = 600;
 const NUMBER_OF_RETRIES = 5;
 
-const getDelayStep = () =>
+const getDelayStep = (): number =>
   parseInt(process.env.RENOVATE_RUBYGEMS_RETRY_DELAY_STEP || '1000', 10);
 
-const toMs = (value: number) => value * getDelayStep();
-const getBannedDelay = (retryAfter: string) =>
+const toMs = (value: number): number => value * getDelayStep();
+const getBannedDelay = (retryAfter: string): number =>
   (parseInt(retryAfter, 10) || RETRY_AFTER) + 1;
-const getDefaultDelay = (count: number) =>
+const getDefaultDelay = (count: number): number =>
   (NUMBER_OF_RETRIES * getDelayStep()) / count;
 
-const getDelayMessage = (delay: any) => `Retry in ${delay} seconds.`;
+const getDelayMessage = (delay: any): string => `Retry in ${delay} seconds.`;
 const getErrorMessage = (status: number) => {
   // istanbul ignore next
   switch (status) {
diff --git a/lib/datasource/sbt/index.ts b/lib/datasource/sbt/index.ts
index 9456fd1e6b09d81a25d9ecf399e342ad88351c31..1e346b41ffbd2397414f8d4590e91ed737c2a77a 100644
--- a/lib/datasource/sbt/index.ts
+++ b/lib/datasource/sbt/index.ts
@@ -6,7 +6,7 @@ import { PkgReleaseConfig, ReleaseResult } from '../common';
 
 export async function getPkgReleases(
   config: PkgReleaseConfig
-): Promise<ReleaseResult> {
+): Promise<ReleaseResult | null> {
   const { lookupName, depType } = config;
 
   const registryUrls =
diff --git a/lib/datasource/terraform/index.ts b/lib/datasource/terraform/index.ts
index ff884aab5d39f294a0757fc1821efb2ebc3dd823..df9a91ba5541a161687372818990c5e47b2712bb 100644
--- a/lib/datasource/terraform/index.ts
+++ b/lib/datasource/terraform/index.ts
@@ -43,7 +43,7 @@ interface TerraformRelease {
 export async function getPkgReleases({
   lookupName,
   registryUrls,
-}: PkgReleaseConfig): Promise<ReleaseResult> {
+}: PkgReleaseConfig): Promise<ReleaseResult | null> {
   const { registry, repository } = getRegistryRepository(
     lookupName,
     registryUrls