Unsafe access to member with 'any' type when configuring REST data source in Apollo server with TypeScript

I am trying to configure a data source in Apollo server with TypeScript:

my-rest-datasource.ts

import { RESTDataSource } from 'apollo-datasource-rest';
import ResolverCtx from 'types/resolver-ctx';
import {
    IdType,
    GetResultType,
} from '../types/myTypes';

class MyRestDataSource extends RESTDataSource<ResolverCtx> {
    constructor() {
        super();
        this.baseURL = 'http://localhost:8080/';
    }

    async myGetMethod(id: IdType): Promise<GetResultType> {
        return this.get(`/get-data/${id}`);
    }
}

export default MyRestDataSource;

myResolvers.ts

import { Resolvers } from 'types/codegen';
import ResolverCtx from 'types/resolver-ctx';

const myResolvers: Resolvers<ResolverCtx> = {
    Query: {
        getData: async (_, { id }, ctx) => await ctx.dataSources.myRestDataSource.myGetMethod(id)
    },
};

export default myResolvers;

resolver-ctx.ts

import MyRestDataSource from '../datasources/my-rest-datasource';

type ApplicationContext = Record<string, any>;

type ApplicationDataSources = {
    myRestDataSource: MyRestDataSource;
};

type ResolverCtx = ApplicationContext & {
    dataSources: ApplicationDataSources;
};

export default ResolverCtx;

However in my-resolvers.ts I am getting ts-lint errors on the getData method:

Unsafe member access .dataSources on an `any` value.eslint@typescript-eslint/no-unsafe-member-access
Unsafe call of an `any` typed value.eslint@typescript-eslint/no-unsafe-call

If I mouse over the ctx, dataSources or myGetMethod in the return statement, the correct types are shown. So I don’t understand where the error is coming from.

This turned out to be to do with the ESLint config within the context of a mono repo.

The code above was in a Lerna implementation with an .eslintrc file at the root which had this property in it:

{
    "parserOptions": {
        "project": "./tsconfig.json"
    }
}

The code above sat in a packages directory of the monorepo in a package, this did not have it’s own .eslintrc

This appeared to cause issues with the module resolution or type resolution for the ESlint Typescript linting rules, causing erroneous errors to be thrown.

The solution was to add another .eslintrc file in the package directory which was the root folder of the package containing the code in my initial question. I had to add this rule to the new .eslintrc:

{
    "parserOptions": {
        "project": "./packages/myPackage1/tsconfig.json"
    }
}

This seems to have fixed the resolution problem.